use of org.jaffa.modules.scheduler.services.configdomain.Task in project jaffa-framework by jaffa-projects.
the class SchedulerManager method getSchedulerTask.
/**
* Returns the scheduler task object for the input dataBeanClass, as defined in the configuration file.
*
* @param dataBeanClass the class for a dataBean.
* @return the TransactionInfo object for the input dataBeanClass, as defined in the configuration file.
*/
public Task getSchedulerTask(String dataBeanClass) {
Task task = schedulerTaskRepository.query(dataBeanClass);
if (task == null) {
// Lookup the class hierarchy. Add a NULL for the dataBeanClassName, even if a Task is not found
synchronized (schedulerTaskRepository) {
task = schedulerTaskRepository.query(dataBeanClass);
try {
if (task == null) {
Class clazz = Class.forName(dataBeanClass);
ContextKey superClassContextKey = null;
while (clazz.getSuperclass() != null && task == null) {
clazz = clazz.getSuperclass();
task = schedulerTaskRepository.query(clazz.getName());
superClassContextKey = schedulerTaskRepository.findKey(clazz.getName());
}
if (superClassContextKey != null) {
schedulerTaskRepository.register(new ContextKey(dataBeanClass, superClassContextKey.getFileName(), superClassContextKey.getVariation(), superClassContextKey.getVariation()), task);
}
}
} catch (ClassNotFoundException e) {
log.error("Unable to find class definition for " + dataBeanClass, e);
}
}
}
return task;
}
use of org.jaffa.modules.scheduler.services.configdomain.Task in project jaffa-framework by jaffa-projects.
the class SchedulerManager method registerResource.
/**
* {@inheritDoc}
*/
@Override
public void registerResource(Resource resource, String context, String variation) throws JAXBException, SAXException, IOException {
Config config = JAXBHelper.unmarshalConfigFile(Config.class, resource, CONFIGURATION_SCHEMA_FILE);
if (config.getTask() != null) {
for (final Task schedulerTask : config.getTask()) {
ContextKey contextKey = new ContextKey(schedulerTask.getDataBean(), resource.getURI().toString(), variation, context);
registerSchedulerTask(contextKey, schedulerTask);
}
}
}
Aggregations