Nitido Inc.

com.nitido.qabase
Class FileConfigurator

java.lang.Object
  extended by com.nitido.qabase.Configurator
      extended by com.nitido.qabase.FileConfigurator

public class FileConfigurator
extends Configurator

This Configurator implementation will retrieve the settings directly from the URL specified.


Field Summary
protected  java.lang.String _instanceName
           
protected  java.util.Hashtable _sections
           
static java.lang.String SECTION_DEFAULT
          The name of the default section used by the Configurator.
static java.lang.String SECTION_LOGGER_ROOT
          The section for Log4j's Root Category settings.
 
Constructor Summary
protected FileConfigurator(java.lang.String instanceName, Configurator inConfig)
          Copy Constructor.
  FileConfigurator(java.lang.String instanceName, java.lang.String identifier)
          Default constructor.
 
Method Summary
 void append(Configurator appendConfig)
          Append the information from the specified incoming configurator.
 void append(java.lang.String identifier)
          Append to the Configurator with the information specified by the identifier.
protected  Configurator clone(java.lang.String instanceName)
          Create a cloned configurator with the same properties settings, but with the specified instanceName.
 java.util.Properties getProperties(java.lang.String section)
          Retrieve the Properties associated to the section.
 java.lang.String getProperty(java.lang.String key)
          Retrieve the specified property value from the default section.
 java.lang.String getProperty(java.lang.String section, java.lang.String key)
          Retrieve the specified property value.
 java.util.Enumeration getPropertyNames(java.lang.String section)
          Get all property names stored under the specific section.
 java.lang.String getPropertyWithDefault(java.lang.String key, java.lang.String defaultValue)
          Retrieve the specified property value from the default section.
 java.lang.String getPropertyWithDefault(java.lang.String section, java.lang.String key, java.lang.String defaultValue)
          Retrieve the specified property value.
 java.util.Enumeration getSectionNames()
          Retrieve all section names stored by this Configurator instance.
 void prepend(Configurator prependConfig)
          Prepend the information from the specified incoming configurator.
 void prepend(java.lang.String identifier)
          Prepend to the Configurator with the information specificed by the prependIdentifier.
 void setProperty(java.lang.String section, java.lang.String name, java.lang.String value)
          Set a specific property value.
 
Methods inherited from class com.nitido.qabase.Configurator
getInstance, getInstance, getInstanceNames
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_sections

protected java.util.Hashtable _sections

_instanceName

protected java.lang.String _instanceName

SECTION_DEFAULT

public static final java.lang.String SECTION_DEFAULT
The name of the default section used by the Configurator. This section name will be used if the section parameter is not specified in some of the methods.

See Also:
Constant Field Values

SECTION_LOGGER_ROOT

public static final java.lang.String SECTION_LOGGER_ROOT
The section for Log4j's Root Category settings. This section must be resides in the config file for the FIRST Configurator ONLY. Otherwise, setting the Root Category in later stage will overwrite all previous Log4j settings.

See Also:
Constant Field Values
Constructor Detail

FileConfigurator

public FileConfigurator(java.lang.String instanceName,
                        java.lang.String identifier)
Default constructor.

Parameters:
instanceName - the name of this Configurator instance.
identifier - the identifier string. (The URL)
See Also:
append( String )

FileConfigurator

protected FileConfigurator(java.lang.String instanceName,
                           Configurator inConfig)
Copy Constructor.

Method Detail

clone

protected Configurator clone(java.lang.String instanceName)
Description copied from class: Configurator
Create a cloned configurator with the same properties settings, but with the specified instanceName. This method should not be invoked by other object!

Specified by:
clone in class Configurator

getProperty

public java.lang.String getProperty(java.lang.String key)
Description copied from class: Configurator
Retrieve the specified property value from the default section.

Specified by:
getProperty in class Configurator
Parameters:
key - the key of the property.
Returns:
the String value of the specified property. The method will return null object if the property has not been declared.

getProperty

public java.lang.String getProperty(java.lang.String section,
                                    java.lang.String key)
Description copied from class: Configurator
Retrieve the specified property value.

Specified by:
getProperty in class Configurator
Parameters:
section - the section name.
key - the key of the property.
Returns:
the String value of the specified property. The method will return null object if the property has not been declared.

getPropertyWithDefault

public java.lang.String getPropertyWithDefault(java.lang.String key,
                                               java.lang.String defaultValue)
