Search in sources :

Example 1 with HumanTaskEventListener

use of org.wso2.carbon.humantask.core.api.event.HumanTaskEventListener 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)

Aggregations

HumanTaskEventListener (org.wso2.carbon.humantask.core.api.event.HumanTaskEventListener)1 HumanTaskServerException (org.wso2.carbon.humantask.core.engine.HumanTaskServerException)1 EventProcessor (org.wso2.carbon.humantask.core.engine.event.processor.EventProcessor)1