com.bbn.swede.core.libraries
Class AbstractConfiguration

java.lang.Object
  extended bycom.bbn.swede.core.libraries.AbstractConfiguration
All Implemented Interfaces:
IConfiguration
Direct Known Subclasses:
LibraryConfiguration, LibraryEntryConfiguration

public abstract class AbstractConfiguration
extends Object
implements IConfiguration

Abstract implementation of IConfiguration. Uses two Properties objects and the IConfiguration.USER_SUFFIX and IConfiguration.SYSTEM_SUFFIX values to implement the functionality specified by IConfiguration.

Author:
aperezlo

Field Summary
 
Fields inherited from interface com.bbn.swede.core.libraries.IConfiguration
SYSTEM_SUFFIX, USER_SUFFIX
 
Constructor Summary
AbstractConfiguration()
           
 
Method Summary
 Properties getProperties()
          This method returns a single Properties object with all of the properties (both System and User).
abstract  IConfigurationValidator getPropertiesValidator()
          Returns an IConfigurationValidator object capable of validating this IConfiguration object.
 Properties getSystemProperties()
          Retrieves all system properties for this configuration.
 String getSystemProperty(String key)
          Accessor method to get a System property.
 Properties getUserProperties()
          Retrieves all user properties for this configuration.
 String getUserProperty(String key)
          Accessor method to get a User property.
 void load(InputStream in)
          Loads a set of System and User properties from a file.
 void removeSystemProperty(String key)
          Mutator method to remove a System property.
 void removeUserProperty(String key)
          Mutator method to remove a User property.
 void setProperties(Properties in)
          This method is used to set System and User properties in a single operation.
 void setSystemProperties(Properties p)
          Mutator method for IConfiguration.
 void setSystemProperty(String key, String value)
          Mutator method to set a System property.
 void setUserProperties(Properties p)
          Mutator method for IConfiguration.
 void setUserProperty(String key, String value)
          Mutator method to set a User property.
 void store(OutputStream out, String header)
          Stores a set of System and User properties in a file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.bbn.swede.core.libraries.IConfiguration
getName
 

Constructor Detail

AbstractConfiguration

public AbstractConfiguration()
Method Detail

getSystemProperties

public Properties getSystemProperties()
Description copied from interface: IConfiguration
Retrieves all system properties for this configuration.

Specified by:
getSystemProperties in interface IConfiguration
Returns:
a Properties class containing all of the System properties.

getUserProperties

public Properties getUserProperties()
Description copied from interface: IConfiguration
Retrieves all user properties for this configuration.

Specified by:
getUserProperties in interface IConfiguration
Returns:
a Properties class containing all of the User properties.

load

public void load(InputStream in)
          throws IOException
Description copied from interface: IConfiguration
Loads a set of System and User properties from a file. The behaviour of this method mimics that of Properties.load(java.io.InputStream).

Specified by:
load in interface IConfiguration
Parameters:
in - The input stream
Throws:
IOException - if an error occured when reading from the input stream
See Also:
Properties.load(java.io.InputStream)

setProperties

public void setProperties(Properties in)
Description copied from interface: IConfiguration
This method is used to set System and User properties in a single operation. The method by which this is accomplished is specific to the implementation of the interface.

Specified by:
setProperties in interface IConfiguration
Parameters:
in - a single Properties object containing all of the System and User properties.

removeSystemProperty

public void removeSystemProperty(String key)
Description copied from interface: IConfiguration
Mutator method to remove a System property.

Specified by:
removeSystemProperty in interface IConfiguration
Parameters:
key - the key to remove from the System properties

removeUserProperty

public void removeUserProperty(String key)
Description copied from interface: IConfiguration
Mutator method to remove a User property.

Specified by:
removeUserProperty in interface IConfiguration
Parameters:
key - the key to be removed from the User properties

setSystemProperties

public void setSystemProperties(Properties p)
Description copied from interface: IConfiguration
Mutator method for IConfiguration.

Specified by:
setSystemProperties in interface IConfiguration
Parameters:
p - a Properties containing all of the System properties

setUserProperties

public void setUserProperties(Properties p)
Description copied from interface: IConfiguration
Mutator method for IConfiguration.

Specified by:
setUserProperties in interface IConfiguration
Parameters:
p - a Properties containing all of the User properties

setSystemProperty

public void setSystemProperty(String key,
                              String value)
Description copied from interface: IConfiguration
Mutator method to set a System property.

Specified by:
setSystemProperty in interface IConfiguration
Parameters:
key - the key
value - the value associated with key

setUserProperty

public void setUserProperty(String key,
                            String value)
Description copied from interface: IConfiguration
Mutator method to set a User property.

Specified by:
setUserProperty in interface IConfiguration
Parameters:
key - the key
value - the value associated with key

getProperties

public Properties getProperties()
This method returns a single Properties object with all of the properties (both System and User). Each user property (i.e. those that have been added with setUserProperty(java.lang.String, java.lang.String)) will appear in the returned object with the value of IConfiguration.USER_SUFFIX appended, and System properties will similarly have IConfiguration.SYSTEM_SUFFIX appended.

Specified by:
getProperties in interface IConfiguration
Returns:
p a single Properties object containing all of the System and User properties.
See Also:
IConfiguration.getProperties()

store

public void store(OutputStream out,
                  String header)
           throws IOException
Description copied from interface: IConfiguration
Stores a set of System and User properties in a file. The behaviour of this method mimics that of Properties.store(java.io.OutputStream, java.lang.String).

Specified by:
store in interface IConfiguration
Parameters:
out - A property stream
header - A description of the property list
Throws:
IOException - if an error occurred writing to the output stream
See Also:
Properties.store(java.io.OutputStream, java.lang.String)

getPropertiesValidator

public abstract IConfigurationValidator getPropertiesValidator()
Description copied from interface: IConfiguration
Returns an IConfigurationValidator object capable of validating this IConfiguration object.

Specified by:
getPropertiesValidator in interface IConfiguration
Returns:
an appropriate IConfigurationValidator object

getSystemProperty

public String getSystemProperty(String key)
Description copied from interface: IConfiguration
Accessor method to get a System property.

Specified by:
getSystemProperty in interface IConfiguration
Parameters:
key - the key
Returns:
value the value associated with key

getUserProperty

public String getUserProperty(String key)
Description copied from interface: IConfiguration
Accessor method to get a User property.

Specified by:
getUserProperty in interface IConfiguration
Parameters:
key - the key
Returns:
value the value associated with key


Copyright © 2004-2005 BBN Technologies. All Rights Reserved.