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());
}
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());
}
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());
}
}
}
}
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());
}
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);
}
}
}
Aggregations