org.openeai.moa.jmsobjects
Class JmsEnterpriseObjectBase


java.lang.Object

  |

  +--org.openeai.OpenEaiObject

        |

        +--org.openeai.moa.EnterpriseObjectBase

              |

              +--org.openeai.moa.XmlEnterpriseObjectImpl

                    |

                    +--org.openeai.moa.jmsobjects.JmsEnterpriseObjectBase

All Implemented Interfaces:
java.lang.Cloneable, EnterpriseObject, JmsEnterpriseObject, PubliclyCloneable, XmlEnterpriseObject

public abstract class JmsEnterpriseObjectBase
extends XmlEnterpriseObjectImpl
implements JmsEnterpriseObject

This is the ancestor of all "message aware" enterprise objects. This is where the functionality for querying, creating, updating and deleting is. This is a specific layer used for producing requests and consuming the replies via JMS. It is also the layer which produces sync messages. Clients use this layer when they call the "message actions" on a given message aware Enterprise Object.

For example, when a client makes a call to BasicPerson.update(), this is the layer performing that function. In some cases, some of the methods used to generate the XML associated with a given message will be re-implemented by a lower class (like InstitutionalId.generate()) This will only be necessary when that lower class doesn't use the same information in its message (the DataArea portion is different).

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

Field Summary
 
Fields inherited from class org.openeai.moa.XmlEnterpriseObjectImpl
ENTERPRISE_FIELDS, XML_LAYOUT_MANAGER
 
Fields inherited from class org.openeai.OpenEaiObject
logger
 
Constructor Summary
JmsEnterpriseObjectBase()
          Constructor.
 
Method Summary
protected  void buildCreateMessage(org.jdom.Document createDoc)
          Using the current contents of the object along with the 'primed' XML document this method builds the acutal Enterprise Message.
protected  void buildDeleteMessage(java.lang.String deleteAction, org.jdom.Document deleteDoc)
          Using the current contents of the object along with the 'primed' XML document this method builds the acutal Enterprise Message.
protected abstract  void buildGenerateMessage(org.jdom.Document generateDoc, XmlEnterpriseObject keyObject)
           
protected  void buildQueryMessage(org.jdom.Document queryDoc, XmlEnterpriseObject keyObject)
          Using the current contents of the 'keyObject' passed in along with the 'primed' XML document this method builds the acutal Enterprise Message.
protected  void buildUpdateMessage(org.jdom.Document updateDoc)
          Using the current contents of the object along with the 'primed' XML document this method builds the acutal Enterprise Message.
 XmlEnterpriseObject create(PointToPointProducer producer)
          Create message production.
 void createSync(PubSubProducer producer)
          Create Sync message production.
 XmlEnterpriseObject delete(java.lang.String deleteAction, PointToPointProducer producer)
          Delete message production.
 void deleteSync(java.lang.String deleteAction, PubSubProducer producer)
          Delete Sync message production.
 java.util.List generate(XmlEnterpriseObject keyObject, PointToPointProducer producer)
          Generate message production.
 void generateSync(PubSubProducer producer, XmlEnterpriseObject keyObject)
          Generate Sync message production.
 Authentication getAuthentication()
          Returns the Authentication object associated with this object.
 java.lang.String getCommandName()
          Returns the Command name associated with this object.
protected  java.lang.String getElementName()
          Abstract method that must be implemented by decendants so this object will know what element it's dealing with when building Xml documents.
 java.util.List getLastErrors()
          Returns a List containing the last errors encountered by this object during a Request action (create, query, generate, update, delete).
 MessageId getMessageId()
          Returns the MessageId object associated with this object.
 XmlEnterpriseObject getXmlEnterpriseObject()
          Helper method that returns this object as an XmlEnterpriseObject.
 void init(MessageObjectConfig mConfig)
          Object initialization.
protected  XmlEnterpriseObject instantiate(java.lang.String className)
           
 java.util.List query(XmlEnterpriseObject keyObject, PointToPointProducer producer)
          Query message production.
protected  void restoreLayoutManagers()
           
protected  void saveLayoutManagers()
           
 void setAuthentication(Authentication auth)
          Sets the Authentication object associated with this object.
 void setCommandName(java.lang.String name)
          Sets the Command name associated with this object.
