This is an automated email from the ASF dual-hosted git repository.
zhangliang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new 963c80477d5 Refactor jdbc example (#28366)
963c80477d5 is described below
commit 963c80477d552e71686520e60629337d493f835e
Author: totalo <[email protected]>
AuthorDate: Sat Sep 23 07:53:16 2023 -0500
Refactor jdbc example (#28366)
* Refactor jdbc example
* add blank
---
.github/workflows/nightly-build.yml | 3 +-
.../example/generator/ExampleGeneratorMain.java | 6 +-
.../example/generator/core/ExampleGenerator.java | 115 --------------
.../generator/core/ExampleGeneratorFactory.java | 111 -------------
.../generator/core/JDBCExampleGenerator.java | 175 +++++++++++++++++++++
.../generator/core/impl/JDBCExampleGenerator.java | 53 -------
.../core/yaml/config/YamlExampleConfiguration.java | 2 -
...gsphere.example.generator.core.ExampleGenerator | 18 ---
.../src/main/resources/template/init.ftl} | 0
9 files changed, 179 insertions(+), 304 deletions(-)
diff --git a/.github/workflows/nightly-build.yml
b/.github/workflows/nightly-build.yml
index 2d1883578eb..31c343584dc 100644
--- a/.github/workflows/nightly-build.yml
+++ b/.github/workflows/nightly-build.yml
@@ -174,7 +174,6 @@ jobs:
framework: [ jdbc, spring-boot-starter-jdbc, spring-boot-starter-jpa,
spring-boot-starter-mybatis, spring-namespace-jdbc, spring-namespace-jpa,
spring-namespace-mybatis ]
mode: [ standalone, cluster-zookeeper ]
transaction: [ local, xa-atomikos, xa-narayana ]
- product: [ jdbc ]
exclude:
- feature: shadow
framework: spring-boot-starter-jpa
@@ -222,7 +221,7 @@ jobs:
- name: Build with Maven
run: ./mvnw -B -T1C -ntp clean install -DskipITs -DskipTests
- name: Generate Examples
- run: ./mvnw -B clean install -f
examples/shardingsphere-jdbc-example-generator/pom.xml -Pexample-generator
-Dproducts=${{ matrix.product }} -Dmodes=${{ matrix.mode }} -Dtransactions=${{
matrix.transaction }} -Dfeatures=${{ matrix.feature }} -Dframeworks=${{
matrix.framework }}
+ run: ./mvnw -B clean install -f
examples/shardingsphere-jdbc-example-generator/pom.xml -Pexample-generator
-Dmodes=${{ matrix.mode }} -Dtransactions=${{ matrix.transaction }}
-Dfeatures=${{ matrix.feature }} -Dframeworks=${{ matrix.framework }}
- name: Test Examples
run : ./mvnw -B test -f
examples/shardingsphere-jdbc-example-generator/target/generated-sources/shardingsphere-jdbc-sample/${{
matrix.feature }}--${{ matrix.framework }}--${{ matrix.mode }}--${{
matrix.transaction }}/pom.xml -Pexample-generator
-Dexec.cleanupDaemonThreads=false
- name: Package Examples
diff --git
a/examples/shardingsphere-jdbc-example-generator/src/main/java/org/apache/shardingsphere/example/generator/ExampleGeneratorMain.java
b/examples/shardingsphere-jdbc-example-generator/src/main/java/org/apache/shardingsphere/example/generator/ExampleGeneratorMain.java
index b2447b0808e..cf0e7cb286b 100644
---
a/examples/shardingsphere-jdbc-example-generator/src/main/java/org/apache/shardingsphere/example/generator/ExampleGeneratorMain.java
+++
b/examples/shardingsphere-jdbc-example-generator/src/main/java/org/apache/shardingsphere/example/generator/ExampleGeneratorMain.java
@@ -21,7 +21,7 @@ import freemarker.template.TemplateException;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import lombok.extern.slf4j.Slf4j;
-import
org.apache.shardingsphere.example.generator.core.ExampleGeneratorFactory;
+import org.apache.shardingsphere.example.generator.core.JDBCExampleGenerator;
import java.io.IOException;
@@ -40,12 +40,12 @@ public final class ExampleGeneratorMain {
* @throws TemplateException template exception
*/
public static void main(final String[] args) throws IOException,
TemplateException {
- new ExampleGeneratorFactory().generate();
+ new JDBCExampleGenerator().generate();
printMessages();
}
private static void printMessages() {
log.info("Example codes are generated successful!");
- log.info("Please find them in folder
`shardingsphere-${product}-sample`.");
+ log.info("Please find them in folder `shardingsphere-jdbc-sample`.");
}
}
diff --git
a/examples/shardingsphere-jdbc-example-generator/src/main/java/org/apache/shardingsphere/example/generator/core/ExampleGenerator.java
b/examples/shardingsphere-jdbc-example-generator/src/main/java/org/apache/shardingsphere/example/generator/core/ExampleGenerator.java
deleted file mode 100644
index 249b2662563..00000000000
---
a/examples/shardingsphere-jdbc-example-generator/src/main/java/org/apache/shardingsphere/example/generator/core/ExampleGenerator.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.example.generator.core;
-
-import com.google.common.base.Strings;
-import freemarker.template.Configuration;
-import freemarker.template.TemplateException;
-import
org.apache.shardingsphere.example.generator.core.yaml.config.YamlExampleConfiguration;
-import org.apache.shardingsphere.infra.autogen.version.ShardingSphereVersion;
-import org.apache.shardingsphere.infra.spi.annotation.SingletonSPI;
-import org.apache.shardingsphere.infra.spi.type.typed.TypedSPI;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.LinkedHashMap;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Properties;
-
-/**
- * Example generator.
- */
-@SingletonSPI
-public interface ExampleGenerator extends TypedSPI {
-
- String PROJECT_PATH =
"shardingsphere-${product}-sample/${feature?replace(',',
'-')}--${framework}--${mode}--${transaction}/";
-
- String RESOURCES_PATH = "src/main/resources";
-
- /**
- * Build output path.
- *
- * @param exampleConfig example configuration
- * @return built output path
- */
- default String buildOutputPath(YamlExampleConfiguration exampleConfig) {
- if (Strings.isNullOrEmpty(exampleConfig.getOutput())) {
- File file = new
File(Objects.requireNonNull(this.getClass().getClassLoader().getResource("")).getPath());
- return file.getParent() + "/generated-sources/" + PROJECT_PATH;
- }
- return exampleConfig.getOutput() + PROJECT_PATH;
- }
-
- /**
- * Generate example.
- *
- * @param templateConfig template configuration
- * @param exampleConfig example configuration
- * @throws IOException IO exception
- * @throws TemplateException template exception
- */
- default void generate(final Configuration templateConfig, final
YamlExampleConfiguration exampleConfig) throws IOException, TemplateException {
- String outputPath = buildOutputPath(exampleConfig);
- for (String eachMode : exampleConfig.getModes()) {
- for (String eachTransaction : exampleConfig.getTransactions()) {
- for (String eachFramework : exampleConfig.getFrameworks()) {
- for (String eachFeature :
GenerateUtils.generateCombination(exampleConfig.getFeatures())) {
- generate(templateConfig,
buildDataModel(exampleConfig.getProps(), eachMode, eachTransaction,
eachFramework, eachFeature), outputPath);
- }
- }
- }
- }
- }
-
- /**
- * Generate example.
- *
- * @param templateConfig template configuration
- * @param dataModel data model
- * @param outputPath output path
- * @throws IOException IO exception
- * @throws TemplateException template exception
- */
- void generate(Configuration templateConfig, Map<String, String> dataModel,
String outputPath) throws IOException, TemplateException;
-
- /**
- * Build data model.
- *
- * @param props properties
- * @param mode mode
- * @param transaction transaction
- * @param framework framework
- * @param feature feature
- * @return built data model
- */
- default Map<String, String> buildDataModel(final Properties props, final
String mode, final String transaction, final String framework, final String
feature) {
- Map<String, String> result = new LinkedHashMap<>();
- props.forEach((key, value) -> result.put(key.toString(),
value.toString()));
- result.put("product", getType());
- result.put("mode", mode);
- result.put("transaction", transaction);
- result.put("feature", feature);
- result.put("framework", framework);
- result.put("shardingsphereVersion", ShardingSphereVersion.VERSION);
- return result;
- }
-
- @Override
- String getType();
-}
diff --git
a/examples/shardingsphere-jdbc-example-generator/src/main/java/org/apache/shardingsphere/example/generator/core/ExampleGeneratorFactory.java
b/examples/shardingsphere-jdbc-example-generator/src/main/java/org/apache/shardingsphere/example/generator/core/ExampleGeneratorFactory.java
deleted file mode 100644
index 930422cc37a..00000000000
---
a/examples/shardingsphere-jdbc-example-generator/src/main/java/org/apache/shardingsphere/example/generator/core/ExampleGeneratorFactory.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.example.generator.core;
-
-import com.google.common.collect.Lists;
-import freemarker.template.Configuration;
-import freemarker.template.TemplateException;
-import lombok.SneakyThrows;
-import
org.apache.shardingsphere.example.generator.core.yaml.config.YamlExampleConfiguration;
-import
org.apache.shardingsphere.example.generator.core.yaml.config.YamlExampleConfigurationValidator;
-import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
-import org.apache.shardingsphere.infra.util.yaml.YamlEngine;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.util.Collections;
-import java.util.List;
-import java.util.Objects;
-import java.util.Properties;
-
-/**
- * Example generator factory.
- */
-public final class ExampleGeneratorFactory {
-
- private static final String CONFIG_FILE = "/config.yaml";
-
- private final Configuration templateConfig;
-
- public ExampleGeneratorFactory() throws IOException {
- templateConfig = createTemplateConfiguration();
- }
-
- private Configuration createTemplateConfiguration() throws IOException {
- Configuration result = new Configuration(Configuration.VERSION_2_3_31);
- result.setDirectoryForTemplateLoading(new
File(Objects.requireNonNull(Thread.currentThread().getContextClassLoader().getResource("template")).getFile()));
- result.setDefaultEncoding("UTF-8");
- return result;
- }
-
- /**
- * Generate directories and files by template.
- *
- * @throws TemplateException template exception
- * @throws IOException IO exception
- */
- public void generate() throws TemplateException, IOException {
- YamlExampleConfiguration exampleConfig = buildExampleConfiguration();
- YamlExampleConfigurationValidator.validate(exampleConfig);
- for (String each : exampleConfig.getProducts()) {
- TypedSPILoader.getService(ExampleGenerator.class,
each).generate(templateConfig, exampleConfig);
- }
- }
-
- private YamlExampleConfiguration buildExampleConfiguration() {
- YamlExampleConfiguration result = swapConfigToObject();
- Properties props = new Properties();
- for (String each : System.getProperties().stringPropertyNames()) {
- props.setProperty(each, System.getProperty(each));
- }
- if (!props.isEmpty()) {
- if (props.containsKey("output")) {
- result.setOutput(props.getProperty("output"));
- }
- if (props.containsKey("modes")) {
- result.setModes(getSysEnvByKey(props, "modes"));
- }
-
- if (props.containsKey("transactions")) {
- result.setTransactions(getSysEnvByKey(props, "transactions"));
- }
- if (props.containsKey("features")) {
- result.setFeatures(getSysEnvByKey(props, "features"));
- }
-
- if (props.containsKey("frameworks")) {
- result.setFrameworks(getSysEnvByKey(props, "frameworks"));
- }
- }
- result.setProducts(Collections.singletonList("jdbc"));
- return result;
- }
-
- private List<String> getSysEnvByKey(final Properties props, final String
key) {
- return Lists.newArrayList(props.getProperty(key).split(","));
- }
-
- @SneakyThrows({URISyntaxException.class, IOException.class})
- private YamlExampleConfiguration swapConfigToObject() {
- URL url = ExampleGeneratorFactory.class.getResource(CONFIG_FILE);
- File file = null == url ? new File(CONFIG_FILE) : new
File(url.toURI().getPath());
- return YamlEngine.unmarshal(file, YamlExampleConfiguration.class);
- }
-}
diff --git
a/examples/shardingsphere-jdbc-example-generator/src/main/java/org/apache/shardingsphere/example/generator/core/JDBCExampleGenerator.java
b/examples/shardingsphere-jdbc-example-generator/src/main/java/org/apache/shardingsphere/example/generator/core/JDBCExampleGenerator.java
new file mode 100644
index 00000000000..038dd5e99f6
--- /dev/null
+++
b/examples/shardingsphere-jdbc-example-generator/src/main/java/org/apache/shardingsphere/example/generator/core/JDBCExampleGenerator.java
@@ -0,0 +1,175 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.example.generator.core;
+
+import com.google.common.base.Strings;
+import com.google.common.collect.Lists;
+import freemarker.template.Configuration;
+import freemarker.template.TemplateException;
+import lombok.SneakyThrows;
+import
org.apache.shardingsphere.example.generator.core.yaml.config.YamlExampleConfiguration;
+import
org.apache.shardingsphere.example.generator.core.yaml.config.YamlExampleConfigurationValidator;
+import
org.apache.shardingsphere.example.generator.scenario.ExampleScenarioFactory;
+import org.apache.shardingsphere.infra.autogen.version.ShardingSphereVersion;
+import org.apache.shardingsphere.infra.util.yaml.YamlEngine;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Properties;
+
+/**
+ * JDBC example generator.
+ */
+public final class JDBCExampleGenerator {
+
+ private static final String CONFIG_FILE = "/config.yaml";
+
+ private final Configuration templateConfig;
+
+ String PROJECT_PATH = "shardingsphere-jdbc-sample/${feature?replace(',',
'-')}--${framework}--${mode}--${transaction}/";
+
+ String RESOURCES_PATH = "src/main/resources";
+
+ private static final String JAVA_CLASS_PATH =
"src/main/java/org/apache/shardingsphere/example/"
+ + "<#assign package = feature?replace('-', '')?replace(',', '.')
/>"
+ + "${package}/${framework?replace('-', '/')}";
+
+ public JDBCExampleGenerator() throws IOException {
+ templateConfig = createTemplateConfiguration();
+ }
+
+ private Configuration createTemplateConfiguration() throws IOException {
+ Configuration result = new Configuration(Configuration.VERSION_2_3_31);
+ result.setDirectoryForTemplateLoading(new
File(Objects.requireNonNull(this.getClass().getClassLoader().getResource("template")).getFile()));
+ result.setDefaultEncoding("UTF-8");
+ return result;
+ }
+
+
+ /**
+ * Generate example.
+ *
+ * @throws IOException IO exception
+ * @throws TemplateException template exception
+ */
+ public void generate() throws IOException, TemplateException {
+ YamlExampleConfiguration exampleConfig = buildExampleConfiguration();
+ YamlExampleConfigurationValidator.validate(exampleConfig);
+ String outputPath = buildOutputPath(exampleConfig);
+ for (String eachMode : exampleConfig.getModes()) {
+ for (String eachTransaction : exampleConfig.getTransactions()) {
+ for (String eachFramework : exampleConfig.getFrameworks()) {
+ for (String eachFeature :
GenerateUtils.generateCombination(exampleConfig.getFeatures())) {
+ doGenerate(templateConfig,
buildDataModel(exampleConfig.getProps(), eachMode, eachTransaction,
eachFramework, eachFeature), outputPath);
+ }
+ }
+ }
+ }
+ }
+
+ private YamlExampleConfiguration buildExampleConfiguration() {
+ YamlExampleConfiguration result = swapConfigToObject();
+ Properties props = new Properties();
+ for (String each : System.getProperties().stringPropertyNames()) {
+ props.setProperty(each, System.getProperty(each));
+ }
+ if (!props.isEmpty()) {
+ if (props.containsKey("output")) {
+ result.setOutput(props.getProperty("output"));
+ }
+ if (props.containsKey("modes")) {
+ result.setModes(getSysEnvByKey(props, "modes"));
+ }
+
+ if (props.containsKey("transactions")) {
+ result.setTransactions(getSysEnvByKey(props, "transactions"));
+ }
+ if (props.containsKey("features")) {
+ result.setFeatures(getSysEnvByKey(props, "features"));
+ }
+
+ if (props.containsKey("frameworks")) {
+ result.setFrameworks(getSysEnvByKey(props, "frameworks"));
+ }
+ }
+ return result;
+ }
+
+ private List<String> getSysEnvByKey(final Properties props, final String
key) {
+ return Lists.newArrayList(props.getProperty(key).split(","));
+ }
+
+ @SneakyThrows({URISyntaxException.class, IOException.class})
+ private YamlExampleConfiguration swapConfigToObject() {
+ URL url = JDBCExampleGenerator.class.getResource(CONFIG_FILE);
+ File file = null == url ? new File(CONFIG_FILE) : new
File(url.toURI().getPath());
+ return YamlEngine.unmarshal(file, YamlExampleConfiguration.class);
+ }
+
+ /**
+ * Build output path.
+ *
+ * @param exampleConfig example configuration
+ * @return built output path
+ */
+ private String buildOutputPath(YamlExampleConfiguration exampleConfig) {
+ if (Strings.isNullOrEmpty(exampleConfig.getOutput())) {
+ File file = new
File(Objects.requireNonNull(this.getClass().getClassLoader().getResource("")).getPath());
+ return file.getParent() + "/generated-sources/" + PROJECT_PATH;
+ }
+ return exampleConfig.getOutput() + PROJECT_PATH;
+ }
+
+ private void doGenerate(final Configuration templateConfig, final
Map<String, String> dataModel, final String relativePath) throws IOException,
TemplateException {
+ ExampleScenarioFactory exampleScenarioFactory = new
ExampleScenarioFactory(dataModel.get("feature"), dataModel.get("framework"),
dataModel.get("transaction"));
+ GenerateUtils.generateDirs(templateConfig, dataModel,
exampleScenarioFactory.getJavaClassPaths(), relativePath + JAVA_CLASS_PATH);
+ GenerateUtils.generateDirs(templateConfig, dataModel,
exampleScenarioFactory.getResourcePaths(), relativePath + RESOURCES_PATH);
+ GenerateUtils.generateFile(templateConfig, "", dataModel,
exampleScenarioFactory.getJavaClassTemplateMap(), relativePath +
JAVA_CLASS_PATH);
+ GenerateUtils.generateFile(templateConfig, "", dataModel,
exampleScenarioFactory.getResourceTemplateMap(), relativePath + RESOURCES_PATH);
+ String outputPath = GenerateUtils.generatePath(templateConfig,
dataModel, relativePath);
+ GenerateUtils.processFile(templateConfig, dataModel, "/pom.ftl",
outputPath + "pom.xml");
+ GenerateUtils.processFile(templateConfig, dataModel, "/init.ftl",
outputPath + "init.sql");
+ }
+
+ /**
+ * Build data model.
+ *
+ * @param props properties
+ * @param mode mode
+ * @param transaction transaction
+ * @param framework framework
+ * @param feature feature
+ * @return built data model
+ */
+ private Map<String, String> buildDataModel(final Properties props, final
String mode, final String transaction, final String framework, final String
feature) {
+ Map<String, String> result = new LinkedHashMap<>();
+ props.forEach((key, value) -> result.put(key.toString(),
value.toString()));
+ result.put("mode", mode);
+ result.put("transaction", transaction);
+ result.put("feature", feature);
+ result.put("framework", framework);
+ result.put("shardingsphereVersion", ShardingSphereVersion.VERSION);
+ return result;
+ }
+}
diff --git
a/examples/shardingsphere-jdbc-example-generator/src/main/java/org/apache/shardingsphere/example/generator/core/impl/JDBCExampleGenerator.java
b/examples/shardingsphere-jdbc-example-generator/src/main/java/org/apache/shardingsphere/example/generator/core/impl/JDBCExampleGenerator.java
deleted file mode 100644
index 4464e46c94a..00000000000
---
a/examples/shardingsphere-jdbc-example-generator/src/main/java/org/apache/shardingsphere/example/generator/core/impl/JDBCExampleGenerator.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.example.generator.core.impl;
-
-import freemarker.template.Configuration;
-import freemarker.template.TemplateException;
-import org.apache.shardingsphere.example.generator.core.ExampleGenerator;
-import org.apache.shardingsphere.example.generator.core.GenerateUtils;
-import
org.apache.shardingsphere.example.generator.scenario.ExampleScenarioFactory;
-
-import java.io.IOException;
-import java.util.Map;
-
-/**
- * JDBC example generator.
- */
-public final class JDBCExampleGenerator implements ExampleGenerator {
-
- private static final String JAVA_CLASS_PATH =
"src/main/java/org/apache/shardingsphere/example/"
- + "<#assign package = feature?replace('-', '')?replace(',', '.')
/>"
- + "${package}/${framework?replace('-', '/')}";
-
- @Override
- public void generate(final Configuration templateConfig, final Map<String,
String> dataModel, final String relativePath) throws IOException,
TemplateException {
- ExampleScenarioFactory exampleScenarioFactory = new
ExampleScenarioFactory(dataModel.get("feature"), dataModel.get("framework"),
dataModel.get("transaction"));
- GenerateUtils.generateDirs(templateConfig, dataModel,
exampleScenarioFactory.getJavaClassPaths(), relativePath + JAVA_CLASS_PATH);
- GenerateUtils.generateDirs(templateConfig, dataModel,
exampleScenarioFactory.getResourcePaths(), relativePath + RESOURCES_PATH);
- GenerateUtils.generateFile(templateConfig, "", dataModel,
exampleScenarioFactory.getJavaClassTemplateMap(), relativePath +
JAVA_CLASS_PATH);
- GenerateUtils.generateFile(templateConfig, "", dataModel,
exampleScenarioFactory.getResourceTemplateMap(), relativePath + RESOURCES_PATH);
- String outputPath = GenerateUtils.generatePath(templateConfig,
dataModel, relativePath);
- GenerateUtils.processFile(templateConfig, dataModel, "/pom.ftl",
outputPath + "pom.xml");
- }
-
- @Override
- public String getType() {
- return "jdbc";
- }
-}
diff --git
a/examples/shardingsphere-jdbc-example-generator/src/main/java/org/apache/shardingsphere/example/generator/core/yaml/config/YamlExampleConfiguration.java
b/examples/shardingsphere-jdbc-example-generator/src/main/java/org/apache/shardingsphere/example/generator/core/yaml/config/YamlExampleConfiguration.java
index 6bbf6e4b4a5..a2393490aed 100644
---
a/examples/shardingsphere-jdbc-example-generator/src/main/java/org/apache/shardingsphere/example/generator/core/yaml/config/YamlExampleConfiguration.java
+++
b/examples/shardingsphere-jdbc-example-generator/src/main/java/org/apache/shardingsphere/example/generator/core/yaml/config/YamlExampleConfiguration.java
@@ -30,8 +30,6 @@ public final class YamlExampleConfiguration implements
YamlConfiguration {
private String output;
- private List<String> products;
-
private List<String> modes;
private List<String> transactions;
diff --git
a/examples/shardingsphere-jdbc-example-generator/src/main/resources/META-INF/services/org.apache.shardingsphere.example.generator.core.ExampleGenerator
b/examples/shardingsphere-jdbc-example-generator/src/main/resources/META-INF/services/org.apache.shardingsphere.example.generator.core.ExampleGenerator
deleted file mode 100644
index dc34689c5af..00000000000
---
a/examples/shardingsphere-jdbc-example-generator/src/main/resources/META-INF/services/org.apache.shardingsphere.example.generator.core.ExampleGenerator
+++ /dev/null
@@ -1,18 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-org.apache.shardingsphere.example.generator.core.impl.JDBCExampleGenerator
diff --git a/examples/src/resources/manual_schema.sql
b/examples/shardingsphere-jdbc-example-generator/src/main/resources/template/init.ftl
similarity index 100%
rename from examples/src/resources/manual_schema.sql
rename to
examples/shardingsphere-jdbc-example-generator/src/main/resources/template/init.ftl