Description copied from class: Configurator
Retrieve the specified property value from the default section. If the specified value is not found, it returns the defaultValue.

Specified by:
getPropertyWithDefault in class Configurator
Parameters:
key - the key of the property.
defaultValue - the default value to be returned in case the property is not found.
Returns:
the String value of the specified property. The method will return the default value if the property has not been declared.

getPropertyWithDefault

public java.lang.String getPropertyWithDefault(java.lang.String section,
                                               java.lang.String key,
                                               java.lang.String defaultValue)
Description copied from class: Configurator
Retrieve the specified property value. If the specified value is not found, it returns the defaultValue.

Specified by:
getPropertyWithDefault in class Configurator
Parameters:
section - the section name
key - the key of the property
Returns:
the String value of the specified property. The method will return the default value if the property has not been declared.

append

public void append(Configurator appendConfig)
Description copied from class: Configurator
Append the information from the specified incoming configurator. If the same section name exists in both Configurator object, this method will go through each property in the appendConfig object and append the values one by one. If a property in this object has a value already, it will be replaced by the value from the appendConfig.

In other words, all the property values stored in this oject before will remain the same only if the appendConfig has no value associated to the same property.

Specified by:
append in class Configurator
Parameters:
appendConfig - the Configurator object whose value is going to be appended to this Configurator.
See Also:
Configurator.prepend( Configurator )

prepend

public void prepend(Configurator prependConfig)
Description copied from class: Configurator
Prepend the information from the specified incoming configurator. This method behaves similar to append( Configurator ) except it would NOT replace any value stored in this object. It will go through each property in the prependConfig and insert the value into this object only if the property doesn't exists.

In other words, this method will not affect any property values that are already stored in this object before its invocation.

Specified by:
prepend in class Configurator
See Also:
Configurator.append( Configurator )

append

public void append(java.lang.String identifier)
Description copied from class: Configurator
Append to the Configurator with the information specified by the identifier. The exact interpretation and syntax of the parameter identifier depends on the implementation.

Specified by:
append in class Configurator
Parameters:
identifier - The string which has the information required by the Configurator implementation.

prepend

public void prepend(java.lang.String identifier)
Description copied from class: Configurator
Prepend to the Configurator with the information specificed by the prependIdentifier. This method behaves similar to append( String ) except it would NOT replace any value stored in this object. It will go through each property in the prependConfig and insert the value into this object only if the property doesn't exists.

In other words, this method will not affect any property values that are already stored in this object before its invocation.

Specified by:
prepend in class Configurator
See Also:
Configurator.append( String )

setProperty

public void setProperty(java.lang.String section,
                        java.lang.String name,
                        java.lang.String value)
Description copied from class: Configurator
Set a specific property value.

Specified by:
setProperty in class Configurator
Parameters:
section - the section name
name - the name of the property
value - the value of the property

getProperties

public java.util.Properties getProperties(java.lang.String section)
Description copied from class: Configurator
Retrieve the Properties associated to the section.

REMINDER: The Properties object returned by this method should be a cloned version of the one stored by the Configurator. Thus, developers are free to do whatever he/she want on the returned Properties object without worrying screwing up other modules using the same Configurator.

If the developer need to set a property value that affect the whole system, the setProperty( action, name, value ) should be invoked instead.

Specified by:
getProperties in class Configurator
Parameters:
section - the section name
Returns:
the Properties object associated to the section. If the specified section doesn't have any properties, it will return null.
See Also:
Configurator.setProperty( String, String, String )

getSectionNames

public java.util.Enumeration getSectionNames()
Description copied from class: Configurator
Retrieve all section names stored by this Configurator instance.

Specified by:
getSectionNames in class Configurator
Returns:
An enumeration of all the section names under this configurator. If there is no property stored, this method will return an empty Enumeration object.

getPropertyNames

public java.util.Enumeration getPropertyNames(java.lang.String section)
Description copied from class: Configurator
Get all property names stored under the specific section.

Specified by:
getPropertyNames in class Configurator
Parameters:
section - the section name.
Returns:
An enumeration of all the property names under the section. If the section name is invalid or there is no property stored, this method will return an empty Enumeration object.

Nitido NiM 2.5 Java API

These JavaDoc pages are generated for release/nim_2_5-2.5.44

Copyright © 1999-2009 Nitido Inc.    Proprietary and Confidential.    All Rights Reserved.