Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## drm.util
Class ConfigProperties

    java.lang.Object
      |
      +--java.util.Dictionary
            |
            +--java.util.Hashtable
                  |
                  +--java.util.Properties
                        |
                        +--drm.util.ConfigProperties

All Implemented Interfaces:
  java.lang.Cloneable, java.util.Map, java.io.Serializable

public class ConfigProperties
extends java.util.Properties

Class for handling configuration files. Extends the functionality of Properties by handling files, system resources and command lines.

See Also:
  Serialized Form

Inner classes inherited from class java.util.Map
`java.util.Map.Entry`

Fields inherited from class java.util.Properties
`defaults`

Constructor Summary
`ConfigProperties()` Calls the Properties onstructor.
`ConfigProperties(java.util.Properties props)` Calls the Properties onstructor.
`ConfigProperties(java.lang.String fileName)` Constructs a ConfigProperty object by loading a file.
`ConfigProperties(java.lang.String[] pars, java.lang.String resource)` Constructs a ConfigProperty object from a parameter list.

Method Summary
`void` | `load(java.lang.String fileName)` Loads given file.
`void` | `loadCommandLineDefs(java.lang.String[] cl)` Appends properties defined in the given command line arg list.
`void` | `loadSystemResource(java.lang.String n)` Adds the properties from the given property file.

Methods inherited from class java.util.Properties
`getProperty, getProperty, list, list, load, 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

### ConfigProperties

    public ConfigProperties()

  Calls the Properties onstructor.

### ConfigProperties

    public ConfigProperties(java.lang.String[] pars,
                            java.lang.String resource)

  Constructs a ConfigProperty object from a parameter list. The algorithm is as follows: first `resource` is used to attempt loading default values from the give system resource. Then pars[0] is tried if it is an existing filename. If it is, reading properties from that file is attempted. Then (if pars[0] was a filename then from index 0 otherwise from index 1) pars is loaded as if it was a command line argument list using `loadCommandLineDefs`. A little inconvinience is that if pars[0] is supposed to be the first command line argument but it is a valid filename at the same time by accident. The caller must take care of that. No exceptions are thrown, instead error messages are written to the standard error. Users who want a finer control should use the public methods of this class.
  Parameters:
    `pars` - The (probably command line) parameter list.
    `resource` - The name of the system resource that contains the defaults. null if there isn't any.

### ConfigProperties

    public ConfigProperties(java.lang.String fileName)
                     throws java.io.IOException

  Constructs a ConfigProperty object by loading a file.
  Parameters:
    `fileName` - The name of the configuration file.

### ConfigProperties

    public ConfigProperties(java.util.Properties props)

  Calls the Properties onstructor.

Method Detail

### load

    public void load(java.lang.String fileName)
              throws java.io.IOException

  Loads given file. Calls `Properties.load` with a file input stream to the given file.

### loadSystemResource

    public void loadSystemResource(java.lang.String n)
                            throws java.io.IOException

  Adds the properties from the given property file. Searches in the class path for the file with the given name.

### loadCommandLineDefs

    public void loadCommandLineDefs(java.lang.String[] cl)
                             throws java.io.IOException

  Appends properties defined in the given command line arg list. Every string in the array is considered as a property file line. The strings are converted to byte arrays according to the default character encoding and then the properties are loaded by the `Properties.load` method. This means that the ISO-8859-1 (or compatible) encoding is assumed.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD