LDAP Classes
Implements Java LDAP

com.novell.ldap
Class LDAPEntry

java.lang.Object
  extended bycom.novell.ldap.LDAPEntry
All Implemented Interfaces:
java.lang.Comparable, java.io.Externalizable, java.io.Serializable
Direct Known Subclasses:
LDAPSchema

public class LDAPEntry
extends java.lang.Object
implements java.lang.Comparable, java.io.Externalizable

Represents a single entry in a directory, consisting of a distinguished name (DN) and zero or more attributes.

An instance of LDAPEntry is created in order to add an entry to a directory, and instances of LDAPEntry are returned on a search by enumerating an LDAPSearchResults.

See Also:
LDAPAttribute, LDAPAttributeSet, Serialized Form

Field Summary
protected  LDAPAttributeSet attrs
           
protected  java.lang.String dn
           
 
Constructor Summary
LDAPEntry()
          Constructs an empty entry.
LDAPEntry(java.lang.String dn)
          Constructs a new entry with the specified distinguished name and with an empty attribute set.
LDAPEntry(java.lang.String dn, LDAPAttributeSet attrs)
          Constructs a new entry with the specified distinguished name and set of attributes.
 
Method Summary
 int compareTo(java.lang.Object entry)
          Compares this object with the specified object for order.
 LDAPAttribute getAttribute(java.lang.String attrName)
          Returns the attributes matching the specified attrName.
 LDAPAttributeSet getAttributeSet()
          Returns the attribute set of the entry.
 LDAPAttributeSet getAttributeSet(java.lang.String subtype)
          Returns an attribute set from the entry, consisting of only those attributes matching the specified subtypes.
 java.lang.String getDN()
          Returns the distinguished name of the entry.
static java.lang.Object readDSML(java.io.InputStream input)
          This method is used to deserialize the DSML encoded representation of this class.
 void readExternal(java.io.ObjectInput in)
          Reads the serialized object from the underlying input stream.
 java.lang.String toString()
          Returns a string representation of this LDAPEntry
 void writeDSML(java.io.OutputStream oout)
          This method does DSML serialization of the instance.
 void writeExternal(java.io.ObjectOutput out)
          Writes the object state to a stream in XML format
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

dn

protected java.lang.String dn

attrs

protected LDAPAttributeSet attrs
Constructor Detail

LDAPEntry

public LDAPEntry()
Constructs an empty entry.


LDAPEntry

public LDAPEntry(java.lang.String dn)
Constructs a new entry with the specified distinguished name and with an empty attribute set.

Parameters:
dn - The distinguished name of the entry. The value is not validated. An invalid distinguished name will cause operations using this entry to fail.

LDAPEntry

public LDAPEntry(java.lang.String dn,
                 LDAPAttributeSet attrs)
Constructs a new entry with the specified distinguished name and set of attributes.

Parameters:
dn - The distinguished name of the new entry. The value is not validated. An invalid distinguished name will cause operations using this entry to fail.

attrs - The initial set of attributes assigned to the entry.
Method Detail

getAttribute

public LDAPAttribute getAttribute(java.lang.String attrName)
Returns the attributes matching the specified attrName.

Parameters:
attrName - The name of the attribute or attributes to return.

Returns:
An array of LDAPAttribute objects.

getAttributeSet

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

All base and subtype variants of all attributes are returned. The LDAPAttributeSet returned may be empty if there are no attributes in the entry.

Returns:
The attribute set of the entry.

getAttributeSet

public LDAPAttributeSet getAttributeSet(java.lang.String subtype)
Returns an attribute set from the entry, consisting of only those attributes matching the specified subtypes.

The getAttributeSet method can be used to extract only a particular language variant subtype of each attribute, if it exists. The "subtype" may be, for example, "lang-ja", "binary", or "lang-ja;phonetic". If more than one subtype is specified, separated with a semicolon, only those attributes with all of the named subtypes will be returned. The LDAPAttributeSet returned may be empty if there are no matching attributes in the entry.

Parameters:
subtype - One or more subtype specification(s), separated with semicolons. The "lang-ja" and "lang-en;phonetic" are valid subtype specifications.
Returns:
An attribute set from the entry with the attributes that match the specified subtypes or an empty set if no attributes match.

getDN

public java.lang.String getDN()
Returns the distinguished name of the entry.

Returns:
The distinguished name of the entry.

compareTo

public int compareTo(java.lang.Object entry)
Compares this object with the specified object for order.

Ordering is determined by comparing normalized DN values (see getDN() and LDAPDN.normalize(java.lang.String)) using the compareTo method of the String class.

Specified by:
compareTo in interface java.lang.Comparable
Parameters:
entry - Entry to compare to
Returns:
A negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

toString

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

Returns:
a string representation of this LDAPEntry

writeDSML

public void writeDSML(java.io.OutputStream oout)
               throws java.io.IOException
This method does DSML serialization of the instance.

Parameters:
oout - Outputstream where the serialzed data has to be written
Throws:
java.io.IOException - if write fails on OutputStream

readDSML

public static java.lang.Object readDSML(java.io.InputStream input)
                                 throws java.io.IOException
This method is used to deserialize the DSML encoded representation of this class.

Parameters:
input - InputStream for the DSML formatted data.
Returns:
Deserialized form of this class.
Throws:
java.io.IOException - when serialization fails.

writeExternal

public void writeExternal(java.io.ObjectOutput out)
                   throws java.io.IOException
Writes the object state to a stream in XML format

Specified by:
writeExternal in interface java.io.Externalizable
Parameters:
out - The ObjectOutput stream where the Object in XML format is being written to
Throws:
java.io.IOException - - If I/O errors occur

readExternal

public void readExternal(java.io.ObjectInput in)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
Reads the serialized object from the underlying input stream.

Specified by:
readExternal in interface java.io.Externalizable
Parameters:
in - The ObjectInput stream where the Serialized Object is being read from
Throws:
java.io.IOException - - If I/O errors occur
java.lang.ClassNotFoundException - - If the class for an object being restored cannot be found.

LDAP Classes
Implements Java LDAP

Copyright © 2002 Novell, Inc. All Rights Reserved.
Novell, Inc.
1800 South Novell Place
Provo, Ut 84606
Phone: (801) 861-5000