Search in sources :

Example 6 with Task

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;
}
Also used : Task(org.jaffa.modules.scheduler.services.configdomain.Task) ContextKey(org.jaffa.loader.ContextKey)

Example 7 with 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);
        }
    }
}
Also used : Task(org.jaffa.modules.scheduler.services.configdomain.Task) ContextKey(org.jaffa.loader.ContextKey) Config(org.jaffa.modules.scheduler.services.configdomain.Config)

Aggregations

Task (org.jaffa.modules.scheduler.services.configdomain.Task)7 ContextKey (org.jaffa.loader.ContextKey)4 ComponentManager (org.jaffa.loader.components.ComponentManager)2 ApplicationRulesManager (org.jaffa.loader.config.ApplicationRulesManager)2 JndiJmsManager (org.jaffa.loader.messaging.JndiJmsManager)2 MessagingManager (org.jaffa.loader.messaging.MessagingManager)2 NavigationManager (org.jaffa.loader.navigation.NavigationManager)2 BusinessFunctionManager (org.jaffa.loader.policy.BusinessFunctionManager)2 RoleManager (org.jaffa.loader.policy.RoleManager)2 SchedulerManager (org.jaffa.loader.scheduler.SchedulerManager)2 SoaEventManager (org.jaffa.loader.soa.SoaEventManager)2 TransactionManager (org.jaffa.loader.transaction.TransactionManager)2 Config (org.jaffa.modules.scheduler.services.configdomain.Config)2 Before (org.junit.Before)2 JAXBException (javax.xml.bind.JAXBException)1 RepositoryJsonService (org.jaffa.api.services.monitoring.controller.RepositoryJsonService)1 CodeHelperInDto (org.jaffa.components.codehelper.dto.CodeHelperInDto)1 ApplicationExceptions (org.jaffa.exceptions.ApplicationExceptions)1 JaffaSchedulerFrameworkException (org.jaffa.modules.scheduler.services.JaffaSchedulerFrameworkException)1 ScheduledTask (org.jaffa.modules.scheduler.services.ScheduledTask)1