atg.commerce.fulfillment
Class FulfillerSystem

java.lang.Object
  extended by atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
      extended by atg.nucleus.GenericService
          extended by atg.commerce.messaging.SourceSinkTemplate
              extended by atg.commerce.fulfillment.FulfillerSystem
All Implemented Interfaces:
MessageSink, MessageSource, NameContextBindingListener, NameContextElement, NameResolver, AdminableService, ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, atg.nucleus.logging.VariableArgumentApplicationLogging, ComponentNameResolver, Service, ServiceListener, java.util.EventListener
Direct Known Subclasses:
ElectronicFulfiller, HardgoodFulfiller, OrderFulfiller

public abstract class FulfillerSystem
extends SourceSinkTemplate

See Also:
OrderFulfiller, HardgoodFulfiller, ElectronicFulfiller

Field Summary
static java.lang.String CLASS_VERSION
           
 java.lang.String mModifyOrderNotificationPort
           
protected  java.lang.String mModifyOrderPort
           
protected  java.lang.String NUCLEUS_NAME
           
 
Fields inherited from class atg.nucleus.GenericService
SERVICE_INFO_KEY
 
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
FulfillerSystem()
           
 
Method Summary
 void doStartService()
           This method establishes the PerformanceMonitor operation name for this fulfiller.
 ClientLockManager getClientLockManager()
          The ClientLockManager is used to ensure that only one thread/message is processing a given order at any given time.
 CommerceItemStates getCommerceItemStates()
          The object containing all the states of a commerce item
 PipelineManager getFulfillmentPipelineManager()
          The PipelineManager used by this fulfillment class to access pipeline processing.
 java.io.Serializable getKeyForMessage(javax.jms.ObjectMessage oMessage)
          This method will return the key to be used for locking out other messages with the same key while a thread is handling this message.
 boolean getLookUpOrderIdFromMessage()
          The value indicates if the order id is to be retrieved from the commerce message
 boolean getLookUpOrderIdFromOrder()
          The value indicates if the order id is to be retrieved from the order object sent in the commerce message when mLookUpOrderIdFromMessage=true and the CommerceMessage.orderId property is null.
 java.lang.String getModifyOrderNotificationPort()
          The port on which the ModifyOrderNotification messages will be sent.
 java.lang.String getModifyOrderPort()
          The port on which the ModifyOrder messages will be sent.
 OrderFulfillmentTools getOrderFulfillmentTools()
          The OrderFulfillmentTools class is used to perform various tasks, such as splitting shipping groups, determining which ports messages should be sent on for fulfillers and many others.
 OrderManager getOrderManager()
          The OrderManager used by this fulfillment class to access order information.
 OrderStates getOrderStates()
          The object containing all the states of an order
 PaymentGroupStates getPaymentGroupStates()
          The object containing all the states of an payment group
 PaymentManager getPaymentManager()
          The PaymentManager is used to debit or credit paymentgroups.
 ShipItemRelationshipStates getShipItemRelationshipStates()
          The object containing all the states of a shipping group / commerce item relationship
 ShippingGroupStates getShippingGroupStates()
          The object containing all the states of a shipping group
protected  boolean handleMessage(java.lang.String pPortName, javax.jms.ObjectMessage pMessage)
           This is called to handle a newly received message.
 void handleNewMessageType(java.lang.String pPortName, javax.jms.ObjectMessage pMessage)
           This method is called to handle all messages other than the other handle methods.
 void receiveMessage(java.lang.String pPortName, javax.jms.Message pMessage)
           This is called to notify the component that a Message has arrived through the given input port.
 void setClientLockManager(ClientLockManager pClientLockManager)
           
 void setCommerceItemStates(CommerceItemStates pCommerceItemStates)
           
 void setFulfillmentPipelineManager(PipelineManager pFulfillmentPipelineManager)
           
 void setLookUpOrderIdFromMessage(boolean pLookUpOrderIdFromMessage)
           
 void setLookUpOrderIdFromOrder(boolean pLookUpOrderIdFromOrder)
           
 void setModifyOrderNotificationPort(java.lang.String pModifyOrderNotificationPort)
           
 void setModifyOrderPort(java.lang.String pModifyOrderPort)
           
 void setOrderFulfillmentTools(OrderFulfillmentTools pOrderFulfillmentTools)
           
 void setOrderManager(OrderManager pOrderManager)
           
 void setOrderStates(OrderStates pOrderStates)
           
 void setPaymentGroupStates(PaymentGroupStates pPaymentGroupStates)
           
 void setPaymentManager(PaymentManager pPaymentManager)
           
 void setShipItemRelationshipStates(ShipItemRelationshipStates pShipItemRelationshipStates)
           
 void setShippingGroupStates(ShippingGroupStates pShippingGroupStates)
           
 
