atg.b2bcommerce.invoice.pipeline
Class GenerateInvoiceMessage

java.lang.Object
  extended by atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
      extended by atg.nucleus.GenericService
          extended by atg.b2bcommerce.invoice.pipeline.GenerateInvoiceMessage
All Implemented Interfaces:
MessageSource, NameContextBindingListener, NameContextElement, NameResolver, AdminableService, ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, VariableArgumentApplicationLogging, ComponentNameResolver, Service, ServiceListener, PipelineProcessor, java.util.EventListener

public class GenerateInvoiceMessage
extends GenericService
implements MessageSource, PipelineProcessor

Pipeline processor that can generate an InvoiceMessage using virtually any class as the underlying dynamo message bean.


Field Summary
static java.lang.String CLASS_VERSION
           
static int[] RETCODES
           
protected static java.util.ResourceBundle sDefaultResources
           
static int SUCCESS
           
 
Fields inherited from class atg.nucleus.GenericService
SERVICE_INFO_KEY
 
Fields inherited from interface atg.service.pipeline.PipelineProcessor
STOP_CHAIN_EXECUTION, STOP_CHAIN_EXECUTION_AND_COMMIT, STOP_CHAIN_EXECUTION_AND_ROLLBACK
 
Fields inherited from interface atg.nucleus.logging.TraceApplicationLogging
DEFAULT_LOG_TRACE_STATUS
 
Fields inherited from interface atg.nucleus.logging.ApplicationLogging
DEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS
 
Constructor Summary
GenerateInvoiceMessage()
           
 
Method Summary
protected  int getErrorReturnCode()
          Return the value that the pipeline processor should return to the pipeline chain in case of error.
 InvoiceTools getInvoiceTools()
          Get the InvoiceTools component used to generate message objects.
 java.lang.String getMessageBeanClass()
          Return the class to use for the dynamo message bean carrying the ObjectMessage data.
 java.util.Properties getMessageBeanPropertyMap()
          Get the mapping table that controls mapping of property values from repository items to dynamo message beans.
 java.lang.String getMessagePort()
          Return the JMS port for which messages will be generated.
 MessageSourceContext getMessageSourceContext()
           
 java.lang.String getMessageType()
          Return the JMS message type string to apply to generated messages.
 int[] getRetCodes()
          Return all possible return values for this processor.
 boolean isAddProfileToMessageBean()
          Query whether to automatically try to add the user profile to the dynamo message bean.
 boolean isEnabled()
          Query whether sending messages from this process is enabled or disabled.
 boolean isMessageSourceStarted()
           
protected  boolean isReady()
          Check to see if this processor is ready to generate messages.
 boolean isRollbackOnError()
          Query whether failure to deliver a message is considered a fatal error.
 int runProcess(java.lang.Object pParam, PipelineResult pResult)
          Generate and send a JMS ObjectMessage for the invoice that appears in the pipeline arguments.
 void setAddProfileToMessageBean(boolean pAddProfile)
          Specify whether to automatically try to add the user profile to the dynamo message bean.
 void setEnabled(boolean pEnabled)
          Enable or disable sending messages from this pipeline processor.
 void setInvoiceTools(InvoiceTools pInvoiceTools)
          Set the InvoiceTools component used to generate message objects.
 void setMessageBeanClass(java.lang.String pMessageBeanClass)
          Specify the class to use for the dynamo message bean carrying the ObjectMessage data.
 void setMessageBeanPropertyMap(java.util.Properties pMessageBeanPropertyMap)
          Set the mapping table that controls mapping of property values from repository items to dynamo message beans whose class is specified by messageBeanClass.
 void setMessagePort(java.lang.String pMessagePort)
          Set the JMS port for which messages will be generated.
 void setMessageSourceContext(MessageSourceContext pContext)
          This notifies the MessageSource as to what its MessageSourceContext should be.
 void setMessageType(java.lang.String pMessageType)
          Set the JMS message type string to apply to generated messages.
 void setRollbackOnError(boolean pRollbackOnError)
          Specify whether or failure to deliver a message is considered a fatal error.
 void startMessageSource()
          This is called to tell the MessageSource that it may begin sending messages.
 void stopMessageSource()
          This is called to tell the MessageSource that it should stop sending messages.
 
Methods inherited from class atg.nucleus.GenericService
addLogListener, createAdminServlet, doStartService, doStopService, getAbsoluteName, getAdminServlet, getLoggingForVlogging, getLogListenerCount, getLogListeners, getName, getNameContext, getNucleus, getRoot, getServiceConfiguration, getServiceInfo, isLoggingDebug, isLoggingError, isLoggingInfo, isLoggingTrace, isLoggingWarning, isRunning, logDebug, logDebug, logDebug, logError, logError, logError, logInfo, logInfo, logInfo, logTrace, logTrace, logTrace, logWarning, logWarning, logWarning, nameContextElementBound, nameContextElementUnbound, removeLogListener, resolveName, resolveName, resolveName, resolveName, sendLogEvent, setLoggingDebug, setLoggingError, setLoggingInfo, setLoggingTrace, setLoggingWarning, setNucleus, setServiceInfo, startService, stopService
 
Methods inherited from class atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASS_VERSION

public static java.lang.String CLASS_VERSION

SUCCESS

public static final int SUCCESS
See Also:
Constant Field Values

RETCODES

public static final int[] RETCODES

sDefaultResources

