|
LDAPJDK 4.1 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--netscape.ldap.util.DN
Objects of this class represent distinguished names (DN). A distinguished name is used to identify an entry in a directory.
The netscape.ldap.LDAPDN
class uses this class
internally. In most cases, when working with DNs in the
LDAP Java classes, you should use the
netscape.ldap.LDAPDN
class.
The following DNs are examples of the different formats for DNs that may appear:
LDAPDN
, Serialized FormField Summary | |
static char[] |
ESCAPED_CHAR
Array of the characters that may be escaped in a DN. |
static int |
OSF
Type specifying a DN in the OSF format. |
static int |
RFC
Type specifying a DN in the RFC format. |
Constructor Summary | |
DN()
Constructs an empty DN object. |
|
DN(java.lang.String dn)
Constructs a DN object from the specified
distinguished name. |
Method Summary | |
void |
addRDN(RDN rdn)
Adds the specified relative distinguished name (RDN) to the current DN. |
void |
addRDNToBack(RDN rdn)
Adds the specified relative distinguished name (RDN) to the end of the current DN. |
void |
addRDNToFront(RDN rdn)
Adds the specified relative distinguished name (RDN) to the beginning of the current DN. |
boolean |
contains(DN dn)
Deprecated. Please use isDescendantOf() instead. |
int |
countRDNs()
Returns the number of components that make up the current DN. |
boolean |
equals(DN dn)
Determines if the current DN is equal to the specified DN. |
java.lang.String[] |
explodeDN(boolean noTypes)
Returns an array of the individual components that make up the current distinguished name. |
int |
getDNType()
Gets the type of format used for the DN (RFC format or OSF format). |
DN |
getParent()
Gets the parent DN for this DN. |
java.util.Vector |
getRDNs()
Returns a list of the components ( RDN objects)
that make up the current DN. |
boolean |
isDescendantOf(DN dn)
Determines if this DN is a descendant of the given DN. |
static boolean |
isDN(java.lang.String dn)
Determines if the given string is an distinguished name or not. |
boolean |
isRFC()
Determines if the DN is in RFC 1485 format. |
void |
setDNType(int type)
Sets the type of format used for the DN (RFC format or OSF format). |
java.lang.String |
toOSFString()
Returns the DN in OSF format. |
java.lang.String |
toRFCString()
Returns the DN in RFC 1485 format. |
java.lang.String |
toString()
Returns the string representation of the DN in its original format. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Field Detail |
public static int RFC
getDNType()
,
setDNType(int)
public static int OSF
getDNType()
,
setDNType(int)
public static final char[] ESCAPED_CHAR
Constructor Detail |
public DN()
DN
object.public DN(java.lang.String dn)
DN
object from the specified
distinguished name. The string representation of the DN
can be in RFC 1485 or OSF format.
dn
- string representation of the distinguished nameMethod Detail |
public void addRDNToFront(RDN rdn)
rdn
- the relative distinguished name to add to the
beginning of the current DNRDN
public void addRDNToBack(RDN rdn)
rdn
- the relative distinguished name to append to the current DNRDN
public void addRDN(RDN rdn)
rdn
- the relative distinguished name to add to the current DNRDN
public void setDNType(int type)
type
- one of the following constants: DN.RFC
(to use the RFC format) or DN.OSF
(to use the OSF format)getDNType()
,
RFC
,
OSF
public int getDNType()
DN.RFC
(if the DN is in RFC format) or DN.OSF
(if the DN is in OSF format).setDNType(int)
,
RFC
,
OSF
public int countRDNs()
public java.util.Vector getRDNs()
RDN
objects)
that make up the current DN.RDN
public java.lang.String[] explodeDN(boolean noTypes)
noTypes
- specify true
to remove the attribute type
and equals sign (for example, "cn=") from each componentpublic boolean isRFC()
true
if the DN is in RFC 1485 format.public java.lang.String toRFCString()
public java.lang.String toOSFString()
public java.lang.String toString()
DN
object was constructed from a DN
in RFC 1485 format, this method returns the DN
in RFC 1485 format.public static boolean isDN(java.lang.String dn)
dn
- distinguished nametrue
or false
.public boolean equals(DN dn)
dn
- DN to compare against the current DNtrue
if the two DNs are the same.public DN getParent()
For example, the following section of code gets the parent DN of "uid=bjensen, ou=People, o=Airius.com."
DN dn = new DN("uid=bjensen, ou=People, o=Airius.com"); DN parent = dn.getParent();The parent DN in this example is "ou=People, o=Airius.com".
public boolean contains(DN dn)
For example, the following section of code determines if the
DN specified by dn1
is under the subtree specified
by dn2
.
DN dn1 = new DN("uid=bjensen, ou=People, o=Airius.com"); DN dn2 = new DN("ou=People, o=Airius.com"); boolean isContain = dn1.contains(dn2)In this case, since "uid=bjensen, ou=People, o=Airius.com" is an entry under the subtree "ou=People, o=Airius.com", the value of
isContain
is true.
dn
- the DN of a subtree to checktrue
if the current DN belongs to the subtree
specified by dn
.public boolean isDescendantOf(DN dn)
For example, the following section of code determines if the
DN specified by dn1
is a descendant of the DN specified
by dn2
.
DN dn1 = new DN("uid=bjensen, ou=People, o=Airius.com"); DN dn2 = new DN("ou=People, o=Airius.com"); boolean isDescendant = dn1.isDescendantOf(dn2)In this case, since "uid=bjensen, ou=People, o=Airius.com" is an entry under the subtree "ou=People, o=Airius.com", the value of
isDescendant
is true.
In the case where the given DN is equal to this DN it returns false.
dn
- the DN of a subtree to checktrue
if the current DN is a descendant of the DN
specified by dn
.
|
LDAPJDK 4.1 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |