Search in sources :

Example 1 with Task

use of org.jaffa.modules.scheduler.services.configdomain.Task in project jaffa-framework by jaffa-projects.

the class RepositoryJsonServiceTest method setUp.

/**
 * This setup function registers resources to each managed repository to produce correct retrieval results
 * @throws Exception
 */
@Before
public void setUp() throws Exception {
    managerRepositoryService = ManagerRepositoryService.getInstance();
    ContextKey testKey = new ContextKey("testKey", "file1.xml", "NULL", "1-PRODUCT");
    SchedulerManager testManager = new SchedulerManager();
    Task testTask = new Task();
    repositoryJsonService = new RepositoryJsonService();
    testKey = new ContextKey("testKey", "file1.xml", "NULL", "1-PRODUCT");
    testManager = new SchedulerManager();
    testTask = new Task();
    // Must populate a repository element in order to retrieve data
    testTask.setAutoCreateDataBean(true);
    testTask.setDataBean("DataBeanTest");
    testTask.setType("TestType");
    testManager.registerSchedulerTask(testKey, testTask);
    // Add managers to ManagerRepositoryService
    managerRepositoryService.add("Task", testManager);
    managerRepositoryService.add("ComponentManager", new ComponentManager());
    managerRepositoryService.add("ApplicationRulesManager", new ApplicationRulesManager());
    managerRepositoryService.add("NavigationManager", new NavigationManager());
    managerRepositoryService.add("BusinessFunctionManager", new BusinessFunctionManager());
    managerRepositoryService.add("RoleManager", new RoleManager());
    managerRepositoryService.add("JndiJmsManager", new JndiJmsManager());
    managerRepositoryService.add("MessagingManager", new MessagingManager());
    managerRepositoryService.add("SoaEventManager", new SoaEventManager());
    managerRepositoryService.add("TransactionManager", new TransactionManager());
}
Also used : NavigationManager(org.jaffa.loader.navigation.NavigationManager) Task(org.jaffa.modules.scheduler.services.configdomain.Task) RoleManager(org.jaffa.loader.policy.RoleManager) JndiJmsManager(org.jaffa.loader.messaging.JndiJmsManager) MessagingManager(org.jaffa.loader.messaging.MessagingManager) SchedulerManager(org.jaffa.loader.scheduler.SchedulerManager) BusinessFunctionManager(org.jaffa.loader.policy.BusinessFunctionManager) ApplicationRulesManager(org.jaffa.loader.config.ApplicationRulesManager) SoaEventManager(org.jaffa.loader.soa.SoaEventManager) RepositoryJsonService(org.jaffa.api.services.monitoring.controller.RepositoryJsonService) TransactionManager(org.jaffa.loader.transaction.TransactionManager) ComponentManager(org.jaffa.loader.components.ComponentManager) Before(org.junit.Before)

Example 2 with Task

use of org.jaffa.modules.scheduler.services.configdomain.Task in project jaffa-framework by jaffa-projects.

the class SchedulerXmlLoadTest method testGetSchedulerTaskByTaskName.

@Test
public void testGetSchedulerTaskByTaskName() {
    SchedulerManager schedulerManager = xmlLoaderConfig.getBean(SchedulerManager.class);
    Task poller = schedulerManager.getSchedulerTaskByTypeName("SOAEventPoller");
    assertNotNull(poller);
    assertEquals("org.jaffa.soa.services.SOAEventPoller", poller.getDataBean());
    Task task = schedulerManager.getSchedulerTaskByTypeName("TransactionDependencySweeper");
    assertNotNull(task);
    assertEquals("org.jaffa.transaction.services.TransactionDependencySweeper", task.getDataBean());
}
Also used : Task(org.jaffa.modules.scheduler.services.configdomain.Task) Test(org.junit.Test)

Example 3 with Task

use of org.jaffa.modules.scheduler.services.configdomain.Task in project jaffa-framework by jaffa-projects.

the class TaskMaintenanceComponent method initDropDownCodes.

/**
 * This will retrieve the set of codes for dropdowns, if any are required
 * @throws ApplicationExceptions This will be thrown in case any invalid data has been set.
 * @throws FrameworkException Indicates some system error.
 */
