Business Components

oracle.jbo.common
Class Configuration

java.lang.Object
  |
  +--oracle.jbo.common.Configuration

public class Configuration
extends java.lang.Object

Class to manage 'Configuration' file created during the design time. The Configuaration file contains one or more named 'Configuration's. A 'Configuration' is a named collection of property-value pairs. They correspond to the list of property-value pairs, needed to perform a JNDI lookup and create an AppModule.
The property values stored in the external file might be mapped to another property name before being used in a JNDI lookup. This mapping is neeed for some properties such as the JDBC connection name. For ease, of editing in the design time, the JDBC connection is stored as a named connection and might need to be mapped to another property name.
This class can retrieve a Configuration created during the design time or create a new 'Configuration'.
This class along with the Configuration file provides an alternative way to store the list of parameters needed to create an AppModule. Clients who wish to store/retrieve the parameters from the Configuration file should use this class.
Configuration c = new Configuration( Configuration.buildConfigFileName("package10")); Hashtable env = c.getConfiguration("Oracle8iCorba"); ApplicationModuleHome home = (ApplicationModuleHome)ic.lookup( env.get(Configuration.APPLICATION_NAME_PROPERTY); ..... .....


Field Summary
static java.lang.String AM_RELEASE_MODE
          Release mode for Application Module pooling
protected static java.lang.String APP_MODULE_CONFIG_BAG
          Name of the tag, which in turn holds the AppModuleConfig nodes
protected static java.lang.String APP_MODULE_CONFIG_NAME
           
static java.lang.String APPLICATION_NAME_PROPERTY
          name of the property in the Config, which identifies the package qualified AppModuleName
static java.lang.String APPLICATION_TYPE_PROPERTY
          name of the property in the Config, which identifies the meaning of the APPLICATION_NAME_PROPERTY.
static java.lang.String APPLICATION_TYPE_VALUE_APPMODULE
           
static java.lang.String APPLICATION_TYPE_VALUE_PACKAGE
           
protected static java.lang.String ATTR_CONFIG_NAME
           
static java.lang.String COMMON
          name of the common package
protected  oracle.xml.parser.v2.XMLDocument configDocument
           
static java.lang.String DB_CONNECTION_PROPERTY
           
static java.lang.String DEFAULT_CONFIG_FILENAME
          default name for the configuration file, created by the Wizards.
protected  java.lang.String fileName
           
static java.lang.String HTTP_CONNECTION_NAME
          constant to indicate the HTTP connection name
static java.lang.String IIOP_CONNECTION_NAME
          constant to indicate the IIOP connection name
static java.lang.String JDBC_CONNECTION_NAME
          name of the property in the Config, which identifies the connect string.
static java.lang.String OAS_DAD
           
 
Constructor Summary
Configuration()
           
 
Method Summary
protected  void addProperties(java.util.Hashtable h)
           
static java.lang.String buildConfigurationFileName(java.lang.String packageName)
          A helper function which hides the details of building a package qualified filename for the Configuration file.
 ApplicationModule createApplicationModule(java.lang.String nameOfTheConfiguration)
          This method, in addition to retrieving the Configuration parameters also performs a JNDI lookup and creates an AppModulue.
protected  org.w3c.dom.Node getAppModuleConfigBagNode()
           
protected  org.w3c.dom.NodeList getAppModuleConfigNodes()
           
protected  oracle.jdeveloper.cm.ConnectionManager getCM()
           
 java.util.Hashtable getConfiguration(java.lang.String nameOfTheConfiguration)
          Get the list of properties for a given Configuration.
 java.lang.String[] getConfigurationNameList()
          Get the list of 'named' Configuration defined in this file.
protected  org.w3c.dom.Node getConfigurationNode(java.lang.String name)
          Helper function to get a named config node
protected  oracle.xml.parser.v2.XMLDocument getXMLDocument()
           
 void initializeFromConnectionName(java.util.Hashtable ht)
           
 void loadFromClassPath(java.lang.String classPathConfigurationFileName)
          Pass the name of the Configuration file.
 void loadFromFile(java.lang.String configurationFileName)
           
 void loadFromStream(java.io.InputStream in)
          Build a Configuration class using the input stream on the config file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

APP_MODULE_CONFIG_BAG

protected static final java.lang.String APP_MODULE_CONFIG_BAG
Name of the tag, which in turn holds the AppModuleConfig nodes

APP_MODULE_CONFIG_NAME

protected static final java.lang.String APP_MODULE_CONFIG_NAME

ATTR_CONFIG_NAME

protected static final java.lang.String ATTR_CONFIG_NAME

APPLICATION_NAME_PROPERTY

public static final java.lang.String APPLICATION_NAME_PROPERTY
name of the property in the Config, which identifies the package qualified AppModuleName

APPLICATION_TYPE_PROPERTY

public static final java.lang.String APPLICATION_TYPE_PROPERTY
name of the property in the Config, which identifies the meaning of the APPLICATION_NAME_PROPERTY.

APPLICATION_TYPE_VALUE_PACKAGE

public static final java.lang.String APPLICATION_TYPE_VALUE_PACKAGE

APPLICATION_TYPE_VALUE_APPMODULE

public static final java.lang.String APPLICATION_TYPE_VALUE_APPMODULE

DB_CONNECTION_PROPERTY

public static final java.lang.String DB_CONNECTION_PROPERTY

JDBC_CONNECTION_NAME

public static final java.lang.String JDBC_CONNECTION_NAME
name of the property in the Config, which identifies the connect string. JDBC named connection ?

IIOP_CONNECTION_NAME

public static final java.lang.String IIOP_CONNECTION_NAME
constant to indicate the IIOP connection name

HTTP_CONNECTION_NAME

public static final java.lang.String HTTP_CONNECTION_NAME
constant to indicate the HTTP connection name

AM_RELEASE_MODE

public static final java.lang.String AM_RELEASE_MODE
Release mode for Application Module pooling

OAS_DAD

public static final java.lang.String OAS_DAD

COMMON

public static final java.lang.String COMMON
name of the common package

DEFAULT_CONFIG_FILENAME

public static final java.lang.String DEFAULT_CONFIG_FILENAME
default name for the configuration file, created by the Wizards.

configDocument

protected oracle.xml.parser.v2.XMLDocument configDocument

fileName

protected java.lang.String fileName
Constructor Detail

Configuration

public Configuration()
Method Detail

loadFromStream

public void loadFromStream(java.io.InputStream in)
                    throws JboException
Build a Configuration class using the input stream on the config file.
Parameters:
in - The input stream on the config file

loadFromFile

public void loadFromFile(java.lang.String configurationFileName)
                  throws JboException

loadFromClassPath

public void loadFromClassPath(java.lang.String classPathConfigurationFileName)
                       throws JboException
Pass the name of the Configuration file. This file is a package qualified name and should be found in the classpath. If the file is not found a runtime exception is thrown Configuration c = Configuration("package1/common/bc4j.xcfg");
Parameters:
filename - Package qualified name of the Configuration file. The configuratin file named bc4j.xcfg is stored in the common package of an AppModule

getConfiguration

public java.util.Hashtable getConfiguration(java.lang.String nameOfTheConfiguration)
                                     throws JboException
Get the list of properties for a given Configuration. This method reads the property from the file (translates some of the property) names are returns a Hashtable with the list of properties. The list of properties which are mapped to a different name are.... The Hashtable returned will be typically used to perform a JNDI lookup and create an AppModule.
Parameters:
nameOfTheConfiguration - which was created in the design time using the Configurations dialog.
Throws:
JboException - if the named Configuration is not found

addProperties

protected void addProperties(java.util.Hashtable h)

getConfigurationNameList

public java.lang.String[] getConfigurationNameList()
                                            throws JboException
Get the list of 'named' Configuration defined in this file.
Returns:
an array of names.
Throws:
JboException - if the named Configuration is not found

createApplicationModule

public ApplicationModule createApplicationModule(java.lang.String nameOfTheConfiguration)
                                          throws JboException
This method, in addition to retrieving the Configuration parameters also performs a JNDI lookup and creates an AppModulue. The caller will still have to invoke the connect() method.
Parameters:
nameOfTheConfiguration - to be used for creating an AppModule
Returns:
an ApplicationModule
Throws:
JboException - if an AppModule could not be created because the named Configuration was not found or the JNDI lookup failed.

buildConfigurationFileName

public static java.lang.String buildConfigurationFileName(java.lang.String packageName)
A helper function which hides the details of building a package qualified filename for the Configuration file.
Parameters:
packageName - pass the name of the ApplicationModule package., ex., pass package10, for package10.Package10Module
Returns:
a string which is the package qualified filename, where the Configuration file is located. In the above example it would return /package10/common/bc4j.xcfg

getConfigurationNode

protected org.w3c.dom.Node getConfigurationNode(java.lang.String name)
Helper function to get a named config node

getAppModuleConfigNodes

protected org.w3c.dom.NodeList getAppModuleConfigNodes()

getAppModuleConfigBagNode

protected org.w3c.dom.Node getAppModuleConfigBagNode()

getXMLDocument

protected oracle.xml.parser.v2.XMLDocument getXMLDocument()
                                                   throws JboException
Parameters:
filename - - Package qualified filename available in the classpath

getCM

protected oracle.jdeveloper.cm.ConnectionManager getCM()

initializeFromConnectionName

public void initializeFromConnectionName(java.util.Hashtable ht)

Business Components