jade.util
Class EnhancedProperties

java.lang.Object
  |
  +--jade.util.BasicProperties
        |
        +--jade.util.ImportableProperties
              |
              +--jade.util.EnhancedProperties
Direct Known Subclasses:
ExpandedProperties

public class EnhancedProperties
extends ImportableProperties

Provides a concrete implementation of ImportableProperties useable in the J2SE (desktop) world. This class relates to four others as follows:

  1. BasicProperties - This class provides the foundation class. It is designed to be usable in the restrictive J2ME CLDC environment. It provides enhanced property management as well as providing support for values containing strings of the form ${key}.
  2. ImportableProperties - This abstract class extends BasicProperties and serves as a basis for supporting the ability to import properties from files. Those files may also contain further import dirrectives. It is also usable in the restrictive J2ME CLDC environment. Since file support will be handled differently in different environments, it contains one abstract method fileReader which given the name of a file (its URL) must return a Reader object. Extending classes will provide that method in a suitable fashion. For example, in the desktop world this would be:
          return new InputStreamReader(new FileInputStream(aFileName));
     
    whereas in the CLDC environment it would be:
     
          return new InputStreamReader(Connector.openInputStream(aFileName));
     
  3. ExpandedProperties - Extends EnhancedProperties and adds support for fetching system environment variables (those usable from the OS shell). This class would need to be carefully considered in different environments.
  4. PropertiesException - Extends RuntimeException and is thrown under various error conditions by these classes.

    Author:
    Dick Cowan - HP Labs

    Constructor Summary
    EnhancedProperties()
              Construct empty property collection.
    EnhancedProperties(java.lang.String aFileName)
              Construct properties from specified file.
    EnhancedProperties(java.lang.String[] theArgs)
              Construct properties from arguments.
     
    Method Summary
    protected  java.io.Reader fileReader(java.lang.String aFileName)
              Construct a Reader for the specified file name.
    static void main(java.lang.String[] args)
              For testing.
     
    Methods inherited from class jade.util.ImportableProperties
    addFromFile, getImportKey, setImportKey, storableProperty
     
    Methods inherited from class jade.util.BasicProperties
    addFromReader, copyProperties, doSubstitutions, doSubstitutions, extractSubset, get, getBooleanProperty, getEnvironmentProperty, getIntProperty, getOneLine, getProperty, getProperty, getPropertyIgnoreCase, getRawProperty, isCandidate, isolateKey, isolateValue, keys, list, load, nextArgIndex, parseArgs, parseArgument, prepareArgs, put, readLine, renameKey, setBooleanProperty, setIntProperty, setProperty, setPropertyIfNot, sortedKeys, specialHandling, store, toStringArray, valueFilter
     
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
     

    Constructor Detail

    EnhancedProperties

    public EnhancedProperties()
    Construct empty property collection.

    EnhancedProperties

    public EnhancedProperties(java.lang.String[] theArgs)
    Construct properties from arguments.
    Parameters:
    theArgs - The applications original arguments.

    EnhancedProperties

    public EnhancedProperties(java.lang.String aFileName)
                       throws java.io.IOException
    Construct properties from specified file.
    Parameters:
    aFileName - The name of the properties file.
    Throws:
    java.io.IOException - if anything goes wrong.
    Method Detail

    main

    public static void main(java.lang.String[] args)
    For testing. Simply pass command line arguments to constructor then display all key=value pairs using sorted enumeration.

    fileReader

    protected java.io.Reader fileReader(java.lang.String aFileName)
                                 throws java.io.IOException
    Construct a Reader for the specified file name.
    Overrides:
    fileReader in class ImportableProperties
    Parameters:
    aFileName - The name of the file.
    Returns:
    Reader The reader for the file.
    Throws:
    java.io.IOException - if anything goes wrong.