|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.directory.api.ldap.model.name.Rdn
public class 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 Ava. Those Avas
are ordered in the alphabetical natural order : a < b < c ... < z As the type
are not case sensitive, we can say that a = A
This class is immutable.
| Field Summary | |
|---|---|
protected Ava |
ava
A simple Ava is used to store the Rdn for the simple case where we only have a single type=value. |
static Rdn |
EMPTY_RDN
An empty Rdn |
static int |
EQUAL
Constant used in comparisons |
static int |
INFERIOR
Constant used in comparisons |
protected static org.slf4j.Logger |
LOG
The LoggerFactory used by this class |
static int |
SUPERIOR
Constant used in comparisons |
static int |
UNDEFINED
CompareTo() results |
| Constructor Summary | |
|---|---|
Rdn()
A empty constructor. |
|
Rdn(Rdn rdn)
Constructs an Rdn from the given rdn. |
|
Rdn(SchemaManager schemaManager)
Creates a new schema aware instance of Rdn. |
|
Rdn(SchemaManager schemaManager,
String rdn)
A constructor that parse a String representing a schema aware Rdn. |
|
Rdn(SchemaManager schemaManager,
String upType,
String upValue)
A constructor that constructs a schema aware Rdn from a type and a value. |
|
Rdn(String rdn)
A constructor that parse a String representing a Rdn. |
|
Rdn(String upType,
String upValue)
A constructor that constructs a Rdn from a type and a value. |
|
| Method Summary | |
|---|---|
Rdn |
apply(SchemaManager schemaManager)
Transform a Rdn by changing the value to its OID counterpart and normalizing the value accordingly to its type. |
Rdn |
clone()
Clone the Rdn |
int |
compareTo(Rdn arg0)
|
boolean |
equals(Object that)
Compares the specified Object with this Rdn for equality. |
static String |
escapeValue(byte[] attrValue)
Transform a value in a String, accordingly to RFC 2253 |
static String |
escapeValue(String value)
Transform a value in a String, accordingly to RFC 2253 |
Ava |
getAva()
Return the unique Ava, or the first one of we have more than one |
Ava |
getAva(String type)
Get the Ava which type is given as an argument. |
String |
getName()
|
String |
getNormName()
|
String |
getNormType()
Return the normalized type, or the first one of we have more than one (the lowest) |
Value<?> |
getNormValue()
Return the normalized value, or the first one of we have more than one (the lowest) |
String |
getType()
Return the user provided type, or the first one of we have more than one (the lowest) |
Value<?> |
getValue()
Return the User Provided value |
Object |
getValue(String type)
Get the Value of the Ava which type is given as an argument. |
int |
hashCode()
Gets the hashcode of this rdn. |
boolean |
isSchemaAware()
Tells if the Rdn is schema aware. |
static boolean |
isValid(String dn)
Validate a NameComponent : |
Iterator<Ava> |
iterator()
Retrieves the components of this Rdn as an iterator of Avas. |
void |
readExternal(ObjectInput in)
We read back the data to create a new RDB. |
int |
size()
Get the number of Avas of this Rdn |
String |
toString()
|
static Object |
unescapeValue(String value)
Unescape the given string according to RFC 2253 If in |
void |
writeExternal(ObjectOutput out)
A Rdn is composed of on to many Avas (AttributeType And Value). |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected static final org.slf4j.Logger LOG
public static final Rdn EMPTY_RDN
protected Ava ava
public static final int UNDEFINED
public static final int SUPERIOR
public static final int INFERIOR
public static final int EQUAL
| Constructor Detail |
|---|
public Rdn()
public Rdn(SchemaManager schemaManager)
schemaManager - the schema manager
public Rdn(SchemaManager schemaManager,
String rdn)
throws LdapInvalidDnException
schemaManager - the schema managerrdn - the String containing the Rdn to parse
LdapInvalidDnException - if the Rdn is invalid
public Rdn(String rdn)
throws LdapInvalidDnException
rdn - the String containing the Rdn to parse
LdapInvalidDnException - if the Rdn is invalid
public Rdn(SchemaManager schemaManager,
String upType,
String upValue)
throws LdapInvalidDnException
The string attribute values are not interpreted as RFC 414 formatted Rdn strings. That is, the values are used literally (not parsed) and assumed to be un-escaped.
schemaManager - the schema managerupType - the user provided type of the RdnupValue - the user provided value of the Rdn
LdapInvalidDnException - if the Rdn is invalid
public Rdn(String upType,
String upValue)
throws LdapInvalidDnException
upType - the user provided type of the RdnupValue - the user provided value of the Rdn
LdapInvalidDnException - if the Rdn is invalidRdn( SchemaManager, String, String )public Rdn(Rdn rdn)
rdn - The non-null Rdn to be copied.| Method Detail |
|---|
public Rdn apply(SchemaManager schemaManager)
throws LdapInvalidDnException
schemaManager - the SchemaManager
LdapInvalidDnException - if the Rdn is invalid
public Object getValue(String type)
throws LdapInvalidDnException
type - the type of the NameArgument
LdapInvalidDnException - if the Rdn is invalidpublic Ava getAva(String type)
type - The type of the NameArgument to be returned
public Iterator<Ava> iterator()
iterator in interface Iterable<Ava>public Rdn clone()
clone in class Objectpublic String getName()
public String getNormName()
public Ava getAva()
public String getType()
public String getNormType()
public Value<?> getValue()
public Value<?> getNormValue()
public boolean equals(Object that)
equals in class Objectrdn - Rdn to be compared for equality with this Rdn
public int size()
public static Object unescapeValue(String value)
throws IllegalArgumentException
value - The value to be unescaped
IllegalArgumentException - When an Illegal value is provided.public static String escapeValue(String value)
value - The attribute value to be escaped
public static String escapeValue(byte[] attrValue)
attrValue - The attribute value to be escaped
public boolean isSchemaAware()
true if the Rdn is schema awarepublic static boolean isValid(String dn)
<name-component> ::= <attributeType> <spaces> '=' <spaces> <attributeValue> <nameComponents>
dn - The string to parse
true if the Rdn is validpublic int hashCode()
hashCode in class ObjectObject.hashCode()
public void writeExternal(ObjectOutput out)
throws IOException
writeExternal in interface Externalizableout - The stream into which the serialized Rdn will be put
IOException - If the stream can't be writtenExternalizable.readExternal(ObjectInput)
public void readExternal(ObjectInput in)
throws IOException,
ClassNotFoundException
writeExternal(ObjectOutput)
method
readExternal in interface Externalizablein - The input stream from which the Rdn will be read
IOException - If we can't read from the input stream
ClassNotFoundException - If we can't create a new RdnExternalizable.readExternal(ObjectInput)public int compareTo(Rdn arg0)
compareTo in interface Comparable<Rdn>public String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||