1 17 package org.apache.servicemix.components.drools.dsl; 18 19 import org.apache.servicemix.components.drools.JbiHelper; 20 import org.drools.spi.Consequence; 21 import org.drools.spi.ConsequenceException; 22 import org.drools.spi.Tuple; 23 24 import javax.jbi.messaging.MessagingException; 25 26 29 public abstract class JbiConsequence implements Consequence { 30 31 public void invoke(Tuple tuple) throws ConsequenceException { 32 JbiHelper helper = (JbiHelper) tuple.getWorkingMemory().getApplicationData("jbi"); 33 if (helper == null) { 34 throw new ConsequenceException("No 'jbi' application data available"); 35 } 36 try { 37 invokeJbiOperation(helper, tuple); 38 } 39 catch (MessagingException e) { 40 throw new ConsequenceException(e); 41 } 42 } 43 44 protected abstract void invokeJbiOperation(JbiHelper helper, Tuple tuple) throws MessagingException; 45 } 46 | Popular Tags |