org.mule.component
Class AbstractComponent

java.lang.Object
  extended by org.mule.component.AbstractComponent
All Implemented Interfaces:
AnnotatedObject, Component, FlowConstructAware, MuleContextAware, Disposable, Initialisable, Lifecycle, Startable, Stoppable, MessageProcessor
Direct Known Subclasses:
AbstractJavaComponent, AbstractWebServiceWrapperComponent, JerseyResourcesComponent, PassThroughComponent, ProcessComponent, RestServiceWrapper, RulesComponent, ScriptComponent

public abstract class AbstractComponent
extends Object
implements Component, MuleContextAware, Lifecycle, AnnotatedObject

Abstract Component to be used by all Component implementations.


Field Summary
protected  FlowConstruct flowConstruct
           
protected  MessageProcessorChain interceptorChain
           
protected  List<Interceptor> interceptors
           
protected  ComponentLifecycleManager lifecycleManager
           
protected  Log logger
          logger used by this class
protected  MuleContext muleContext
           
protected  ServerNotificationHandler notificationHandler
           
protected  ComponentStatistics statistics
           
 
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
AbstractComponent()
           
 
Method Summary
protected  MuleEvent createResultEvent(MuleEvent event, Object result)
           
 void dispose()
          A lifecycle method where implementor should free up any resources.
protected  void doDispose()
           
protected  void doInitialise()
           
protected abstract  Object doInvoke(MuleEvent event)
           
protected  void doStart()
           
protected  void doStop()
           
protected  void fireComponentNotification(MuleMessage message, int action)
           
 Object getAnnotation(QName name)
          Gets the value of specified annotation.
 Map<QName,Object> getAnnotations()
          Gets all annotations.
 FlowConstruct getFlowConstruct()
           
 List<Interceptor> getInterceptors()
           
protected  String getName()
           
 ComponentStatistics getStatistics()
          Component statistics are used to gather component statistics such as sync/async invocation counts and total and average execution time.
 void initialise()
          Method used to perform any initialisation work.
 MuleEvent process(MuleEvent event)
          Invokes the MessageProcessor.
 void release()
           
 void setAnnotations(Map<QName,Object> newAnnotations)
          Sets annotations to the object.
 void setFlowConstruct(FlowConstruct flowConstruct)
           
 void setInterceptors(List<Interceptor> interceptors)
           
 void setMuleContext(MuleContext context)
           
 void start()
           
 void stop()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

logger

protected final Log logger
logger used by this class


flowConstruct

protected FlowConstruct flowConstruct

statistics

protected ComponentStatistics statistics

notificationHandler

protected ServerNotificationHandler notificationHandler

interceptors

protected List<Interceptor> interceptors

interceptorChain

protected MessageProcessorChain interceptorChain

muleContext

protected MuleContext muleContext

lifecycleManager

protected ComponentLifecycleManager lifecycleManager
Constructor Detail

AbstractComponent

public AbstractComponent()
Method Detail

setMuleContext

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

getInterceptors

public List<Interceptor> getInterceptors()

setInterceptors

public void setInterceptors(List<Interceptor> interceptors)

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

createResultEvent

protected MuleEvent createResultEvent(MuleEvent event,
                                      Object result)
                               throws MuleException
Throws:
MuleException

doInvoke

protected abstract Object doInvoke(MuleEvent event)
                            throws Exception
Throws:
Exception

toString

public String toString()
Overrides:
toString in class Object

release

public void release()

getStatistics

public ComponentStatistics getStatistics()
Description copied from interface: Component
Component statistics are used to gather component statistics such as sync/async invocation counts and total and average execution time.

Specified by:
getStatistics in interface Component

setFlowConstruct

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

getFlowConstruct

public FlowConstruct getFlowConstruct()

initialise

public final 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

doInitialise

protected void doInitialise()
                     throws InitialisationException
Throws:
InitialisationException

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

doDispose

protected void doDispose()

stop

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

doStart

protected void doStart()
                throws MuleException
Throws:
MuleException

start

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

doStop

protected void doStop()
               throws MuleException
Throws:
MuleException

fireComponentNotification

protected void fireComponentNotification(MuleMessage message,
                                         int action)

getName

protected String getName()

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


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