protected  org.jdom.Element setControlArea(org.jdom.Element controlArea)
           
 void setMessageId(MessageId msgId)
          Sets the MessageId object associated with this object.
 XmlEnterpriseObject update(PointToPointProducer producer)
          Update message production.
 void updateSync(PubSubProducer producer)
          Update Sync message production.
 
Methods inherited from class org.openeai.moa.XmlEnterpriseObjectImpl
addInputLayoutManager, addOutputLayoutManager, buildObjectFromInput, buildObjectFromXmlString, buildOutputFromObject, buildOutputFromObject, clone, deferInitialization, dumpData, equals, getApplicationValue, getBaseline, getCombinedKeyValue, getControlArea, getCreateDoc, getCreateDocUri, getCreateSyncDoc, getCreateSyncDocUri, getDeleteDoc, getDeleteDocUri, getDeleteSyncDoc, getDeleteSyncDocUri, getEnterpriseFields, getEnterpriseValue, getGenerateDoc, getGenerateDocUri, getGenerateSyncDoc, getGenerateSyncDocUri, getInputLayoutManager, getInputLayoutManager, getInputLayoutManagers, getOutputLayoutManager, getOutputLayoutManager, getOutputLayoutManagers, getProvideDoc, getProvideDocUri, getQueryDoc, getQueryDocUri, getResponseDoc, getResponseDocUri, getRootElementName, getTestId, getUpdateDoc, getUpdateDocUri, getUpdateSyncDoc, getUpdateSyncDocUri, getValidation, getValueFromObject, getValueFromObject, initializeChild, isDate, isEmpty, setBaseline, setCreateDoc, setCreateDocUri, setCreateSyncDoc, setCreateSyncDocUri, setDeleteDoc, setDeleteDocUri, setDeleteSyncDoc, setDeleteSyncDocUri, setEnterpriseFields, setGenerateDoc, setGenerateDocUri, setGenerateSyncDoc, setGenerateSyncDocUri, setInputLayoutManager, setInputLayoutManagers, setOutputLayoutManager, setOutputLayoutManagers, setProvideDoc, setProvideDocUri, setQueryDoc, setQueryDocUri, setResponseDoc, setResponseDocUri, setTestId, setUpdateDoc, setUpdateDocUri, setUpdateSyncDoc, setUpdateSyncDocUri, setValidation, toString, toXmlString
 
Methods inherited from class org.openeai.OpenEaiObject
addLog4jProperty, getAppName, getDebug, getFromAddr, getLog4jProperties, getMailHost, getMailService, getProperties, getToAddr, initializeLog4j, initializeLog4j, initializeLog4j, setAppName, setDebug, setFromAddr, setMailHost, setMailService, setProperties, setToAddr
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JmsEnterpriseObjectBase


public JmsEnterpriseObjectBase()
Constructor.

All "message-aware" objects inherit from this object. It provides most of the foundation methods that those objects need to be "message-aware".

Method Detail

getXmlEnterpriseObject


public XmlEnterpriseObject getXmlEnterpriseObject()
Helper method that returns this object as an XmlEnterpriseObject.

Specified by:
getXmlEnterpriseObject in interface JmsEnterpriseObject
Returns:
org.openeai.moa.XmlEnterpriseObject. This object cast to an XmlEnterpriseObject.

saveLayoutManagers


protected void saveLayoutManagers()

restoreLayoutManagers


protected void restoreLayoutManagers()

setCommandName


public final void setCommandName(java.lang.String name)
Sets the Command name associated with this object. This is a core part of all messages (a property on the JMS message) and no message can be produced if this hasn't been set. However, this gets set when the Message Object is initialized via the init method and the MessageObjectConfig object. The Command Name is set based on contents of the application Deployment configuration document which is used to initialize all message objects. No client application should ever need to call this method directly. This is information that will be used by a consumer of the message to determine which "command" to execute when it receives the message. For more information on Commands and the University JMS Consumer framework refer to the JavaDoc for the org.openeai.jms.consumer package.

Specified by:
setCommandName in interface JmsEnterpriseObject

getCommandName


