org.openeai.afa
Class ScheduledCommandImpl

java.lang.Object
  extended by org.openeai.OpenEaiObject
      extended by org.openeai.afa.ScheduledCommandImpl

public class ScheduledCommandImpl
extends OpenEaiObject

This is the parent class of all ScheduledCommands. These commands are Java components that are used to execute specific business logic associated to a given Schedule. It provides convenience methods for its decendants.

Version:
3.0 - 28 January 2003
Author:
Tod Jackson (tod@openeai.org), Steve Wheat (steve@openeai.org)
See Also:
Schedule, ScheduledCommand

Field Summary
static org.apache.log4j.Category logger
           
 
Constructor Summary
ScheduledCommandImpl(CommandConfig cConfig)
          Constructor
 
Method Summary
protected  void addAppConfig(AppConfig aConfig)
           
protected  Error buildError(java.lang.String errType, java.lang.String errNumber, java.lang.String errDescription)
          Builds a single Error object that can be added to the ArrayList of errors (or for any other reason) to pass to the publishSyncError method.
 AppConfig getAppConfig()
          Get AppConfig associated to this command.
protected  java.util.Vector getAppConfigs()
           
protected  org.jdom.Element getControlArea(org.jdom.Element root)
          This method looks at the document and returns the appropriate ControlArea.
protected  boolean getInboundXmlValidation()
          Get inbound xml validation.
 java.util.HashMap getMsgComponents()
          Returns the HashMap that is a list of Messaging Components (gateways) that this command needs to know about.
protected  boolean getOutboundXmlValidation()
          Get outbound xml validation.
 PubSubProducer getSyncErrorPublisher()
          Get SyncErrorPublisher associated to this command.
protected  java.lang.String getSyncErrorSyncPrimedDocumentUri()
          Returns the SyncErrorSync primed document that will be used if this ScheduledCommand needs to publish a Sync-Error-Sync messages if errors occur during the execution of the command.
protected  void publishSyncError(java.lang.String action, java.util.List errors)
          This method is used to publish a Sync-Error-Sync message when/if the ScheduledCommand has any errors during processing (during the 'execute' method).
protected  void publishSyncError(java.lang.String action, java.util.List errors, java.lang.Throwable e)
          This method is used to publish a Sync-Error-Sync message when/if the ScheduledCommand has any errors during processing (during the 'execute' method).
protected  void setAppConfig(AppConfig aConfig)
          Set AppConfig associated to this command.
protected  void setInboundXmlValidation(boolean validate)
          Set inbound xml validation.
 void setMsgComponents(java.util.HashMap components)
          Sets the HashMap that is a list of Messaging Components (gateways) that this command needs to know about.
protected  void setOutboundXmlValidation(boolean validate)
          Set outbound xml validation.
protected  void setSyncErrorSyncPrimedDocumentUri(java.lang.String uri)
          Sets the SyncErrorSync primed document that will be used if this ScheduledCommand needs to publish a Sync-Error-Sync messages if errors occur during the execution of the command.
 void shutdown()
           
 
Methods inherited from class org.openeai.OpenEaiObject
getAppName, getDebug, getFromAddr, getMailHost, getMailService, getProperties, getToAddr, initializeLog4j, initializeLog4j, initializeLog4j, setAppName, setDebug, setFromAddr, setMailHost, setMailService, setProperties, setToAddr
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

public static org.apache.log4j.Category logger
Constructor Detail

ScheduledCommandImpl

public ScheduledCommandImpl(CommandConfig cConfig)
                     throws java.lang.InstantiationException
Constructor

Throws:
java.lang.InstantiationException
Method Detail

setInboundXmlValidation

protected void setInboundXmlValidation(boolean validate)
Set inbound xml validation. This is used to determine whether or not to validate xml. Since Scheduled commands do not consume messages like ConsumerCommands, this attribute can be used for general decision making when considering whether or not to validate XML Documents that may exist as part of the Scheduled Command's execution.

Parameters:
validate - boolean

getInboundXmlValidation

protected boolean getInboundXmlValidation()
Get inbound xml validation.

Returns:
boolean

setOutboundXmlValidation

protected void setOutboundXmlValidation(boolean validate)
Set outbound xml validation. This is used to determine whether or not to validate xml. Since Scheduled commands do not return messages like ConsumerCommands, this attribute can be used for general decision making when considering whether or not to validate XML Documents that may exist as part of the Scheduled Command's execution.

Parameters:
validate -

getOutboundXmlValidation

protected boolean getOutboundXmlValidation()
Get outbound xml validation.

Returns:
boolean

getSyncErrorPublisher

