|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.directory.shared.ldap.name.LdapDN
The LdapDN class contains a DN (Distinguished Name). Its specification can be found in RFC 2253, "UTF-8 String Representation of Distinguished Names". We will store two representation of a DN : - a user Provider represeentation, which is the parsed String given by a user - an internal representation. A DN is formed of RDNs, in a specific order : RDN[n], RDN[n-1], ... RDN[1], RDN[0] It represents a tree, in which the root is the last RDN (RDN[0]) and the leaf is the first RDN (RDN[n]).
Field Summary | |
static LdapDN |
EMPTY_LDAPDN
A null LdapDN |
static int |
EQUALS
Value returned by the compareTo method if values are equals |
static int |
NOT_EQUALS
Value returned by the compareTo method if values are not equals |
Constructor Summary | |
LdapDN()
Construct an empty LdapDN object |
|
LdapDN(byte[] bytes)
Parse a buffer and checks that it is a valid DN |
|
LdapDN(java.lang.String upName)
Parse a String and checks that it is a valid DN |
Method Summary | |
javax.naming.Name |
add(int posn,
java.lang.String comp)
Adds a single component at a specified position within this name. |
javax.naming.Name |
add(java.lang.String comp)
Adds a single component to the end of this name. |
javax.naming.Name |
addAll(int posn,
javax.naming.Name name)
Adds the components of a name -- in order -- at a specified position within this name. |
javax.naming.Name |
addAll(javax.naming.Name suffix)
Adds the components of a name -- in order -- to the end of this name. |
java.lang.Object |
clone()
Generates a new copy of this name. |
int |
compareTo(java.lang.Object obj)
Compares this name with another name for order. |
boolean |
endsWith(javax.naming.Name name)
Determines whether this name ends with a specified suffix. |
boolean |
equals(java.lang.Object obj)
|
java.lang.String |
get(int posn)
Retrieves a component of this name. |
java.util.Enumeration |
getAll()
Retrieves the components of this name as an enumeration of strings. |
java.util.Enumeration |
getAllRdn()
Retrieves the components of this name as an enumeration of strings. |
static byte[] |
getBytes(javax.naming.Name dn)
Get an UTF-8 representation of the normalized form of the DN |
java.lang.String |
getName()
Get the initial DN (without normalization) |
static int |
getNbBytes(javax.naming.Name dn)
Get the number of bytes necessary to store this DN |
javax.naming.Name |
getPrefix(int posn)
Creates a name whose components consist of a prefix of the components of this name. |
Rdn |
getRdn(int posn)
Retrieves a component of this name. |
java.util.List |
getRdns()
Retrieves all the components of this name. |
javax.naming.Name |
getSuffix(int posn)
Creates a name whose components consist of a suffix of the components in this name. |
int |
hashCode()
Gets the hashcode of the string representation of this name. |
boolean |
isEmpty()
Determines whether this name is empty. |
static javax.naming.Name |
normalize(javax.naming.Name dn)
|
static javax.naming.Name |
normalize(javax.naming.Name dn,
java.util.Map oids)
Change the internal DN, using the first alias instead of oids or other aliases. |
static LdapString |
normalizeAttribute(byte[] data)
Substitute OIDs and aliases for the simplest alias |
java.lang.Object |
remove(int posn)
Removes a component from this name. |
int |
size()
Get the number of NameComponent conatained in this LdapDN |
boolean |
startsWith(javax.naming.Name name)
Determines whether this name starts with a specified prefix. |
java.lang.String |
toNormName()
Build the normalized DN as a String, |
java.lang.String |
toString()
Return the normalized DN as a String. |
java.lang.String |
toUpName()
Return the User Provided DN as a String, |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int NOT_EQUALS
public static final int EQUALS
public static final LdapDN EMPTY_LDAPDN
Constructor Detail |
public LdapDN()
public LdapDN(java.lang.String upName) throws javax.naming.InvalidNameException
<distinguishedName> ::= <name> | e
<name> ::= <name-component> <name-components>
<name-components> ::= <spaces> <separator>
<spaces> <name-component> <name-components> | e
A
- InvalidNameException is thrown if the buffer does not
contains a valid DN.
javax.naming.InvalidNameException
public LdapDN(byte[] bytes) throws javax.naming.InvalidNameException
<distinguishedName> ::= <name> | e
<name> ::= <name-component> <name-components>
<name-components> ::= <spaces> <separator>
<spaces> <name-component> <name-components> | e
bytes
- The byte buffer that contains the DN
A
- InvalidNameException is thrown if the buffer does not
contains a valid DN.
javax.naming.InvalidNameException
Method Detail |
public java.lang.String toNormName()
public java.lang.String toString()
public java.lang.String toUpName()
public int hashCode()
Object.hashCode()
public java.lang.String getName()
public int size()
size
in interface javax.naming.Name
public static int getNbBytes(javax.naming.Name dn)
public static byte[] getBytes(javax.naming.Name dn)
public boolean startsWith(javax.naming.Name name)
startsWith
in interface javax.naming.Name
name
- the name to check
public boolean endsWith(javax.naming.Name name)
endsWith
in interface javax.naming.Name
name
- the name to check
public boolean isEmpty()
isEmpty
in interface javax.naming.Name
public java.lang.String get(int posn)
get
in interface javax.naming.Name
posn
- the 0-based index of the component to retrieve. Must be in the
range [0,size()).
java.lang.ArrayIndexOutOfBoundsException
- if posn is outside the specified rangepublic Rdn getRdn(int posn)
posn
- the 0-based index of the component to retrieve. Must be in the
range [0,size()).
java.lang.ArrayIndexOutOfBoundsException
- if posn is outside the specified rangepublic java.util.List getRdns()
public java.util.Enumeration getAll()
getAll
in interface javax.naming.Name
public java.util.Enumeration getAllRdn()
public javax.naming.Name getPrefix(int posn)
getPrefix
in interface javax.naming.Name
posn
- the 0-based index of the component at which to stop. Must be
in the range [0,size()].
java.lang.ArrayIndexOutOfBoundsException
- if posn is outside the specified rangepublic javax.naming.Name getSuffix(int posn)
getSuffix
in interface javax.naming.Name
posn
- the 0-based index of the component at which to start. Must be
in the range [0,size()].
java.lang.ArrayIndexOutOfBoundsException
- if posn is outside the specified rangepublic javax.naming.Name addAll(javax.naming.Name suffix) throws javax.naming.InvalidNameException
addAll
in interface javax.naming.Name
suffix
- the components to add
javax.naming.InvalidNameException
- if suffix is not a valid name, or if the addition
of the components would violate the syntax rules of this namepublic javax.naming.Name addAll(int posn, javax.naming.Name name) throws javax.naming.InvalidNameException
addAll
in interface javax.naming.Name
name
- the components to addposn
- the index in this name at which to add the new components.
Must be in the range [0,size()].
java.lang.ArrayIndexOutOfBoundsException
- if posn is outside the specified range
javax.naming.InvalidNameException
- if n is not a valid name, or if the addition of
the components would violate the syntax rules of this namepublic javax.naming.Name add(java.lang.String comp) throws javax.naming.InvalidNameException
add
in interface javax.naming.Name
comp
- the component to add
javax.naming.InvalidNameException
- if adding comp would violate the syntax rules of
this namepublic javax.naming.Name add(int posn, java.lang.String comp) throws javax.naming.InvalidNameException
add
in interface javax.naming.Name
comp
- the component to addposn
- the index at which to add the new component. Must be in the
range [0,size()].
java.lang.ArrayIndexOutOfBoundsException
- if posn is outside the specified range
javax.naming.InvalidNameException
- if adding comp would violate the syntax rules of
this namepublic java.lang.Object remove(int posn) throws javax.naming.InvalidNameException
remove
in interface javax.naming.Name
posn
- the index of the component to remove. Must be in the range
[0,size()).
java.lang.ArrayIndexOutOfBoundsException
- if posn is outside the specified range
javax.naming.InvalidNameException
- if deleting the component would violate the syntax rules of
the namepublic java.lang.Object clone()
clone
in interface javax.naming.Name
Object.clone()
public boolean equals(java.lang.Object obj)
Object.equals(java.lang.Object)
public int compareTo(java.lang.Object obj)
As with Object.equals(), the notion of ordering for names depends on the class that implements this interface. For example, the ordering may be based on lexicographical ordering of the name components. Specific attributes of the name, such as how it treats case, may affect the ordering. In general, two names of different classes may not be compared.
compareTo
in interface javax.naming.Name
obj
- the non-null object to compare against.
java.lang.ClassCastException
- if obj is not a Name of a type that may be
compared with this nameComparable.compareTo(Object)
public static javax.naming.Name normalize(javax.naming.Name dn, java.util.Map oids) throws javax.naming.InvalidNameException, javax.naming.NamingException
dn
- The DN to transformoids
- The mapping between names and oids.
javax.naming.InvalidNameException
- If the DN is invalid
javax.naming.NamingException
public static javax.naming.Name normalize(javax.naming.Name dn) throws javax.naming.InvalidNameException, javax.naming.NamingException
javax.naming.InvalidNameException
javax.naming.NamingException
public static LdapString normalizeAttribute(byte[] data) throws LdapStringEncodingException
LdapStringEncodingException
- If the attribute is not valid
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |