org.apache.directory.shared.ldap.name
Class SimpleNameComponentNormalizer

java.lang.Object
  extended by org.apache.directory.shared.ldap.name.SimpleNameComponentNormalizer
All Implemented Interfaces:
NameComponentNormalizer

public class SimpleNameComponentNormalizer
extends Object
implements NameComponentNormalizer

A simple NameComponentNormalizer which uses the same Normalizer to always normalize the value the same way regardless of the attribute the value is for.

Version:
$Rev: 437312 $
Author:
Apache Directory Project

Constructor Summary
SimpleNameComponentNormalizer(Normalizer normalizer)
          Creates a new SimpleNameComponentNormalizer with the normalizer it uses ever time irrespective of the attribute name or oid.
 
Method Summary
 boolean isDefined(String oid)
          Checks to see if an attribute name/oid is defined.
 Object normalizeByName(String name, byte[] val)
          Normalizes an attribute's value given the name of the attribute - short names like 'cn' as well as 'commonName' should work here.
 Object normalizeByName(String name, String val)
          Normalizes an attribute's value given the name of the attribute - short names like 'cn' as well as 'commonName' should work here.
 Object normalizeByOid(String oid, byte[] val)
          Normalizes an attribute's value given the OID of the attribute.
 Object normalizeByOid(String oid, String val)
          Normalizes an attribute's value given the OID of the attribute.
 String normalizeName(String attributeName)
          Normalizes the attribute name/alias to use the OID for it instead.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleNameComponentNormalizer

public SimpleNameComponentNormalizer(Normalizer normalizer)
Creates a new SimpleNameComponentNormalizer with the normalizer it uses ever time irrespective of the attribute name or oid.

Parameters:
normalizer - the Normalizer to use for all normalization requests
Method Detail

normalizeByName

public Object normalizeByName(String name,
                              String val)
                       throws NamingException
Description copied from interface: NameComponentNormalizer
Normalizes an attribute's value given the name of the attribute - short names like 'cn' as well as 'commonName' should work here.

Specified by:
normalizeByName in interface NameComponentNormalizer
Parameters:
name - the name of the attribute
val - the value of the attribute to normalize
Returns:
the normalized value
Throws:
NamingException - if there is a recognition problem or a syntax issue

normalizeByName

public Object normalizeByName(String name,
                              byte[] val)
                       throws NamingException
Description copied from interface: NameComponentNormalizer
Normalizes an attribute's value given the name of the attribute - short names like 'cn' as well as 'commonName' should work here.

Specified by:
normalizeByName in interface NameComponentNormalizer
Parameters:
name - the name of the attribute
val - the value of the attribute to normalize
Returns:
the normalized value
Throws:
NamingException - if there is a recognition problem or a syntax issue

normalizeByOid

public Object normalizeByOid(String oid,
                             String val)
                      throws NamingException
Description copied from interface: NameComponentNormalizer
Normalizes an attribute's value given the OID of the attribute.

Specified by:
normalizeByOid in interface NameComponentNormalizer
Parameters:
oid - the OID of the attribute
val - the value of the attribute to normalize
Returns:
the normalized value
Throws:
NamingException - if there is a recognition problem or a syntax issue

normalizeByOid

public Object normalizeByOid(String oid,
                             byte[] val)
                      throws NamingException
Description copied from interface: NameComponentNormalizer
Normalizes an attribute's value given the OID of the attribute.

Specified by:
normalizeByOid in interface NameComponentNormalizer
Parameters:
oid - the OID of the attribute
val - the value of the attribute to normalize
Returns:
the normalized value
Throws:
NamingException - if there is a recognition problem or a syntax issue

isDefined

public boolean isDefined(String oid)
Description copied from interface: NameComponentNormalizer
Checks to see if an attribute name/oid is defined.

Specified by:
isDefined in interface NameComponentNormalizer
Parameters:
oid - the name/oid of the attribute to see if it is defined
Returns:
true if it is, false otherwise

normalizeName

public String normalizeName(String attributeName)
                     throws NamingException
Description copied from interface: NameComponentNormalizer
Normalizes the attribute name/alias to use the OID for it instead.

Specified by:
normalizeName in interface NameComponentNormalizer
Parameters:
attributeName - the name or OID of the attributeType
Returns:
the OID of the attributeType if it is recognized
Throws:
NamingException - if the attributeName is not recognized as a valid alias


Copyright © 2004-2012. All Rights Reserved.