Search in sources :

Example 1 with HumanTaskServerException

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);
    }
}
Also used : HumanTaskServerException(org.wso2.carbon.humantask.core.engine.HumanTaskServerException) PeopleQueryEvaluator(org.wso2.carbon.humantask.core.engine.PeopleQueryEvaluator) HumanTaskServerException(org.wso2.carbon.humantask.core.engine.HumanTaskServerException)

Example 2 with HumanTaskServerException

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;
}
Also used : HumanTaskServerException(org.wso2.carbon.humantask.core.engine.HumanTaskServerException) EventProcessor(org.wso2.carbon.humantask.core.engine.event.processor.EventProcessor) HumanTaskEventListener(org.wso2.carbon.humantask.core.api.event.HumanTaskEventListener) HumanTaskServerException(org.wso2.carbon.humantask.core.engine.HumanTaskServerException)

Example 3 with HumanTaskServerException

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);
        }
    }
}
Also used : TaskInfo(org.wso2.carbon.ntask.core.TaskInfo) TaskManager(org.wso2.carbon.ntask.core.TaskManager) TaskException(org.wso2.carbon.ntask.common.TaskException) HumanTaskServerException(org.wso2.carbon.humantask.core.engine.HumanTaskServerException) HumanTaskServerConfiguration(org.wso2.carbon.humantask.core.configuration.HumanTaskServerConfiguration) RemovableTaskCleanupJob(org.wso2.carbon.humantask.cleanup.scheduler.ntask.RemovableTaskCleanupJob) LinkedHashMap(java.util.LinkedHashMap)

Example 4 with HumanTaskServerException

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);
    }
}
Also used : HumanTaskServerException(org.wso2.carbon.humantask.core.engine.HumanTaskServerException) Database(org.wso2.carbon.humantask.core.db.Database) HumanTaskServerException(org.wso2.carbon.humantask.core.engine.HumanTaskServerException)

Example 5 with HumanTaskServerException

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);
    }
}
Also used : HumanTaskServerException(org.wso2.carbon.humantask.core.engine.HumanTaskServerException) HumanTaskServerException(org.wso2.carbon.humantask.core.engine.HumanTaskServerException)

Aggregations

HumanTaskServerException (org.wso2.carbon.humantask.core.engine.HumanTaskServerException)5 LinkedHashMap (java.util.LinkedHashMap)1 RemovableTaskCleanupJob (org.wso2.carbon.humantask.cleanup.scheduler.ntask.RemovableTaskCleanupJob)1 HumanTaskEventListener (org.wso2.carbon.humantask.core.api.event.HumanTaskEventListener)1 HumanTaskServerConfiguration (org.wso2.carbon.humantask.core.configuration.HumanTaskServerConfiguration)1 Database (org.wso2.carbon.humantask.core.db.Database)1 PeopleQueryEvaluator (org.wso2.carbon.humantask.core.engine.PeopleQueryEvaluator)1 EventProcessor (org.wso2.carbon.humantask.core.engine.event.processor.EventProcessor)1 TaskException (org.wso2.carbon.ntask.common.TaskException)1 TaskInfo (org.wso2.carbon.ntask.core.TaskInfo)1 TaskManager (org.wso2.carbon.ntask.core.TaskManager)1