public final java.lang.String getCommandName()
Returns the Command name associated with this object. This is a core part of all messages (a property on the JMS message) and no message can be produced if either this hasn't been set. However, this gets set when the Message Object is initialized via the init method and the MessageObjectConfig object. The Command Name is set based on contents of the MessagingEnterprise XML document which is used to initialize all message objects. No client application should ever need to call this method directly. This is information that will be used by a consumer of the message to determine which "command" to execute when it receives the message. For more information on Commands and the University JMS Consumer framework refer to the JavaDoc for the org.openeai.jms.consumer package.

Specified by:
getCommandName in interface JmsEnterpriseObject
Returns:
String message name associated with this object.

setMessageId


public final void setMessageId(MessageId msgId)
Sets the MessageId object associated with this object. This is a core part of all messages (in the ControlArea) and no message can be produced if this hasn't been set. However, this gets set when the Message Object is initialized via the init method and the MessageObjectConfig object. The information contained in the MessageId object is set based on contents of the MessagingEnterprise XML document which is used to initialize all message objects. No client application should ever need to call this method directly.

Specified by:
setMessageId in interface JmsEnterpriseObject

getMessageId


public final MessageId getMessageId()
Returns the MessageId object associated with this object. This is a core part of all messages (in the ControlArea) and no message can be produced if this hasn't been set. However, this gets set when the Message Object is initialized via the init method and the MessageObjectConfig object. The information contained in the MessageId object is set based on contents of the MessagingEnterprise XML document which is used to initialize all message objects. No client application should ever need to call this method directly.

Specified by:
getMessageId in interface JmsEnterpriseObject
Returns:
MessageId the MessageId object associated with this object.

setAuthentication


public final void setAuthentication(Authentication auth)
Sets the Authentication object associated with this object. This is a core part of all messages (in the ControlArea) and no message can be produced if this hasn't been set. However, this gets set when the Message Object is initialized via the init method and the MessageObjectConfig object. The information contained in the Authentication object is set based on contents of the MessagingEnterprise XML document which is used to initialize all message objects. No client application should ever need to call this method directly.

Specified by:
setAuthentication in interface JmsEnterpriseObject

getAuthentication


public final Authentication getAuthentication()
Returns the Authentication object associated with this object. This is a core part of all messages (in the ControlArea) and no message can be produced if this hasn't been set. However, this gets set when the Message Object is initialized via the init method and the MessageObjectConfig object. The information contained in the Authentication object is set based on contents of the MessagingEnterprise XML document which is used to initialize all message objects. No client application should ever need to call this method directly.

Specified by:
getAuthentication in interface JmsEnterpriseObject
Returns:
Authentication the authentication object associated with this object.

getElementName


protected java.lang.String getElementName()
Abstract method that must be implemented by decendants so this object will know what element it's dealing with when building Xml documents.

Returns:
String the element name.

buildCreateMessage


protected void buildCreateMessage(org.jdom.Document createDoc)
                           throws org.jdom.JDOMException,
                                  EnterpriseObjectCreateException
Using the current contents of the object along with the 'primed' XML document this method builds the acutal Enterprise Message. (e.g. - Person/BasicPerson-Create-Request or Person/BasicPerson-Create-Sync). This Enterprise Message will then be sent via JMS to a queue/topic and consumed by a Gateway which will process the request/sync and return a reply if appropriate. Note, replies will only be returned when a request message is sent.

Returns:
Document the Enterprise Message with a DataArea consisting of the current contents of this object and a ControlArea consisting of appropriate ControlArea information based on the configuration of this object. (e.g. - Sender, Datetime etc.)

Throws:
EnterpriseObjectCreateException - if errors serializing the object as an Xml Element.
org.jdom.JDOMException - if errors occur manipulating the document.

buildDeleteMessage


protected void buildDeleteMessage(java.lang.String deleteAction,
                                  org.jdom.Document deleteDoc)
                           throws org.jdom.JDOMException,
                                  EnterpriseObjectDeleteException
Using the current contents of the object along with the 'primed' XML document this method builds the acutal Enterprise Message. (e.g. - Person/BasicPerson-Delete-Request or Person/BasicPerson-Delete-Sync). This Enterprise Message will then be sent via JMS to a queue/topic and consumed by a Gateway which will process the request/sync and return a reply if appropriate. Note, replies will only be returned when a request message is sent.

