com.caucho.util
Class Registry

java.lang.Object
  |
  +--com.caucho.util.Registry

public final class Registry
extends java.lang.Object

The Registry is a configuration tree based on a key, value pair structure, essentially like an AList.


Constructor Summary
Registry()
           
 
Method Summary
static void addListener(ChangeListener listener)
           
 RegistryNode createNode(java.lang.String name, java.lang.String value)
          Create a new RegistryNode.
static boolean getBoolean(java.lang.String path, boolean deflt)
           
static int getChangeCount()
           
static QDate getDate(java.lang.String path, QDate deflt)
           
 java.util.ArrayList getDependList()
          Returns the dependency list.
static double getDouble(java.lang.String path, double deflt)
           
static int getInt(java.lang.String path, int deflt)
           
static java.lang.String getPath(java.lang.String path, java.lang.String deflt)
          Returns a configuration value, interpreted as a file path.
static long getPeriod(java.lang.String path, long deflt)
           
static Registry getRegistry()
          Returns the default registry.
static java.lang.String getString(java.lang.String path, java.lang.String deflt)
           
 RegistryNode getTop()
          Returns the top node.
 boolean isModified()
          Returns true if any of the source configuration files have changed.
static RegistryNode lookup(java.lang.String path)
          Looks up a registry node based on the path.
static Registry parse(Path path)
          Parses a registry tree from a file.
static Registry parse(ReadStream is)
          Parses a registry tree from a file.
static void removeListener(ChangeListener listener)
           
static Registry setDefault(Registry registry)
          Sets the default configuration
static Registry setRegistry(Registry registry)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Registry

public Registry()
Method Detail

createNode

public RegistryNode createNode(java.lang.String name,
                               java.lang.String value)
Create a new RegistryNode. Use is discouraged.
Parameters:
name - name of the node
value - value of the node
Returns:
the new node

isModified

public boolean isModified()
Returns true if any of the source configuration files have changed.

getDependList

public java.util.ArrayList getDependList()
Returns the dependency list.

getTop

public RegistryNode getTop()
Returns the top node.

parse

public static Registry parse(Path path)
                      throws java.io.IOException,
                             org.xml.sax.SAXException
Parses a registry tree from a file.
Parameters:
path - the file containing the configuration.
Returns:
the root of the configuration tree

parse

public static Registry parse(ReadStream is)
                      throws java.io.IOException,
                             org.xml.sax.SAXException
Parses a registry tree from a file.
Parameters:
is - a stream containing the configuration.
Returns:
the root of the configuration tree.

setDefault

public static Registry setDefault(Registry registry)
Sets the default configuration
Parameters:
registry - configuration to be used as the new default

setRegistry

public static Registry setRegistry(Registry registry)

getRegistry

public static Registry getRegistry()
Returns the default registry.

lookup

public static RegistryNode lookup(java.lang.String path)
Looks up a registry node based on the path.
Parameters:
path - relative path into the registry.

getBoolean

public static boolean getBoolean(java.lang.String path,
                                 boolean deflt)
                          throws RegistryException

getInt

public static int getInt(java.lang.String path,
                         int deflt)
                  throws RegistryException

getDouble

public static double getDouble(java.lang.String path,
                               double deflt)
                        throws RegistryException

getString

public static java.lang.String getString(java.lang.String path,
                                         java.lang.String deflt)

getPath

public static java.lang.String getPath(java.lang.String path,
                                       java.lang.String deflt)
Returns a configuration value, interpreted as a file path.
Parameters:
path - the registry path
deflt - default value if the configuration isn't specified.
Returns:
the matching registry value or null

getDate

public static QDate getDate(java.lang.String path,
                            QDate deflt)
                     throws RegistryException

getPeriod

public static long getPeriod(java.lang.String path,
                             long deflt)
                      throws RegistryException

addListener

public static void addListener(ChangeListener listener)

getChangeCount

public static int getChangeCount()

removeListener

public static void removeListener(ChangeListener listener)