org.apache.directory.shared.ldap.name
Enum DnParser

java.lang.Object
  extended by java.lang.Enum<DnParser>
      extended by org.apache.directory.shared.ldap.name.DnParser
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<DnParser>

public enum DnParser
extends java.lang.Enum<DnParser>

This class parses a DN. The DN MUST respect this BNF grammar (as of RFC2253, par. 3, and RFC1779, fig. 1)

- <distinguishedName> ::= <name> | e
- <name> ::= <name-component> <name-components>
- <name-components> ::= <spaces> <separator> <spaces> <name-component> <name-components> | e
- <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

Version:
$Rev: 923667 $, $Date: 2010-03-16 11:22:36 +0100 (Tue, 16 Mar 2010) $
Author:
Apache Directory Project

Enum Constant Summary
INSTANCE
           
 
Method Summary
static DnParser getNameParser()
          Get a reference to the NameParser.
 DN parse(java.lang.String dn)
          Parse a String and return a DN if the String is a valid DN
static void parseInternal(java.lang.String name, java.util.List<RDN> rdns)
          Parse a DN.
static boolean validateInternal(java.lang.String name)
          Validate a DN
static DnParser valueOf(java.lang.String name)
          Returns the enum constant of this type with the specified name.
static DnParser[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

INSTANCE

public static final DnParser INSTANCE
Method Detail

values

public static DnParser[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (DnParser c : DnParser.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static DnParser valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
java.lang.NullPointerException - if the argument is null

getNameParser

public static DnParser getNameParser()
Get a reference to the NameParser. Needed to be compliant with the JNDI API

Returns:
An instance of the NameParser

parseInternal

public static void parseInternal(java.lang.String name,
                                 java.util.List<RDN> rdns)
                          throws LdapInvalidDnException
Parse a DN.

Parameters:
dn - The DN to be parsed
rdns - The list that will contain the RDNs
Throws:
LdapInvalidDnException - If the DN is invalid

validateInternal

public static boolean validateInternal(java.lang.String name)
Validate a DN

Parameters:
dn - The DN to be parsed
Returns:
true if the DN is valid

parse

public DN parse(java.lang.String dn)
         throws LdapInvalidDnException
Parse a String and return a DN if the String is a valid DN

Parameters:
dn - The DN to parse
Returns:
A DN
Throws:
LdapInvalidDnException - If the String is not a valid DN


Copyright © 2003-2011 Apache Software Foundation. All Rights Reserved.