org.openorb.CORBA.kernel
Class OpenORBLoader

java.lang.Object
  |
  +--org.openorb.CORBA.kernel.OpenORBLoader
All Implemented Interfaces:
ORBLoader

public class OpenORBLoader
extends java.lang.Object
implements ORBLoader

This class gets information from the command line to load OpenORB features. This class also provides several methods to access some information about configuration. For example, it is possible to call 'getBooleanProperty' to get a boolean value that corresponds to an OpenORB property ( stored into a profile ).

Version:
$Revision: 1.30 $ $Date: 2002/07/27 12:25:02 $
Author:
Jerome Daniel

Constructor Summary
OpenORBLoader()
          Constructor
 
Method Summary
 java.lang.reflect.Constructor classConstructor(java.lang.String prop_key, java.lang.String defl, java.lang.Class[] args_t)
           
 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.
 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.
 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 properties, ORB orb)
          ORB Initialization.
 java.util.Iterator properties(java.lang.String name)
          Iterate over property values with the specified prefix.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OpenORBLoader

public OpenORBLoader()
Constructor
Method Detail

init

public void init(java.lang.String[] args,
                 java.util.Properties properties,
                 ORB orb)
ORB Initialization.
Specified by:
init in interface ORBLoader

display_configuration

public void display_configuration()
This operation is used to display an OpenORB configuration.
Specified by:
display_configuration in interface ORBLoader

display_configuration

public void display_configuration(org.apache.avalon.framework.logger.Logger logger)
This operation is used to display an OpenORB configuration.

properties

public java.util.Iterator properties(java.lang.String name)
Iterate over property values with the specified prefix.

Specified by:
properties in interface ORBLoader
Parameters:
name - parent of properties. Properies of the form name + "." + are returned, where can be anything. May be null to iterate over all properies.
Returns:
unmodifiable iterator over the name's decendants. This iterator returns objects of type Property.

getProperty

public Property getProperty(java.lang.String name)
Get the Property object with the given name.
Specified by:
getProperty in interface ORBLoader
Parameters:
name - the property name.

getStringProperty

public java.lang.String getStringProperty(java.lang.String name,
                                          java.lang.String defl)
Get the string property with the given name.
Specified by:
getStringProperty in interface ORBLoader
Parameters:
name - the property name.
defl - default value to use if property not found.

getStringProperty

public java.lang.String getStringProperty(java.lang.String name)
                                   throws PropertyNotFoundException
Get the string property with the given name.
Specified by:
getStringProperty in interface ORBLoader
Parameters:
name - the property name.
Throws:
PropertyNotFoundException - the property cannot be found.

getIntProperty

public int getIntProperty(java.lang.String name,
                          int defl)
Get the integer property with the given name.
Specified by:
getIntProperty in interface ORBLoader
Parameters:
name - the property name.
defl - default value to use if property not found.
Throws:
INITIALIZE - The property value is not parsable to an int.

getIntProperty

public int getIntProperty(java.lang.String name)
                   throws PropertyNotFoundException
Get the integer property with the given name.
Specified by:
getIntProperty in interface ORBLoader
Parameters:
name - the property name.
Throws:
PropertyNotFoundException - the property cannot be found.
INITIALIZE - The property value is not parsable to an int.

getBooleanProperty

public boolean getBooleanProperty(java.lang.String name,
                                  boolean defl)
Get the boolean property with the given name.
Specified by:
getBooleanProperty in interface ORBLoader
Parameters:
name - the property name.
defl - default value to use if property not found.

getBooleanProperty

public boolean getBooleanProperty(java.lang.String name)
                           throws PropertyNotFoundException
Get the boolean property with the given name.
Specified by:
getBooleanProperty in interface ORBLoader
Parameters:
name - the property name.
Throws:
PropertyNotFoundException - the property cannot be found.

getURLProperty

public java.net.URL getURLProperty(java.lang.String name,
                                   java.net.URL defl)
Get the URL property with the given name.
Specified by:
getURLProperty in interface ORBLoader
Parameters:
name - the property name.
defl - default value to use if property not found.
Throws:
java.lang.ClassCastException - The property value is not parsable to a URL.

getURLProperty

public java.net.URL getURLProperty(java.lang.String name)
                            throws PropertyNotFoundException
Get the URL property with the given name.
Specified by:
getURLProperty in interface ORBLoader
Parameters:
name - the property name.
Throws:
PropertyNotFoundException - the property cannot be found.
java.lang.ClassCastException - The property value is not parsable to a URL.

getClassProperty

public java.lang.Class getClassProperty(java.lang.String name,
                                        java.lang.Class defl)
Get the Class object property with the given name.
Specified by:
getClassProperty in interface ORBLoader
Parameters:
name - the property name.
defl - default value to use if property not found.
Throws:
INITIALIZE - the property value cannot be loaded as a class.

getClassProperty

public java.lang.Class getClassProperty(java.lang.String name,
                                        java.lang.String defl)
Get the Class object property with the given name.
Specified by:
getClassProperty in interface ORBLoader
Parameters:
name - the property name.
defl - String name of default value to use if property not found.
Throws:
INITIALIZE - the property value or default class cannot be loaded as a class.

getClassProperty

public java.lang.Class getClassProperty(java.lang.String name)
                                 throws PropertyNotFoundException
Get the integer property with the given name.
Specified by:
getClassProperty in interface ORBLoader
Parameters:
name - the property name.
Throws:
PropertyNotFoundException - the property cannot be found.
INITIALIZE - the property value cannot be loaded as a class.

constructClass

public java.lang.Object constructClass(java.lang.String prop_key,
                                       java.lang.String defl,
                                       java.lang.Object[] args)
                                throws java.lang.reflect.InvocationTargetException
This operation is used to load a class with the given property name and default class name.
Specified by:
constructClass in interface ORBLoader
Parameters:
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.
Returns:
the newly constructed object, or null if the property value is set to the empty string.
Throws:
java.lang.reflect.InvocationTargetException - an exception occoured in the constructor.
INITIALIZE - the property value or default class cannot be loaded as a class.
java.lang.IllegalArgumentException - some other problem occoured.

constructClass

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
This operation is used to load a class with the given property name and default class name.
Specified by:
constructClass in interface ORBLoader
Parameters:
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.
Returns:
the newly constructed object, or null if the property value is set to the empty string.
Throws:
java.lang.reflect.InvocationTargetException - an exception occoured in the constructor.
INITIALIZE - the property value or default class cannot be loaded as a class.
java.lang.IllegalArgumentException - some other problem occoured.

classConstructor

public java.lang.reflect.Constructor classConstructor(java.lang.String prop_key,
                                                      java.lang.String defl,
                                                      java.lang.Class[] args_t)
Specified by:
classConstructor in interface ORBLoader