|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--com.ca.commons.naming.RDN
An RDN element. May be multi-valued (but most aren't)
Some quick definitions:
While parts of an rdn (particular attributes and values) may be manipulated as raw, unescaped strings, entire rdns are always escaped when represented as strings (e.g. by the 'toString()' method).
An added complication is unicode. While strings may be entered as escaped utf8, they are always converted to unicode asap, and never returned as utf8. (they are automatically translated to utf8 by jndi when transmitted to the server, or manually by JXplorer when saving ldif files as a final step).
The class is optimised for single valued RDNs, as this represents the majority of examples seen by the author...
This class uses delayed evaluation of RDN strings. Hence invalid RDNs can be instantiated, and will only throw exceptions when used.
| Constructor Summary | |
RDN()
Empty constructor - creates an RDN with no values. |
|
RDN(RDN copyMe)
clones an RDN. |
|
RDN(java.lang.String rdn)
Standard constructor - creates an RDN using an ldap escaped utf8 rdn string, which may be multi-valued. |
|
| Method Summary | |
void |
addEscaped(java.lang.String rdnfragment)
adds an ldap escaped utf8 Name element (i.e. the portion of an rdn separated by a '+' sign) |
void |
addRaw(java.lang.String rdnfragment)
adds an unescaped unicode Name element (i.e. one of the parts seperated by a '+' sign). |
boolean |
contains(java.lang.String attributeType)
Utility function - returns true if the passed attribute value is contained within the RDN. |
void |
dump()
Debug prints the raw, unescaped form of the elements. |
boolean |
equals(java.lang.Object o)
Generic equality test allows for test against non-RDN objects via their 'toString()' and a case-insensitive match. |
boolean |
equals(RDN test)
test two RDNs for equivalence. |
java.lang.String |
getAtt()
Gets the first attribute name. |
java.lang.String |
getAtt(int i)
gets the attribute name from a particular indexed rdn element. |
java.lang.String[] |
getAtts()
gets the attribute type names as a String array. |
java.lang.String |
getElement(int i)
Returns the Ith att-val pair in escaped ldap form. |
java.lang.String[] |
getElements()
Returns all elements as a string array, in escaped ldap form. |
java.lang.String |
getRawVal()
Gets the first raw, unescaped, attribute value. |
java.lang.String |
getRawVal(int i)
gets the raw, unescaped, attribute value from a particular indexed rdn element. |
java.lang.String |
getRawVal(java.lang.String attributeType)
Utility function - returns a raw attribute value looked up by name. |
java.lang.String[] |
getRawVals()
gets the attribute type names as a String array. |
boolean |
isEmpty()
Whether the rdn is empty (i.e. is an empty string) |
boolean |
isMultiValued()
|
void |
setElement(int i,
java.lang.String ldapEscapedElement)
Sets the Ith att-val pair in escaped ldap form. |
void |
setRawVal(java.lang.String v)
Sets the raw, unescaped value of uni-valued rdn. |
void |
setRawVal(java.lang.String v,
int i)
sets a raw, unescaped, value at a particular index position. |
int |
size()
returns the number of sub-elements in this rdn. |
java.lang.String |
toString()
Returns the RDN as an ldap escaped ldap utf8 string. |
boolean |
validate()
Checks whether the RDN is valid (i.e. has non null, correctly escaped elements). |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public RDN()
public RDN(java.lang.String rdn)
rdn - the string rdn to be parsedpublic RDN(RDN copyMe)
copyMe - the RDN to copy.| Method Detail |
public boolean isEmpty()
public void addEscaped(java.lang.String rdnfragment)
throws javax.naming.InvalidNameException
rdnfragment - an attribute = value pair.
javax.naming.InvalidNameException
public void addRaw(java.lang.String rdnfragment)
throws javax.naming.InvalidNameException
rdnfragment - an attribute = value pair.
javax.naming.InvalidNameExceptionpublic java.lang.String toString()
toString in class java.lang.Objectpublic void dump()
public java.lang.String getElement(int i)
i - the element index to get (counting from 0)
public java.lang.String[] getElements()
public void setElement(int i,
java.lang.String ldapEscapedElement)
throws javax.naming.InvalidNameException
i - the element index to get (counting from 0)ldapEscapedElement - the element to replace (if the
rdn is single valued, this would be the whole rdn.)
javax.naming.InvalidNameExceptionpublic java.lang.String getAtt()
public java.lang.String getAtt(int i)
public java.lang.String[] getAtts()
public boolean contains(java.lang.String attributeType)
public java.lang.String getRawVal(java.lang.String attributeType)
attributeType - the attribute type to find the corresponding
value for (e.g. "cn").
public java.lang.String getRawVal()
public java.lang.String getRawVal(int i)
public java.lang.String[] getRawVals()
public void setRawVal(java.lang.String v)
throws javax.naming.InvalidNameException
javax.naming.InvalidNameException
public void setRawVal(java.lang.String v,
int i)
throws javax.naming.InvalidNameException
javax.naming.InvalidNameExceptionpublic int size()
public boolean isMultiValued()
public boolean equals(RDN test)
public boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic boolean validate()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||