|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--com.ca.commons.naming.DN
A Data class that encapsulated the idea of an ldap Distinguished Name of the form: ou=frog farmers,o=frogcorp,c=au - and provides a bunch of utility methods for modifying and reading these values, especially the various bits of each rdn in various ways.
implements javax.naming.Name.
Why don't we just use CompoundName or CompositeName?
- basically because we're not supporting multiple
naming systems - we're *only* supporting ldap. So Name is implemented
for support with existing jndi ftns, but also a lot of other stuff
is needed for rdns, and multi-value rdns. This could be architected
as, say, compound name with another helper class, but that seems
clumsy.
| Field Summary | |
static java.lang.String |
BLANKBASEDN
Default constructor creates a DN with no value set. |
| Constructor Summary | |
DN()
|
|
DN(DN copyMe)
Copy constructor creates a new DN with an item by item copy of the parameter DN. |
|
DN(javax.naming.Name name)
This Constructor takes an existing jndi Name, And initialises itself by taking that Name's rdn elements an element at a time, and converting them to RDN objects. |
|
DN(java.lang.String ldapDN)
Main Constructor takes an ldap Distinguished Name string (e.g. |
|
| Method Summary | |
javax.naming.Name |
add(int posn,
RDN rdn)
The core method for adding RDN objects to the name. |
javax.naming.Name |
add(int posn,
java.lang.String rdn)
|
javax.naming.Name |
add(RDN rdn)
Add an RDN to the end of the DN. |
javax.naming.Name |
add(java.lang.String rdn)
|
javax.naming.Name |
addAll(int posn,
javax.naming.Name n)
|
javax.naming.Name |
addAll(javax.naming.Name suffix)
|
void |
addChildRDN(RDN rdn)
Adds a new 'deepest level' RDN to a DN |
void |
addChildRDN(java.lang.String rdn)
Adds a new 'deepest level' RDN to a DN |
void |
addParentRDN(java.lang.String rdn)
Adds an RDN to an existing DN at the highest level - mainly used internally while parsing a DN. |
static void |
checkRDN(java.lang.String RDN)
roughly checks if an RDN is syntactically and schematically correct. |
void |
clear()
Empties the DN of all RDNs. |
java.lang.Object |
clone()
|
int |
compareTo(java.lang.Object obj)
|
void |
debugPrint()
dumps the dn in a structured form, demonstrating parsing. |
boolean |
endsWith(javax.naming.Name n)
|
boolean |
equals(DN testDN)
Check whether this DN is equal to another DN... |
boolean |
equals(java.lang.Object o)
implement the object.equals(object) method for genericity and unit testing. |
boolean |
error()
Whether there was an error using this DN (i.e. when creating it). |
protected java.lang.String |
exchangeRDNelementValue(java.lang.String rdn,
java.lang.String value)
Exchanges the value of an rdn att=val element, and returns |
java.lang.String |
get(int posn)
|
java.util.Enumeration |
getAll()
|
java.lang.String |
getDN()
a synonym for 'toString()' this returns the full ldap DN. |
java.lang.String |
getError()
Gets the error message (if any) associated with this DN. |
RDN |
getLowestRDN()
gets the value of the lowest ldap RDN, i.e. the furthest-from-the-root class value of the DN. |
javax.naming.Name |
getPrefix(int posn)
|
RDN |
getRDN(int i)
gets the full RDN (e.g. |
java.lang.String |
getRDNAttribute(int i)
gets the ldap 'class' (e.g. |
java.lang.String |
getRDNValue(int i)
gets the ldap value (e.g. |
RDN |
getRootRDN()
Returns the root RDN as a string (e.g. |
javax.naming.Name |
getSuffix(int posn)
|
boolean |
isEmpty()
returns true if this is an 'empty', or root DN (i.e. \"\") |
DN |
parentDN()
Returns the full DN of this DN's immediate parent (i.e. returns this DN after removing the lowest RDN) |
java.lang.Object |
remove(int posn)
|
void |
reverse()
reverse the order of elements in a DN... |
void |
setError(java.lang.String e)
Overload this method for app specific error handling. |
void |
setLowestRDNRawValue(java.lang.String value)
sets (or more often resets) the lowest (furthest-from-root) value of the DN |
void |
setRDN(RDN rdn,
int i)
gets the full RDN (e.g. |
boolean |
sharesParent(DN testDN)
Tests if the DNs are identical except for the lowest RDN (e.g. they are leaves on the same branch) |
int |
size()
|
boolean |
startsWith(DN testDN)
Checks whether the testDN is a subset of the current DN, starting from the root. |
boolean |
startsWith(javax.naming.Name n)
|
java.lang.String |
toFormattedString()
Spits back the DN as a tree-level formatted string (mainly for debugging) |
java.lang.String |
toString()
Spits back the DN as an escaped ldap DN string |
| Methods inherited from class java.lang.Object |
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static java.lang.String BLANKBASEDN
| Constructor Detail |
public DN()
public DN(DN copyMe)
public DN(java.lang.String ldapDN)
ldapDN - the ldap distinguished name to be parsed.public DN(javax.naming.Name name)
| Method Detail |
public java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String toFormattedString()
public java.lang.String getDN()
public java.lang.String getRDNAttribute(int i)
i - the index of the RDN class to return.public java.lang.String getRDNValue(int i)
i - the index of the RDN value to return.public void debugPrint()
public void setRDN(RDN rdn,
int i)
i - the index of the RDN to return.public RDN getRDN(int i)
i - the index of the RDN to return.public RDN getRootRDN()
public RDN getLowestRDN()
public static void checkRDN(java.lang.String RDN)
throws javax.naming.InvalidNameException
RDN - the RDN string to check for correctness
javax.naming.InvalidNameExceptionpublic void addParentRDN(java.lang.String rdn)
public void addChildRDN(java.lang.String rdn)
throws javax.naming.InvalidNameException
javax.naming.InvalidNameException
public void addChildRDN(RDN rdn)
throws javax.naming.InvalidNameException
javax.naming.InvalidNameExceptionpublic void setLowestRDNRawValue(java.lang.String value)
value - the (raw, unescaped) new lowest RDN value to overwrite the existing lowest RDN value with
protected java.lang.String exchangeRDNelementValue(java.lang.String rdn,
java.lang.String value)
public boolean equals(DN testDN)
testDN - the DN to compare against this DNpublic boolean equals(java.lang.Object o)
equals in class java.lang.Objecto - a DN or Name object to test againstpublic boolean startsWith(DN testDN)
testDN - the subset DN to test againstpublic boolean sharesParent(DN testDN)
testDN - the putatitive sibling DNpublic DN parentDN()
public void reverse()
public void clear()
public void setError(java.lang.String e)
public boolean error()
public java.lang.String getError()
public javax.naming.Name add(RDN rdn)
public javax.naming.Name add(int posn,
RDN rdn)
posn - the position in the DN to add the RDN at (0 = root)rdn - the RDN to add (may be multi-valued).
public javax.naming.Name add(int posn,
java.lang.String rdn)
throws javax.naming.InvalidNameException
add in interface javax.naming.Namejavax.naming.InvalidNameException
public javax.naming.Name add(java.lang.String rdn)
throws javax.naming.InvalidNameException
add in interface javax.naming.Namejavax.naming.InvalidNameException
public javax.naming.Name addAll(int posn,
javax.naming.Name n)
throws javax.naming.InvalidNameException
addAll in interface javax.naming.Namejavax.naming.InvalidNameException
public javax.naming.Name addAll(javax.naming.Name suffix)
throws javax.naming.InvalidNameException
addAll in interface javax.naming.Namejavax.naming.InvalidNameExceptionpublic java.lang.Object clone()
clone in interface javax.naming.Nameclone in class java.lang.Objectpublic int compareTo(java.lang.Object obj)
compareTo in interface javax.naming.Namepublic boolean endsWith(javax.naming.Name n)
endsWith in interface javax.naming.Namepublic java.lang.String get(int posn)
get in interface javax.naming.Namepublic java.util.Enumeration getAll()
getAll in interface javax.naming.Namepublic javax.naming.Name getPrefix(int posn)
getPrefix in interface javax.naming.Namepublic javax.naming.Name getSuffix(int posn)
getSuffix in interface javax.naming.Namepublic boolean isEmpty()
isEmpty in interface javax.naming.Namepublic java.lang.Object remove(int posn)
remove in interface javax.naming.Namepublic int size()
size in interface javax.naming.Namepublic boolean startsWith(javax.naming.Name n)
startsWith in interface javax.naming.Name
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||