Returns:
Document the Enterprise Message with a DataArea consisting of the current contents of this object and a ControlArea consisting of appropriate ControlArea information based on the configuration of this object. (e.g. - Sender, Datetime etc.)

Throws:
EnterpriseObjectDeleteException - if errors serializing the object as an Xml Element.
org.jdom.JDOMException - if errors occur manipulating the document.

buildUpdateMessage


protected void buildUpdateMessage(org.jdom.Document updateDoc)
                           throws org.jdom.JDOMException,
                                  EnterpriseObjectUpdateException
Using the current contents of the object along with the 'primed' XML document this method builds the acutal Enterprise Message. (e.g. - Person/BasicPerson-Update-Request or Person/BasicPerson-Update-Sync). This Enterprise Message will then be sent via JMS to a queue/topic and consumed by a Gateway which will process the request/sync and return a reply if appropriate. Note, replies will only be returned when a request message is sent.

Returns:
Document the Enterprise Message with a DataArea consisting of the current contents of this object and a ControlArea consisting of appropriate ControlArea information based on the configuration of this object. (e.g. - Sender, Datetime etc.)

Throws:
EnterpriseObjectUpdateException - if errors serializing the object as an Xml Element.
org.jdom.JDOMException - if errors occur manipulating the document.

buildQueryMessage


protected void buildQueryMessage(org.jdom.Document queryDoc,
                                 XmlEnterpriseObject keyObject)
                          throws org.jdom.JDOMException,
                                 EnterpriseObjectQueryException
Using the current contents of the 'keyObject' passed in along with the 'primed' XML document this method builds the acutal Enterprise Message. (e.g. - Person/BasicPerson-Query-Request). This Enterprise Message will then be sent via JMS to a queue/topic and consumed by a Gateway which will process the query request and return an appropriate provide-reply.

This method may be overridden by ancestors of JmsEnterpriseObject if they require a different 'keyObject' in the Query. (e.g. - InstituitonalIdentity requires an UnknownPerson instead of a LightweightPerson).

Returns:
Document the Enterprise Message with a DataArea consisting of the current contents of the 'keyObject' and a ControlArea consisting of appropriate ControlArea information based on the configuration of this object. (e.g. - Sender, Datetime etc.)

Throws:
EnterpriseObjectQueryException - if errors serializing the object as an Xml Element.
org.jdom.JDOMException - if errors occur manipulating the document.

buildGenerateMessage


protected abstract void buildGenerateMessage(org.jdom.Document generateDoc,
                                             XmlEnterpriseObject keyObject)
                                      throws org.jdom.JDOMException,
                                             EnterpriseObjectGenerateException
org.jdom.JDOMException
EnterpriseObjectGenerateException

setControlArea


protected org.jdom.Element setControlArea(org.jdom.Element controlArea)
                                   throws EnterpriseObjectException
EnterpriseObjectException

init


public void init(MessageObjectConfig mConfig)
          throws EnterpriseObjectException
Object initialization. This method initializes the current object with information contained in the EnterpriseConfigurationObject passed in. All JmsEnterpriseObjects inherit this functionality and the init method is called when the AppConfig object is being built for a particular application. This method will never be called directly from an application. The call is "behind the scenes". The values stored in the config object passed in are retreived from the Application Deployment and EnterpriseObjects documents. This includes configuration information for things like: Primed Documents, Xml Validation, Enterprise field rules (translation, formats, scrubbing etc.) and Layout management. See the documentation for the Application Deployment and EnterpriseObjects Xml documents for more information on these items. More information can also be found in the JavaDoc for the org.openeai.config package.

Overrides:
init in class XmlEnterpriseObjectImpl
Parameters:
mConfig - MessageObjectConfig object loaded with all configuration information relative to this object built from the configuration document.

Throws:
EnterpriseObjectException - if errors occur initializing the current MessageObject.
See Also:
MessageObjectConfig, EnterpriseFields

generateSync


public final void generateSync(PubSubProducer producer,
                               XmlEnterpriseObject keyObject)
                        throws EnterpriseObjectSyncException
Generate Sync message production. Builds an XML document (using the primed generate sync document as a "template") out of the current contents of the object. While building the XML generate Sync document, it will validate contents of the object checking for any malformed, missing or invalid fields. Field data values are also checked for validitity against the EnterpriseObjects document. Publishes the XML document in a JMS message to the topic connected to by producer.

