org.mule.routing
Class AbstractSelectiveRouter

java.lang.Object
  extended by org.mule.routing.AbstractSelectiveRouter
All Implemented Interfaces:
AnnotatedObject, FlowConstructAware, MuleContextAware, Disposable, Initialisable, Lifecycle, Startable, Stoppable, MessageProcessor, RouterStatisticsRecorder, SelectiveRouter
Direct Known Subclasses:
ChoiceRouter

public abstract class AbstractSelectiveRouter
extends Object
implements SelectiveRouter, RouterStatisticsRecorder, Lifecycle, FlowConstructAware, MuleContextAware, AnnotatedObject


Field Summary
 
Fields inherited from interface org.mule.api.lifecycle.Initialisable
PHASE_NAME
 
Fields inherited from interface org.mule.api.lifecycle.Startable
PHASE_NAME
 
Fields inherited from interface org.mule.api.lifecycle.Stoppable
PHASE_NAME
 
Fields inherited from interface org.mule.api.lifecycle.Disposable
PHASE_NAME
 
Fields inherited from interface org.mule.api.AnnotatedObject
PROPERTY_NAME
 
Constructor Summary
AbstractSelectiveRouter()
           
 
Method Summary
 void addRoute(MessageProcessor processor, Filter filter)
           
 void dispose()
          A lifecycle method where implementor should free up any resources.
 Object getAnnotation(QName name)
          Gets the value of specified annotation.
 Map<QName,Object> getAnnotations()
          Gets all annotations.
 List<MessageProcessorFilterPair> getConditionalMessageProcessors()
           
 RouterStatistics getRouterStatistics()
           
 void initialise()
          Method used to perform any initialisation work.
 MuleEvent process(MuleEvent event)
          Invokes the MessageProcessor.
 void removeRoute(MessageProcessor processor)
           
protected abstract  Collection<MessageProcessor> selectProcessors(MuleEvent event)
           
 void setAnnotations(Map<QName,Object> newAnnotations)
          Sets annotations to the object.
 void setDefaultRoute(MessageProcessor processor)
           
 void setFlowConstruct(FlowConstruct flowConstruct)
           
 void setMuleContext(MuleContext context)
           
 void setRouterStatistics(RouterStatistics routerStatistics)
           
 void start()
           
 void stop()
           
 String toString()
           
 void updateRoute(MessageProcessor processor, Filter filter)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractSelectiveRouter

public AbstractSelectiveRouter()
Method Detail

setFlowConstruct

public void setFlowConstruct(FlowConstruct flowConstruct)
Specified by:
setFlowConstruct in interface FlowConstructAware

setMuleContext

public void setMuleContext(MuleContext context)
Specified by:
setMuleContext in interface MuleContextAware

initialise

public void initialise()
                throws InitialisationException
Description copied from interface: Initialisable
Method used to perform any initialisation work. If a fatal error occurs during initialisation an InitialisationException should be thrown, causing the Mule instance to shutdown. If the error is recoverable, say by retrying to connect, a RecoverableException should be thrown. There is no guarantee that by throwing a Recoverable exception that the Mule instance will not shut down.

Specified by:
initialise in interface Initialisable
Throws:
InitialisationException - if a fatal error occurs causing the Mule instance to shutdown
RecoverableException - if an error occurs that can be recovered from

start

public void start()
           throws MuleException
Specified by:
start in interface Startable
Throws:
MuleException

stop

public void stop()
          throws MuleException
Specified by:
stop in interface Stoppable
Throws:
MuleException

dispose

public void dispose()
Description copied from interface: Disposable
A lifecycle method where implementor should free up any resources. If an exception is thrown it should just be logged and processing should continue. This method should not throw Runtime exceptions.

Specified by:
dispose in interface Disposable

addRoute

public void addRoute(MessageProcessor processor,
                     Filter filter)
Specified by:
addRoute in interface SelectiveRouter

removeRoute

public void removeRoute(MessageProcessor processor)
Specified by:
removeRoute in interface SelectiveRouter

updateRoute

public void updateRoute(MessageProcessor processor,
                        Filter filter)
Specified by:
updateRoute in interface SelectiveRouter

setDefaultRoute

public void setDefaultRoute(MessageProcessor processor)
Specified by:
setDefaultRoute in interface SelectiveRouter

process

public MuleEvent process(MuleEvent event)
                  throws MuleException
Description copied from interface: MessageProcessor
Invokes the MessageProcessor.

Specified by:
process in interface MessageProcessor
Parameters:
event - MuleEvent to be processed
Returns:
optional response MuleEvent
Throws:
MuleException

selectProcessors

protected abstract Collection<MessageProcessor> selectProcessors(MuleEvent event)
Returns:
the processors selected according to the specific router strategy or an empty collection (not null).

getConditionalMessageProcessors

public List<MessageProcessorFilterPair> getConditionalMessageProcessors()

getRouterStatistics

public RouterStatistics getRouterStatistics()

setRouterStatistics

public void setRouterStatistics(RouterStatistics routerStatistics)
Specified by:
setRouterStatistics in interface RouterStatisticsRecorder

getAnnotation

public final Object getAnnotation(QName name)
Description copied from interface: AnnotatedObject
Gets the value of specified annotation.

Specified by:
getAnnotation in interface AnnotatedObject
Returns:
the value of specified annotation

getAnnotations

public final Map<QName,Object> getAnnotations()
Description copied from interface: AnnotatedObject
Gets all annotations.

Specified by:
getAnnotations in interface AnnotatedObject
Returns:
all annotation

setAnnotations

public final void setAnnotations(Map<QName,Object> newAnnotations)
Description copied from interface: AnnotatedObject
Sets annotations to the object.

Specified by:
setAnnotations in interface AnnotatedObject

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2003-2012 MuleSoft, Inc.. All Rights Reserved.