org.mule.devkit.processor
Class DevkitBasedMessageProcessor

java.lang.Object
  extended by org.mule.devkit.processor.ExpressionEvaluatorSupport
      extended by org.mule.devkit.processor.DevkitBasedMessageProcessor
All Implemented Interfaces:
FlowConstructAware, MuleContextAware, Disposable, Initialisable, Startable, Stoppable
Direct Known Subclasses:
AbstractAuthorizeMessageProcessor, AbstractDevkitBasedPageableMessageProcessor, AbstractListeningMessageProcessor, BaseOAuth1UnauthorizeMessageProcessor, BaseOAuth2UnauthorizeMessageProcessor, FetchAccessTokenMessageProcessor

public abstract class DevkitBasedMessageProcessor
extends ExpressionEvaluatorSupport
implements FlowConstructAware, MuleContextAware, Startable, Disposable, Stoppable, Initialisable


Field Summary
protected  FlowConstruct flowConstruct
          Flow Construct
protected  Object moduleObject
          Module object
protected  MuleContext muleContext
          Mule Context
 
Fields inherited from interface org.mule.api.lifecycle.Startable
PHASE_NAME
 
Fields inherited from interface org.mule.api.lifecycle.Disposable
PHASE_NAME
 
Fields inherited from interface org.mule.api.lifecycle.Stoppable
PHASE_NAME
 
Fields inherited from interface org.mule.api.lifecycle.Initialisable
PHASE_NAME
 
Constructor Summary
DevkitBasedMessageProcessor(String operationName)
           
 
Method Summary
 void dispose()
          A lifecycle method where implementor should free up any resources.
protected abstract  MuleEvent doProcess(MuleEvent event)
          Implementors of this class need to implement this method in order to perform actual processing
protected  Object findOrCreate(Class<?> moduleClass, boolean shouldAutoCreate, MuleEvent muleEvent)
          Obtains the expression manager from the Mule context and initialises the connector.
 String getAccessTokenId()
           
 FlowConstruct getFlowConstruct()
          Retrieves flowConstruct
 MuleContext getMuleContext()
          Retrieves muleContext
 void initialise()
          Obtains the expression manager from the Mule context and initialises the connector.
 void overwritePayload(MuleEvent event, Object resultPayload)
          Overwrites the event payload with the specified one
 MuleEvent process(MuleEvent event)
          This final process implementation shields actual processing into abstract method {@link org.mule.security.oauth.processor.AbstractDevkitBasedMessageProcessor.
 void setAccessTokenId(String accessTokenId)
           
 void setFlowConstruct(FlowConstruct value)
          Sets flowConstruct
 void setModuleObject(Object value)
          Sets moduleObject
 void setMuleContext(MuleContext value)
          Sets muleContext
 void start()
           
 void stop()
           
 
Methods inherited from class org.mule.devkit.processor.ExpressionEvaluatorSupport
computeClassHierarchy, evaluate, evaluateAndTransform, evaluateAndTransform, getAccessTokenId, isAssignableFrom, isList, isListClass, isMap, isMapClass, transform, transform, transform
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

moduleObject

protected Object moduleObject
Module object


muleContext

protected MuleContext muleContext
Mule Context


flowConstruct

protected FlowConstruct flowConstruct
Flow Construct

Constructor Detail

DevkitBasedMessageProcessor

public DevkitBasedMessageProcessor(String operationName)
Method Detail

process

public MuleEvent process(MuleEvent event)
                  throws MuleException
This final process implementation shields actual processing into abstract method doProcess(MuleEvent) Afterwards, it performs payload transformation by invoking overwritePayload(MuleEvent, Object) In case the processing throws NotAuthorizedException, the module object is casted to OAuthAdapter and exception handling is delegated into its OnNoTokenPolicy. For any other kind of exception, it is logged and wrapped into a MuleException

Parameters:
event - the current mule event.
Returns:
the mule event returned by the message processor or the OnNoTokenPolicy in case of NotAuthorizedException
Throws:
MuleException

doProcess

protected abstract MuleEvent doProcess(MuleEvent event)
                                throws Exception
Implementors of this class need to implement this method in order to perform actual processing

Parameters:
event - the mule event
Returns:
a mule event
Throws:
Exception

findOrCreate

protected final Object findOrCreate(Class<?> moduleClass,
                                    boolean shouldAutoCreate,
                                    MuleEvent muleEvent)
                             throws IllegalAccessException,
                                    InstantiationException,
                                    ConfigurationException,
                                    RegistrationException
Obtains the expression manager from the Mule context and initialises the connector. If a target object has not been set already it will search the Mule registry for a default one.

Throws:
InstantiationException
ConfigurationException
IllegalAccessException
RegistrationException

overwritePayload

public final void overwritePayload(MuleEvent event,
                                   Object resultPayload)
                            throws Exception
Overwrites the event payload with the specified one

Throws:
Exception

initialise

public void initialise()
                throws InitialisationException
Obtains the expression manager from the Mule context and initialises the connector. If a target object has not been set already it will search the Mule registry for a default one.

Specified by:
initialise in interface Initialisable
Throws:
InitialisationException
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

setMuleContext

public final void setMuleContext(MuleContext value)
Sets muleContext

Specified by:
setMuleContext in interface MuleContextAware
Parameters:
value - Value to set

getMuleContext

public final MuleContext getMuleContext()
Retrieves muleContext


setFlowConstruct

public final void setFlowConstruct(FlowConstruct value)
Sets flowConstruct

Specified by:
setFlowConstruct in interface FlowConstructAware
Parameters:
value - Value to set

getFlowConstruct

public final FlowConstruct getFlowConstruct()
Retrieves flowConstruct


setModuleObject

public final void setModuleObject(Object value)
Sets moduleObject

Parameters:
value - Value to set

getAccessTokenId

public String getAccessTokenId()

setAccessTokenId

public void setAccessTokenId(String accessTokenId)


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