org.openorb.CORBA.kernel
Class Properties

java.lang.Object
  |
  +--org.openorb.CORBA.kernel.Properties
All Implemented Interfaces:
org.apache.avalon.framework.logger.LogEnabled

public class Properties
extends java.lang.Object
implements org.apache.avalon.framework.logger.LogEnabled

This class contains all kernel properties.

Version:
$Revision: 1.12 $ $Date: 2002/07/16 11:20:52 $
Author:
Jerome Daniel

Constructor Summary
Properties()
           
 
Method Summary
 void addProperty(java.lang.String name, boolean value)
          Add a boolean property.
 void addProperty(java.lang.String name, java.lang.Class clz)
          Add a Class property.
 void addProperty(java.lang.String name, int value)
          Add an integer property.
 void addProperty(java.lang.String name, java.lang.String value)
          Add a string property.
 void addProperty(java.lang.String name, java.net.URL value)
          Add a URL property.
 void display()
          Display properties.
 void display(org.apache.avalon.framework.logger.Logger logger)
          Display properties.
 void enableLogging(org.apache.avalon.framework.logger.Logger logger)
          Setup current logger
 java.lang.String formatString(java.lang.String str)
          Format the string argument, replacing ${prop.name} with the value of the property.
 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 integer 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.
 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

Properties

public Properties()
Method Detail

enableLogging

public void enableLogging(org.apache.avalon.framework.logger.Logger logger)
Setup current logger
Specified by:
enableLogging in interface org.apache.avalon.framework.logger.LogEnabled

addProperty

public void addProperty(java.lang.String name,
                        java.lang.String value)
Add a string property.
Parameters:
name - the property name.
value - the property value. May be null to delete named property.

addProperty

public void addProperty(java.lang.String name,
                        int value)
Add an integer property.
Parameters:
name - the property name.
value - the property value.

addProperty

public void addProperty(java.lang.String name,
                        boolean value)
Add a boolean property.
Parameters:
name - the property name.
value - the property value.

addProperty

public void addProperty(java.lang.String name,
                        java.net.URL value)
Add a URL property.
Parameters:
name - the property name.
value - the property value.

addProperty

public void addProperty(java.lang.String name,
                        java.lang.Class clz)
Add a Class property.
Parameters:
name - the property name.
value - the property value. May be null to delete named property.

properties

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

Parameters:
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.
Returns:
unmodifiable iterator over the name's decendants.

display

public void display()
Display properties.

display

public void display(org.apache.avalon.framework.logger.Logger logger)
Display properties.

formatString

public java.lang.String formatString(java.lang.String str)
Format the string argument, replacing ${prop.name} with the value of the property. Any ${prop.url} at position 0 will result in the remainder of the string being resolved relative to the base URL.
Throws:
java.lang.IllegalArgumentException - if the string has unbalanced ${ }

getProperty

public Property getProperty(java.lang.String name)
Get the Property object with the given name.
Parameters:
name - the property name.
Returns:
the property, or null if none is defined.

getStringProperty

public java.lang.String getStringProperty(java.lang.String name,
                                          java.lang.String defl)
Get the string property with the given name.
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.
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.
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.
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. The default value is used if the property is missing. Property values of false or no are parsed as false, all other non-missing values are parsed as true.
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. The default value is used if the property is missing. Property values of false or no are parsed as false, all other non-missing values are parsed as true.
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.
Parameters:
name - the property name.
defl - default value to use if property not found.
Throws:
INITIALIZE - The property value is not parsable to a URL.

getURLProperty

public java.net.URL getURLProperty(java.lang.String name)
                            throws PropertyNotFoundException
Get the integer property with the given name.
Parameters:
name - the property name.
Throws:
PropertyNotFoundException - the property cannot be found.
INITIALIZE - The property value is not parsable to an int.

getClassProperty

public java.lang.Class getClassProperty(java.lang.String name,
                                        java.lang.Class defl)
Get the Class object property with the given name.
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.
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.
Parameters:
name - the property name.
Throws:
PropertyNotFoundException - the property cannot be found.
INITIALIZE - the property value cannot be loaded as a class.