Methods inherited from class atg.commerce.messaging.SourceSinkTemplate
getDelayOnSendRetry, getMessageSourceContext, getMessageSourceName, getTransactionManager, isAllowMessageSending, sendCommerceMessage, sendObjectMessage, setAllowMessageSending, setDelayOnSendRetry, setMessageSourceContext, setMessageSourceName, setTransactionManager, startMessageSource, stopMessageSource
 
Methods inherited from class atg.nucleus.GenericService
addLogListener, createAdminServlet, 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

NUCLEUS_NAME

protected java.lang.String NUCLEUS_NAME

mModifyOrderNotificationPort

public java.lang.String mModifyOrderNotificationPort

mModifyOrderPort

protected java.lang.String mModifyOrderPort
Constructor Detail

FulfillerSystem

public FulfillerSystem()
Method Detail

setOrderManager

public void setOrderManager(OrderManager pOrderManager)

getOrderManager

public OrderManager getOrderManager()
The OrderManager used by this fulfillment class to access order information. The OrderManager is used to load and save orders.

See Also:
OrderManager

setFulfillmentPipelineManager

public void setFulfillmentPipelineManager(PipelineManager pFulfillmentPipelineManager)

getFulfillmentPipelineManager

public PipelineManager getFulfillmentPipelineManager()
The PipelineManager used by this fulfillment class to access pipeline processing.

See Also:
PipelineManager

setClientLockManager

public void setClientLockManager(ClientLockManager pClientLockManager)

getClientLockManager

public ClientLockManager getClientLockManager()
The ClientLockManager is used to ensure that only one thread/message is processing a given order at any given time.

See Also:
ClientLockManager

setPaymentManager

public void setPaymentManager(PaymentManager pPaymentManager)

getPaymentManager

public PaymentManager getPaymentManager()
The PaymentManager is used to debit or credit paymentgroups.

See Also:
PaymentManager

setModifyOrderNotificationPort

public void setModifyOrderNotificationPort(java.lang.String pModifyOrderNotificationPort)

getModifyOrderNotificationPort

public java.lang.String getModifyOrderNotificationPort()
The port on which the ModifyOrderNotification messages will be sent.


setModifyOrderPort

public void setModifyOrderPort(java.lang.String pModifyOrderPort)

getModifyOrderPort

public java.lang.String getModifyOrderPort()
The port on which the ModifyOrder messages will be sent.


setOrderFulfillmentTools

public void setOrderFulfillmentTools(OrderFulfillmentTools pOrderFulfillmentTools)

getOrderFulfillmentTools

public OrderFulfillmentTools getOrderFulfillmentTools()
The OrderFulfillmentTools class is used to perform various tasks, such as splitting shipping groups, determining which ports messages should be sent on for fulfillers and many others.

See Also:
OrderFulfillmentTools

setOrderStates

public void setOrderStates(OrderStates pOrderStates)

getOrderStates

public OrderStates getOrderStates()
The object containing all the states of an order


setShippingGroupStates

public void setShippingGroupStates(ShippingGroupStates pShippingGroupStates)

getShippingGroupStates

public ShippingGroupStates getShippingGroupStates()
The object containing all the states of a shipping group


setPaymentGroupStates

public void setPaymentGroupStates(PaymentGroupStates pPaymentGroupStates)

getPaymentGroupStates

public PaymentGroupStates getPaymentGroupStates()
The object containing all the states of an payment group


setShipItemRelationshipStates

public void setShipItemRelationshipStates(ShipItemRelationshipStates pShipItemRelationshipStates)

getShipItemRelationshipStates