public final PubSubProducer getSyncErrorPublisher()
Get SyncErrorPublisher associated to this command. It is called by commands when they need to publish a sync error via the publishSyncError method also defined in ScheduledCommandImpl.

Returns:
PubSubProducer

setAppConfig

protected void setAppConfig(AppConfig aConfig)
Set AppConfig associated to this command. It is called in the constructor of ScheculedCommandImpl.

Parameters:
aConfig -

getAppConfig

public final AppConfig getAppConfig()
Get AppConfig associated to this command. It is called by commands.

Returns:
AppConfig

getSyncErrorSyncPrimedDocumentUri

protected java.lang.String getSyncErrorSyncPrimedDocumentUri()
Returns the SyncErrorSync primed document that will be used if this ScheduledCommand needs to publish a Sync-Error-Sync messages if errors occur during the execution of the command.

Returns:
String the document URI to the primed Sync-Error-Sync document

setSyncErrorSyncPrimedDocumentUri

protected void setSyncErrorSyncPrimedDocumentUri(java.lang.String uri)
Sets the SyncErrorSync primed document that will be used if this ScheduledCommand needs to publish a Sync-Error-Sync messages if errors occur during the execution of the command.

Parameters:
uri - String the document URI to the primed Sync-Error-Sync document

publishSyncError

protected void publishSyncError(java.lang.String action,
                                java.util.List errors,
                                java.lang.Throwable e)
This method is used to publish a Sync-Error-Sync message when/if the ScheduledCommand has any errors during processing (during the 'execute' method).

Parameters:
action - String the action being performed. If a 'null' action is passed in, 'Unknown' is used. This will cause the Sync-Error-Sync document being published to be invalid because the list of actions is constrained in SctSegments.

errors - java.util.List an ArrayList of org.openeai.moa.objects.Error objects that have been built with the appropriate error number, error type and error descriptions.

e - Throwable an exception that has occurred in the ScheduledCommand. This exception will be added to the list of errors passed in.

publishSyncError

protected void publishSyncError(java.lang.String action,
                                java.util.List errors)
This method is used to publish a Sync-Error-Sync message when/if the ScheduledCommand has any errors during processing (during the 'execute' method).

Parameters:
action - String the action being performed. If a 'null' action is passed in, 'Unknown' is used. This will cause the Sync-Error-Sync document being published to be invalid because the list of actions is constrained in SctSegments.

java.util.List - a List of org.openeai.moa.objects.Error objects that have been built with the appropriate error number, error type and error descriptions.

buildError

protected Error buildError(java.lang.String errType,
                           java.lang.String errNumber,
                           java.lang.String errDescription)
Builds a single Error object that can be added to the ArrayList of errors (or for any other reason) to pass to the publishSyncError method.

Parameters:
errType - String error Type ('application' or 'system')
errNumber - String error Number
errDescription - String error Description
Returns:
org.openeai.moa.objects.Error the error object that gets built.

getControlArea

protected org.jdom.Element getControlArea(org.jdom.Element root)
This method looks at the document and returns the appropriate ControlArea. Since there can be three different control areas based on the message (ControlAreaRequest, ControlAreaReply and ControlAreaSync) we need to have some intelligence built in when retrieving the element from the document. Clients should never need to call this method directly.

Parameters:
root - org.jdom.Element the root element of the document
Returns:
Element the ControlArea element (may be ControlAreaRequest, ControlAreaReply or ControlAreaSync depending on the doc)

addAppConfig

protected void addAppConfig(AppConfig aConfig)

getAppConfigs

protected java.util.Vector getAppConfigs()

setMsgComponents

public final void setMsgComponents(java.util.HashMap components)
Sets the HashMap that is a list of Messaging Components (gateways) that this command needs to know about. This is specifically used by gateways like Routers and Proxies which need to forward sync or request messages to an end point. This is a list of AppConfig objects that correspond to that end point and contains message object, producers etc. that are needed to route/forward a message to that end point.

Parameters:
components - HashMap a HashMap containing AppConfigs for end points of intrest to this command.


getMsgComponents

public final java.util.HashMap getMsgComponents()
Returns the HashMap that is a list of Messaging Components (gateways) that this command needs to know about. This is specifically used by gateways like Routers and Proxies which need to forward sync or request messages to an end point. This is a list of AppConfig objects that correspond to that end point and contains message object, producers etc. that are needed to route/forward a message to that end point.

Returns:
HashMap a HashMap containing AppConfigs for end points of intrest to this command.

shutdown

public void shutdown()
              throws ScheduledCommandException
Throws:
ScheduledCommandException


Copyright © 2002,2003 OpenEAI Software Foundation