/** * This method validates the intercepted activity event. * * @param actType The activity type * @throws Exception Failed to validate activity */ public void validate(ActivityType actType) throws Exception { // Check if predicate defined and if so, the event is applicable if (_predicate == null || _predicate.evaluate(actType)) { // Process the event _eventProcessor.process(null, actType, 0); } }
/** * This method closes the node. * * @throws Exception Failed to close the node */ protected void close() throws Exception { for (Channel ch : _channels) { ch.close(); } _container = null; _handler = null; getEventProcessor().setResultHandler(null); getEventProcessor().close(); }
/** * This method initializes the node. * * @throws Exception Failed to initialize the node */ protected void init() throws Exception { if (getPredicate() != null) { getPredicate().init(); } if (getEventProcessor() == null) { throw new Exception("Event Processor has not been configured for node"); } getEventProcessor().init(); if (getEventProcessor().getAsynchronous()) { _handler = new NodeResultHandler(); getEventProcessor().setResultHandler(_handler); } }
/** * {@inheritDoc} */ public void init() throws Exception { super.init(); // Obtain JavaMail session InitialContext context=new InitialContext(); _session = (Session)context.lookup(_jndiName); // Initialize scripts initSubjectScript(); initContentScript(); // Validate validate(); }
/** * {@inheritDoc} */ public void init() throws Exception { super.init(); // Load the script java.io.InputStream is=Thread.currentThread().getContextClassLoader().getResourceAsStream(_script); if (is == null) { throw new Exception("Unable to locate MVEL script '"+_script+"'"); } else { byte[] b=new byte[is.available()]; is.read(b); is.close(); // Compile expression _scriptExpression = MVEL.compileExpression(new String(b)); if (LOG.isLoggable(Level.FINE)) { LOG.fine("Initialized script="+_script +" compiled="+_scriptExpression); } } _context = new DefaultEPContext(getServices(), getParameters()); }
/** * {@inheritDoc} */ public void init() throws Exception { super.init(); String config=_configuration; if (config == null || config.trim().length() == 0) { config = DEFAULT_HIBERNATE_CFG_XML; } final URL configXml = Thread.currentThread().getContextClassLoader().getResource(config); if (LOG.isLoggable(Level.FINE)) { LOG.fine("Hibernate configure: "+configXml); } _jpaStore = new JpaStore(configXml, JNDI_PROPERTY); }
/** * {@inheritDoc} */ @JsonIgnore public void setResultHandler(ResultHandler handler) { super.setResultHandler(handler); _context.setResultHandler(handler); }
/** * {@inheritDoc} */ public void handle(Object result) { if (LOG.isLoggable(Level.FINEST)) { LOG.finest(">>> "+this+": Handle result="+result); } if (_handler != null) { if (result instanceof java.io.Serializable) { _handler.handle((java.io.Serializable)result); } else { LOG.severe("Result from event processor is not serializable: "+result); } } else { RESULT.set(result); } }