All LDAP Classes
Internal LDAP Classes

com.novell.ldap.util
Class RDN

java.lang.Object
  extended by com.novell.ldap.util.RDN

public class RDN
extends java.lang.Object

A RDN encapsulates a single object's name of a Distinguished Name(DN). The object name represented by this class contains no context. Thus a Relative Distinguished Name (RDN) could be relative to anywhere in the Directories tree.

For example, of following DN, 'cn=admin, ou=marketing, o=corporation', all possible RDNs are 'cn=admin', 'ou=marketing', and 'o=corporation'.

Multivalued attributes are encapsulated in this class. For example the following could be represented by an RDN: 'cn=john + l=US', or 'cn=juan + l=ES'

See Also:
DN

Field Summary
private  java.lang.String rawValue
           
private  java.util.ArrayList types
           
private  java.util.ArrayList values
           
 
Constructor Summary
RDN()
           
RDN(java.lang.String rdn)
          Creates an RDN object from the DN component specified in the string RDN
 
Method Summary
 void add(java.lang.String attrType, java.lang.String attrValue, java.lang.String rawValue)
          Adds another value to the RDN.
private  boolean equalAttrType(java.lang.String attr1, java.lang.String attr2)
          Internal function used by equal to compare Attribute types.
 boolean equals(RDN rdn)
          Compares the RDN to the rdn passed.
 java.lang.String[] explodeRDN(boolean noTypes)
          Returns each multivalued name in the current RDN as an array of Strings.
protected  java.lang.String getRawValue()
          Returns the actually Raw String before Normalization
 java.lang.String getType()
          Returns the type of this RDN.
 java.lang.String[] getTypes()
          Returns all the types for this RDN.
 java.lang.String getValue()
          Returns the values of this RDN.
 java.lang.String[] getValues()
          Returns all the types for this RDN.
 boolean isMultivalued()
          Determines if this RDN is multivalued or not
 java.lang.String toString()
          Creates a string that represents this RDN, according to RFC 2253
 java.lang.String toString(boolean noTypes)
          Creates a string that represents this RDN.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

types

private java.util.ArrayList types

values

private java.util.ArrayList values

rawValue

private java.lang.String rawValue
Constructor Detail

RDN

public RDN(java.lang.String rdn)
Creates an RDN object from the DN component specified in the string RDN

Parameters:
rdn - the DN component

RDN

public RDN()
Method Detail

equals

public boolean equals(RDN rdn)
Compares the RDN to the rdn passed. Note: If an there exist any mulivalues in one RDN they must all be present in the other.

Parameters:
rdn - the RDN to compare to
Throws:
java.lang.IllegalArgumentException - if the application compares a name with an OID.

equalAttrType

private boolean equalAttrType(java.lang.String attr1,
                              java.lang.String attr2)
Internal function used by equal to compare Attribute types. Because attribute types could either be an OID or a name. There needs to be a Translation mechanism. This function will absract this functionality. Currently if types differ (Oid and number) then UnsupportedOperation is thrown, either one or the other must used. In the future an OID to name translation can be used.


getRawValue

protected java.lang.String getRawValue()
Returns the actually Raw String before Normalization

Returns:
The raw string

add

public void add(java.lang.String attrType,
                java.lang.String attrValue,
                java.lang.String rawValue)
Adds another value to the RDN. Only one attribute type is allowed for the RDN.

Parameters:
attrType - Attribute type, could be an OID or String
attrValue - Attribute Value, must be normalized and escaped
rawValue - or text before normalization, can be Null

toString

public java.lang.String toString()
Creates a string that represents this RDN, according to RFC 2253

Overrides:
toString in class java.lang.Object
Returns:
An RDN string

toString

public java.lang.String toString(boolean noTypes)
Creates a string that represents this RDN. If noTypes is true then Atribute types will be ommited.

Parameters:
noTypes - true if attribute types will be omitted.
Returns:
An RDN string

explodeRDN

public java.lang.String[] explodeRDN(boolean noTypes)
Returns each multivalued name in the current RDN as an array of Strings.

Parameters:
noTypes - Specifies whether Attribute types are included. The attribute type names will be ommitted if the parameter noTypes is true.
Returns:
List of multivalued Attributes

getType

public java.lang.String getType()
Returns the type of this RDN. This method assumes that only one value is used, If multivalues attributes are used only the first Type is returned. Use GetTypes.

Returns:
Type of attribute

getTypes

public java.lang.String[] getTypes()
Returns all the types for this RDN.

Returns:
list of types

getValue

public java.lang.String getValue()
Returns the values of this RDN. If multivalues attributes are used only the first Type is returned. Use GetTypes.

Returns:
Type of attribute

getValues

public java.lang.String[] getValues()
Returns all the types for this RDN.

Returns:
list of types

isMultivalued

public boolean isMultivalued()
Determines if this RDN is multivalued or not

Returns:
true if this RDN is multivalued

All LDAP Classes
Internal LDAP Classes

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