public class RDN extends Object implements Cloneable, Comparable<RDN>, Externalizable, Iterable<AVA>
Modifier and Type | Field and Description |
---|---|
protected AVA |
atav
A simple AttributeTypeAndValue 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(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.
|
RDN(String upType,
String normType,
String upValue,
String normValue)
A constructor that constructs a RDN from a type and a value.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clear the RDN, removing all the AttributeTypeAndValues.
|
Object |
clone()
Clone the Rdn
|
int |
compareTo(RDN rdn)
Compares two RDNs.
|
boolean |
equals(Object rdn)
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 |
getAtav()
Return the unique AttributeTypeAndValue, or the first one of we have more
than one
|
AVA |
getAttributeTypeAndValue(String type)
Get the AttributeTypeAndValue which type is given as an argument.
|
int |
getLength()
Get the Rdn length
|
String |
getName() |
int |
getNbAtavs() |
String |
getNormName() |
String |
getNormType()
Return the normalized type, or the first one of we have more than one (the lowest)
|
String |
getNormValue()
Return the normalized value, or the first one of we have more than one (the lowest)
|
int |
getStart()
Get the start position
|
String |
getUpType()
Return the user provided type, or the first one of we have more than one (the lowest)
|
String |
getUpValue()
Return the User Provided value
|
Object |
getValue(String type)
Get the Value of the AttributeTypeAndValue which type is given as an
argument.
|
int |
hashCode()
Gets the hashcode of this rdn.
|
Iterator<AVA> |
iterator()
Retrieves the components of this RDN as an iterator of AttributeTypeAndValue.
|
RDN |
normalize(Map<String,OidNormalizer> oidsMap)
Transform a RDN by changing the value to its OID counterpart and
normalizing the value accordingly to its type.
|
void |
readExternal(ObjectInput in) |
void |
setUpName(String upName)
Set the User Provided Name
|
int |
size()
Get the number of Attribute type and value of this Rdn
|
String |
toString() |
static Object |
unescapeValue(String value)
Unescape the given string according to RFC 2253 If in
|
void |
writeExternal(ObjectOutput out) |
protected static final org.slf4j.Logger LOG
public static final RDN EMPTY_RDN
protected AVA atav
public static final int UNDEFINED
public static final int SUPERIOR
public static final int INFERIOR
public static final int EQUAL
public RDN()
public RDN(String rdn) throws LdapInvalidDnException
rdn
- The String containing the RDN to parseLdapInvalidDnException
- If the RDN is invalidpublic RDN(String upType, String normType, String upValue, String normValue) throws LdapInvalidDnException
upType
- The user provided type of the RDNupValue
- The user provided value of the RDNnormType
- The normalized provided type of the RDNnormValue
- The normalized 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 invalidpublic RDN(RDN rdn)
rdn
- The non-null Rdn to be copied.public RDN normalize(Map<String,OidNormalizer> oidsMap) throws LdapInvalidDnException
rdn
- The RDN to modify.oidsMap
- The map of all existing oids and normalizer.LdapException
- If the RDN is invalid.LdapInvalidDnException
public void clear()
public Object getValue(String type) throws LdapInvalidDnException
type
- The type of the NameArgumentLdapInvalidDnException
public int getStart()
public int getLength()
public AVA getAttributeTypeAndValue(String type)
type
- The type of the NameArgument to be returnedpublic Iterator<AVA> iterator()
public Object clone()
public int compareTo(RDN rdn)
compareTo
in interface Comparable<RDN>
object
- public String getName()
public String getNormName()
public void setUpName(String upName)
upName
- the User Provided damepublic int getNbAtavs()
public AVA getAtav()
public String getUpType()
public String getNormType()
public String getUpValue()
public String getNormValue()
public boolean equals(Object rdn)
public int size()
public static Object unescapeValue(String value)
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 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 writtenA RDN is composed of on to many ATAVs (AttributeType And Value).
We should write all those ATAVs sequencially, following the
structure :
- nbAtavs
The number of ATAVs to write. Can't be 0.
- upName
The User provided RDN
- normName
The normalized RDN. It can be empty if the normalized
name equals the upName.
- atavs
For each ATAV :
- start
The position of this ATAV in the upName string
- length
The ATAV user provided length
- Call the ATAV write method
The ATAV itself
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readExternal
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 RDNWe read back the data to create a new RDB. The structure
read is exposed in the {@link RDN#writeExternal(ObjectOutput)}
method
Copyright © 2003-2013 The Apache Software Foundation. All Rights Reserved.