com.mulesoft.adapter.module
Class AbstractPIModule

java.lang.Object
  extended by com.mulesoft.adapter.module.AbstractPIModule
All Implemented Interfaces:
PIModule
Direct Known Subclasses:
SalesforcePIModule

public abstract class AbstractPIModule
extends Object
implements PIModule

Base PIModule implementation relying on DynamicModule.
Each interface type (aka root tag name of the xml payload) is used as discriminant to dispatch to a dedicated OperationHandler.


Field Summary
protected static com.sap.tc.logging.Location LOCATION
           
 
Constructor Summary
AbstractPIModule(com.sap.aii.af.service.cpa.Channel channel)
           
 
Method Summary
protected  org.mule.tools.module.invocation.DynamicModule createConfiguredDynamicModule(com.sap.aii.af.service.cpa.Channel channel)
           
protected  org.mule.tools.module.invocation.DynamicModule createDefaultDynamicModule(org.mule.tools.module.model.Module module, Map<String,Object> parameters, org.mule.retry.policies.AbstractPolicyTemplate retryPolicyTemplate)
           
protected  org.mule.tools.module.invocation.DynamicModule createDynamicModule(org.mule.tools.module.model.Module module, Map<String,Object> parameters, org.mule.retry.policies.AbstractPolicyTemplate retryPolicyTemplate)
           
protected abstract  org.mule.tools.module.model.Module createModule(com.sap.aii.af.service.cpa.Channel channel)
           
protected  javax.resource.cci.Record createOutput(com.sap.engine.interfaces.messaging.api.Message message, byte[] payload, IPILogger logger)
           
protected  Map<String,Object> createParameters(com.sap.aii.af.service.cpa.Channel channel)
           
protected  Map<String,Object> createParametersDefault(com.sap.aii.af.service.cpa.Channel channel)
          Extract mandatory parameters from Channel by relying on Module.getParameters().
protected  org.mule.retry.policies.AbstractPolicyTemplate createRetryPolicyTemplate()
           
protected  byte[] dispatch(com.sap.engine.interfaces.messaging.api.Message message, IPILogger logger)
          Dispatch execution to the correct OperationHandler.
 void dispose()
          Dispose this module.
protected  void disposeDefault()
          Dispose underlying DynamicModule.
 javax.resource.cci.Record execute(javax.resource.cci.InteractionSpec spec, XIMessageRecordImpl input, IPILogger logger)
           
protected  com.sap.aii.af.service.cpa.Channel getChannel()
           
protected  org.mule.tools.module.invocation.DynamicModule getModule()
           
protected  OperationHandler getOperationHandler(com.sap.engine.interfaces.messaging.api.Message message)
           
protected  void register(OperationHandler handler)
          Register an OperationHandler with this PIModule.
 boolean retryOn(Throwable cause)
          perform retry of delivery
protected  void subscribe(String sourceName, Map<String,Object> overridenParameters, XIMessageFactoryImpl messageFactory)
          Subscribe to a named Module.Source associated to specified Channel.
protected  void unsubscribe(String sourceName)
          Unsubscribe from a named Module.Source.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOCATION

protected static final com.sap.tc.logging.Location LOCATION
Constructor Detail

AbstractPIModule

public AbstractPIModule(com.sap.aii.af.service.cpa.Channel channel)
                 throws javax.resource.ResourceException
Throws:
javax.resource.ResourceException
Method Detail

getChannel

protected final com.sap.aii.af.service.cpa.Channel getChannel()

getModule

protected final org.mule.tools.module.invocation.DynamicModule getModule()

createConfiguredDynamicModule

protected final org.mule.tools.module.invocation.DynamicModule createConfiguredDynamicModule(com.sap.aii.af.service.cpa.Channel channel)
                                                                                      throws javax.resource.ResourceException
Parameters:
channel -
Returns:
complete DynamicModule configured using Channel details
Throws:
javax.resource.ResourceException

createDynamicModule

protected org.mule.tools.module.invocation.DynamicModule createDynamicModule(org.mule.tools.module.model.Module module,
                                                                             Map<String,Object> parameters,
                                                                             org.mule.retry.policies.AbstractPolicyTemplate retryPolicyTemplate)
                                                                      throws javax.resource.ResourceException
Parameters:
module -
parameters -
retryPolicyTemplate -
Returns:
Throws:
javax.resource.ResourceException

createDefaultDynamicModule

protected final org.mule.tools.module.invocation.DynamicModule createDefaultDynamicModule(org.mule.tools.module.model.Module module,
                                                                                          Map<String,Object> parameters,
                                                                                          org.mule.retry.policies.AbstractPolicyTemplate retryPolicyTemplate)
                                                                                   throws javax.resource.ResourceException
Parameters:
module -
parameters -
retryPolicyTemplate -
Returns:
Throws:
javax.resource.ResourceException

createModule

protected abstract org.mule.tools.module.model.Module createModule(com.sap.aii.af.service.cpa.Channel channel)
                                                            throws javax.resource.ResourceException
