netscape.ldap

Class LDAPEntry

Implemented Interfaces:
java.io.Serializable

public class LDAPEntry
extends java.lang.Object
implements java.io.Serializable

Represents an entry in the directory.
Version:
1.0
See Also:
Serialized Form

Constructor Summary

LDAPEntry()
Constructs an empty entry.
LDAPEntry(String distinguishedName)
Constructs a new entry with the specified distinguished name and with an empty attribute set.
LDAPEntry(String distinguishedName, LDAPAttributeSet attrs)
Constructs a new entry with the specified distinguished name and set of attributes.

Method Summary

LDAPAttribute
getAttribute(String attrName)
In an entry, returns the single attribute that exactly matches the specified attribute name.
LDAPAttribute
getAttribute(String attrName, String lang)
Returns the subtype that matches "attrName" and that best matches a language specification "lang".
LDAPAttributeSet
getAttributeSet()
Returns the attribute set of the entry.
LDAPAttributeSet
getAttributeSet(String subtype)
Creates a new attribute set containing only the attributes that have the specified subtypes.
String
getDN()
Returns the distinguished name of the current entry.
String
toString()
Retrieves the string representation of the entry's distinguished name (DN) and its attributes.

Constructor Details

LDAPEntry

public LDAPEntry()
Constructs an empty entry.

LDAPEntry

public LDAPEntry(String distinguishedName)
Constructs a new entry with the specified distinguished name and with an empty attribute set.
Parameters:
distinguishedName - the distinguished name of the new entry

LDAPEntry

public LDAPEntry(String distinguishedName,
                 LDAPAttributeSet attrs)
Constructs a new entry with the specified distinguished name and set of attributes.
Parameters:
distinguishedName - the distinguished name of the new entry
attrs - the set of attributes to assign to the new entry

Method Details

getAttribute

public LDAPAttribute getAttribute(String attrName)
In an entry, returns the single attribute that exactly matches the specified attribute name.
Parameters:
attrName - name of attribute to return For example:
"cn"            // Only a non-subtyped version of cn
"cn;lang-ja"    // Only a Japanese version of cn, will not
// return "cn;lang-ja-JP-kanji", for example
Returns:
attribute in the current entry that has exactly the same name, or null (if no attribute in the entry matches the specified name).
See Also:
LDAPAttribute

getAttribute

public LDAPAttribute getAttribute(String attrName,
                                  String lang)
Returns the subtype that matches "attrName" and that best matches a language specification "lang". If there are subtypes other than "lang" subtypes included in attrName, e.g. "cn;binary", only attributes with all of those subtypes are returned. If lang is null or empty, the method behaves as getAttribute(attrName). If there are no matching attributes, null is returned. Example:
  Assume the entry contains only the following attributes:
     cn;lang-en
     cn;lang-ja-JP-kanji
     sn
  getAttribute( "cn" ) returns null.
  getAttribute( "sn" ) returns the "sn" attribute.
  getAttribute( "cn", "lang-en-us" ) returns the "cn;lang-en" attribute.
  getAttribute( "cn", "lang-en" ) returns the "cn;lang-en" attribute.
  getAttribute( "cn", "lang-ja" ) returns null.
  getAttribute( "sn", "lang-en" ) returns the "sn" attribute.

Parameters:
attrName - name of attribute to find in the entry
lang - a language specification (for example, lang-en)
Returns:
the attribute that matches the base name and that best matches any specified language subtype.
See Also:
LDAPAttribute

getAttributeSet

public LDAPAttributeSet getAttributeSet()
Returns the attribute set of the entry.
Returns:
set of attributes in the entry.

getAttributeSet

public LDAPAttributeSet getAttributeSet(String subtype)
Creates a new attribute set containing only the attributes that have the specified subtypes.

For example, suppose an entry contains the following attributes:

 cn
 cn;lang-ja
 sn;phonetic;lang-ja
 sn;lang-us
 
If you call the getAttributeSet method and pass lang-ja as the argument, the method returns an attribute set containing the following attributes:

 cn;lang-ja
 sn;phonetic;lang-ja
 
Parameters:
subtype - semi-colon delimited list of subtypes that you want to find in attribute names.
"lang-ja"        // Only Japanese language subtypes
"binary"         // Only binary subtypes
"binary;lang-ja" // Only Japanese language subtypes
which also are binary
Returns:
attribute set containing the attributes that have the specified subtypes.

getDN

public String getDN()
Returns the distinguished name of the current entry.
Returns:
distinguished name of the current entry.

toString

public String toString()
Retrieves the string representation of the entry's distinguished name (DN) and its attributes. For example:
 LDAPEntry: uid=bjensen, ou=People, o=airius.com; LDAPAttributeSet:
 LDAPAttribute {type='cn', values='Barbara Jensen,Babs Jensen'}
 LDAPAttribute {type='sn', values='Jensen'}LDAPAttribute {type='givenname',
 values='Barbara'}LDAPAttribute {type='objectclass', values='top,person,
 organizationalPerson,inetOrgPerson'}LDAPAttribute {type='ou',
 values='Product Development,People'}
 
Returns:
string representation of the entry's DN and its attributes.