|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object
|
+--org.openeai.OpenEaiObject
|
+--org.openeai.config.EnterpriseConfigurationObjectImpl
|
+--org.openeai.config.AppConfig
The AppConfig class acts as a container for all pre-configured object that an application may use. It reads an application's config XML document, instantiates the objects contained in that document and configures them according to the information found in the document. Then, those objects are available to the application via the getObject, getObjectByType or getObjectsLike methods.
The config document can be stored in several different places which include: file system, web server or directory server. Typically, an application instantiates app config using a properties file that contains all the properties AppConfig needs to find the configuration document and configure the application listed in the properties file.
Currently, an AppConfig is associated to these distinct types of applications:
Configuration Parameters:
These are the configuration parameters that may exist in an application's property file.
| Name | Required | Description |
|---|---|---|
| instanceName | no, unless a gateway is being started | For gateways, this property is used by PubSubConsumers to establish their durable subscriptions. This should be reflective of where the gateway is physically running (machine name etc.) |
| providerUrl | yes | Indicates where the config doc is located. If the protocol specified is "ldaps" AppConfig will use SSL to connect to the directory server. It does this by using JSSE. Other protocols that can be specified include http:, https: and file:. A local file system path can also be specified like "/usr/configs/ConfigDoc.xml" or "c:/user/configs/ConfigDoc.xml". |
| initialContextFactory | no, unless the providerUrl is ldap/ldaps | The initialContextFactory property indicates how AppConfig is to connect to the store (only applies to directory server connection) |
| securityPrincipal | no, unless the providerUrl is ldap/ldaps | The securityPrincipal and securityCredentials are directory server credentials used to connect to the providerUrl in the directory server. This is only related to configuration documents stored in a directory server. |
| securityCredentials | no, unless the providerUrl is ldap/ldaps | The securityPrincipal and securityCredentials are directory server credentials used to connect to the providerUrl in the directory server. This is only related to configuration documents stored in a directory server. |
| configDocName | no, unless the providerUrl is ldap/ldaps | name of the object as it's stored in the directory server. |
| messageComponentName | yes | the application/gateway etc. being configured specifically, as it's named in the config doc. |
Example properties file:
Directory Server Example:
Web Server Example:
File system Example:
| Field Summary |
| Fields inherited from class org.openeai.OpenEaiObject |
logger |
| Constructor Summary | |
AppConfig()
Constructor |
|
AppConfig(org.jdom.Element configElement)
This constructor might be used if an application has already parsed the deployment document and found the configuration Element associated to the application. |
|
AppConfig(java.util.Properties props)
This is the most commonly used constructor. |
|
AppConfig(java.lang.String docUri,
java.lang.String appName)
This constructor might be used if an application knows URI of the document that is to be used to configure the application. |
|
| Method Summary | |
java.lang.String |
dumpStats()
Returns name and class information about all objects currently stored in this AppConfig object. |
java.lang.String |
getDocUri()
Returns the config document URI that is used to locate the XML config document for this application. |
java.lang.Object |
getObject(java.lang.String name)
Returns the object stored in this AppConfig object with the name passed in. |
java.lang.Object |
getObjectByType(java.lang.String className)
Returns the first object stored in this AppConfig that maches the class name passed in. |
java.util.List |
getObjectsLike(java.lang.String pattern)
Returns a Vector of objects currently stored in this AppConfig object with names that contain the pattern passed in. |
java.lang.String |
getProviderUrl()
Returns the providerUrl instance variable associated with this Application. |
void |
init(org.jdom.Element eConfig)
This is the "workhorse" initialization method for an AppConfig object. |
boolean |
isInitialized()
Returns an indication that specifies if this AppConfig object has been initialized yet. |
void |
reInitialize()
Re-initializes this AppConfig object. |
void |
setDocUri(java.lang.String docUri)
Sets the config document URI that is used to locate the XML config document for this application. |
void |
setProviderUrl(java.lang.String url)
Sets the providerUrl instance variable associated with this Application. |
| Methods inherited from class org.openeai.config.EnterpriseConfigurationObjectImpl |
addProperty, getAppName, getConfigDoc, getConfigElementByAttributeValue, getElementByAttributeValue, getName, getType, getValidation, setAppName, setConfigDoc, setName, setType, setValidation |
| Methods inherited from class org.openeai.OpenEaiObject |
addLog4jProperty, getDebug, getFromAddr, getLog4jProperties, 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 |
| Methods inherited from interface org.openeai.config.EnterpriseConfigurationObject |
getAppName, getProperties, setAppName |
| Constructor Detail |
public AppConfig()
public AppConfig(java.lang.String docUri,
java.lang.String appName)
throws EnterpriseConfigurationObjectException
EnterpriseConfigurationObjectException - if any errors occur while initializing the component.
public AppConfig(java.util.Properties props)
throws EnterpriseConfigurationObjectException
EnterpriseConfigurationObjectException - if any errors occur while initializing the component.
public AppConfig(org.jdom.Element configElement)
throws EnterpriseConfigurationObjectException
EnterpriseConfigurationObjectException - if any errors occur while initializing the component.| Method Detail |
public final void setProviderUrl(java.lang.String url)
public final java.lang.String getProviderUrl()
public final boolean isInitialized()
public final java.lang.String getDocUri()
public final void setDocUri(java.lang.String docUri)
public final void reInitialize()
throws EnterpriseConfigurationObjectException
EnterpriseConfigurationObjectException
public final java.lang.Object getObjectByType(java.lang.String className)
throws EnterpriseConfigurationObjectException
java.lang.NullPointerException - if no objects of type passed in exist.
EnterpriseConfigurationObjectException
public final java.util.List getObjectsLike(java.lang.String pattern)
throws EnterpriseConfigurationObjectException
java.lang.NullPointerException - if no objects exist with names containing the pattern passed in.
EnterpriseConfigurationObjectException
public final java.lang.Object getObject(java.lang.String name)
throws EnterpriseConfigurationObjectException
java.lang.NullPointerException - if no object exists with a name passed in.
EnterpriseConfigurationObjectException
public void init(org.jdom.Element eConfig)
throws EnterpriseConfigurationObjectException
This method loops through all the child elements within the Configuration element passed in and instantiates configuration Java objects with those individual config elements. Then, it passes those Java objects to the appropriate Java object's constructor. These Java objects that are instantiated with the configuration objects, are then available to applications via the getObject, getObjectsLike and getObjectByType methods.
For example, an XML aware ProducerConfig object is instantiated/initialized with the ProducerConfig XML element. This object is then used to construct either a PointToPointProducer or a PubSubProducer foundation component depending on the information contained in the ProducerConfig object/element. Finally, the Producer that's instantiated is stored within the AppConfig object and can be retrieved during application execution by the application developer. This way, the Producer is instantiated, configured and potentially started (ready for producing messages) all based on information contained in the configuration document. All the application developer has to do is enter the appropriate configuration information into the config document and start his application. When the application is started, an AppConfig object is built and the appropriate Producers are added to it for use by the application being developed.
init in interface EnterpriseConfigurationObjectEnterpriseConfigurationObjectException - if any errors occur while initializing the component.public java.lang.String dumpStats()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||