org.pf.directory.ldap
Class LDAPDirEntryContainer

java.lang.Object
  extended by org.pf.directory.MultiValueAttributes
      extended by org.pf.directory.DirectoryObject
          extended by org.pf.directory.ldap.LDAPDirEntry
              extended by org.pf.directory.ldap.LDAPDirEntryContainer
All Implemented Interfaces:
AttributeReadAccess

public class LDAPDirEntryContainer
extends LDAPDirEntry

This special LDAP entry object is for containers that contain other LDAP entries.

Version:
1.1
Author:
Manfred Duchrow

Field Summary
 
Fields inherited from class org.pf.directory.ldap.LDAPDirEntry
ATTRNAME_CREATE_TIMESTAMP, ATTRNAME_CREATORS_NAME, ATTRNAME_MODIFIERS_NAME, ATTRNAME_MODIFY_TIMESTAMP, ATTRNAME_NAMING_CONTEXTS, ATTRNAME_SUBSCHEMA_SUBENTRY
 
Constructor Summary
LDAPDirEntryContainer(DistinguishedName dn)
          Initialize the new instance with a DN.
LDAPDirEntryContainer(LDAPDirEntry dirObject)
          Initialize the new instance with the given entry data.
LDAPDirEntryContainer(java.lang.String dn)
          Initialize the new instance with a DN.
 
Method Summary
 void addChild(LDAPDirEntry entry)
          Adds the given entry as child of this container
 boolean contains(DistinguishedName dn)
          Returns true if this container contains an entry with the given distinguished name.
 boolean contains(LDAPDirEntry entry)
          Returns true if this container contains exactly the given object.
 LDAPSearchResult findAll(LDAPDirEntryFilter filter)
          Returns all objects down the whole hierarchy starting from this object if they match the given filter.
 LDAPSearchResult findAll(LDAPDirEntryFilter filter, int sizeLimit)
          Returns all objects down the whole hierarchy starting from this object if they match the given filter.
 LDAPSearchResult findAll(java.lang.String filter)
          Returns all objects down the whole hierarchy starting from this object if they match the given filter.
 LDAPSearchResult findAll(java.lang.String filter, int sizeLimit)
          Returns all objects down the whole hierarchy starting from this object if they match the given filter.
 LDAPDirEntry findChild(LDAPDirEntryFilter filter)
          Returns the first immediate child that matches the given filter
 LDAPDirEntry findChild(java.lang.String filter)
          Returns the first immediate child that matches the given filter
 LDAPSearchResult findChildren(LDAPDirEntryFilter filter)
          Returns all immediate children that match the given filter
 LDAPSearchResult findChildren(LDAPDirEntryFilter filter, int sizeLimit)
          Returns all immediate children that match the given filter
 LDAPSearchResult findChildren(java.lang.String filter)
          Returns all immediate children that match the given filter
 LDAPSearchResult findChildren(java.lang.String filter, int sizeLimit)
          Returns all immediate children that match the given filter
 int getChildCount()
          Returns the number of children
 boolean isContainer()
          Returns true if this entry is a container object that can contain other entries as children.
 boolean removeChild(DistinguishedName dn)
          Removes the child that has the same DN as the given one.
 boolean removeChild(LDAPDirEntry entry)
          Removes the given entry from this container's children
 java.lang.String toString()
          Returns a string representation of this object
 
Methods inherited from class org.pf.directory.ldap.LDAPDirEntry
getCreateTimestamp, getDistinguishedName, getDN, getModifyTimestamp, setAttribute, setCreateTimestamp, setModifyTimestamp, updateFrom, updateModifyTimestamp, updateTimestamps
 
Methods inherited from class org.pf.directory.DirectoryObject
equals, getID, hashCode, matches
 
Methods inherited from class org.pf.directory.MultiValueAttributes
addAttribute, addValue, addValue, getAttribute, getAttributeAsString, getAttributeAsStringArray, getAttributeNames, getAttributeValue, getCopyOfAttributes, getMetaData, getValue, getValues, hasAttribute, isEmpty, removeAttribute, removeValue, setMetaData, size
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LDAPDirEntryContainer

public LDAPDirEntryContainer(java.lang.String dn)
Initialize the new instance with a DN.


LDAPDirEntryContainer

