org.opends.server.config
Class ConfigEntry

java.lang.Object
  extended by org.opends.server.config.ConfigEntry

@PublicAPI(stability=VOLATILE,
           mayInstantiate=true,
           mayExtend=false,
           mayInvoke=true)
public final class ConfigEntry
extends java.lang.Object

This class defines a configuration entry, which can hold zero or more attributes that may control the configuration of various components of the Directory Server.


Constructor Summary
ConfigEntry(Entry entry, ConfigEntry parent)
          Creates a new config entry with the provided information.
 
Method Summary
 void addChild(ConfigEntry childEntry)
          Adds the specified entry as a child of this configuration entry.
 void deregisterAddListener(ConfigAddListener listener)
          Deregisters the provided add listener so that it will no longer be notified if any new entries are added immediately below this configuration entry.
 boolean deregisterChangeListener(ConfigChangeListener listener)
          Attempts to deregister the provided change listener with this configuration entry.
 void deregisterDeleteListener(ConfigDeleteListener listener)
          Deregisters the provided delete listener so that it will no longer be notified if any new are removed immediately below this configuration entry.
 ConfigEntry duplicate()
          Creates a duplicate of this configuration entry that should be used when making changes to this entry.
 java.util.concurrent.CopyOnWriteArrayList<ConfigAddListener> getAddListeners()
          Retrieves the set of config add listeners that have been registered for this entry.
 java.util.concurrent.CopyOnWriteArrayList<ConfigChangeListener> getChangeListeners()
          Retrieves the set of change listeners that have been registered with this configuration entry.
 java.util.concurrent.ConcurrentHashMap<DN,ConfigEntry> getChildren()
          Retrieves the set of children associated with this configuration entry.
 ConfigAttribute getConfigAttribute(ConfigAttribute stub)
          Retrieves the specified configuration attribute from this configuration entry.
 java.util.concurrent.CopyOnWriteArrayList<ConfigDeleteListener> getDeleteListeners()
          Retrieves the set of config delete listeners that have been registered for this entry.
 DN getDN()
          Retrieves the DN for this configuration entry.
 Entry getEntry()
          Retrieves the actual entry wrapped by this configuration entry.
 ConfigEntry getParent()
          Retrieves the configuration entry that is the immediate parent for this configuration entry.
 boolean hasChildren()
          Indicates whether this entry has any children.
 boolean hasObjectClass(java.lang.String name)
          Indicates whether this configuration entry contains the specified objectclass.
 void putConfigAttribute(ConfigAttribute attribute)
          Puts the provided configuration attribute in this entry (adding a new attribute if one doesn't exist, or replacing it if one does).
 void registerAddListener(ConfigAddListener listener)
          Registers the provided add listener so that it will be notified if any new entries are added immediately below this configuration entry.
 void registerChangeListener(ConfigChangeListener listener)
          Registers the provided change listener so that it will be notified of any changes to this configuration entry.
 void registerDeleteListener(ConfigDeleteListener listener)
          Registers the provided delete listener so that it will be notified if any entries are deleted immediately below this configuration entry.
 ConfigEntry removeChild(DN childDN)
          Attempts to remove the child entry with the specified DN.
 boolean removeConfigAttribute(java.lang.String lowerName)
          Removes the specified configuration attribute from the entry.
 void setEntry(Entry entry)
          Replaces the actual entry wrapped by this configuration entry with the provided entry.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConfigEntry

public ConfigEntry(Entry entry,
                   ConfigEntry parent)
Creates a new config entry with the provided information.

Parameters:
entry - The entry that will be encapsulated by this config entry.
parent - The configuration entry that is the immediate parent for this configuration entry. It may be null if this entry is the configuration root.
Method Detail

getEntry

public Entry getEntry()
Retrieves the actual entry wrapped by this configuration entry.

Returns:
The actual entry wrapped by this configuration entry.

setEntry

public void setEntry(Entry entry)
Replaces the actual entry wrapped by this configuration entry with the provided entry. The given entry must be non-null and must have the same DN as the current entry. No validation will be performed on the target entry. All add/delete/change listeners that have been registered will be maintained, it will keep the same parent and set of children, and all other settings will remain the same.

Parameters:
entry - The new entry to store in this config entry.

getDN

public DN getDN()
Retrieves the DN for this configuration entry.

Returns:
The DN for this configuration entry.

hasObjectClass

public boolean hasObjectClass(java.lang.String name)
Indicates whether this configuration entry contains the specified objectclass.

Parameters:
name - The name of the objectclass for which to make the determination.
Returns:
true if this configuration entry contains the specified objectclass, or false if not.

getConfigAttribute

public ConfigAttribute getConfigAttribute(ConfigAttribute stub)
                                   throws ConfigException
Retrieves the specified configuration attribute from this configuration entry.

Parameters:
stub - The stub to use to format the returned configuration attribute.
Returns:
The requested configuration attribute from this configuration entry, or null if no such attribute is present in this entry.
Throws:
ConfigException - If the specified attribute exists but cannot be interpreted as the specified type of configuration attribute.

putConfigAttribute

public void putConfigAttribute(ConfigAttribute attribute)
Puts the provided configuration attribute in this entry (adding a new attribute if one doesn't exist, or replacing it if one does). This must only be performed on a duplicate of a configuration entry and never on a configuration entry itself.

Parameters:
attribute - The configuration attribute to use.

removeConfigAttribute

public boolean removeConfigAttribute(java.lang.String lowerName)
Removes the specified configuration attribute from the entry. This will have no impact if the specified attribute is not contained in the entry.

Parameters:
lowerName - The name of the configuration attribute to remove from the entry, formatted in all lowercase characters.
Returns:
true if the requested attribute was found and removed, or false if not.

getParent

public ConfigEntry getParent()
Retrieves the configuration entry that is the immediate parent for this configuration entry.

Returns:
The configuration entry that is the immediate parent for this configuration entry. It may be null if this entry is the configuration root.

getChildren

public java.util.concurrent.ConcurrentHashMap<DN,ConfigEntry> getChildren()
Retrieves the set of children associated with this configuration entry. This list should not be altered by the caller.

Returns:
The set of children associated with this configuration entry.

hasChildren

public boolean hasChildren()
Indicates whether this entry has any children.

Returns:
true if this entry has one or more children, or false if not.

addChild

public void addChild(ConfigEntry childEntry)
              throws ConfigException
Adds the specified entry as a child of this configuration entry. No check will be made to determine whether the specified entry actually should be a child of this entry, and this method will not notify any add listeners that might be registered with this configuration entry.

Parameters:
childEntry - The entry to add as a child of this configuration entry.
Throws:
ConfigException - If the provided entry could not be added as a child of this configuration entry (e.g., because another entry already exists with the same DN).

removeChild

public ConfigEntry removeChild(DN childDN)
                        throws ConfigException
Attempts to remove the child entry with the specified DN. This method will not notify any delete listeners that might be registered with this configuration entry.

Parameters:
childDN - The DN of the child entry to remove from this config entry.
Returns:
The configuration entry that was removed as a child of this entry.
Throws:
ConfigException - If the specified child entry did not exist or if it had children of its own.

duplicate

public ConfigEntry duplicate()
Creates a duplicate of this configuration entry that should be used when making changes to this entry. Changes should only be made to the duplicate (never the original) and then applied to the original. Note that this method and the other methods used to make changes to the entry contents are not threadsafe and therefore must be externally synchronized to ensure that only one change may be in progress at any given time.

Returns:
A duplicate of this configuration entry that should be used when making changes to this entry.

getChangeListeners

public java.util.concurrent.CopyOnWriteArrayList<ConfigChangeListener> getChangeListeners()
Retrieves the set of change listeners that have been registered with this configuration entry.

Returns:
The set of change listeners that have been registered with this configuration entry.

registerChangeListener

public void registerChangeListener(ConfigChangeListener listener)
Registers the provided change listener so that it will be notified of any changes to this configuration entry. No check will be made to determine whether the provided listener is already registered.

Parameters:
listener - The change listener to register with this config entry.

deregisterChangeListener

public boolean deregisterChangeListener(ConfigChangeListener listener)
Attempts to deregister the provided change listener with this configuration entry.

Parameters:
listener - The change listener to deregister with this config entry.
Returns:
true if the specified listener was deregistered, or false if it was not.

getAddListeners

public java.util.concurrent.CopyOnWriteArrayList<ConfigAddListener> getAddListeners()
Retrieves the set of config add listeners that have been registered for this entry.

Returns:
The set of config add listeners that have been registered for this entry.

registerAddListener

public void registerAddListener(ConfigAddListener listener)
Registers the provided add listener so that it will be notified if any new entries are added immediately below this configuration entry.

Parameters:
listener - The add listener that should be registered.

deregisterAddListener

public void deregisterAddListener(ConfigAddListener listener)
Deregisters the provided add listener so that it will no longer be notified if any new entries are added immediately below this configuration entry.

Parameters:
listener - The add listener that should be deregistered.

getDeleteListeners

public java.util.concurrent.CopyOnWriteArrayList<ConfigDeleteListener> getDeleteListeners()
Retrieves the set of config delete listeners that have been registered for this entry.

Returns:
The set of config delete listeners that have been registered for this entry.

registerDeleteListener

public void registerDeleteListener(ConfigDeleteListener listener)
Registers the provided delete listener so that it will be notified if any entries are deleted immediately below this configuration entry.

Parameters:
listener - The delete listener that should be registered.

deregisterDeleteListener

public void deregisterDeleteListener(ConfigDeleteListener listener)
Deregisters the provided delete listener so that it will no longer be notified if any new are removed immediately below this configuration entry.

Parameters:
listener - The delete listener that should be deregistered.