public ShipItemRelationshipStates getShipItemRelationshipStates()
The object containing all the states of a shipping group / commerce item relationship


setCommerceItemStates

public void setCommerceItemStates(CommerceItemStates pCommerceItemStates)

getCommerceItemStates

public CommerceItemStates getCommerceItemStates()
The object containing all the states of a commerce item


setLookUpOrderIdFromMessage

public void setLookUpOrderIdFromMessage(boolean pLookUpOrderIdFromMessage)

getLookUpOrderIdFromMessage

public boolean getLookUpOrderIdFromMessage()
The value indicates if the order id is to be retrieved from the commerce message


setLookUpOrderIdFromOrder

public void setLookUpOrderIdFromOrder(boolean pLookUpOrderIdFromOrder)

getLookUpOrderIdFromOrder

public boolean getLookUpOrderIdFromOrder()
The value indicates if the order id is to be retrieved from the order object sent in the commerce message when mLookUpOrderIdFromMessage=true and the CommerceMessage.orderId property is null.


receiveMessage

public void receiveMessage(java.lang.String pPortName,
                           javax.jms.Message pMessage)
                    throws javax.jms.JMSException

This is called to notify the component that a Message has arrived through the given input port. The MessageSink should be prepared to handle concurrent calls of this method from multiple Threads. All messages received by a FulfillerSystem subclass are expected to be ObjectMessages. All of the objects contained within those object messages are assumed to be CommerceMessage objects.

Each FulfillerSystem subclass processes the message types that it expects to receive. Message processing occurs in the handleMessage method, which each subclass overrides. Additional (custom) message types can be handled by extending the handleNewMessageType method and adding whatever logic is required in there.

The method uses the ClientLockManager to guarantee that only one thread dealing with a message for a given key is running through the system at any moment. The key used to acquire the lock is returned by the method getKeyForMessage().

Specified by:
receiveMessage in interface MessageSink
Overrides:
receiveMessage in class SourceSinkTemplate
Parameters:
pPortName - - the port on which this message was received
pMessage - - the message that was sent on the port.
Throws:
javax.jms.JMSException
See Also:
handleMessage(java.lang.String, javax.jms.ObjectMessage), OrderFulfiller, HardgoodFulfiller, ElectronicFulfiller, ClientLockManager

getKeyForMessage

public java.io.Serializable getKeyForMessage(javax.jms.ObjectMessage oMessage)
                                      throws javax.jms.JMSException
This method will return the key to be used for locking out other messages with the same key while a thread is handling this message.

Parameters:
pMessage - the ObjectMessage containing the CommerceMessage.
Returns:
an Object which serves as the key for the message
Throws:
javax.jms.JMSException

handleMessage

protected boolean handleMessage(java.lang.String pPortName,
                                javax.jms.ObjectMessage pMessage)
                         throws javax.jms.JMSException

This is called to handle a newly received message. Before this method is called, the message is subjected to basic validity checks, a transaction is established, and an exclusive lock is acquired for the message's key.

Each FulfillerSystem subclass should override this method to handle the message types that are appropriate to that subclass. Otherwise, handleNewMessageType will be called.

Parameters:
pPortName - - the port on which this message was received
pMessage - - the message that was sent on the port.
Throws:
javax.jms.JMSException
See Also:
#receive, handleNewMessageType(java.lang.String, javax.jms.ObjectMessage)

handleNewMessageType

public void handleNewMessageType(java.lang.String pPortName,
                                 javax.jms.ObjectMessage pMessage)
                          throws javax.jms.JMSException

This method is called to handle all messages other than the other handle methods. The default implementation logs a warning and does nothing else. Should new message types be added, this method can be overridden and the handling of the message can be done within. Note that no extra work for locking needs to happen.

Parameters:
pPortName - - the port on which this message was received
pMessage - - an ObjectMessage which will contain a CommerceMessage as an object
Throws:
javax.jms.JMSException - is thrown on a failure to send a message

doStartService

public void doStartService()
                    throws ServiceException

This method establishes the PerformanceMonitor operation name for this fulfiller.

Overrides:
doStartService in class GenericService
Throws:
ServiceException - if the Service had a problem starting up
See Also:
GenericService