org.apache.servicemix.drools
Class DroolsExecutionContext

java.lang.Object
  extended by org.drools.event.DefaultAgendaEventListener
      extended by org.apache.servicemix.drools.DroolsExecutionContext
All Implemented Interfaces:
EventListener, org.drools.event.AgendaEventListener

public class DroolsExecutionContext
extends org.drools.event.DefaultAgendaEventListener

Represents the execution context of the Drools rules for a single MessageExchange


Field Summary
static String JBI_HELPER_KEY
           
 
Constructor Summary
DroolsExecutionContext(DroolsEndpoint endpoint, javax.jbi.messaging.MessageExchange exchange)
          Start a new execution context for the specified exchange.
 
Method Summary
 void activationCreated(org.drools.event.ActivationCreatedEvent event, org.drools.WorkingMemory workingMemory)
           
 javax.jbi.messaging.MessageExchange getExchange()
          Return the MessageExchange we are evaluating rules on
 JbiHelper getHelper()
          Access the JbiHelper object that is being exposed to the .drl file
 int getRulesFired()
          Get the number of rules that were fired
 boolean isExchangeHandled()
          Returns true if the MessageExchange was handled by the rules themselves (e.g. by answering or faulting the exchange}
 void start()
          Start the execution context.
 void stop()
          Stop the context, disposing of all event listeners and working memory contents
 void update()
          Update the working memory, potentially triggering additional rules
 
Methods inherited from class org.drools.event.DefaultAgendaEventListener
activationCancelled, afterActivationFired, agendaGroupPopped, agendaGroupPushed, beforeActivationFired
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

JBI_HELPER_KEY

public static final String JBI_HELPER_KEY
See Also:
Constant Field Values
Constructor Detail

DroolsExecutionContext

public DroolsExecutionContext(DroolsEndpoint endpoint,
                              javax.jbi.messaging.MessageExchange exchange)
Start a new execution context for the specified exchange. This will create and fill WorkingMemory and register listeners on it to keep track of things.

Parameters:
endpoint -
exchange -
Method Detail

start

public void start()
Start the execution context. This will fire all rules in the rule base.


update

public void update()
Update the working memory, potentially triggering additional rules


stop

public void stop()
Stop the context, disposing of all event listeners and working memory contents


getRulesFired

public int getRulesFired()
Get the number of rules that were fired


isExchangeHandled

public boolean isExchangeHandled()
Returns true if the MessageExchange was handled by the rules themselves (e.g. by answering or faulting the exchange}


getExchange

public javax.jbi.messaging.MessageExchange getExchange()
Return the MessageExchange we are evaluating rules on


activationCreated

public void activationCreated(org.drools.event.ActivationCreatedEvent event,
                              org.drools.WorkingMemory workingMemory)
Specified by:
activationCreated in interface org.drools.event.AgendaEventListener
Overrides:
activationCreated in class org.drools.event.DefaultAgendaEventListener

getHelper

public JbiHelper getHelper()
Access the JbiHelper object that is being exposed to the .drl file



Copyright © 2005-2009 The Apache Software Foundation. All Rights Reserved.