|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectnet.sf.ldaptemplate.support.DistinguishedName
Default implementation of a Name corresponding to an LDAP path. A DistinguishedName implementation is included in JDK1.5 (LdapName), but not in prior releases, and this implementation is intended if a prior implementation is used. An DistinguishedName is particularly useful when building or modifying an Ldap path dynamically, as escaping will be taken care of. A path is split into several names. The Name interface specifies that the most significant part be in position 0, i.e. The path: uid=adam.skogman, ou=People, ou=EU Name[0]: ou=EU Name[1]: ou=People Name[2]: uid=adam.skogman Useful for parsing and building LDAP paths.
DistinguishedName path = new DistinguishedName();
path.addLast("cn", entry.getUid());
path.addLast("ou", "users");
path.append(new DistinguishedName(helpdesk.getSomeSuffix()));
String dn = path.toString();
TODO: Implement compareTo().
| Field Summary | |
static DistinguishedName |
EMPTY_PATH
|
protected static java.util.regex.Pattern |
NAME_PATTERN
|
| Constructor Summary | |
DistinguishedName()
Construct a new DistinguishedName with no components. |
|
DistinguishedName(java.util.LinkedList list)
Construct a new DistinguishedName from the supplied List of LdapRdn objects. |
|
DistinguishedName(javax.naming.Name name)
Construct a new DistinguishedName from the supplied Name. |
|
DistinguishedName(java.lang.String path)
Construct a new DistinguishedName from a String. |
|
| Method Summary | |
javax.naming.Name |
add(int index,
java.lang.String string)
|
javax.naming.Name |
add(java.lang.String string)
|
void |
add(java.lang.String key,
java.lang.String value)
|
javax.naming.Name |
addAll(int arg0,
javax.naming.Name name)
|
javax.naming.Name |
addAll(javax.naming.Name name)
|
void |
append(DistinguishedName path)
Add a LDAP path first |
java.lang.Object |
clone()
|
int |
compareTo(java.lang.Object o)
|
boolean |
contains(DistinguishedName path)
Determines if a ldap path contains another path. |
java.lang.String |
encode()
Builds a complete LDAP path, ldap encoded, useful as a DN Always uses lowercase, always separates with ", " i.e. comma and a space. |
boolean |
endsWith(javax.naming.Name name)
Determines if this ldap path ends with a certian path. |
boolean |
equals(java.lang.Object obj)
|
java.lang.String |
get(int index)
|
java.util.Enumeration |
getAll()
|
LdapRdn |
getLdapRdn(int index)
Get the LdapRdn at a specified position. |
java.util.LinkedList |
getNames()
Get the name list. |
javax.naming.Name |
getPrefix(int index)
|
javax.naming.Name |
getSuffix(int index)
|
int |
hashCode()
|
boolean |
isEmpty()
|
protected void |
parse(java.lang.String path)
Parse the supplied String and make this instance represent the corresponding distinguished name. |
void |
prepend(DistinguishedName path)
Add a LDAP path first |
java.lang.Object |
remove(int arg0)
|
LdapRdn |
removeFirst()
Remove the first part of this DistinguishedName. |
void |
removeFirst(javax.naming.Name path)
Remove the supplied path from the beginning of this DistinguishedName if this instance starts with |
LdapRdn |
removeLast()
Remove the ldast part of this DistinguishedName. |
int |
size()
|
boolean |
startsWith(javax.naming.Name name)
|
java.lang.String |
toString()
Get the String representation of this DistinguishedName. |
java.lang.String |
toUrl()
Builds a complete LDAP path, ldap and url encoded. |
| Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static final DistinguishedName EMPTY_PATH
protected static final java.util.regex.Pattern NAME_PATTERN
| Constructor Detail |
public DistinguishedName()
public DistinguishedName(java.lang.String path)
path - a String corresponding to a (syntactically) valid LDAP path.public DistinguishedName(java.util.LinkedList list)
list - the components that this instance will consist of.public DistinguishedName(javax.naming.Name name)
name - the Name to construct a new DistinguishedName from.| Method Detail |
protected void parse(java.lang.String path)
path - the LDAP path to parse.public LdapRdn getLdapRdn(int index)
index - the LdapRdn to retrieve.
public java.util.LinkedList getNames()
public java.lang.String toString()
public java.lang.String encode()
public java.lang.String toUrl()
public boolean contains(DistinguishedName path)
path - the path to check.
public void append(DistinguishedName path)
path - public void prepend(DistinguishedName path)
path - public LdapRdn removeFirst()
public void removeFirst(javax.naming.Name path)
path - the path to remove from the beginning of this instance.public java.lang.Object clone()
clone in interface javax.naming.NameObject.clone()public boolean equals(java.lang.Object obj)
Object.equals(java.lang.Object)public int hashCode()
Object.hashCode()public int compareTo(java.lang.Object o)
compareTo in interface javax.naming.Namepublic int size()
size in interface javax.naming.Namepublic boolean isEmpty()
isEmpty in interface javax.naming.Namepublic java.util.Enumeration getAll()
getAll in interface javax.naming.Namepublic java.lang.String get(int index)
get in interface javax.naming.Namepublic javax.naming.Name getPrefix(int index)
getPrefix in interface javax.naming.Namepublic javax.naming.Name getSuffix(int index)
getSuffix in interface javax.naming.Namepublic boolean startsWith(javax.naming.Name name)
startsWith in interface javax.naming.Namepublic boolean endsWith(javax.naming.Name name)
endsWith in interface javax.naming.Namename - The suffix to check for
public javax.naming.Name addAll(javax.naming.Name name)
throws javax.naming.InvalidNameException
addAll in interface javax.naming.Namejavax.naming.InvalidNameException
public javax.naming.Name addAll(int arg0,
javax.naming.Name name)
throws javax.naming.InvalidNameException
addAll in interface javax.naming.Namejavax.naming.InvalidNameException
public javax.naming.Name add(java.lang.String string)
throws javax.naming.InvalidNameException
add in interface javax.naming.Namejavax.naming.InvalidNameException
public javax.naming.Name add(int index,
java.lang.String string)
throws javax.naming.InvalidNameException
add in interface javax.naming.Namejavax.naming.InvalidNameException
public java.lang.Object remove(int arg0)
throws javax.naming.InvalidNameException
remove in interface javax.naming.Namejavax.naming.InvalidNameExceptionpublic LdapRdn removeLast()
public void add(java.lang.String key,
java.lang.String value)
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||