org.openeai.layouts
Interface EnterpriseLayoutManager

All Known Implementing Classes:
XmlLayout

public interface EnterpriseLayoutManager

The interface that specifies what methods all EnterpriseLayoutManagers must implement. The implementations of this interface (layout managers) are associated to a message object through an application's configuration document when that object is initialized by AppConfig. A message object may have multiple layout managers associated to it and they can be switched between at runtime. It is these layout managers that provide the logic to build the object from different types of inputs as well as serialize the object to different types of outputs.

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

Method Summary
 void buildObjectFromInput(java.lang.Object input, XmlEnterpriseObject anXmlEnterpriseObject)
          Method used to build an object from an input.
 java.lang.Object buildOutputFromObject(XmlEnterpriseObject anXmlEnterpriseObject)
          Method used to serialize an object to some output.
 java.lang.Object buildOutputFromObject(XmlEnterpriseObject anXmlEnterpriseObject, java.lang.String appName)
          Method used to serialize an object to some output for a particular application.
 java.lang.String getEnterpriseObjectsUri()
          Returns the EnterpriseObjects document uri associated to this EnterpriseFields object.
 java.lang.String getLayoutManagerName()
          Returns the name associated to the layout manager.
 org.jdom.Element getLayoutRoot()
          Returns the layout manager's root element from the EnterpriseObjects document associated to the MessageObject that was configured.
 void init(java.lang.String layoutManagerName, org.jdom.Document layoutDoc)
          Method used to initialize the LayoutMangager implementation with information found in the EnterpriseObjects document associated to the object being initialized.
 void setEnterpriseObjectsUri(java.lang.String uri)
          Sets the EnterpriseObjects document uri associated to this EnterpriseFields object.
 void setLayoutManagerName(java.lang.String name)
          Sets the name associated to the layout manager.
 

Method Detail

init

void init(java.lang.String layoutManagerName,
          org.jdom.Document layoutDoc)
          throws EnterpriseLayoutException
Method used to initialize the LayoutMangager implementation with information found in the EnterpriseObjects document associated to the object being initialized. The layoutmanager implementation retrieves information from the EnterpriseObjects document to tell it how the object should be built from an input and serialized to an output.

Parameters:
layoutManagerName - String, the name of the layout associated to the object that should be located and used. This layout specifies the details regarding the type of layout being used. The layout manager implementation will use this information to determine how to build and serialize the object using the layout manager implementation. The contents of this layout may include a specific layout definition or it may simply be a reference to another Document that contains that information. That is up to the layout manager implementation.
layoutDoc - Document, the JDOM Document that contains the layout information (the EnterpriseObject Document)
Throws:
EnterpriseLayoutException - if any errors occur initializing the layout manager implementation.

buildObjectFromInput

void buildObjectFromInput(java.lang.Object input,
                          XmlEnterpriseObject anXmlEnterpriseObject)
                          throws EnterpriseLayoutException
Method used to build an object from an input. An input can be any type of object and it is up to the layout manager implementation to specify what allowable inputs are. For example, the OpenEAI software foundation includes an XmlLayout manager that all objects use to build themselves from and serialize themselves to XML. This is one implementation of an EnterpriseLayoutManager that expects the input passed to this method to be an XML Element (JDOM Element) Other examples, are ExtractLayouts that expect the input to be a String and so on. Those Layout Manager implementations then take the input given to them and build the Java object from that input. How they do this is completely up to the implementors of the layout manager.

All XmlEnterpriseObject objects inherit a buildObjectFromInput method that makes a call to the Layout manager implementation as specified in the configuration document for that object.

Parameters:
input - Object, the input object that should be used to build the object from.
anXmlEnterpriseObject - XmlEnterpriseObject, the XmlEnterpriseObject that is to be built from the input.
Throws:
EnterpriseLayoutException - if any errors occur building the object from the input.

buildOutputFromObject

java.lang.Object buildOutputFromObject(XmlEnterpriseObject anXmlEnterpriseObject)
                                       throws EnterpriseLayoutException
Method used to serialize an object to some output. An output can be any type of object and it is up to the layout manager implementation to specify what output will be. It is also up to the application developer using that layout manager to cast the returned serialized version of the object to the appropriate type of object that they're expecting. For example, the OpenEAI software foundation includes an XmlLayout manager that all objects use to build themselves from and serialize themselves to XML. This is one implementation of an EnterpriseLayoutManager that expects the output returned from this method to be an XML Element (JDOM Element).

All XmlEnterpriseObject objects inherit a buildOutputFromObject method that makes a call to the Layout manager implementation as specified in the configuration document for that object.

Parameters:
anXmlEnterpriseObject - XmlEnterpriseObject, the XmlEnterpriseObject that is to be serialized.
Returns:
Object the serialized representation of the object.
Throws:
EnterpriseLayoutException - if any errors occur building the object from the input.

buildOutputFromObject

java.lang.Object buildOutputFromObject(XmlEnterpriseObject anXmlEnterpriseObject,
                                       java.lang.String appName)
                                       throws EnterpriseLayoutException
Method used to serialize an object to some output for a particular application. An output can be any type of object and it is up to the layout manager implementation to specify what output will be. It is also up to the application developer using that layout manager to cast the returned serialized version of the object to the appropriate type of object that they're expecting. For example, the OpenEAI software foundation includes an XmlLayout manager that all objects use to build themselves from and serialize themselves to XML. This is one implementation of an EnterpriseLayoutManager that expects the output returned from this method to be an XML Element (JDOM Element).

This method differs from the buildOutputFromObject(XmlEnterpriseObject) method in that it takes the current 'Enterprise Values' contained within the object and converts them to 'Application Values' that are appropriate for the application name passed in. The rules for these reverse translations are found in the EnterpriseObjects document associated to the object in the application's configuration document.

All XmlEnterpriseObject objects inherit a buildOutputFromObject(String appName) method that makes a call to the Layout manager implementation as specified in the configuration document for that object.

Parameters:
anXmlEnterpriseObject - XmlEnterpriseObject, the XmlEnterpriseObject that is to be serialized.
appName - the name of the application as specified in the translations section of the Enterprise Object document whos application values should be used in the conversion from Enterprise Values to Application Values.
Returns:
Object the serialized representation of the object.
Throws:
EnterpriseLayoutException - if any errors occur building the object from the input.

setLayoutManagerName

void setLayoutManagerName(java.lang.String name)
Sets the name associated to the layout manager.

Parameters:
name - String the layout manager name.

getLayoutManagerName

java.lang.String getLayoutManagerName()
Returns the name associated to the layout manager.

Returns:
String the layout manager name.

getLayoutRoot

org.jdom.Element getLayoutRoot()
Returns the layout manager's root element from the EnterpriseObjects document associated to the MessageObject that was configured.

Returns:
Element

setEnterpriseObjectsUri

void setEnterpriseObjectsUri(java.lang.String uri)
Sets the EnterpriseObjects document uri associated to this EnterpriseFields object. This document contains the rules that will be use to build the EnterpriseFields object.

Parameters:
uri - String URI to the EnterpriseObjects document. Can be file system or web uri.

getEnterpriseObjectsUri

java.lang.String getEnterpriseObjectsUri()
Returns the EnterpriseObjects document uri associated to this EnterpriseFields object. This document contains the rules that will be use to build the EnterpriseFields object.

Returns:
String URI to the EnterpriseObjects document. Can be file system or web uri.


Copyright © 2002,2003 OpenEAI Software Foundation