Parameters:
channel -
Returns:
complete Module configured using Channel details
Throws:
javax.resource.ResourceException

createParameters

protected Map<String,Object> createParameters(com.sap.aii.af.service.cpa.Channel channel)
                                       throws javax.resource.ResourceException
Parameters:
channel -
Returns:
all parameters configuring the Module
Throws:
javax.resource.ResourceException

createParametersDefault

protected Map<String,Object> createParametersDefault(com.sap.aii.af.service.cpa.Channel channel)
Extract mandatory parameters from Channel by relying on Module.getParameters().

Parameters:
channel -
Returns:

createRetryPolicyTemplate

protected org.mule.retry.policies.AbstractPolicyTemplate createRetryPolicyTemplate()
Returns:
AbstractPolicyTemplate used by AbstractPIModule#createDynamicModule(com.sap.aii.af.service.cpa.Channel)
See Also:
http://www.mulesoft.org/common-retry-policies, Reconnection+Strategies

getOperationHandler

protected final OperationHandler getOperationHandler(com.sap.engine.interfaces.messaging.api.Message message)
                                              throws javax.resource.ResourceException
Parameters:
message -
Returns:
operation (aka interface) encapsulated in specified Message
Throws:
javax.resource.ResourceException

execute

public final javax.resource.cci.Record execute(javax.resource.cci.InteractionSpec spec,
                                               XIMessageRecordImpl input,
                                               IPILogger logger)
                                        throws javax.resource.ResourceException
Specified by:
execute in interface PIModule
Returns:
result of this module execution
Throws:
javax.resource.ResourceException

retryOn

public boolean retryOn(Throwable cause)
Description copied from interface: PIModule
perform retry of delivery

Specified by:
retryOn in interface PIModule
Parameters:
cause - exeption that occured
Returns:
whether to retry delivering the message

register

protected final void register(OperationHandler handler)
Register an OperationHandler with this PIModule. Will be considered during PIModule#execute(javax.resource.cci.InteractionSpec, javax.resource.cci.Record) .

Parameters:
handler -

createOutput

protected final javax.resource.cci.Record createOutput(com.sap.engine.interfaces.messaging.api.Message message,
                                                       byte[] payload,
                                                       IPILogger logger)
                                                throws javax.resource.ResourceException,
                                                       IOException,
                                                       com.sap.engine.interfaces.messaging.api.exception.InvalidParamException,
                                                       com.sap.engine.interfaces.messaging.api.exception.PayloadFormatException
Parameters:
message -
payload -
logger -
Returns:
a Record encapsulating specified `payload`. Useful as an PI output.
Throws:
javax.resource.ResourceException
IOException
com.sap.engine.interfaces.messaging.api.exception.InvalidParamException
com.sap.engine.interfaces.messaging.api.exception.PayloadFormatException
See Also:
#execute(javax.resource.cci.InteractionSpec, javax.resource.cci.Record)

dispatch

protected byte[] dispatch(com.sap.engine.interfaces.messaging.api.Message message,
                          IPILogger logger)
                   throws javax.resource.ResourceException,
                          org.mule.api.MuleException,
                          IOException,
                          com.sap.engine.interfaces.messaging.api.exception.InvalidParamException,
                          com.sap.engine.interfaces.messaging.api.exception.PayloadFormatException,
                          ParserConfigurationException,
                          SAXException
Dispatch execution to the correct OperationHandler.

Parameters:
message -
Returns:
Throws:
javax.resource.ResourceException
org.mule.api.lifecycle.InitialisationException
org.mule.api.MuleException
IOException
com.sap.engine.interfaces.messaging.api.exception.InvalidParamException
com.sap.engine.interfaces.messaging.api.exception.PayloadFormatException
ParserConfigurationException
SAXException
See Also:
#extractPayload(javax.resource.cci.Record), #extractOperation(javax.resource.cci.Record)

subscribe

protected final void subscribe(String sourceName,
                               Map<String,Object> overridenParameters,
                               XIMessageFactoryImpl messageFactory)
                        throws org.mule.api.MuleException,
                               com.sap.aii.af.lib.mp.processor.ModuleProcessorException
Subscribe to a named Module.Source associated to specified Channel.

Parameters:
sourceName -
overridenParameters -
channel -
messageFactory -
Throws:
org.mule.api.lifecycle.InitialisationException
org.mule.api.MuleException
com.sap.aii.af.lib.mp.processor.ModuleProcessorException

unsubscribe

protected final void unsubscribe(String sourceName)
                          throws org.mule.api.MuleException
Unsubscribe from a named Module.Source.

Parameters:
sourceName -
Throws:
org.mule.api.MuleException

dispose

public void dispose()
Description copied from interface: PIModule
Dispose this module.

Specified by:
dispose in interface PIModule

disposeDefault

protected final void disposeDefault()
Dispose underlying DynamicModule.

See Also:
DynamicModule.dispose()


Copyright © 2012. All Rights Reserved.