Novell exteNd
Director 5.2 API

com.sssw.fw.api
Interface EbiConfig

All Superinterfaces:
Serializable

public interface EbiConfig
extends Serializable

Interface for managing configuration properties. Its methods let you get and set properties in the Director configuration files. The files for the Director subsystems, all called config.xml, are in the subsystem-name-conf subdirectory of the corresponding subsystem-nameService.jar. The boot servlet of the Director EAR loads all subsystem configuration files into memory. It also loads config.xml from any portal WARs in the EAR. You can use an EbiConfig object to access all the configuration properties in your application.

You get the EbiConfig object from fw.factory.EboFactory:

   EbiConfig config = com.sssw.fw.factory.EboFactory.getConfig();
 

You can reload configuration files by setting up an InputStream for the file and calling the load() method. The configuration file you load must be valid; it must be an XML file that uses the following elements:

<properties>
    <property>
       <key>keyname</key> 
       <value>data</value> 
    </property>
    <property>...</property>
 </properties>
 

Changes you make to property values are in memory only. They are in effect until the server is rebooted or the config.xml file is reloaded. To make permanent changes, you need to edit the config.xml file and redeploy the EAR.

Although a config.xml file is text, property values can have a data type based on their actual value. If the value element has the values of true or false, the property's data type is boolean. If the value element consists of digits, it is considered numeric. Although you can get any of these values as a String, using the typed methods does the data type conversion for you.


Field Summary
static String EL_FW_Config
          Director element type for an EbiConfig object.
 
Method Summary
 boolean getBooleanProperty(String property, boolean defaultvalue)
          Gets a property that has a boolean value.
 Map getContains(String contains)
          Returns a Map of property key/value pairs whose keys contain the specified value.
 Map getEndsWith(String endsWith)
          Returns a Map of property key/value pairs whose keys end with the specified value.
 long getLongProperty(String propertyname, long defaultvalue)
          Gets a property that has a numeric value.
 String getProperty(String propertyname)
          Gets the value of a property as a String value.
 String getProperty(String propertyname, String defaultvalue)
          Gets the value of a property as a String value or substitutes a default value.
 String[] getPropertyNames(String value, boolean caseSensitive)
          Returns the list of names of properties whose value is equal to the passed in value.
 Map getStartsWith(String startsWith)
          Returns a Map of property key/value pairs whose keys start with the specified value.
 boolean isDefined(String propertyname)
          Checks whether a property exists in the configuration file.
 Set keySet()
          Gets a Set of all the keys in all the currently loaded configuration files.
 void load(InputStream in)
          Loads a configuration file into the EbiConfig object.
 void setBooleanProperty(String property, boolean value)
          Sets a property that has a boolean value.
 void setLongProperty(String property, long value)
          Sets a property that has a numeric value.
 void setProperty(String property, String value)
          Sets a property that has a String value.
 void systemOut(Map map)
          Prints the contents of a Map to System.out.
 

Field Detail

EL_FW_Config

public static final String EL_FW_Config
Director element type for an EbiConfig object.
Method Detail

systemOut

public void systemOut(Map map)
Prints the contents of a Map to System.out. This utility method is provided as a convenience for debugging configuration files.
Parameters:
map - The Map object to print.

load

public void load(InputStream in)
          throws EboUnrecoverableSystemException
Loads a configuration file into the EbiConfig object. For information about valid configuration files, see EbiConfig. Reloading a configuration file for a subsystem or portal WAR replaces any property values that you have set.
Parameters:
in - An input stream to a valid config.xml document.

getProperty

public String getProperty(String propertyname)
Gets the value of a property as a String value.
Parameters:
property - The name of a property.
Returns:
A String that is the value of the specified property.

getProperty

public String getProperty(String propertyname,
                          String defaultvalue)
Gets the value of a property as a String value or substitutes a default value. If the property is not present in the configuration file, The default value you specify is returned instead.
Parameters:
property - The name of a property.
defaultvalue - The value to return if the property is not defined.
Returns:
A String that is the value of the specified property or the specified default value if the property does not exist.

getBooleanProperty

public boolean getBooleanProperty(String property,
                                  boolean defaultvalue)
Gets a property that has a boolean value.
Parameters:
property - The name of a property.
Returns:
A boolean that is the value of the specified property.

getLongProperty

public long getLongProperty(String propertyname,
                            long defaultvalue)
Gets a property that has a numeric value.
Parameters:
property - The name of a property.
Returns:
A long that is the value of the specified property.

setProperty

public void setProperty(String property,
                        String value)
                 throws EboDataException
Sets a property that has a String value.
Parameters:
property - The name of a property.
value - The String value you want to assign to the property.
Throws:
EboDataException - if the property is not updated successfully.

setLongProperty

public void setLongProperty(String property,
                            long value)
                     throws EboDataException
Sets a property that has a numeric value.
Parameters:
property - The name of a property.
value - The long value you want to assign to the property.
Throws:
EboDataException - if the property is not updated successfully.

setBooleanProperty

public void setBooleanProperty(String property,
                               boolean value)
                        throws EboDataException
Sets a property that has a boolean value.
Parameters:
property - The name of a property.
value - The boolean value you want to assign to the property.
Throws:
EboDataException - if the property is not updated successfully.

isDefined

public boolean isDefined(String propertyname)
Checks whether a property exists in the configuration file.
Parameters:
property - The name of a property.
Returns:
Boolean true if the property is a valid property, false if the property does not exist.

getStartsWith

public Map getStartsWith(String startsWith)
Returns a Map of property key/value pairs whose keys start with the specified value.
Parameters:
startsWith - String specifying the starting text of the keys you are searching for.
Returns:
Map of the property elements matching the criteria.

getEndsWith

public Map getEndsWith(String endsWith)
Returns a Map of property key/value pairs whose keys end with the specified value.
Parameters:
endsWith - String specifying the ending text of the keys you are searching for.
Returns:
Map of the property elements matching the criteria.

getContains

public Map getContains(String contains)
Returns a Map of property key/value pairs whose keys contain the specified value.
Parameters:
startsWith - String specifying text that appears in the keys you are searching for.
Returns:
Map of the elements matching the criteria.

keySet

public Set keySet()
Gets a Set of all the keys in all the currently loaded configuration files.
Returns:
Set of the keys in the config.xml file.

getPropertyNames

public String[] getPropertyNames(String value,
                                 boolean caseSensitive)
Returns the list of names of properties whose value is equal to the passed in value.
Parameters:
value - The value for which to find property names.
caseSensitive - If true, make the search case-sensitive.
Returns:
The list of names of matching properties; empty if no matches.

Novell exteNd
Director 5.2 API