Specified by:
generateSync in interface JmsEnterpriseObject
Throws:
EnterpriseObjectSyncException - if any errors occur when validating the contents of the object. Or, if any errors occur while publishing the message.

createSync


public final void createSync(PubSubProducer producer)
                      throws EnterpriseObjectSyncException
Create Sync message production. Builds an XML document (using the primed create sync document as a baseline) out of the current contents of the object. While building the XML Create Sync document, it will validate contents of the object checking for any malformed, missing or invalid fields. Field data values are also checked for validitity against the EnterpriseObjects document. Publishes the XML document in a JMS message to the topic connected to by producer.

Specified by:
createSync in interface JmsEnterpriseObject
Parameters:
producer - org.openeai.jms.producer.PubSubProducer to use to publish the message.
Throws:
EnterpriseObjectSyncException - if any errors occur when validating the contents of the object. Or, if any errors occur while publishing the message.

deleteSync


public final void deleteSync(java.lang.String deleteAction,
                             PubSubProducer producer)
                      throws EnterpriseObjectSyncException
Delete Sync message production. Builds an XML document (using the primed delete sync document as a baseline) out of the current contents of the object. While building the XML Delete Sync document, it will validate contents of the object checking for any malformed, missing or invalid fields. Field data values are also checked for validitity against the EnterpriseObjects document. Publishes the XML document in a JMS message to the topic connected to by producer.

Specified by:
deleteSync in interface JmsEnterpriseObject
Throws:
EnterpriseObjectSyncException - if any errors occur when validating the contents of the object. Or, if any errors occur while publishing the message.

updateSync


public final void updateSync(PubSubProducer producer)
                      throws EnterpriseObjectSyncException
Update Sync message production. Builds an XML document (using the primed update sync document as a "template") out of the current contents of the object. It will use the current contents of the object as the NewData portion of the message and it will use the m_baseline object as the Baseline portion of the message. The m_baseline object is set when this object was "queried" for previously. While building the XML Update Sync document, it will validate contents of the object checking for any malformed, missing or invalid fields. Field data values are also checked for validitity against the EnterpriseObjects document. Publishes the XML document in a JMS message to the topic connected to by producer.

Specified by:
updateSync in interface JmsEnterpriseObject
Throws:
EnterpriseObjectSyncException - if any errors occur when validating the contents of the object. Or, if any errors occur while publishing the message.

create


public final XmlEnterpriseObject create(PointToPointProducer producer)
                                 throws EnterpriseObjectCreateException
Create message production. Builds an XML document (using the primed create document as a "template") out of the current contents of the object. While building the XML Create document, it will validate contents of the object checking for any malformed, missing or invalid fields. Field data values are also checked for validitity against the EnterpriseObjects document. Uses the producer passed in to send the XML document as a JMS request to the queue connected to by the producer which then processes the response checking for any errors in the response.

Specified by:
create in interface JmsEnterpriseObject
Returns:
XmlEnterpriseObject a generic response which will indicate success or failure. If failure, any error information will be included in that result. The object returned is actually a org.openeai.moa.objects.Result object.

Throws:
EnterpriseObjectCreateException - if any errors occur when validating the contents of the object, if any errors occur while producing the request or if the object doesn't support the create action. This exception will also be thrown if the contents of the reply document contains an error. That is, if the consuming application had errors processing the request. This exception will include the Result information containing the error that occurred.

delete


public final XmlEnterpriseObject delete(java.lang.String deleteAction,
                                        PointToPointProducer producer)
                                 throws EnterpriseObjectDeleteException
Delete message production. Builds an XML document (using the primed delete document as a "template") out of the current contents of the object. While building the XML Delete document, it will validate contents of the object checking for any malformed, missing or invalid fields. Field data values are also checked for validitity against the EnterpriseObjects document. Uses the producer passed in to send the XML document as a JMS request to the queue connected to by the producer which then processes the response checking for any errors in the response.

Specified by:
delete in interface JmsEnterpriseObject
Returns:
XmlEnterpriseObject a generic response which will indicate success or failure. If failure, any error information will be included in that result. The object returned is actually a org.openeai.moa.objects.Result object.

