org.codehaus.plexus.registry.commons
Class CommonsConfigurationRegistry

java.lang.Object
  extended by org.codehaus.plexus.logging.AbstractLogEnabled
      extended by org.codehaus.plexus.registry.commons.CommonsConfigurationRegistry
All Implemented Interfaces:
org.codehaus.plexus.logging.LogEnabled, org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable, org.codehaus.plexus.registry.Registry

public class CommonsConfigurationRegistry
extends org.codehaus.plexus.logging.AbstractLogEnabled
implements org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable, org.codehaus.plexus.registry.Registry

Implementation of the registry component using Commons Configuration. The use of Commons Configuration enables a variety of sources to be used, including XML files, properties, JNDI, JDBC, etc.

The component can be configured using the properties configuration item, the content of which should take the format of an input to the Commons Configuration configuration builder.


Field Summary
 
Fields inherited from interface org.codehaus.plexus.registry.Registry
ROLE
 
Constructor Summary
CommonsConfigurationRegistry()
           
 
Method Summary
 void addChangeListener(org.codehaus.plexus.registry.RegistryListener listener)
           
 void addConfigurationFromFile(java.io.File file)
           
 void addConfigurationFromFile(java.io.File file, java.lang.String prefix)
           
 void addConfigurationFromResource(java.lang.String resource)
           
 void addConfigurationFromResource(java.lang.String resource, java.lang.String prefix)
           
 java.lang.String dump()
           
 boolean getBoolean(java.lang.String key)
           
 boolean getBoolean(java.lang.String key, boolean defaultValue)
           
 int getInt(java.lang.String key)
           
 int getInt(java.lang.String key, int defaultValue)
           
 java.util.Collection getKeys()
           
 java.util.List getList(java.lang.String key)
           
 java.util.Properties getProperties(java.lang.String key)
           
 org.codehaus.plexus.registry.Registry getSection(java.lang.String name)
           
 java.lang.String getString(java.lang.String key)
           
 java.lang.String getString(java.lang.String key, java.lang.String defaultValue)
           
 org.codehaus.plexus.registry.Registry getSubset(java.lang.String key)
           
 java.util.List getSubsetList(java.lang.String key)
           
 void initialize()
           
 boolean isEmpty()
           
 void remove(java.lang.String key)
           
 void removeSubset(java.lang.String key)
           
 void save()
           
 void setBoolean(java.lang.String key, boolean value)
           
 void setInt(java.lang.String key, int value)
           
 void setProperties(org.codehaus.plexus.configuration.PlexusConfiguration properties)
           
 void setString(java.lang.String key, java.lang.String value)
           
 
Methods inherited from class org.codehaus.plexus.logging.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CommonsConfigurationRegistry

public CommonsConfigurationRegistry()
Method Detail

dump

public java.lang.String dump()
Specified by:
dump in interface org.codehaus.plexus.registry.Registry

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface org.codehaus.plexus.registry.Registry

getSubset

public org.codehaus.plexus.registry.Registry getSubset(java.lang.String key)
Specified by:
getSubset in interface org.codehaus.plexus.registry.Registry

getList

public java.util.List getList(java.lang.String key)
Specified by:
getList in interface org.codehaus.plexus.registry.Registry

getSubsetList

public java.util.List getSubsetList(java.lang.String key)
Specified by:
getSubsetList in interface org.codehaus.plexus.registry.Registry

getProperties

public java.util.Properties getProperties(java.lang.String key)
Specified by:
getProperties in interface org.codehaus.plexus.registry.Registry

save

public void save()
          throws org.codehaus.plexus.registry.RegistryException
Specified by:
save in interface org.codehaus.plexus.registry.Registry
Throws:
org.codehaus.plexus.registry.RegistryException

addChangeListener

public void addChangeListener(org.codehaus.plexus.registry.RegistryListener listener)
Specified by:
addChangeListener in interface org.codehaus.plexus.registry.Registry

getKeys

public java.util.Collection getKeys()
Specified by:
getKeys in interface org.codehaus.plexus.registry.Registry

remove

public void remove(java.lang.String key)
Specified by:
remove in interface org.codehaus.plexus.registry.Registry

removeSubset

public void removeSubset(java.lang.String key)
Specified by:
removeSubset in interface org.codehaus.plexus.registry.Registry

getString

public java.lang.String getString(java.lang.String key)
Specified by:
getString in interface org.codehaus.plexus.registry.Registry

getString

public java.lang.String getString(java.lang.String key,
                                  java.lang.String defaultValue)
Specified by:
getString in interface org.codehaus.plexus.registry.Registry

setString

public void setString(java.lang.String key,
                      java.lang.String value)
Specified by:
setString in interface org.codehaus.plexus.registry.Registry

getInt

public int getInt(java.lang.String key)
Specified by:
getInt in interface org.codehaus.plexus.registry.Registry

getInt

public int getInt(java.lang.String key,
                  int defaultValue)
Specified by:
getInt in interface org.codehaus.plexus.registry.Registry

setInt

public void setInt(java.lang.String key,
                   int value)
Specified by:
setInt in interface org.codehaus.plexus.registry.Registry

getBoolean

public boolean getBoolean(java.lang.String key)
Specified by:
getBoolean in interface org.codehaus.plexus.registry.Registry

getBoolean

public boolean getBoolean(java.lang.String key,
                          boolean defaultValue)
Specified by:
getBoolean in interface org.codehaus.plexus.registry.Registry

setBoolean

public void setBoolean(java.lang.String key,
                       boolean value)
Specified by:
setBoolean in interface org.codehaus.plexus.registry.Registry

addConfigurationFromResource

public void addConfigurationFromResource(java.lang.String resource)
                                  throws org.codehaus.plexus.registry.RegistryException
Specified by:
addConfigurationFromResource in interface org.codehaus.plexus.registry.Registry
Throws:
org.codehaus.plexus.registry.RegistryException

addConfigurationFromResource

public void addConfigurationFromResource(java.lang.String resource,
                                         java.lang.String prefix)
                                  throws org.codehaus.plexus.registry.RegistryException
Specified by:
addConfigurationFromResource in interface org.codehaus.plexus.registry.Registry
Throws:
org.codehaus.plexus.registry.RegistryException

addConfigurationFromFile

public void addConfigurationFromFile(java.io.File file)
                              throws org.codehaus.plexus.registry.RegistryException
Specified by:
addConfigurationFromFile in interface org.codehaus.plexus.registry.Registry
Throws:
org.codehaus.plexus.registry.RegistryException

addConfigurationFromFile

public void addConfigurationFromFile(java.io.File file,
                                     java.lang.String prefix)
                              throws org.codehaus.plexus.registry.RegistryException
Specified by:
addConfigurationFromFile in interface org.codehaus.plexus.registry.Registry
Throws:
org.codehaus.plexus.registry.RegistryException

initialize

public void initialize()
                throws org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException
Specified by:
initialize in interface org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable
Throws:
org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException

setProperties

public void setProperties(org.codehaus.plexus.configuration.PlexusConfiguration properties)

getSection

public org.codehaus.plexus.registry.Registry getSection(java.lang.String name)
Specified by:
getSection in interface org.codehaus.plexus.registry.Registry


Copyright © 2001-2010 Codehaus. All Rights Reserved.