org.openeai.config
Class EnterpriseConfigurationObjectImpl

java.lang.Object
  extended by org.openeai.OpenEaiObject
      extended by org.openeai.config.EnterpriseConfigurationObjectImpl
Direct Known Subclasses:
AppConfig, CommandConfig, ConsumerConfig, DbConnectionPoolConfig, LoggerConfig, MailServiceConfig, MessageObjectConfig, ProducerConfig, PropertyConfig, ScheduleConfig, ScheduledAppConfig, ThreadPoolConfig

public abstract class EnterpriseConfigurationObjectImpl
extends OpenEaiObject

The parent class for all of our 'configuration' objects. The reason we add this layer to our configuration strategy is so all our framework components don't have to be 'xml aware'. This way we can abstract that requirement and if we ever decide to use anything besides or in addition to XML for configuration information, we just have to change this layer and not our framework components per se.

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

Field Summary
 
Fields inherited from class org.openeai.OpenEaiObject
logger
 
Constructor Summary
EnterpriseConfigurationObjectImpl()
          Constructor
 
Method Summary
 void addProperty(java.lang.String key, java.lang.String value)
          Adds a general property (name/value pair) to this object's inherited Properties object.
 java.lang.String getAppName()
          Returns the Application name associated to this configuration object (and the actual object that will be initialized with this configuration object).
 org.jdom.Document getConfigDoc()
          Returns the deployment/configuration document that is associated to this Configuration object.
 org.jdom.Element getConfigElementByAttributeValue(java.lang.String value, java.lang.String attributeName)
           
 org.jdom.Element getElementByAttributeValue(org.jdom.Element e, java.lang.String attrValue)
           
 java.lang.String getName()
          Returns the object name associated to the configuration object being built.
 java.lang.String getType()
          Returns the type of Configuration object that this is.
 boolean getValidation()
          Returns a boolean indicating whether or not XML document validation for the deployment documents is turned on or not.
 void init(org.jdom.Element configElement)
          Provides base initialization.
 boolean refresh()
           
 void setAppName(java.lang.String name)
          Sets the Application name associated to this configuration object (and the actual object that will be initialized with this configuration object).
 void setConfigDoc(org.jdom.Document configDoc)
          Sets the deployment/configuration document that is associated to this Configuration object.
 void setName(java.lang.String name)
          Sets the object name associated to the configuration object being built.
 void setRefresh(boolean refresh)
           
 void setType(java.lang.String type)
          Sets the type of Configuration object that this is.
 void setValidation(boolean validate)
          This method, along with 'getValidation' are used to determine if the XML configuration document used to configure an application will be validated or not.
 
Methods inherited from class org.openeai.OpenEaiObject
getDebug, getFromAddr, getMailHost, getMailService, getProperties, getToAddr, initializeLog4j, initializeLog4j, initializeLog4j, setDebug, setFromAddr, setMailHost, setMailService, setProperties, setToAddr
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EnterpriseConfigurationObjectImpl

public EnterpriseConfigurationObjectImpl()
Constructor

Method Detail

init

public void init(org.jdom.Element configElement)
          throws EnterpriseConfigurationObjectException
Provides base initialization. Currently, this method only looks for the 'refresh' attribute that may be associated to all configuration elements. If subclasses call super.init(configElement) they'll set that refresh property on themselves if it's present. Then, they can provide the specific implemenation for themselves appropriately.

Parameters:
configElement - Element the configuration element that AppConfig has pulled from the configuration document relevant to the configuration object being configured. Or, the element that was found in the init() method.
Throws:
EnterpriseConfigurationObjectException - if errors occur processing the configuration Element.

setName

public void setName(java.lang.String name)
Sets the object name associated to the configuration object being built. Specifically, this is the "name" attribute that all configuration Elements have as defined in the Deployment.dtd document. This allows AppConfig to store the pre-configured objects that get initialized using these configuration objects by name and application developers to retrieve them by name.

Parameters:
name - String the name of the configuration object (and thus the actual foundation object) specified in the "name" attribute associated to each configuration Element in the deployment document.

getName

public java.lang.String getName()
Returns the object name associated to the configuration object being built. Specifically, this is the "name" attribute that all configuration Elements have as defined in the Deployment.dtd document. This allows AppConfig to store the pre-configured objects that get initialized using these configuration objects by name and application developers to retrieve them by name.

Returns:
String the name of the configuration object (and thus the actual foundation object) specified in the "name" attribute associated to each configuration Element in the deployment document.

setAppName

public final void setAppName(java.lang.String name)
Sets the Application name associated to this configuration object (and the actual object that will be initialized with this configuration object).

Overrides:
setAppName in class OpenEaiObject
Parameters:
name - String the name of the application to which this object will belong.

getAppName

public final java.lang.String getAppName()
Returns the Application name associated to this configuration object (and the actual object that will be initialized with this configuration object).

Overrides:
getAppName in class OpenEaiObject
Returns:
String the name of the application to which this object will belong.

setType

public void setType(java.lang.String type)
Sets the type of Configuration object that this is. Types so far include:

Parameters:
type. -

getType

public java.lang.String getType()
Returns the type of Configuration object that this is. Types so far include:

Returns:
String type.

setRefresh

public final void setRefresh(boolean refresh)

refresh

public boolean refresh()

setValidation

public final void setValidation(boolean validate)
This method, along with 'getValidation' are used to determine if the XML configuration document used to configure an application will be validated or not. There are currently no uses of this method therefore all deployment/configuration XML document validation is always false. These methods may be removed altogether in the future because at this point there is really no way to turn validation on for these deployment/configuration documents. Additionally, there may not be any reason to do so. Validation is typically performed when the document is being filled out. There are times when it is necessary to allow an invalid document to exist for testing purposes etc.

Parameters:
validate - boolean true to turn XML validation on false to turn it off.

getValidation

public final boolean getValidation()
Returns a boolean indicating whether or not XML document validation for the deployment documents is turned on or not. Currently, XML validation is always 'false'.

Returns:
boolean true to turn XML validation on false to turn it off.

setConfigDoc

public final void setConfigDoc(org.jdom.Document configDoc)
Sets the deployment/configuration document that is associated to this Configuration object. This is determined when AppConifg is initialized. Then it parses that document and calls this method so the object will have a reference to the document it needs to configure itself.

Parameters:
configDoc - Document JDOM Document.

getConfigDoc

public final org.jdom.Document getConfigDoc()
Returns the deployment/configuration document that is associated to this Configuration object. This is determined when AppConifg is initialized. This is what the object uses to determine how it needs to be configured.

Returns:
Document JDOM Document.

addProperty

public final void addProperty(java.lang.String key,
                              java.lang.String value)
Adds a general property (name/value pair) to this object's inherited Properties object. Many Configuration objects use general properties in addition to specific instance variables in the object to specify the configuration informatin for an object. It's up to the implementor of the EnterpriseConfigurationObject (i.e. ProducerConfig) and the foundation component (i.e. PointToPointProducer) to determine what will be general properties and what will be specified via specific instance variables and the corresponding getter/setter methods.

Generally, "simple" configuration elements should be considered for use as a general properties and complex configuration elements that have an associated Java object should be specific getter/setter methods in the configuration object.

Parameters:
key - String the property name
value - String the property value

getElementByAttributeValue

public final org.jdom.Element getElementByAttributeValue(org.jdom.Element e,
                                                         java.lang.String attrValue)

getConfigElementByAttributeValue

public final org.jdom.Element getConfigElementByAttributeValue(java.lang.String value,
                                                               java.lang.String attributeName)


Copyright © 2002,2003 OpenEAI Software Foundation