|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.directory.shared.ldap.name.Rdn
This class store the name-component part or the following BNF grammar (as of
RFC2253, par. 3, and RFC1779, fig. 1) :
- <name-component> ::=
<attributeType> <spaces> '=' <spaces>
<attributeValue> <attributeTypeAndValues>
-
<attributeTypeAndValues> ::= <spaces> '+' <spaces>
<attributeType> <spaces> '=' <spaces>
<attributeValue> <attributeTypeAndValues> | e
-
<attributeType> ::= [a-zA-Z] <keychars> | <oidPrefix> [0-9]
<digits> <oids> | [0-9] <digits> <oids>
-
<keychars> ::= [a-zA-Z] <keychars> | [0-9] <keychars> | '-'
<keychars> | e
- <oidPrefix> ::= 'OID.' | 'oid.' | e
-
<oids> ::= '.' [0-9] <digits> <oids> | e
-
<attributeValue> ::= <pairs-or-strings> | '#' <hexstring>
|'"' <quotechar-or-pairs> '"'
- <pairs-or-strings> ::= '\'
<pairchar> <pairs-or-strings> | <stringchar>
<pairs-or-strings> | e
- <quotechar-or-pairs> ::=
<quotechar> <quotechar-or-pairs> | '\' <pairchar>
<quotechar-or-pairs> | e
- <pairchar> ::= ',' | '=' | '+' |
'<' | '>' | '#' | ';' | '\' | '"' | [0-9a-fA-F] [0-9a-fA-F]
-
<hexstring> ::= [0-9a-fA-F] [0-9a-fA-F] <hexpairs>
-
<hexpairs> ::= [0-9a-fA-F] [0-9a-fA-F] <hexpairs> | e
-
<digits> ::= [0-9] <digits> | e
- <stringchar> ::=
[0x00-0xFF] - [,=+<>#;\"\n\r]
- <quotechar> ::= [0x00-0xFF] -
[\"]
- <separator> ::= ',' | ';'
- <spaces> ::= ' '
<spaces> | e
A RDN is a part of a DN. It can be composed of many types, as in the RDN
following RDN :
ou=value + cn=other value
or
ou=value + ou=another value
In this case, we have to store an 'ou' and a 'cn' in the RDN.
The types are case insensitive.
Spaces before and after types and values are not stored.
Spaces before and after '+' are not stored.
Thus, we can consider that the following RDNs are equals :
'ou=test 1'
' ou=test 1'
'ou =test 1'
'ou= test 1'
'ou=test 1 '
' ou = test 1 '
So are the following :
'ou=test 1+cn=test 2'
'ou = test 1 + cn = test 2'
' ou =test 1+ cn =test 2 '
'cn = test 2 +ou = test 1'
but the following are not equal :
'ou=test 1'
'ou=test 1'
because we have more than one spaces inside the value.
The Rdn is composed of one or more AttributeTypeAndValue (atav) Those atavs
are ordered in the alphabetical natural order : a < b < c ... < z As the type
are not case sensitive, we can say that a = A
Field Summary | |
static int |
EQUALS
|
static int |
INFERIOR
|
static int |
SUPERIOR
|
static int |
UNDEFINED
CompareTo() results |
Constructor Summary | |
Rdn()
A empty constructor. |
|
Rdn(byte[] bytes)
A constructor that parse a RDN from a byte array. |
|
Rdn(Rdn rdn)
Constructs an Rdn from the given rdn. |
|
Rdn(java.lang.String rdn)
A constructor that parse a String RDN |
|
Rdn(java.lang.String type,
java.lang.String value)
A constructor that constructs a RDN from a type and a value. |
Method Summary | |
void |
clear()
Clear the RDN, removing all the AttributeTypeAndValues. |
java.lang.Object |
clone()
Clone the Rdn |
int |
compareTo(java.lang.Object object)
Compares two RDNs. |
boolean |
equals(java.lang.Object rdn)
Compares the specified Object with this Rdn for equality. |
static java.lang.String |
escapeValue(java.lang.Object attrValue)
Transform a value in a String, accordingly to RFC 2253 |
AttributeTypeAndValue |
getAtav()
Return the unique AttributeTypeAndValue, or the first one of we have more than one |
AttributeTypeAndValue |
getAttributeTypeAndValue(java.lang.String type)
Get the AttributeTypeAndValue which type is given as an argument. |
int |
getNbAtavs()
|
java.lang.String |
getType()
Return the type, or the first one of we have more than one (the lowest) |
java.lang.String |
getUpName()
Returns a String representation of the RDN |
java.lang.String |
getValue()
Return the value, or the first one of we have more than one (the lowest) |
java.lang.String |
getValue(java.lang.String type)
Get the Value of the AttributeTypeAndValue which type is given as an argument. |
int |
hashcode()
Returns the hash code of this RDN. |
java.util.Iterator |
iterator()
Retrieves the components of this name as an enumeration of strings. |
void |
setUpName(java.lang.String upName)
Set the User Provided Name |
int |
size()
Get the number of Attribute type and value of this Rdn |
javax.naming.directory.Attributes |
toAttributes()
Transform the Rdn into an javax.naming.directory.Attributes |
java.lang.String |
toString()
Returns a String representation of the RDN |
static java.lang.Object |
unescapeValue(java.lang.String value)
Unescape the given string according to RFC 2253 If in |
Methods inherited from class java.lang.Object |
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int UNDEFINED
public static final int SUPERIOR
public static final int INFERIOR
public static final int EQUALS
Constructor Detail |
public Rdn()
public Rdn(java.lang.String rdn) throws javax.naming.InvalidNameException
rdn
- The String containing the RDN to parse
javax.naming.InvalidNameException
- If the RDN is invalidpublic Rdn(byte[] bytes) throws javax.naming.InvalidNameException
javax.naming.InvalidNameException
- If the RDN is invalidpublic Rdn(java.lang.String type, java.lang.String value) throws javax.naming.InvalidNameException
type
- The type of the RDNvalue
- The value of the RDN
javax.naming.InvalidNameException
- If the RDN is invalidpublic Rdn(Rdn rdn)
rdn
- The non-null Rdn to be copied.Method Detail |
public void clear()
public java.lang.String getValue(java.lang.String type) throws javax.naming.InvalidNameException
type
- The type of the NameArgument
javax.naming.InvalidNameException
public AttributeTypeAndValue getAttributeTypeAndValue(java.lang.String type)
type
- The type of the NameArgument to be returned
public java.util.Iterator iterator()
public java.lang.Object clone()
public int compareTo(java.lang.Object object)
compareTo
in interface java.lang.Comparable
object
-
public java.lang.String toString()
public java.lang.String getUpName()
public void setUpName(java.lang.String upName)
public int getNbAtavs()
public AttributeTypeAndValue getAtav()
public java.lang.String getType()
public java.lang.String getValue()
public boolean equals(java.lang.Object rdn)
rdn
- Rdn to be compared for equality with this Rdn
public int hashcode()
public int size()
public javax.naming.directory.Attributes toAttributes()
public static java.lang.Object unescapeValue(java.lang.String value) throws java.lang.IllegalArgumentException
value
- The value to be unescaped
java.lang.IllegalArgumentException
- -
When an Illegal value is provided.public static java.lang.String escapeValue(java.lang.Object attrValue)
attrValue
- The attribute value to be escaped
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |