public class Rdn extends Object implements Cloneable, Externalizable, Iterable<Ava>
Modifier and Type | Field and Description |
---|---|
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 and Description |
---|
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.
|
Modifier and Type | Method and Description |
---|---|
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
|
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 |
getUpType()
Return the user provided type, or the first one of we have more than one (the lowest)
|
Value<?> |
getUpValue()
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).
|
protected static final org.slf4j.Logger LOG
protected Ava ava
public static final int UNDEFINED
public static final int SUPERIOR
public static final int INFERIOR
public static final int EQUAL
public Rdn()
public Rdn(SchemaManager schemaManager)
schemaManager
- the schema managerpublic Rdn(SchemaManager schemaManager, String rdn) throws LdapInvalidDnException
schemaManager
- the schema managerrdn
- the String containing the Rdn to parseLdapInvalidDnException
- if the Rdn is invalidpublic Rdn(String rdn) throws LdapInvalidDnException
rdn
- the String containing the Rdn to parseLdapInvalidDnException
- if the Rdn is invalidpublic 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 RdnLdapInvalidDnException
- if the Rdn is invalidpublic Rdn(String upType, String upValue) throws LdapInvalidDnException
upType
- the user provided type of the RdnupValue
- the user provided value of the RdnLdapInvalidDnException
- if the Rdn is invalidRdn( SchemaManager, String, String )
public Rdn apply(SchemaManager schemaManager) throws LdapInvalidDnException
schemaManager
- the SchemaManagerLdapInvalidDnException
- if the Rdn is invalidpublic Object getValue(String type) throws LdapInvalidDnException
type
- the type of the NameArgumentLdapInvalidDnException
- if the Rdn is invalidpublic Ava getAva(String type)
type
- The type of the NameArgument to be returnedpublic Iterator<Ava> iterator()
public String getNormName()
public Ava getAva()
public String getUpType()
public String getNormType()
public Value<?> getUpValue()
public Value<?> getNormValue()
public boolean equals(Object that)
public int size()
public static Object unescapeValue(String value) throws IllegalArgumentException
value
- The value to be unescapedIllegalArgumentException
- When an Illegal value is provided.public static String escapeValue(String value)
value
- The attribute value to be escapedpublic static String escapeValue(byte[] attrValue)
attrValue
- The attribute value to be escapedpublic 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 parsetrue
if the Rdn is validpublic int hashCode()
hashCode
in class Object
Object.hashCode()
public void writeExternal(ObjectOutput out) throws IOException
writeExternal
in interface Externalizable
out
- The stream into which the serialized Rdn will be putIOException
- If the stream can't be writtenExternalizable.readExternal(ObjectInput)
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
writeExternal(ObjectOutput)
methodreadExternal
in interface Externalizable
in
- The input stream from which the Rdn will be readIOException
- If we can't read from the input streamClassNotFoundException
- If we can't create a new RdnExternalizable.readExternal(ObjectInput)
Copyright © 2003-2014 The Apache Software Foundation. All Rights Reserved.