|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.orb.config.DefaultLoader
The DefaultLoader
provides support for the configuration
of a new ORB instance based on default and supplied properties, and
lifecycle processing of pluggable Initializer
s encountered
during the configuration process. The implementation also handles the
decommissioning of initializers as part of loader disposal.
The property set profile for an ORB instance is created based on command line arguments, supplied properties, and an optional embedded configuration.
Property resolution. | |
Source | Description |
args |
Property declarations supplied under the init method take precedence.
The args array is passed to the Configuration for resolution.
|
properties |
The properties argument to the init method is the second source
of property declarations. The DefaultLoader uses the properties
argument to establish a new instance that is populated
with additional properties based on the |
configuration |
A Configuration value may be embeded in the supplied
Properties value under the "CONFIGURATION" key.
Properties declared in the configuration instance that are recognized by
the loader are detailed here.
<property name="propertyName" value="propertyValue"/> <property name="propertyName" file="fileName"/> <initializer class="org.apache.pss.Initializer" name="pss"/> |
defaults |
A set of static default properties are used to suppliment the user defined
properties. Default properties are contained in the
org/apache/orb/config/orb.properties and
org/apache/orb/config/DefaultLoader.xml configuration
resources bundeled in the distribution jar file.
|
Resources required to manage pluggable component lifecycle handling are provided to the loader using special keyed values. Keys and the associated values are described in the following table.
Embedded Avalon Resources. | |
Key | Description |
LOGGER |
The logging channel to be assigned to the ORB. The logger is used as the relative root when creatiing and assigning logging channels to pluggable initializers. |
CONFIGURATION |
A configuration instance that may be used to supply supplimentary property
declarations and initializers configuration blocks. Initializers that
implement the Avalon Cascading interface will be supplied with
its configuration during initializer loading.
|
CONTEXT |
The Context is an application context that will be supplied to
any initializers that implement the Contextualizable interface.
|
The logger supplied to the loader under the embedded properties LOGGER
key is assigned as the root logging catagory for the ORB. Catagories for
initializers are created as child catagories. If the supplied logger has the catagory
name of demo.orb
, an initializer catagory for PSS would be
demo.orb.pss
. Initializer sub-catagories are resolved from the supplied
configuration. The DefaultLoader
locates an initializer declaration based
on an initilizer element with a class
attribute value matching that
initializer implementation class name. The name
attribute value is used
as the logging channel sub-catagory name.
<initializer class="org.apache.pss.Initializer" name="pss"/>
The following code fragment demonstrates the creation of a new ORB instance
using embedded resources and the DefaultLoader
class.
Properties properties = new Properties(); // declare the ORB and Singleton implementations properties.setProperty( "org.omg.CORBA.ORBClass", "org.openorb.orb.core.ORB" ); properties.setProperty("org.omg.CORBA.ORBSingletonClass", "org.openorb.orb.core.ORBSingleton" ); // declare the loader that will be instatiated by the ORB properties.setProperty("openorb.ORBLoader", "org.apache.orb.config.DefaultLoader"); // add the embedded configuration, logger and context resources properties.put( "CONFIGURATION", m_config ); properties.put( "LOGGER", getLogger().getChildLogger("orb") ); properties.put( "CONTEXT", m_context ); // create the ORB orb = ORB.init( m_args, properties );
Constructor Summary | |
DefaultLoader()
|
Method Summary | |
java.lang.reflect.Constructor |
classConstructor(java.lang.String key,
java.lang.String defl,
java.lang.Class[] args)
Creation of a class constructor. |
java.lang.Object |
constructClass(java.lang.String prop_key,
java.lang.String defl,
java.lang.Object[] args)
This operation is used to load a class with the given property name and default class name. |
java.lang.Object |
constructClass(java.lang.String prop_key,
java.lang.String defl,
java.lang.Object[] args,
java.lang.Class[] args_t)
This operation is used to load a class with the given property name and default class name. |
void |
display_configuration()
This operation is used to display an OpenORB configuration. |
void |
display_configuration(org.apache.avalon.framework.logger.Logger logger)
This operation is used to display an OpenORB configuration. |
void |
dispose()
Called by the ORB during shutdown enabling the initalizer to clean up. |
boolean |
getBooleanProperty(java.lang.String name)
Get the boolean property with the given name. |
boolean |
getBooleanProperty(java.lang.String name,
boolean defl)
Get the boolean property with the given name. |
java.lang.Class |
getClassProperty(java.lang.String name)
Get the integer property with the given name. |
java.lang.Class |
getClassProperty(java.lang.String name,
java.lang.Class defl)
Get the Class object property with the given name. |
java.lang.Class |
getClassProperty(java.lang.String name,
java.lang.String defl)
Get the Class object property with the given name. |
static java.util.Properties |
getDefaultProperties()
Returns the system wide default ORB properties |
int |
getIntProperty(java.lang.String name)
Get the integer property with the given name. |
int |
getIntProperty(java.lang.String name,
int defl)
Get the integer property with the given name. |
Property |
getProperty(java.lang.String name)
Get the Property object with the given name. |
java.lang.String |
getStringProperty(java.lang.String name)
Get the string property with the given name. |
java.lang.String |
getStringProperty(java.lang.String name,
java.lang.String defl)
Get the string property with the given name. |
java.net.URL |
getURLProperty(java.lang.String name)
Get the URL property with the given name. |
java.net.URL |
getURLProperty(java.lang.String name,
java.net.URL defl)
Get the URL property with the given name. |
void |
init(java.lang.String[] args,
java.util.Properties props,
ORB orb)
ORB Initialization. |
void |
load_kernel()
This operation is used to load the OpenORB kernel. |
void |
mergeProperties(java.io.File root,
org.apache.avalon.framework.configuration.Configuration config,
java.util.Properties properties)
Adds property declarations to the supplied Properties argument from the supplied configuration. |
java.util.Iterator |
properties(java.lang.String name)
Iterate over property values with the specified prefix. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public DefaultLoader()
Method Detail |
public void load_kernel()
Depending on the property openorb.server.enable ( default true ) and openorb.client.enable ( default true ) this method instantiates the ServerCPCManager and the ClientCPCMamager. This instantiation is pluggable as it is driven by properties:
The property openorb.dynany.enable (default true) allows to avoid loading the DynAnyFactory if it is not used by the application. This can save you some amount memory.
The property openorb.client.enable also decides whether to load the initiali references ORBPolicyManager and PolicyCurrent into the ORB.
public void init(java.lang.String[] args, java.util.Properties props, ORB orb)
init
in interface ORBLoader
args
- command line argumentsprops
- properties argumentorb
- the ORB instancepublic void display_configuration()
display_configuration
in interface ORBLoader
public void display_configuration(org.apache.avalon.framework.logger.Logger logger)
logger
- the logging channel to direct display of propertiespublic java.util.Iterator properties(java.lang.String name)
properties
in interface ORBLoader
name
- parent of properties. Properies of the form name + "." + xxx
are returned, where xxx can be anything. May be null to iterate over all
properies.public Property getProperty(java.lang.String name)
getProperty
in interface ORBLoader
name
- the property name.public java.lang.String getStringProperty(java.lang.String name, java.lang.String defl)
getStringProperty
in interface ORBLoader
name
- the property name.defl
- default value to use if property not found.public java.lang.String getStringProperty(java.lang.String name) throws PropertyNotFoundException
getStringProperty
in interface ORBLoader
name
- the property name.PropertyNotFoundException
- the property cannot be found.public int getIntProperty(java.lang.String name, int defl)
getIntProperty
in interface ORBLoader
name
- the property name.defl
- default value to use if property not found.public int getIntProperty(java.lang.String name) throws PropertyNotFoundException
getIntProperty
in interface ORBLoader
name
- the property name.PropertyNotFoundException
- the property cannot be found.public boolean getBooleanProperty(java.lang.String name, boolean defl)
getBooleanProperty
in interface ORBLoader
name
- the property name.defl
- default value to use if property not found.public boolean getBooleanProperty(java.lang.String name) throws PropertyNotFoundException
getBooleanProperty
in interface ORBLoader
name
- the property name.PropertyNotFoundException
- the property cannot be found.public java.net.URL getURLProperty(java.lang.String name, java.net.URL defl)
getURLProperty
in interface ORBLoader
name
- the property name.defl
- default value to use if property not found.public java.net.URL getURLProperty(java.lang.String name) throws PropertyNotFoundException
getURLProperty
in interface ORBLoader
name
- the property name.PropertyNotFoundException
- the property cannot be found.public java.lang.Class getClassProperty(java.lang.String name, java.lang.Class defl)
getClassProperty
in interface ORBLoader
name
- the property name.defl
- default value to use if property not found.public java.lang.Class getClassProperty(java.lang.String name, java.lang.String defl)
getClassProperty
in interface ORBLoader
name
- the property name.defl
- String name of default value to use if property not found.public java.lang.Class getClassProperty(java.lang.String name) throws PropertyNotFoundException
getClassProperty
in interface ORBLoader
name
- the property name.PropertyNotFoundException
- the property cannot be found.public java.lang.Object constructClass(java.lang.String prop_key, java.lang.String defl, java.lang.Object[] args) throws java.lang.reflect.InvocationTargetException
constructClass
in interface ORBLoader
prop_key
- Property name, this string property holds the name of the
class. May be null if no property is used.defl
- Default class name. Used if the named property is not found.
May be null to indicate no load should be performed if property
is missing.args
- arguments to constructor. If any constructor arguments are
primitive types then the four argument version of this function
must be used.java.lang.reflect.InvocationTargetException
- an exception occoured
in the constructor.public java.lang.Object constructClass(java.lang.String prop_key, java.lang.String defl, java.lang.Object[] args, java.lang.Class[] args_t) throws java.lang.reflect.InvocationTargetException
constructClass
in interface ORBLoader
prop_key
- Property name, this string property holds the name of the
class. May be null if no property is used.defl
- Default class name. Used if the named property is not found.
May be null to indicate no load should be performed if property
is missing.args
- arguments to constructor. If any constructor arguments are
primitive types then the four argument version of this function
must be used.args_t
- types of onstructor arguments. If any of these are null they
will be determined from getClass on the matching arg. Length
must match length of args.java.lang.reflect.InvocationTargetException
- an exception occoured
in the constructor.public java.lang.reflect.Constructor classConstructor(java.lang.String key, java.lang.String defl, java.lang.Class[] args)
classConstructor
in interface ORBLoader
key
- property keydefl
- default valueargs
- constructor argumentspublic static java.util.Properties getDefaultProperties()
public void mergeProperties(java.io.File root, org.apache.avalon.framework.configuration.Configuration config, java.util.Properties properties) throws java.lang.Exception
<any-containing-element> <property name="myProperty" value="someValue"/> <property name="info" file="eggs.xml"/> </any-containing-element>
root
- the file path to be used in resolution of property
element in the configuration that contain 'file' attributes as
the property valueconfig
- a configuration containing 'property' element declarationsproperties
- the properties to mergejava.lang.Exception
- if an merge error occurspublic void dispose()
dispose
in interface org.apache.avalon.framework.activity.Disposable
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |