You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by zh...@apache.org on 2020/06/26 16:41:19 UTC
[shardingsphere-elasticjob-lite] branch master updated: Use enum
and reflect to simplify JSON processor (#848)
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-elasticjob-lite.git
The following commit(s) were added to refs/heads/master by this push:
new 7e6a59c Use enum and reflect to simplify JSON processor (#848)
7e6a59c is described below
commit 7e6a59ce691ba22465e1f867489d0eee8ff9fcb7
Author: Liang Zhang <te...@163.com>
AuthorDate: Sat Jun 27 00:41:11 2020 +0800
Use enum and reflect to simplify JSON processor (#848)
* Merge LiteJobConfigurationGsonTypeAdapter and AbstractJobConfigurationGsonTypeAdapter
* Refactor LiteJobConfigurationGsonTypeAdapter.read
* Refactor LiteJobConfigurationGsonTypeAdapter.write
* remove LiteJobConfigurationConstants
---
.../lite/internal/config/ConfigurationService.java | 1 +
.../config/LiteJobConfigurationConstants.java | 38 -----
.../config/LiteJobConfigurationGsonFactory.java | 145 -----------------
.../internal/config/RescheduleListenerManager.java | 1 +
.../config/json/JobConfigurationJsonEnum.java | 86 +++++++++++
.../json/LiteJobConfigurationGsonFactory.java | 64 ++++++++
.../json/LiteJobConfigurationGsonTypeAdapter.java | 161 +++++++++++++++++++
.../internal/failover/FailoverListenerManager.java | 2 +-
.../sharding/MonitorExecutionListenerManager.java | 2 +-
.../internal/sharding/ShardingListenerManager.java | 2 +-
.../AbstractJobConfigurationGsonTypeAdapter.java | 172 ---------------------
.../lite/integrate/AbstractBaseStdJobTest.java | 2 +-
.../integrate/std/script/ScriptElasticJobTest.java | 2 +-
.../internal/config/ConfigurationServiceTest.java | 1 +
.../LiteJobConfigurationGsonFactoryTest.java | 1 +
.../internal/settings/JobSettingsAPIImpl.java | 2 +-
.../internal/statistics/JobStatisticsAPIImpl.java | 2 +-
17 files changed, 322 insertions(+), 362 deletions(-)
diff --git a/elastic-job-lite-core/src/main/java/org/apache/shardingsphere/elasticjob/lite/internal/config/ConfigurationService.java b/elastic-job-lite-core/src/main/java/org/apache/shardingsphere/elasticjob/lite/internal/config/ConfigurationService.java
index e388d1b..701da5e 100644
--- a/elastic-job-lite-core/src/main/java/org/apache/shardingsphere/elasticjob/lite/internal/config/ConfigurationService.java
+++ b/elastic-job-lite-core/src/main/java/org/apache/shardingsphere/elasticjob/lite/internal/config/ConfigurationService.java
@@ -20,6 +20,7 @@ package org.apache.shardingsphere.elasticjob.lite.internal.config;
import org.apache.shardingsphere.elasticjob.lite.config.LiteJobConfiguration;
import org.apache.shardingsphere.elasticjob.lite.exception.JobConfigurationException;
import org.apache.shardingsphere.elasticjob.lite.exception.JobExecutionEnvironmentException;
+import org.apache.shardingsphere.elasticjob.lite.internal.config.json.LiteJobConfigurationGsonFactory;
import org.apache.shardingsphere.elasticjob.lite.internal.storage.JobNodeStorage;
import org.apache.shardingsphere.elasticjob.lite.reg.base.CoordinatorRegistryCenter;
import org.apache.shardingsphere.elasticjob.lite.util.env.TimeService;
diff --git a/elastic-job-lite-core/src/main/java/org/apache/shardingsphere/elasticjob/lite/internal/config/LiteJobConfigurationConstants.java b/elastic-job-lite-core/src/main/java/org/apache/shardingsphere/elasticjob/lite/internal/config/LiteJobConfigurationConstants.java
deleted file mode 100644
index e4bbf8e..0000000
--- a/elastic-job-lite-core/src/main/java/org/apache/shardingsphere/elasticjob/lite/internal/config/LiteJobConfigurationConstants.java
+++ /dev/null
@@ -1,38 +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.elasticjob.lite.internal.config;
-
-/**
- * Lite job configuration constants.
- */
-public final class LiteJobConfigurationConstants {
-
- public static final String MONITOR_EXECUTION = "monitorExecution";
-
- public static final String MAX_TIME_DIFF_SECONDS = "maxTimeDiffSeconds";
-
- public static final String MONITOR_PORT = "monitorPort";
-
- public static final String JOB_SHARDING_STRATEGY_TYPE = "jobShardingStrategyType";
-
- public static final String RECONCILE_INTERVAL_MINUTES = "reconcileIntervalMinutes";
-
- public static final String DISABLED = "disabled";
-
- public static final String OVERWRITE = "overwrite";
-}
diff --git a/elastic-job-lite-core/src/main/java/org/apache/shardingsphere/elasticjob/lite/internal/config/LiteJobConfigurationGsonFactory.java b/elastic-job-lite-core/src/main/java/org/apache/shardingsphere/elasticjob/lite/internal/config/LiteJobConfigurationGsonFactory.java
deleted file mode 100644
index f339a64..0000000
--- a/elastic-job-lite-core/src/main/java/org/apache/shardingsphere/elasticjob/lite/internal/config/LiteJobConfigurationGsonFactory.java
+++ /dev/null
@@ -1,145 +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.elasticjob.lite.internal.config;
-
-import com.google.gson.stream.JsonReader;
-import com.google.gson.stream.JsonWriter;
-import lombok.AccessLevel;
-import lombok.NoArgsConstructor;
-import org.apache.shardingsphere.elasticjob.lite.config.JobTypeConfiguration;
-import org.apache.shardingsphere.elasticjob.lite.config.LiteJobConfiguration;
-import org.apache.shardingsphere.elasticjob.lite.util.json.AbstractJobConfigurationGsonTypeAdapter;
-import org.apache.shardingsphere.elasticjob.lite.util.json.GsonFactory;
-
-import java.io.IOException;
-import java.util.Map;
-
-/**
- * Job configuration gson factory.
- */
-@NoArgsConstructor(access = AccessLevel.PRIVATE)
-public final class LiteJobConfigurationGsonFactory {
-
- static {
- GsonFactory.registerTypeAdapter(LiteJobConfiguration.class, new LiteJobConfigurationGsonTypeAdapter());
- }
-
- /**
- * Transform job configuration to json.
- *
- * @param liteJobConfig job configuration
- * @return job configuration json string
- */
- public static String toJson(final LiteJobConfiguration liteJobConfig) {
- return GsonFactory.getGson().toJson(liteJobConfig);
- }
-
- /**
- * Transform job configuration to json.
- *
- * @param liteJobConfig job configuration
- * @return job configuration json string
- */
- public static String toJsonForObject(final Object liteJobConfig) {
- return GsonFactory.getGson().toJson(liteJobConfig);
- }
-
- /**
- * Transform json string to job configuration.
- *
- * @param liteJobConfigJson job configuration json string
- * @return job configuration
- */
- public static LiteJobConfiguration fromJson(final String liteJobConfigJson) {
- return GsonFactory.getGson().fromJson(liteJobConfigJson, LiteJobConfiguration.class);
- }
-
- /**
- * Job configuration gson type adapter.
- */
- public static final class LiteJobConfigurationGsonTypeAdapter extends AbstractJobConfigurationGsonTypeAdapter<LiteJobConfiguration> {
-
- @Override
- protected void addToCustomizedValueMap(final String jsonName, final JsonReader in, final Map<String, Object> customizedValueMap) throws IOException {
- switch (jsonName) {
- case LiteJobConfigurationConstants.MONITOR_EXECUTION:
- customizedValueMap.put(jsonName, in.nextBoolean());
- break;
- case LiteJobConfigurationConstants.MAX_TIME_DIFF_SECONDS:
- customizedValueMap.put(jsonName, in.nextInt());
- break;
- case LiteJobConfigurationConstants.MONITOR_PORT:
- customizedValueMap.put(jsonName, in.nextInt());
- break;
- case LiteJobConfigurationConstants.JOB_SHARDING_STRATEGY_TYPE:
- customizedValueMap.put(jsonName, in.nextString());
- break;
- case LiteJobConfigurationConstants.RECONCILE_INTERVAL_MINUTES:
- customizedValueMap.put(jsonName, in.nextInt());
- break;
- case LiteJobConfigurationConstants.DISABLED:
- customizedValueMap.put(jsonName, in.nextBoolean());
- break;
- case LiteJobConfigurationConstants.OVERWRITE:
- customizedValueMap.put(jsonName, in.nextBoolean());
- break;
- default:
- in.skipValue();
- break;
- }
- }
-
- @Override
- protected LiteJobConfiguration getJobRootConfiguration(final JobTypeConfiguration typeConfig, final Map<String, Object> customizedValueMap) {
- LiteJobConfiguration.Builder builder = LiteJobConfiguration.newBuilder(typeConfig);
- if (customizedValueMap.containsKey(LiteJobConfigurationConstants.MONITOR_EXECUTION)) {
- builder.monitorExecution((boolean) customizedValueMap.get(LiteJobConfigurationConstants.MONITOR_EXECUTION));
- }
- if (customizedValueMap.containsKey(LiteJobConfigurationConstants.MAX_TIME_DIFF_SECONDS)) {
- builder.maxTimeDiffSeconds((int) customizedValueMap.get(LiteJobConfigurationConstants.MAX_TIME_DIFF_SECONDS));
- }
- if (customizedValueMap.containsKey(LiteJobConfigurationConstants.MONITOR_PORT)) {
- builder.monitorPort((int) customizedValueMap.get(LiteJobConfigurationConstants.MONITOR_PORT));
- }
- if (customizedValueMap.containsKey(LiteJobConfigurationConstants.JOB_SHARDING_STRATEGY_TYPE)) {
- builder.jobShardingStrategyType((String) customizedValueMap.get(LiteJobConfigurationConstants.JOB_SHARDING_STRATEGY_TYPE));
- }
- if (customizedValueMap.containsKey(LiteJobConfigurationConstants.RECONCILE_INTERVAL_MINUTES)) {
- builder.reconcileIntervalMinutes((int) customizedValueMap.get(LiteJobConfigurationConstants.RECONCILE_INTERVAL_MINUTES));
- }
- if (customizedValueMap.containsKey(LiteJobConfigurationConstants.DISABLED)) {
- builder.disabled((boolean) customizedValueMap.get(LiteJobConfigurationConstants.DISABLED));
- }
- if (customizedValueMap.containsKey(LiteJobConfigurationConstants.OVERWRITE)) {
- builder.overwrite((boolean) customizedValueMap.get(LiteJobConfigurationConstants.OVERWRITE));
- }
- return builder.build();
- }
-
- @Override
- protected void writeCustomized(final JsonWriter out, final LiteJobConfiguration value) throws IOException {
- out.name(LiteJobConfigurationConstants.MONITOR_EXECUTION).value(value.isMonitorExecution());
- out.name(LiteJobConfigurationConstants.MAX_TIME_DIFF_SECONDS).value(value.getMaxTimeDiffSeconds());
- out.name(LiteJobConfigurationConstants.MONITOR_PORT).value(value.getMonitorPort());
- out.name(LiteJobConfigurationConstants.JOB_SHARDING_STRATEGY_TYPE).value(value.getJobShardingStrategyType());
- out.name(LiteJobConfigurationConstants.RECONCILE_INTERVAL_MINUTES).value(value.getReconcileIntervalMinutes());
- out.name(LiteJobConfigurationConstants.DISABLED).value(value.isDisabled());
- out.name(LiteJobConfigurationConstants.OVERWRITE).value(value.isOverwrite());
- }
- }
-}
diff --git a/elastic-job-lite-core/src/main/java/org/apache/shardingsphere/elasticjob/lite/internal/config/RescheduleListenerManager.java b/elastic-job-lite-core/src/main/java/org/apache/shardingsphere/elasticjob/lite/internal/config/RescheduleListenerManager.java
index 83b78d6..4968274 100644
--- a/elastic-job-lite-core/src/main/java/org/apache/shardingsphere/elasticjob/lite/internal/config/RescheduleListenerManager.java
+++ b/elastic-job-lite-core/src/main/java/org/apache/shardingsphere/elasticjob/lite/internal/config/RescheduleListenerManager.java
@@ -18,6 +18,7 @@
package org.apache.shardingsphere.elasticjob.lite.internal.config;
import org.apache.curator.framework.recipes.cache.TreeCacheEvent.Type;
+import org.apache.shardingsphere.elasticjob.lite.internal.config.json.LiteJobConfigurationGsonFactory;
import org.apache.shardingsphere.elasticjob.lite.internal.listener.AbstractJobListener;
import org.apache.shardingsphere.elasticjob.lite.internal.listener.AbstractListenerManager;
import org.apache.shardingsphere.elasticjob.lite.internal.schedule.JobRegistry;
diff --git a/elastic-job-lite-core/src/main/java/org/apache/shardingsphere/elasticjob/lite/internal/config/json/JobConfigurationJsonEnum.java b/elastic-job-lite-core/src/main/java/org/apache/shardingsphere/elasticjob/lite/internal/config/json/JobConfigurationJsonEnum.java
new file mode 100644
index 0000000..11eaea2
--- /dev/null
+++ b/elastic-job-lite-core/src/main/java/org/apache/shardingsphere/elasticjob/lite/internal/config/json/JobConfigurationJsonEnum.java
@@ -0,0 +1,86 @@
+/*
+ * 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.elasticjob.lite.internal.config.json;
+
+import lombok.Getter;
+import lombok.RequiredArgsConstructor;
+
+import java.util.Arrays;
+import java.util.Optional;
+
+/**
+ * Job configuration json enum.
+ */
+@RequiredArgsConstructor
+@Getter
+public enum JobConfigurationJsonEnum {
+
+ JOB_NAME("jobName", String.class),
+
+ JOB_TYPE("jobType", String.class),
+
+ CRON("cron", String.class),
+
+ SHARDING_TOTAL_COUNT("shardingTotalCount", int.class),
+
+ SHARDING_ITEM_PARAMETERS("shardingItemParameters", String.class),
+
+ JOB_PARAMETER("jobParameter", String.class),
+
+ FAILOVER("failover", boolean.class),
+
+ MISFIRE("misfire", boolean.class),
+
+ JOB_EXECUTOR_SERVICE_HANDLER_TYPE("jobExecutorServiceHandlerType", String.class),
+
+ JOB_ERROR_HANDLER_TYPE("jobErrorHandlerType", String.class),
+
+ MONITOR_EXECUTION("monitorExecution", boolean.class),
+
+ MAX_TIME_DIFF_SECONDS("maxTimeDiffSeconds", int.class),
+
+ MONITOR_PORT("monitorPort", int.class),
+
+ JOB_SHARDING_STRATEGY_TYPE("jobShardingStrategyType", String.class),
+
+ RECONCILE_INTERVAL_MINUTES("reconcileIntervalMinutes", int.class),
+
+ DESCRIPTION("description", String.class),
+
+ STREAMING_PROCESS("streamingProcess", boolean.class),
+
+ SCRIPT_COMMAND_LINE("scriptCommandLine", String.class),
+
+ DISABLED("disabled", boolean.class),
+
+ OVERWRITE("overwrite", boolean.class);
+
+ private final String jsonName;
+
+ private final Class<?> jsonType;
+
+ /**
+ * Find job configuration json enumeration.
+ *
+ * @param jsonName json name
+ * @return job configuration json enumeration
+ */
+ public static Optional<JobConfigurationJsonEnum> find(final String jsonName) {
+ return Arrays.stream(JobConfigurationJsonEnum.values()).filter(each -> each.getJsonName().equals(jsonName)).findFirst();
+ }
+}
diff --git a/elastic-job-lite-core/src/main/java/org/apache/shardingsphere/elasticjob/lite/internal/config/json/LiteJobConfigurationGsonFactory.java b/elastic-job-lite-core/src/main/java/org/apache/shardingsphere/elasticjob/lite/internal/config/json/LiteJobConfigurationGsonFactory.java
new file mode 100644
index 0000000..633d9d4
--- /dev/null
+++ b/elastic-job-lite-core/src/main/java/org/apache/shardingsphere/elasticjob/lite/internal/config/json/LiteJobConfigurationGsonFactory.java
@@ -0,0 +1,64 @@
+/*
+ * 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.elasticjob.lite.internal.config.json;
+
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
+import org.apache.shardingsphere.elasticjob.lite.config.LiteJobConfiguration;
+import org.apache.shardingsphere.elasticjob.lite.util.json.GsonFactory;
+
+/**
+ * Job configuration gson factory.
+ */
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public final class LiteJobConfigurationGsonFactory {
+
+ static {
+ GsonFactory.registerTypeAdapter(LiteJobConfiguration.class, new LiteJobConfigurationGsonTypeAdapter());
+ }
+
+ /**
+ * Transform job configuration to json.
+ *
+ * @param liteJobConfig job configuration
+ * @return job configuration json string
+ */
+ public static String toJson(final LiteJobConfiguration liteJobConfig) {
+ return GsonFactory.getGson().toJson(liteJobConfig);
+ }
+
+ /**
+ * Transform job configuration to json.
+ *
+ * @param liteJobConfig job configuration
+ * @return job configuration json string
+ */
+ public static String toJsonForObject(final Object liteJobConfig) {
+ return GsonFactory.getGson().toJson(liteJobConfig);
+ }
+
+ /**
+ * Transform json string to job configuration.
+ *
+ * @param liteJobConfigJson job configuration json string
+ * @return job configuration
+ */
+ public static LiteJobConfiguration fromJson(final String liteJobConfigJson) {
+ return GsonFactory.getGson().fromJson(liteJobConfigJson, LiteJobConfiguration.class);
+ }
+}
diff --git a/elastic-job-lite-core/src/main/java/org/apache/shardingsphere/elasticjob/lite/internal/config/json/LiteJobConfigurationGsonTypeAdapter.java b/elastic-job-lite-core/src/main/java/org/apache/shardingsphere/elasticjob/lite/internal/config/json/LiteJobConfigurationGsonTypeAdapter.java
new file mode 100644
index 0000000..d4f0a43
--- /dev/null
+++ b/elastic-job-lite-core/src/main/java/org/apache/shardingsphere/elasticjob/lite/internal/config/json/LiteJobConfigurationGsonTypeAdapter.java
@@ -0,0 +1,161 @@
+/*
+ * 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.elasticjob.lite.internal.config.json;
+
+import com.google.common.base.Preconditions;
+import com.google.common.base.Strings;
+import com.google.gson.TypeAdapter;
+import com.google.gson.stream.JsonReader;
+import com.google.gson.stream.JsonWriter;
+import org.apache.shardingsphere.elasticjob.lite.api.JobType;
+import org.apache.shardingsphere.elasticjob.lite.config.JobCoreConfiguration;
+import org.apache.shardingsphere.elasticjob.lite.config.JobTypeConfiguration;
+import org.apache.shardingsphere.elasticjob.lite.config.LiteJobConfiguration;
+import org.apache.shardingsphere.elasticjob.lite.config.dataflow.DataflowJobConfiguration;
+import org.apache.shardingsphere.elasticjob.lite.config.script.ScriptJobConfiguration;
+import org.apache.shardingsphere.elasticjob.lite.config.simple.SimpleJobConfiguration;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Optional;
+
+/**
+ * Job configuration gson type adapter.
+ */
+public final class LiteJobConfigurationGsonTypeAdapter extends TypeAdapter<LiteJobConfiguration> {
+
+ @Override
+ public LiteJobConfiguration read(final JsonReader in) throws IOException {
+ Map<String, Object> jsonValueMap = new HashMap<>(32, 1);
+ in.beginObject();
+ while (in.hasNext()) {
+ String jsonName = in.nextName();
+ Optional<JobConfigurationJsonEnum> jsonEnum = JobConfigurationJsonEnum.find(jsonName);
+ if (jsonEnum.isPresent()) {
+ Class<?> jsonType = jsonEnum.get().getJsonType();
+ if (boolean.class == jsonType) {
+ jsonValueMap.put(jsonName, in.nextBoolean());
+ } else if (int.class == jsonType) {
+ jsonValueMap.put(jsonName, in.nextInt());
+ } else if (String.class == jsonType) {
+ jsonValueMap.put(jsonName, in.nextString());
+ }
+ } else {
+ in.skipValue();
+ }
+ }
+ in.endObject();
+ JobCoreConfiguration coreConfig = createJobCoreConfiguration((String) jsonValueMap.get(JobConfigurationJsonEnum.JOB_NAME.getJsonName()),
+ (String) jsonValueMap.get(JobConfigurationJsonEnum.CRON.getJsonName()), (int) jsonValueMap.getOrDefault(JobConfigurationJsonEnum.SHARDING_TOTAL_COUNT.getJsonName(), 0),
+ (String) jsonValueMap.get(JobConfigurationJsonEnum.SHARDING_ITEM_PARAMETERS.getJsonName()), (String) jsonValueMap.get(JobConfigurationJsonEnum.JOB_PARAMETER.getJsonName()),
+ (boolean) jsonValueMap.getOrDefault(JobConfigurationJsonEnum.FAILOVER.getJsonName(), false),
+ (boolean) jsonValueMap.getOrDefault(JobConfigurationJsonEnum.MISFIRE.getJsonName(), false),
+ (String) jsonValueMap.get(JobConfigurationJsonEnum.JOB_EXECUTOR_SERVICE_HANDLER_TYPE.getJsonName()),
+ (String) jsonValueMap.get(JobConfigurationJsonEnum.JOB_ERROR_HANDLER_TYPE.getJsonName()),
+ (String) jsonValueMap.get(JobConfigurationJsonEnum.DESCRIPTION.getJsonName()));
+ JobTypeConfiguration typeConfig = createJobTypeConfiguration(coreConfig, JobType.valueOf((String) jsonValueMap.get(JobConfigurationJsonEnum.JOB_TYPE.getJsonName())),
+ (boolean) jsonValueMap.getOrDefault(JobConfigurationJsonEnum.STREAMING_PROCESS.getJsonName(), false),
+ (String) jsonValueMap.getOrDefault(JobConfigurationJsonEnum.SCRIPT_COMMAND_LINE.getJsonName(), ""));
+ return createJobRootConfiguration(typeConfig, jsonValueMap);
+ }
+
+ private JobCoreConfiguration createJobCoreConfiguration(final String jobName, final String cron, final int shardingTotalCount,
+ final String shardingItemParameters, final String jobParameter, final boolean failover,
+ final boolean misfire, final String jobExecutorServiceHandlerType, final String jobErrorHandlerType, final String description) {
+ return JobCoreConfiguration.newBuilder(jobName, cron, shardingTotalCount)
+ .shardingItemParameters(shardingItemParameters).jobParameter(jobParameter).failover(failover).misfire(misfire).description(description)
+ .jobExecutorServiceHandlerType(jobExecutorServiceHandlerType)
+ .jobErrorHandlerType(jobErrorHandlerType)
+ .build();
+ }
+
+ private JobTypeConfiguration createJobTypeConfiguration(final JobCoreConfiguration coreConfig, final JobType jobType, final boolean streamingProcess, final String scriptCommandLine) {
+ Preconditions.checkNotNull(jobType, "jobType cannot be null.");
+ switch (jobType) {
+ case SIMPLE:
+ return new SimpleJobConfiguration(coreConfig);
+ case DATAFLOW:
+ return new DataflowJobConfiguration(coreConfig, streamingProcess);
+ case SCRIPT:
+ return new ScriptJobConfiguration(coreConfig, scriptCommandLine);
+ default:
+ throw new UnsupportedOperationException(String.valueOf(jobType));
+ }
+ }
+
+ private LiteJobConfiguration createJobRootConfiguration(final JobTypeConfiguration typeConfig, final Map<String, Object> jsonValueMap) {
+ LiteJobConfiguration.Builder builder = LiteJobConfiguration.newBuilder(typeConfig);
+ if (jsonValueMap.containsKey(JobConfigurationJsonEnum.MONITOR_EXECUTION.getJsonName())) {
+ builder.monitorExecution((boolean) jsonValueMap.get(JobConfigurationJsonEnum.MONITOR_EXECUTION.getJsonName()));
+ }
+ if (jsonValueMap.containsKey(JobConfigurationJsonEnum.MAX_TIME_DIFF_SECONDS.getJsonName())) {
+ builder.maxTimeDiffSeconds((int) jsonValueMap.get(JobConfigurationJsonEnum.MAX_TIME_DIFF_SECONDS.getJsonName()));
+ }
+ if (jsonValueMap.containsKey(JobConfigurationJsonEnum.MONITOR_PORT.getJsonName())) {
+ builder.monitorPort((int) jsonValueMap.get(JobConfigurationJsonEnum.MONITOR_PORT.getJsonName()));
+ }
+ if (jsonValueMap.containsKey(JobConfigurationJsonEnum.JOB_SHARDING_STRATEGY_TYPE.getJsonName())) {
+ builder.jobShardingStrategyType((String) jsonValueMap.get(JobConfigurationJsonEnum.JOB_SHARDING_STRATEGY_TYPE.getJsonName()));
+ }
+ if (jsonValueMap.containsKey(JobConfigurationJsonEnum.RECONCILE_INTERVAL_MINUTES.getJsonName())) {
+ builder.reconcileIntervalMinutes((int) jsonValueMap.get(JobConfigurationJsonEnum.RECONCILE_INTERVAL_MINUTES.getJsonName()));
+ }
+ if (jsonValueMap.containsKey(JobConfigurationJsonEnum.DISABLED.getJsonName())) {
+ builder.disabled((boolean) jsonValueMap.get(JobConfigurationJsonEnum.DISABLED.getJsonName()));
+ }
+ if (jsonValueMap.containsKey(JobConfigurationJsonEnum.OVERWRITE.getJsonName())) {
+ builder.overwrite((boolean) jsonValueMap.get(JobConfigurationJsonEnum.OVERWRITE.getJsonName()));
+ }
+ return builder.build();
+ }
+
+ @Override
+ public void write(final JsonWriter out, final LiteJobConfiguration value) throws IOException {
+ out.beginObject();
+ out.name(JobConfigurationJsonEnum.JOB_NAME.getJsonName()).value(value.getTypeConfig().getCoreConfig().getJobName());
+ out.name(JobConfigurationJsonEnum.JOB_TYPE.getJsonName()).value(value.getTypeConfig().getJobType().name());
+ out.name(JobConfigurationJsonEnum.CRON.getJsonName()).value(value.getTypeConfig().getCoreConfig().getCron());
+ out.name(JobConfigurationJsonEnum.SHARDING_TOTAL_COUNT.getJsonName()).value(value.getTypeConfig().getCoreConfig().getShardingTotalCount());
+ out.name(JobConfigurationJsonEnum.SHARDING_ITEM_PARAMETERS.getJsonName()).value(value.getTypeConfig().getCoreConfig().getShardingItemParameters());
+ out.name(JobConfigurationJsonEnum.JOB_PARAMETER.getJsonName()).value(value.getTypeConfig().getCoreConfig().getJobParameter());
+ out.name(JobConfigurationJsonEnum.FAILOVER.getJsonName()).value(value.getTypeConfig().getCoreConfig().isFailover());
+ out.name(JobConfigurationJsonEnum.MISFIRE.getJsonName()).value(value.getTypeConfig().getCoreConfig().isMisfire());
+ if (!Strings.isNullOrEmpty(value.getTypeConfig().getCoreConfig().getJobExecutorServiceHandlerType())) {
+ out.name(JobConfigurationJsonEnum.JOB_EXECUTOR_SERVICE_HANDLER_TYPE.getJsonName()).value(value.getTypeConfig().getCoreConfig().getJobExecutorServiceHandlerType());
+ }
+ if (!Strings.isNullOrEmpty(value.getTypeConfig().getCoreConfig().getJobErrorHandlerType())) {
+ out.name(JobConfigurationJsonEnum.JOB_ERROR_HANDLER_TYPE.getJsonName()).value(value.getTypeConfig().getCoreConfig().getJobErrorHandlerType());
+ }
+ out.name(JobConfigurationJsonEnum.DESCRIPTION.getJsonName()).value(value.getTypeConfig().getCoreConfig().getDescription());
+ if (value.getTypeConfig().getJobType() == JobType.DATAFLOW) {
+ out.name(JobConfigurationJsonEnum.STREAMING_PROCESS.getJsonName()).value(((DataflowJobConfiguration) value.getTypeConfig()).isStreamingProcess());
+ } else if (value.getTypeConfig().getJobType() == JobType.SCRIPT) {
+ ScriptJobConfiguration scriptJobConfig = (ScriptJobConfiguration) value.getTypeConfig();
+ out.name(JobConfigurationJsonEnum.SCRIPT_COMMAND_LINE.getJsonName()).value(scriptJobConfig.getScriptCommandLine());
+ }
+ out.name(JobConfigurationJsonEnum.MONITOR_EXECUTION.getJsonName()).value(value.isMonitorExecution());
+ out.name(JobConfigurationJsonEnum.MAX_TIME_DIFF_SECONDS.getJsonName()).value(value.getMaxTimeDiffSeconds());
+ out.name(JobConfigurationJsonEnum.MONITOR_PORT.getJsonName()).value(value.getMonitorPort());
+ out.name(JobConfigurationJsonEnum.JOB_SHARDING_STRATEGY_TYPE.getJsonName()).value(value.getJobShardingStrategyType());
+ out.name(JobConfigurationJsonEnum.RECONCILE_INTERVAL_MINUTES.getJsonName()).value(value.getReconcileIntervalMinutes());
+ out.name(JobConfigurationJsonEnum.DISABLED.getJsonName()).value(value.isDisabled());
+ out.name(JobConfigurationJsonEnum.OVERWRITE.getJsonName()).value(value.isOverwrite());
+ out.endObject();
+ }
+}
diff --git a/elastic-job-lite-core/src/main/java/org/apache/shardingsphere/elasticjob/lite/internal/failover/FailoverListenerManager.java b/elastic-job-lite-core/src/main/java/org/apache/shardingsphere/elasticjob/lite/internal/failover/FailoverListenerManager.java
index 5bee0ef..b544aea 100644
--- a/elastic-job-lite-core/src/main/java/org/apache/shardingsphere/elasticjob/lite/internal/failover/FailoverListenerManager.java
+++ b/elastic-job-lite-core/src/main/java/org/apache/shardingsphere/elasticjob/lite/internal/failover/FailoverListenerManager.java
@@ -21,7 +21,7 @@ import org.apache.curator.framework.recipes.cache.TreeCacheEvent.Type;
import org.apache.shardingsphere.elasticjob.lite.config.LiteJobConfiguration;
import org.apache.shardingsphere.elasticjob.lite.internal.config.ConfigurationNode;
import org.apache.shardingsphere.elasticjob.lite.internal.config.ConfigurationService;
-import org.apache.shardingsphere.elasticjob.lite.internal.config.LiteJobConfigurationGsonFactory;
+import org.apache.shardingsphere.elasticjob.lite.internal.config.json.LiteJobConfigurationGsonFactory;
import org.apache.shardingsphere.elasticjob.lite.internal.instance.InstanceNode;
import org.apache.shardingsphere.elasticjob.lite.internal.listener.AbstractJobListener;
import org.apache.shardingsphere.elasticjob.lite.internal.listener.AbstractListenerManager;
diff --git a/elastic-job-lite-core/src/main/java/org/apache/shardingsphere/elasticjob/lite/internal/sharding/MonitorExecutionListenerManager.java b/elastic-job-lite-core/src/main/java/org/apache/shardingsphere/elasticjob/lite/internal/sharding/MonitorExecutionListenerManager.java
index 7ed12bf..b02bb41 100644
--- a/elastic-job-lite-core/src/main/java/org/apache/shardingsphere/elasticjob/lite/internal/sharding/MonitorExecutionListenerManager.java
+++ b/elastic-job-lite-core/src/main/java/org/apache/shardingsphere/elasticjob/lite/internal/sharding/MonitorExecutionListenerManager.java
@@ -18,7 +18,7 @@
package org.apache.shardingsphere.elasticjob.lite.internal.sharding;
import org.apache.shardingsphere.elasticjob.lite.internal.config.ConfigurationNode;
-import org.apache.shardingsphere.elasticjob.lite.internal.config.LiteJobConfigurationGsonFactory;
+import org.apache.shardingsphere.elasticjob.lite.internal.config.json.LiteJobConfigurationGsonFactory;
import org.apache.shardingsphere.elasticjob.lite.internal.listener.AbstractJobListener;
import org.apache.shardingsphere.elasticjob.lite.internal.listener.AbstractListenerManager;
import org.apache.shardingsphere.elasticjob.lite.reg.base.CoordinatorRegistryCenter;
diff --git a/elastic-job-lite-core/src/main/java/org/apache/shardingsphere/elasticjob/lite/internal/sharding/ShardingListenerManager.java b/elastic-job-lite-core/src/main/java/org/apache/shardingsphere/elasticjob/lite/internal/sharding/ShardingListenerManager.java
index a1526a9..87082c5 100644
--- a/elastic-job-lite-core/src/main/java/org/apache/shardingsphere/elasticjob/lite/internal/sharding/ShardingListenerManager.java
+++ b/elastic-job-lite-core/src/main/java/org/apache/shardingsphere/elasticjob/lite/internal/sharding/ShardingListenerManager.java
@@ -18,7 +18,7 @@
package org.apache.shardingsphere.elasticjob.lite.internal.sharding;
import org.apache.shardingsphere.elasticjob.lite.internal.config.ConfigurationNode;
-import org.apache.shardingsphere.elasticjob.lite.internal.config.LiteJobConfigurationGsonFactory;
+import org.apache.shardingsphere.elasticjob.lite.internal.config.json.LiteJobConfigurationGsonFactory;
import org.apache.shardingsphere.elasticjob.lite.internal.instance.InstanceNode;
import org.apache.shardingsphere.elasticjob.lite.internal.listener.AbstractJobListener;
import org.apache.shardingsphere.elasticjob.lite.internal.listener.AbstractListenerManager;
diff --git a/elastic-job-lite-core/src/main/java/org/apache/shardingsphere/elasticjob/lite/util/json/AbstractJobConfigurationGsonTypeAdapter.java b/elastic-job-lite-core/src/main/java/org/apache/shardingsphere/elasticjob/lite/util/json/AbstractJobConfigurationGsonTypeAdapter.java
deleted file mode 100644
index 0f3f440..0000000
--- a/elastic-job-lite-core/src/main/java/org/apache/shardingsphere/elasticjob/lite/util/json/AbstractJobConfigurationGsonTypeAdapter.java
+++ /dev/null
@@ -1,172 +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.elasticjob.lite.util.json;
-
-import com.google.common.base.Preconditions;
-import com.google.common.base.Strings;
-import com.google.gson.TypeAdapter;
-import com.google.gson.stream.JsonReader;
-import com.google.gson.stream.JsonWriter;
-import org.apache.shardingsphere.elasticjob.lite.api.JobType;
-import org.apache.shardingsphere.elasticjob.lite.config.JobCoreConfiguration;
-import org.apache.shardingsphere.elasticjob.lite.config.JobRootConfiguration;
-import org.apache.shardingsphere.elasticjob.lite.config.JobTypeConfiguration;
-import org.apache.shardingsphere.elasticjob.lite.config.dataflow.DataflowJobConfiguration;
-import org.apache.shardingsphere.elasticjob.lite.config.script.ScriptJobConfiguration;
-import org.apache.shardingsphere.elasticjob.lite.config.simple.SimpleJobConfiguration;
-
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * Job configuration gson type adapter.
- *
- * @param <T> type of job root configuration
- */
-public abstract class AbstractJobConfigurationGsonTypeAdapter<T extends JobRootConfiguration> extends TypeAdapter<T> {
-
- @Override
- public T read(final JsonReader in) throws IOException {
- String jobName = "";
- String cron = "";
- int shardingTotalCount = 0;
- String shardingItemParameters = "";
- String jobParameter = "";
- boolean failover = false;
- boolean misfire = failover;
- String jobExecutorServiceHandlerType = "";
- String jobErrorHandlerType = "";
- String description = "";
- JobType jobType = null;
- boolean streamingProcess = false;
- String scriptCommandLine = "";
- Map<String, Object> customizedValueMap = new HashMap<>(32, 1);
- in.beginObject();
- while (in.hasNext()) {
- String jsonName = in.nextName();
- switch (jsonName) {
- case "jobName":
- jobName = in.nextString();
- break;
- case "cron":
- cron = in.nextString();
- break;
- case "shardingTotalCount":
- shardingTotalCount = in.nextInt();
- break;
- case "shardingItemParameters":
- shardingItemParameters = in.nextString();
- break;
- case "jobParameter":
- jobParameter = in.nextString();
- break;
- case "failover":
- failover = in.nextBoolean();
- break;
- case "misfire":
- misfire = in.nextBoolean();
- break;
- case "jobExecutorServiceHandlerType":
- jobExecutorServiceHandlerType = in.nextString();
- break;
- case "jobErrorHandlerType":
- jobErrorHandlerType = in.nextString();
- break;
- case "description":
- description = in.nextString();
- break;
- case "jobType":
- jobType = JobType.valueOf(in.nextString());
- break;
- case "streamingProcess":
- streamingProcess = in.nextBoolean();
- break;
- case "scriptCommandLine":
- scriptCommandLine = in.nextString();
- break;
- default:
- addToCustomizedValueMap(jsonName, in, customizedValueMap);
- break;
- }
- }
- in.endObject();
- JobCoreConfiguration coreConfig = getJobCoreConfiguration(
- jobName, cron, shardingTotalCount, shardingItemParameters, jobParameter, failover, misfire, jobExecutorServiceHandlerType, jobErrorHandlerType, description);
- JobTypeConfiguration typeConfig = getJobTypeConfiguration(coreConfig, jobType, streamingProcess, scriptCommandLine);
- return getJobRootConfiguration(typeConfig, customizedValueMap);
- }
-
- protected abstract void addToCustomizedValueMap(String jsonName, JsonReader in, Map<String, Object> customizedValueMap) throws IOException;
-
- private JobCoreConfiguration getJobCoreConfiguration(final String jobName, final String cron, final int shardingTotalCount,
- final String shardingItemParameters, final String jobParameter, final boolean failover,
- final boolean misfire, final String jobExecutorServiceHandlerType, final String jobErrorHandlerType, final String description) {
- return JobCoreConfiguration.newBuilder(jobName, cron, shardingTotalCount)
- .shardingItemParameters(shardingItemParameters).jobParameter(jobParameter).failover(failover).misfire(misfire).description(description)
- .jobExecutorServiceHandlerType(jobExecutorServiceHandlerType)
- .jobErrorHandlerType(jobErrorHandlerType)
- .build();
- }
-
- private JobTypeConfiguration getJobTypeConfiguration(final JobCoreConfiguration coreConfig, final JobType jobType, final boolean streamingProcess, final String scriptCommandLine) {
- Preconditions.checkNotNull(jobType, "jobType cannot be null.");
- switch (jobType) {
- case SIMPLE:
- return new SimpleJobConfiguration(coreConfig);
- case DATAFLOW:
- return new DataflowJobConfiguration(coreConfig, streamingProcess);
- case SCRIPT:
- return new ScriptJobConfiguration(coreConfig, scriptCommandLine);
- default:
- throw new UnsupportedOperationException(String.valueOf(jobType));
- }
- }
-
- protected abstract T getJobRootConfiguration(JobTypeConfiguration typeConfig, Map<String, Object> customizedValueMap);
-
- @Override
- public void write(final JsonWriter out, final T value) throws IOException {
- out.beginObject();
- out.name("jobName").value(value.getTypeConfig().getCoreConfig().getJobName());
- out.name("jobType").value(value.getTypeConfig().getJobType().name());
- out.name("cron").value(value.getTypeConfig().getCoreConfig().getCron());
- out.name("shardingTotalCount").value(value.getTypeConfig().getCoreConfig().getShardingTotalCount());
- out.name("shardingItemParameters").value(value.getTypeConfig().getCoreConfig().getShardingItemParameters());
- out.name("jobParameter").value(value.getTypeConfig().getCoreConfig().getJobParameter());
- out.name("failover").value(value.getTypeConfig().getCoreConfig().isFailover());
- out.name("misfire").value(value.getTypeConfig().getCoreConfig().isMisfire());
- if (!Strings.isNullOrEmpty(value.getTypeConfig().getCoreConfig().getJobExecutorServiceHandlerType())) {
- out.name("jobExecutorServiceHandlerType").value(value.getTypeConfig().getCoreConfig().getJobExecutorServiceHandlerType());
- }
- if (!Strings.isNullOrEmpty(value.getTypeConfig().getCoreConfig().getJobErrorHandlerType())) {
- out.name("jobErrorHandlerType").value(value.getTypeConfig().getCoreConfig().getJobErrorHandlerType());
- }
- out.name("description").value(value.getTypeConfig().getCoreConfig().getDescription());
- if (value.getTypeConfig().getJobType() == JobType.DATAFLOW) {
- out.name("streamingProcess").value(((DataflowJobConfiguration) value.getTypeConfig()).isStreamingProcess());
- } else if (value.getTypeConfig().getJobType() == JobType.SCRIPT) {
- ScriptJobConfiguration scriptJobConfig = (ScriptJobConfiguration) value.getTypeConfig();
- out.name("scriptCommandLine").value(scriptJobConfig.getScriptCommandLine());
- }
- writeCustomized(out, value);
- out.endObject();
- }
-
- protected abstract void writeCustomized(JsonWriter out, T value) throws IOException;
-}
diff --git a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/integrate/AbstractBaseStdJobTest.java b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/integrate/AbstractBaseStdJobTest.java
index f424297..5d7c418 100644
--- a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/integrate/AbstractBaseStdJobTest.java
+++ b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/integrate/AbstractBaseStdJobTest.java
@@ -34,7 +34,7 @@ import org.apache.shardingsphere.elasticjob.lite.config.script.ScriptJobConfigur
import org.apache.shardingsphere.elasticjob.lite.config.simple.SimpleJobConfiguration;
import org.apache.shardingsphere.elasticjob.lite.executor.ShardingContexts;
import org.apache.shardingsphere.elasticjob.lite.fixture.EmbedTestingServer;
-import org.apache.shardingsphere.elasticjob.lite.internal.config.LiteJobConfigurationGsonFactory;
+import org.apache.shardingsphere.elasticjob.lite.internal.config.json.LiteJobConfigurationGsonFactory;
import org.apache.shardingsphere.elasticjob.lite.internal.election.LeaderService;
import org.apache.shardingsphere.elasticjob.lite.internal.schedule.JobRegistry;
import org.apache.shardingsphere.elasticjob.lite.internal.schedule.SchedulerFacade;
diff --git a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/integrate/std/script/ScriptElasticJobTest.java b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/integrate/std/script/ScriptElasticJobTest.java
index 4269f6c..e1de2ec 100644
--- a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/integrate/std/script/ScriptElasticJobTest.java
+++ b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/integrate/std/script/ScriptElasticJobTest.java
@@ -23,7 +23,7 @@ import org.apache.shardingsphere.elasticjob.lite.config.script.ScriptJobConfigur
import org.apache.shardingsphere.elasticjob.lite.fixture.util.ScriptElasticJobUtil;
import org.apache.shardingsphere.elasticjob.lite.integrate.AbstractBaseStdJobAutoInitTest;
import org.apache.shardingsphere.elasticjob.lite.integrate.WaitingUtils;
-import org.apache.shardingsphere.elasticjob.lite.internal.config.LiteJobConfigurationGsonFactory;
+import org.apache.shardingsphere.elasticjob.lite.internal.config.json.LiteJobConfigurationGsonFactory;
import org.junit.Test;
import java.io.IOException;
diff --git a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/config/ConfigurationServiceTest.java b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/config/ConfigurationServiceTest.java
index 38218fa..49f91d8 100644
--- a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/config/ConfigurationServiceTest.java
+++ b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/config/ConfigurationServiceTest.java
@@ -23,6 +23,7 @@ import org.apache.shardingsphere.elasticjob.lite.exception.JobExecutionEnvironme
import org.apache.shardingsphere.elasticjob.lite.fixture.LiteJsonConstants;
import org.apache.shardingsphere.elasticjob.lite.fixture.TestSimpleJob;
import org.apache.shardingsphere.elasticjob.lite.fixture.util.JobConfigurationUtil;
+import org.apache.shardingsphere.elasticjob.lite.internal.config.json.LiteJobConfigurationGsonFactory;
import org.apache.shardingsphere.elasticjob.lite.internal.storage.JobNodeStorage;
import org.apache.shardingsphere.elasticjob.lite.util.ReflectionUtils;
import org.junit.Before;
diff --git a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/config/LiteJobConfigurationGsonFactoryTest.java b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/config/LiteJobConfigurationGsonFactoryTest.java
index 4d2285b..3cd6788 100644
--- a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/config/LiteJobConfigurationGsonFactoryTest.java
+++ b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/config/LiteJobConfigurationGsonFactoryTest.java
@@ -23,6 +23,7 @@ import org.apache.shardingsphere.elasticjob.lite.config.LiteJobConfiguration;
import org.apache.shardingsphere.elasticjob.lite.config.dataflow.DataflowJobConfiguration;
import org.apache.shardingsphere.elasticjob.lite.config.script.ScriptJobConfiguration;
import org.apache.shardingsphere.elasticjob.lite.config.simple.SimpleJobConfiguration;
+import org.apache.shardingsphere.elasticjob.lite.internal.config.json.LiteJobConfigurationGsonFactory;
import org.junit.Test;
import static org.hamcrest.CoreMatchers.is;
diff --git a/elastic-job-lite-lifecycle/src/main/java/org/apache/shardingsphere/elasticjob/lite/lifecycle/internal/settings/JobSettingsAPIImpl.java b/elastic-job-lite-lifecycle/src/main/java/org/apache/shardingsphere/elasticjob/lite/lifecycle/internal/settings/JobSettingsAPIImpl.java
index 455c251..ae72250 100644
--- a/elastic-job-lite-lifecycle/src/main/java/org/apache/shardingsphere/elasticjob/lite/lifecycle/internal/settings/JobSettingsAPIImpl.java
+++ b/elastic-job-lite-lifecycle/src/main/java/org/apache/shardingsphere/elasticjob/lite/lifecycle/internal/settings/JobSettingsAPIImpl.java
@@ -24,7 +24,7 @@ import org.apache.shardingsphere.elasticjob.lite.api.JobType;
import org.apache.shardingsphere.elasticjob.lite.config.LiteJobConfiguration;
import org.apache.shardingsphere.elasticjob.lite.config.dataflow.DataflowJobConfiguration;
import org.apache.shardingsphere.elasticjob.lite.config.script.ScriptJobConfiguration;
-import org.apache.shardingsphere.elasticjob.lite.internal.config.LiteJobConfigurationGsonFactory;
+import org.apache.shardingsphere.elasticjob.lite.internal.config.json.LiteJobConfigurationGsonFactory;
import org.apache.shardingsphere.elasticjob.lite.internal.storage.JobNodePath;
import org.apache.shardingsphere.elasticjob.lite.lifecycle.api.JobSettingsAPI;
import org.apache.shardingsphere.elasticjob.lite.lifecycle.domain.JobSettings;
diff --git a/elastic-job-lite-lifecycle/src/main/java/org/apache/shardingsphere/elasticjob/lite/lifecycle/internal/statistics/JobStatisticsAPIImpl.java b/elastic-job-lite-lifecycle/src/main/java/org/apache/shardingsphere/elasticjob/lite/lifecycle/internal/statistics/JobStatisticsAPIImpl.java
index c2449fb..a84b797 100644
--- a/elastic-job-lite-lifecycle/src/main/java/org/apache/shardingsphere/elasticjob/lite/lifecycle/internal/statistics/JobStatisticsAPIImpl.java
+++ b/elastic-job-lite-lifecycle/src/main/java/org/apache/shardingsphere/elasticjob/lite/lifecycle/internal/statistics/JobStatisticsAPIImpl.java
@@ -19,7 +19,7 @@ package org.apache.shardingsphere.elasticjob.lite.lifecycle.internal.statistics;
import lombok.RequiredArgsConstructor;
import org.apache.shardingsphere.elasticjob.lite.config.LiteJobConfiguration;
-import org.apache.shardingsphere.elasticjob.lite.internal.config.LiteJobConfigurationGsonFactory;
+import org.apache.shardingsphere.elasticjob.lite.internal.config.json.LiteJobConfigurationGsonFactory;
import org.apache.shardingsphere.elasticjob.lite.internal.storage.JobNodePath;
import org.apache.shardingsphere.elasticjob.lite.lifecycle.api.JobStatisticsAPI;
import org.apache.shardingsphere.elasticjob.lite.lifecycle.domain.JobBriefInfo;