protected void initDropDownCodes() throws ApplicationExceptions, FrameworkException {
    ApplicationExceptions appExps = null;
    CodeHelperInDto input = null;
    if (getBusinessObjectXML() != null && getTaskType() != null) {
        Task task = SchedulerConfiguration.getInstance().getTask(getTaskType());
        if (task != null && task.getDataBean() != null) {
            try {
                setBusinessObject(JAXBHelper.unmarshalPayload(getBusinessObjectXML(), task.getDataBean()));
            } catch (JAXBException e) {
                log.error("A task has not been configured for the dataBean " + task.getDataBean(), e);
                throw new JaffaSchedulerFrameworkException(JaffaSchedulerFrameworkException.MISSING_TASK_FOR_DATA_BEAN, new Object[] { task.getDataBean() }, e);
            } catch (ClassNotFoundException e) {
                log.error("A task has not been configured for the dataBean " + task.getDataBean(), e);
                throw new JaffaSchedulerFrameworkException(JaffaSchedulerFrameworkException.MISSING_TASK_FOR_DATA_BEAN, new Object[] { task.getDataBean() }, e);
            }
        }
    }
    // Initialize the taskType DropDown
    m_taskTypeCodes = new TreeSet<String>();
    if (getBusinessObject() != null) {
        try {
            Task task = SchedulerConfiguration.getInstance().getTaskByDataBean(getBusinessObject().getClass().getName());
            if (task != null)
                m_taskTypeCodes.add(task.getType());
        } catch (ClassNotFoundException e) {
            log.error("A task has not been configured for the dataBean " + getBusinessObject().getClass().getName(), e);
            throw new JaffaSchedulerFrameworkException(JaffaSchedulerFrameworkException.MISSING_TASK_FOR_DATA_BEAN, new Object[] { getBusinessObject().getClass().getName() }, e);
        }
    } else {
        Task[] tasks = SchedulerConfiguration.getInstance().getTasks();
        if (tasks != null) {
            for (Task task : tasks) {
                if (task.isAutoCreateDataBean() && SchedulerBrowser.hasBrowseTaskAccess(task.getType()))
                    m_taskTypeCodes.add(task.getType());
            }
        }
    }
}
Also used : CodeHelperInDto(org.jaffa.components.codehelper.dto.CodeHelperInDto) Task(org.jaffa.modules.scheduler.services.configdomain.Task) ScheduledTask(org.jaffa.modules.scheduler.services.ScheduledTask) ApplicationExceptions(org.jaffa.exceptions.ApplicationExceptions) JAXBException(javax.xml.bind.JAXBException) JaffaSchedulerFrameworkException(org.jaffa.modules.scheduler.services.JaffaSchedulerFrameworkException)

Example 4 with Task

use of org.jaffa.modules.scheduler.services.configdomain.Task in project jaffa-framework by jaffa-projects.

the class RepositoryJsonServiceTest method setUp.

/**
 * This setup function registers resources to each managed repository to produce correct retrieval results
 * @throws Exception
 */
@Before
public void setUp() throws Exception {
    managerRepositoryService = ManagerRepositoryService.getInstance();
    repositoryJsonService = new RepositoryJsonService();
    testKey = new ContextKey("testKey", "file1.xml", "NULL", "1-PRODUCT");
    testManager = new SchedulerManager();
    testTask = new Task();
    // Must populate a repository element in order to retrieve data
    testTask.setAutoCreateDataBean(true);
    testTask.setDataBean("DataBeanTest");
    testTask.setType("TestType");
    testManager.registerSchedulerTask(testKey, testTask);
    // Add managers to ManagerRepositoryService
    managerRepositoryService.add("Task", testManager);
    managerRepositoryService.add("ComponentManager", new ComponentManager());
    managerRepositoryService.add("ApplicationRulesManager", new ApplicationRulesManager());
    managerRepositoryService.add("NavigationManager", new NavigationManager());
    managerRepositoryService.add("BusinessFunctionManager", new BusinessFunctionManager());
    managerRepositoryService.add("RoleManager", new RoleManager());
    managerRepositoryService.add("JndiJmsManager", new JndiJmsManager());
    managerRepositoryService.add("MessagingManager", new MessagingManager());
    managerRepositoryService.add("SoaEventManager", new SoaEventManager());
    managerRepositoryService.add("TransactionManager", new TransactionManager());
}
Also used : NavigationManager(org.jaffa.loader.navigation.NavigationManager) Task(org.jaffa.modules.scheduler.services.configdomain.Task) RoleManager(org.jaffa.loader.policy.RoleManager) JndiJmsManager(org.jaffa.loader.messaging.JndiJmsManager) MessagingManager(org.jaffa.loader.messaging.MessagingManager) SchedulerManager(org.jaffa.loader.scheduler.SchedulerManager) BusinessFunctionManager(org.jaffa.loader.policy.BusinessFunctionManager) ApplicationRulesManager(org.jaffa.loader.config.ApplicationRulesManager) SoaEventManager(org.jaffa.loader.soa.SoaEventManager) ContextKey(org.jaffa.loader.ContextKey) TransactionManager(org.jaffa.loader.transaction.TransactionManager) ComponentManager(org.jaffa.loader.components.ComponentManager) Before(org.junit.Before)

Example 5 with Task

use of org.jaffa.modules.scheduler.services.configdomain.Task in project jaffa-framework by jaffa-projects.

the class SchedulerManager method unregisterResource.

/**
 * {@inheritDoc}
 */
@Override
public void unregisterResource(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);
            unregisterSchedulerTask(contextKey);
        }
    }
}
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