use of org.wso2.carbon.humantask.core.engine.HumanTaskServerException in project carbon-business-process by wso2.
the class HumanTaskServer method initPeopleQueryEvaluator.
/**
* @throws HumanTaskServerException :
*/
private void initPeopleQueryEvaluator() throws HumanTaskServerException {
try {
PeopleQueryEvaluator peopleQueryEvaluator = (PeopleQueryEvaluator) Class.forName(serverConfig.getPeopleQueryEvaluatorClass()).newInstance();
taskEngine.setPeopleQueryEvaluator(peopleQueryEvaluator);
} catch (Exception ex) {
String errMsg = "Error instantiating the PeopleQueryEvaluator Class :" + serverConfig.getPeopleQueryEvaluatorClass();
throw new HumanTaskServerException(errMsg, ex);
}
}
use of org.wso2.carbon.humantask.core.engine.HumanTaskServerException in project carbon-business-process by wso2.
the class HumanTaskServer method initEventProcessor.
//
/**
* Event processor initialisation logic.
* As of now we have a set of event listeners which we register at the server startup.
*
* @throws HumanTaskServerException : If the event listener object instantiation fails.
*/
private void initEventProcessor() throws HumanTaskServerException {
EventProcessor eventProcessor = new EventProcessor();
for (String eventListenerClassName : serverConfig.getEventListenerClassNames()) {
try {
Class eventListenerClass = this.getClass().getClassLoader().loadClass(eventListenerClassName);
HumanTaskEventListener eventListener = (HumanTaskEventListener) eventListenerClass.newInstance();
eventProcessor.addEventListener(eventListener);
} catch (Exception e) {
log.fatal("Couldn't initialize the event listener for class: " + eventListenerClassName, e);
throw new HumanTaskServerException("Couldn't initialize a event listener: " + eventListenerClassName, e);
}
}
this.eventProcessor = eventProcessor;
}
use of org.wso2.carbon.humantask.core.engine.HumanTaskServerException in project carbon-business-process by wso2.
the class TaskCleanupSchedulerUtil method initTaskCleanupJob.
/**
* Initialises the task clean up task.
*
* @throws HumanTaskServerException :
*/
public static void initTaskCleanupJob() throws HumanTaskServerException {
HumanTaskServerConfiguration serverConfig = HumanTaskCleanupSchedulerServiceComponent.getHumanTaskServer().getServerConfig();
if (serverConfig.isTaskCleanupEnabled()) {
try {
log.info("Initialising the task cleanup service.....");
HumanTaskCleanupSchedulerServiceComponent.getTaskService().registerTaskType(HumanTaskConstants.HUMANTASK_TASK_TYPE);
TaskManager taskManager = HumanTaskCleanupSchedulerServiceComponent.getTaskService().getTaskManager(HumanTaskConstants.HUMANTASK_TASK_TYPE);
TaskInfo.TriggerInfo triggerInfo = new TaskInfo.TriggerInfo();
triggerInfo.setCronExpression(serverConfig.getTaskCleanupCronExpression());
triggerInfo.setDisallowConcurrentExecution(true);
Map<String, String> propertyMap = new LinkedHashMap<String, String>();
TaskInfo taskInfo = new TaskInfo(HumanTaskConstants.HUMANTASK_CLEANUP_JOB, RemovableTaskCleanupJob.class.getName(), propertyMap, triggerInfo);
taskManager.registerTask(taskInfo);
taskManager.rescheduleTask(HumanTaskConstants.HUMANTASK_CLEANUP_JOB);
} catch (TaskException ex) {
String errMsg = "Error occurred while registering task type : " + HumanTaskConstants.HUMANTASK_TASK_TYPE;
throw new HumanTaskServerException(errMsg, ex);
}
}
}
use of org.wso2.carbon.humantask.core.engine.HumanTaskServerException in project carbon-business-process by wso2.
the class HumanTaskServer method initDataSource.
// Initialises the data source with the provided configuration parameters.
private void initDataSource() throws HumanTaskServerException {
database = new Database(serverConfig);
// TODO - need to handle the external transaction managers.
database.setTransactionManager(tnxManager);
try {
database.start();
} catch (Exception e) {
String errMsg = "Humantask Database Initialization failed.";
throw new HumanTaskServerException(errMsg, e);
}
}
use of org.wso2.carbon.humantask.core.engine.HumanTaskServerException in project carbon-business-process by wso2.
the class HumanTaskServer method initTransactionManager.
// initialize the external transaction manager.
private void initTransactionManager() throws HumanTaskServerException {
String transactionFactoryName = serverConfig.getTransactionFactoryClass();
if (log.isDebugEnabled()) {
log.debug("Initializing transaction manager using " + transactionFactoryName);
}
try {
Class txFactoryClass = this.getClass().getClassLoader().loadClass(transactionFactoryName);
Object txFactory = txFactoryClass.newInstance();
tnxManager = (TransactionManager) txFactoryClass.getMethod("getTransactionManager", (Class[]) null).invoke(txFactory);
// Didn't use Debug Transaction manager which used in ODE.
// TODO: Look for the place we use this axis parameter.
// axisConfiguration.addParameter("ode.transaction.manager", transactionManager);
} catch (Exception e) {
log.fatal("Couldn't initialize a transaction manager with factory: " + transactionFactoryName, e);
throw new HumanTaskServerException("Couldn't initialize a transaction manager with factory: " + transactionFactoryName, e);
}
}
Aggregations