protected static java.util.ResourceBundle sDefaultResources
Constructor Detail

GenerateInvoiceMessage

public GenerateInvoiceMessage()
Method Detail

setInvoiceTools

public void setInvoiceTools(InvoiceTools pInvoiceTools)
Set the InvoiceTools component used to generate message objects.


getInvoiceTools

public InvoiceTools getInvoiceTools()
Get the InvoiceTools component used to generate message objects.


setEnabled

public void setEnabled(boolean pEnabled)
Enable or disable sending messages from this pipeline processor.


isEnabled

public boolean isEnabled()
Query whether sending messages from this process is enabled or disabled.


setRollbackOnError

public void setRollbackOnError(boolean pRollbackOnError)
Specify whether or failure to deliver a message is considered a fatal error. If this value is set to true, then any error in constructing or delivering a message will cause the processor to return a value meaning "abort execution and roll back the current transaction". If this value is set to false, then errors in message creation and delivery will be ignored, and the pipeline processor will always return a success status code.


isRollbackOnError

public boolean isRollbackOnError()
Query whether failure to deliver a message is considered a fatal error.


setMessageBeanClass

public void setMessageBeanClass(java.lang.String pMessageBeanClass)
Specify the class to use for the dynamo message bean carrying the ObjectMessage data. If no value is specified, a default value will be derived from InvoiceTools.defaultInvoiceMessageClass.

See Also:
InvoiceTools

getMessageBeanClass

public java.lang.String getMessageBeanClass()
Return the class to use for the dynamo message bean carrying the ObjectMessage data.


setMessageBeanPropertyMap

public void setMessageBeanPropertyMap(java.util.Properties pMessageBeanPropertyMap)
Set the mapping table that controls mapping of property values from repository items to dynamo message beans whose class is specified by messageBeanClass. If no value is specified, a default value will be derived from InvoiceTools.defaultInvoiceMessageMap.

See Also:
InvoiceTools

getMessageBeanPropertyMap

public java.util.Properties getMessageBeanPropertyMap()
Get the mapping table that controls mapping of property values from repository items to dynamo message beans.


setMessageType

public void setMessageType(java.lang.String pMessageType)
Set the JMS message type string to apply to generated messages.


getMessageType

public java.lang.String getMessageType()
Return the JMS message type string to apply to generated messages.


setMessagePort

public void setMessagePort(java.lang.String pMessagePort)
Set the JMS port for which messages will be generated. If no value is specified, the default value will be the string "DEFAULT".


getMessagePort

public java.lang.String getMessagePort()
Return the JMS port for which messages will be generated.


setAddProfileToMessageBean

public void setAddProfileToMessageBean(boolean pAddProfile)
Specify whether to automatically try to add the user profile to the dynamo message bean. If true, and if the message bean class contains a property named profile whose type is RepositoryItem, then the profile property will be set to the user profile of the use who placed the order resulting in the creation of the invoice being processed. Otherwise no special attempt will be made to populate the profile property of the message bean, even if it exists.

See Also:
InvoiceTools

isAddProfileToMessageBean

public boolean isAddProfileToMessageBean()
Query whether to automatically try to add the user profile to the dynamo message bean.


setMessageSourceContext

public void setMessageSourceContext(MessageSourceContext pContext)
Description copied from interface: MessageSource
This notifies the MessageSource as to what its MessageSourceContext should be. The context is what the component should use to generate and send out Messages. The component should not actually start to send out Messages until startMessageSource() is called. An implementation will generally store the MessageSourceContext in a member variable.

Specified by:
setMessageSourceContext in interface MessageSource

getMessageSourceContext

public MessageSourceContext getMessageSourceContext()

startMessageSource

public void startMessageSource()
Description copied from interface: MessageSource
This is called to tell the MessageSource that it may begin sending messages.

Specified by:
startMessageSource in interface MessageSource

stopMessageSource

public void stopMessageSource()
Description copied from interface: MessageSource
This is called to tell the MessageSource that it should stop sending messages.

Specified by:
stopMessageSource in interface MessageSource

isMessageSourceStarted

public boolean isMessageSourceStarted()

runProcess

public int runProcess(java.lang.Object pParam,
                      PipelineResult pResult)
Generate and send a JMS ObjectMessage for the invoice that appears in the pipeline arguments. The ObjectMessage will encapsulate a dynamo message bean whose class is specified by messageBeanClass, will be generated on the port specified by messagePort, and will have its JMS message type set to the string specified by messageBeanType.

Specified by:
runProcess in interface PipelineProcessor
Parameters:
pParam - Pipeline parameters, which should be an instance of InvoicePipelineArgs.
pResult - Standard pipeline result object.
Returns:
an integer value which is mapped to the next processor to execute. STOP_CHAIN_EXECUTION will notify the PipelineManager to stop execution. An unmapped value will throw a RunProcessException.

isReady

protected boolean isReady()
Check to see if this processor is ready to generate messages.

Returns:
true if the processor is enabled and startMessageSource has been called, false otherwise.

getErrorReturnCode

protected int getErrorReturnCode()
Return the value that the pipeline processor should return to the pipeline chain in case of error. The value returned is determined by the setting of the rollbackOnError property.


getRetCodes

public int[] getRetCodes()
Return all possible return values for this processor.

Specified by:
getRetCodes in interface PipelineProcessor
Returns:
an array of all the return codes that could be returned by this PipelineProcessor.