public LDAPDirEntryContainer(DistinguishedName dn)
Initialize the new instance with a DN.


LDAPDirEntryContainer

public LDAPDirEntryContainer(LDAPDirEntry dirObject)
Initialize the new instance with the given entry data. Actually that means creating a container out of a "simple" entry.

Method Detail

addChild

public void addChild(LDAPDirEntry entry)
Adds the given entry as child of this container

Parameters:
entry - The new child to add (must not be null)

removeChild

public boolean removeChild(LDAPDirEntry entry)
Removes the given entry from this container's children

Parameters:
entry - The child to remove (must not be null)

removeChild

public boolean removeChild(DistinguishedName dn)
Removes the child that has the same DN as the given one.

Parameters:
dn - The dn of the child to remove (must not be null)

contains

public boolean contains(LDAPDirEntry entry)
Returns true if this container contains exactly the given object. That is, comparison is done by identity (==) rather than equality.

Parameters:
entry - The entry to look for

contains

public boolean contains(DistinguishedName dn)
Returns true if this container contains an entry with the given distinguished name.

Parameters:
dn - The DN to look for

findChild

public LDAPDirEntry findChild(LDAPDirEntryFilter filter)
Returns the first immediate child that matches the given filter

Parameters:
filter - A filter that gets called for each child

findChild

public LDAPDirEntry findChild(java.lang.String filter)
                       throws MatchRuleParseException
Returns the first immediate child that matches the given filter

Parameters:
filter - A filter complient to RFC 2254
Throws:
MatchRuleParseException

findChildren

public LDAPSearchResult findChildren(java.lang.String filter)
                              throws MatchRuleParseException
Returns all immediate children that match the given filter

Parameters:
filter - A filter complient to RFC 2254
Throws:
MatchRuleParseException - If the given filter cannot be parsed

findChildren

public LDAPSearchResult findChildren(LDAPDirEntryFilter filter)
Returns all immediate children that match the given filter

Parameters:
filter - A filter that defines which objects match

findChildren

public LDAPSearchResult findChildren(java.lang.String filter,
                                     int sizeLimit)
                              throws MatchRuleParseException
Returns all immediate children that match the given filter

Parameters:
filter - A filter complient to RFC 2254
sizeLimit - Maximum number of entries to be collected ( 0 = unlimited )
Throws:
MatchRuleParseException - If the given filter cannot be parsed

findChildren

public LDAPSearchResult findChildren(LDAPDirEntryFilter filter,
                                     int sizeLimit)
Returns all immediate children that match the given filter

Parameters:
filter - A filter that defines which object matches
sizeLimit - Maximum number of entries to be collected ( 0 = unlimited )

findAll

public LDAPSearchResult findAll(java.lang.String filter)
                         throws MatchRuleParseException
Returns all objects down the whole hierarchy starting from this object if they match the given filter.

Parameters:
filter - A filter complient to RFC 2254
Throws:
MatchRuleParseException - If the given filter cannot be parsed

findAll

public LDAPSearchResult findAll(LDAPDirEntryFilter filter)
Returns all objects down the whole hierarchy starting from this object if they match the given filter.

Parameters:
filter - A filter that defines which objects match

findAll

public LDAPSearchResult findAll(java.lang.String filter,
                                int sizeLimit)
                         throws MatchRuleParseException
Returns all objects down the whole hierarchy starting from this object if they match the given filter.

Parameters:
filter - A filter complient to RFC 2254
sizeLimit - Maximum number of entries to be collected ( 0 = unlimited )
Throws:
MatchRuleParseException - If the given filter cannot be parsed

findAll

public LDAPSearchResult findAll(LDAPDirEntryFilter filter,
                                int sizeLimit)
Returns all objects down the whole hierarchy starting from this object if they match the given filter.

Parameters:
filter - A filter the defines which objects match
sizeLimit - Maximum number of entries to be collected ( 0 = unlimited )

isContainer

public boolean isContainer()
Returns true if this entry is a container object that can contain other entries as children.

Here it always returns true.

Overrides:
isContainer in class LDAPDirEntry

getChildCount

public int getChildCount()
Returns the number of children


toString

public java.lang.String toString()
Returns a string representation of this object

Overrides:
toString in class LDAPDirEntry