String jobName = ctx.getJobDetail().getFullName();
if (log.isDebugEnabled()) {
log.debug("Executing task : " + jobName);
}
JobDataMap jdm = ctx.getMergedJobDataMap();
String jobClassName = (String) jdm.get(CLASSNAME);
if (jobClassName == null) {
handleException("No " + CLASSNAME + " in JobDetails");
}
boolean initRequired = false;
Task task = (Task) jdm.get(TaskDescription.INSTANCE);
if (task == null) {
initRequired = true;
}
SynapseEnvironment se = (SynapseEnvironment) jdm.get("SynapseEnvironment");
if (initRequired) {
try {
task = (Task) getClass().getClassLoader().loadClass(jobClassName).newInstance();
} catch (Exception e) {
handleException("Cannot instantiate task : " + jobClassName, e);
}
Set properties = (Set) jdm.get(PROPERTIES);
for (Object property : properties) {
OMElement prop = (OMElement) property;
log.debug("Found Property : " + prop.toString());
PropertyHelper.setStaticProperty(prop, task);
}