// if the definition is not a map, it can't be a schedule
if (mapDef instanceof PropertyDefinitionMap) {
PropertyDefinitionMap jobMapDef = (PropertyDefinitionMap) mapDef;
ConfigurationTemplate defaultTemplate = jobMapDef.getConfigurationDefinition().getDefaultTemplate();
PropertyMap defaults = defaultTemplate.getConfiguration().getMap(mapDef.getName());
// prepare some defaults if the schedule didn't define some of these
// we assume:
// the map name is the methodName that will be invoked
// the class name is null, which means its the stateful plugin component to be invoked
// the schedule is always enabled
// the schedule is never concurrent
// the schedule is a periodic schedule that triggers every 10 minutes
// the schedule has no callback data
String methodName = defaults.getSimpleValue(SCHEDULED_JOB_PROP_NAME_METHOD_NAME, mapDef.getName());
String className = defaults.getSimpleValue(SCHEDULED_JOB_PROP_NAME_CLASS, null);
String enabledStr = defaults.getSimpleValue(SCHEDULED_JOB_PROP_NAME_ENABLED, "true");
String concurrentStr = defaults.getSimpleValue(SCHEDULED_JOB_PROP_NAME_CONCURRENT, "false");
String clusteredStr = defaults.getSimpleValue(SCHEDULED_JOB_PROP_NAME_CLUSTERED, "true");
String scheduleTypeStr = defaults.getSimpleValue(SCHEDULED_JOB_PROP_NAME_SCHEDULE_TYPE,
PeriodicScheduleType.TYPE_NAME);
String scheduleTriggerStr = defaults.getSimpleValue(SCHEDULED_JOB_PROP_NAME_SCHEDULE_TRIGGER, "600000");
String jobId = jobMapDef.getName();
boolean enabled = Boolean.parseBoolean(enabledStr);
boolean concurrent = Boolean.parseBoolean(concurrentStr);
boolean clustered = Boolean.parseBoolean(clusteredStr);
AbstractScheduleType scheduleType;
scheduleType = AbstractScheduleType.create(concurrent, clustered, scheduleTypeStr, scheduleTriggerStr);
if (scheduleType == null) {
throw new InvalidPluginDescriptorException("Invalid schedule type: " + scheduleTypeStr);
}
// the callback data will contain all simple properties in the schedule job map
Properties callbackData = new Properties();
Map<String, PropertyDefinition> allPropDefs = jobMapDef.getMap();
for (PropertyDefinition currentPropDef : allPropDefs.values()) {
if (currentPropDef instanceof PropertyDefinitionSimple) {
String currentPropDefName = currentPropDef.getName();
String currentPropDefValue = defaults.getSimpleValue(currentPropDefName, null);
if (currentPropDefValue != null) {
callbackData.setProperty(currentPropDefName, currentPropDefValue);
}
}
}