use of com.dangdang.ddframe.job.executor.handler.JobProperties in project elastic-job by dangdangdotcom.
the class AbstractJobConfigurationGsonTypeAdapter method getJobProperties.
private JobProperties getJobProperties(final JsonReader in) throws IOException {
JobProperties result = new JobProperties();
in.beginObject();
while (in.hasNext()) {
switch(in.nextName()) {
case "job_exception_handler":
result.put(JobProperties.JobPropertiesEnum.JOB_EXCEPTION_HANDLER.getKey(), in.nextString());
break;
case "executor_service_handler":
result.put(JobProperties.JobPropertiesEnum.EXECUTOR_SERVICE_HANDLER.getKey(), in.nextString());
break;
default:
break;
}
}
in.endObject();
return result;
}
use of com.dangdang.ddframe.job.executor.handler.JobProperties in project elastic-job by dangdangdotcom.
the class AbstractJobConfigurationGsonTypeAdapter method read.
@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 description = "";
JobProperties jobProperties = new JobProperties();
JobType jobType = null;
String jobClass = "";
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 "description":
description = in.nextString();
break;
case "jobProperties":
jobProperties = getJobProperties(in);
break;
case "jobType":
jobType = JobType.valueOf(in.nextString());
break;
case "jobClass":
jobClass = 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, description, jobProperties);
JobTypeConfiguration typeConfig = getJobTypeConfiguration(coreConfig, jobType, jobClass, streamingProcess, scriptCommandLine);
return getJobRootConfiguration(typeConfig, customizedValueMap);
}
Aggregations