Throws:
EnterpriseObjectDeleteException - if any errors occur when validating the contents of the object, if any errors occur while producing the request or if the object doesn't support the create action. This exception will also be thrown if the contents of the reply document contains an error. That is, if the consuming application had errors processing the request. This exception will include the Result information containing the error that occurred.

update


public final XmlEnterpriseObject update(PointToPointProducer producer)
                                 throws EnterpriseObjectUpdateException
Update message production. Builds an XML document (using the primed update document as a "template") out of the current contents of the object (this). It will use the current contents of the object as the NewData portion of the message and it will use this object's "baseline" object as the Baseline portion of the message. The "baseline" object is set when this object was "queried" for previously. While building the XML Update message, it will validate contents checking for any malformed, missing or invalid fields. Field data values are also checked for validitity against the EnterpriseObjects document. Uses the producer passed in to send the XML document as a JMS request to the queue connected to by the producer which then processes the response checking for any errors in the response.

Specified by:
update in interface JmsEnterpriseObject
Returns:
XmlEnterpriseObject (Result) this will indicate the success or failure of the Update request. In an error condition, this will include any error information.

Throws:
EnterpriseObjectUpdateException - if any errors occur when validating the contents of the object, if any errors occur while producing the request or if the object doesn't support the create action. This exception will also be thrown if the contents of the reply document contains an error. That is, if the consuming application had errors processing the request. This exception will include the Result information containing the error that occurred.

generate


public final java.util.List generate(XmlEnterpriseObject keyObject,
                                     PointToPointProducer producer)
                              throws EnterpriseObjectGenerateException
Generate message production. Builds an XML document (using the primed generate document as a "template") out of the current contents of the object. While building the XML Generate document, it will validate contents of the object checking for any malformed, missing or invalid fields. Field data values are also checked for validitity against the EnterpriseObjects document. Uses the producer passed in to send the XML document as a JMS request to the queue connected to by the producer which then processes the response checking for any errors in the response.

Specified by:
generate in interface JmsEnterpriseObject
Returns:
java.util.List this is a list of XmlEnterpriseObject objects generated by the authoritative source (the application consuming the request to generate). Typically, this will be only one object (like an InstitutionalIdentity).

Throws:
EnterpriseObjectGenerateException - if any errors occur when validating the contents of the object, if any errors occur while producing the request or if the object doesn't support the create action. This exception will also be thrown if the contents of the reply document contains an error. That is, if the consuming application had errors processing the request. This exception will include the Result information containing the error that occurred.

query


public final java.util.List query(XmlEnterpriseObject keyObject,
                                  PointToPointProducer producer)
                           throws EnterpriseObjectQueryException
Query message production. Builds an XML document (using the primed query document as a "template") out of the current contents of the keyObject passed in. While building the XML Query message, it will validate contents of the keyObject checking for any malformed, missing or invalid fields. Field data values are also checked for validitity against the EnterpriseObjects document. Uses the producer passed in to send the XML document as a JMS request to the queue connected to by the producer which then processes the response checking for any errors in the response.

Specified by:
query in interface JmsEnterpriseObject
Returns:
java.util.List this is a list of XmlEnterpriseObject objects (like BasicPerson, BasicEmployee etc.) provided by the authoritative source (the application consuming the query request).

Throws:
EnterpriseObjectQueryException - if any errors occur when validating the contents of the object, if any errors occur while producing the request or if the object doesn't support the create action. This exception will also be thrown if the contents of the reply document contains an error. That is, if the consuming application had errors processing the request. This exception will include the Result information containing the error that occurred.

getLastErrors


public java.util.List getLastErrors()
Returns a List containing the last errors encountered by this object during a Request action (create, query, generate, update, delete). When an error occurs during one of those actions, an exception is thrown. Therefore, the calling application doesn't have access to the errror objects in the result. This convenience method gives them access to those Error objects so they may use them accordingly in their application instead of having to parse the exception message etc.

Specified by:
getLastErrors in interface JmsEnterpriseObject
Returns:
java.util.List the list of errors that were saved the last time this object had an error performing a request action.

instantiate


protected XmlEnterpriseObject instantiate(java.lang.String className)
                                   throws java.lang.InstantiationException
java.lang.InstantiationException


Copyright © 2002, OpenEAI Software Foundation