com.rhi.architecture.lang
Class CompositeProperties

java.lang.Object
  extended byjava.util.Dictionary
      extended byjava.util.Hashtable
          extended byjava.util.Properties
              extended bycom.rhi.architecture.lang.CompositeProperties
All Implemented Interfaces:
java.lang.Cloneable, java.util.Map, java.io.Serializable

public class CompositeProperties
extends java.util.Properties

  This class resolves references in a properties file to other properties 
 files. Properties files are categorized in 2 classes for the explanation of 
 this class.
 
  1. Base properties - these are like base classes in OOP, and properties from these files are taken as defaults. These properties can be overridden by specifying in a more specific file. Base property files are identified by "base.include.files" entry. Multiple files can be specified separated by comma.
  2. Referenced properties - these are like object references from a class in OOP, properties from these files will be read and added to main properties file. These files are identified by entries starting with "include." *
Base properties file can have referenced properties file but not the other way round. This is done to limit features provided by this class to the necessary ones and to keep the class simple.

Author:
Vaibhav Ranjangaonkar
See Also:
PropertyUtils, PropertiesException, Serialized Form

Field Summary
 
Fields inherited from class java.util.Properties
defaults
 
Constructor Summary
CompositeProperties()
          default constructor
CompositeProperties(java.util.Properties plain)
          This constructor can be used if a Properties object is already existing, but the user would like to resolve any file inclusions it may contain.
CompositeProperties(java.lang.String fileName)
          constructor - loads a Property file of the provided name from the classpath.
 
Method Summary
 void load(java.io.InputStream is)
          load propery name/value pairs from an input stream.
 
Methods inherited from class java.util.Properties
getProperty, getProperty, list, list, propertyNames, save, setProperty, store
 
Methods inherited from class java.util.Hashtable
clear, clone, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keys, keySet, put, putAll, rehash, remove, size, toString, values
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CompositeProperties

public CompositeProperties()
default constructor


CompositeProperties

public CompositeProperties(java.lang.String fileName)
                    throws PropertiesException
constructor - loads a Property file of the provided name from the classpath. If it references any other properties files, they too are resolved.

Parameters:
fileName -
Throws:
PropertiesException

CompositeProperties

public CompositeProperties(java.util.Properties plain)
                    throws PropertiesException
This constructor can be used if a Properties object is already existing, but the user would like to resolve any file inclusions it may contain. It can be used to wrap Properties file from other components & present a Properties interface to a client.

Parameters:
plain -
Throws:
PropertiesException
Method Detail

load

public void load(java.io.InputStream is)
          throws java.io.IOException
load propery name/value pairs from an input stream. This is overridden by the CompositePropeties obj so that references can be resolved before the client sees the Properties object.

Parameters:
is - - InputStream containing properties.
Throws:
java.io.IOException


Copyright © 2002-2004 Robert Half International. All Rights Reserved.