org.codehaus.plexus.registry.naming
Class NamingRegistry

java.lang.Object
  extended by org.codehaus.plexus.logging.AbstractLogEnabled
      extended by org.codehaus.plexus.registry.naming.NamingRegistry
All Implemented Interfaces:
org.codehaus.plexus.logging.LogEnabled, org.codehaus.plexus.registry.Registry
Direct Known Subclasses:
EmptyNamingRegistry

public class NamingRegistry
extends org.codehaus.plexus.logging.AbstractLogEnabled
implements org.codehaus.plexus.registry.Registry

Since:
8 feb. 07
Version:
$Id: NamingRegistry.java 6034 2007-03-07 22:48:07Z brett $
Author:
olamy

Field Summary
private  javax.naming.Context baseContext
           
private  org.codehaus.plexus.naming.Naming naming
          can be null if useDefaultNaming (new InitialContext)
private  java.util.List registryListeners
           
private  boolean useDefaultNaming
           
 
Fields inherited from interface org.codehaus.plexus.registry.Registry
ROLE
 
Constructor Summary
  NamingRegistry()
           
private NamingRegistry(javax.naming.Context baseContext)
          this is use in order to return SubRegistry (reason of private)
 
Method Summary
 void addChangeListener(org.codehaus.plexus.registry.RegistryListener registryListener)
           
 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()
           
private  javax.naming.Context getBaseContext()
           
 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)
           
private  java.lang.Object getObject(java.lang.String key)
           
 java.util.Properties getProperties(java.lang.String key)
           
 org.codehaus.plexus.registry.Registry getSection(java.lang.String name)
          do same as getSubset
 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)
           
 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 setString(java.lang.String key, java.lang.String value)
           
private  void setValue(java.lang.String value, java.lang.String javaClassName, java.lang.String key)
           
 
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
 

Field Detail

naming

private org.codehaus.plexus.naming.Naming naming
can be null if useDefaultNaming (new InitialContext)


useDefaultNaming

private boolean useDefaultNaming

baseContext

private javax.naming.Context baseContext

registryListeners

private java.util.List registryListeners
Constructor Detail

NamingRegistry

public NamingRegistry()

NamingRegistry

private NamingRegistry(javax.naming.Context baseContext)
this is use in order to return SubRegistry (reason of private)

Parameters:
baseContext -
Method Detail

getBaseContext

private javax.naming.Context getBaseContext()
                                     throws javax.naming.NamingException
Throws:
javax.naming.NamingException

getObject

private java.lang.Object getObject(java.lang.String key)
                            throws javax.naming.NamingException,
                                   javax.naming.NameNotFoundException
Throws:
javax.naming.NamingException
javax.naming.NameNotFoundException

getBoolean

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

getBoolean

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

getInt

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

getInt

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

getString

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

getString

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

getList

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

getSubset

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

getKeys

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

getProperties

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

getSection

public org.codehaus.plexus.registry.Registry getSection(java.lang.String name)
do same as getSubset

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

getSubsetList

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

isEmpty

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

dump

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

addChangeListener

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

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
See Also:
Registry.addConfigurationFromFile(java.io.File)

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
See Also:
Registry.addConfigurationFromResource(java.lang.String)

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

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

save

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

setBoolean

public void setBoolean(java.lang.String key,
                       boolean value)
Specified by:
setBoolean 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

setString

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

setValue

private void setValue(java.lang.String value,
                      java.lang.String javaClassName,
                      java.lang.String key)
               throws javax.naming.NamingException
Throws:
javax.naming.NamingException

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