org.apache.directory.shared.ldap.schema.normalizers
Class CachingNormalizer

java.lang.Object
  extended by org.apache.directory.shared.ldap.schema.AbstractSchemaObject
      extended by org.apache.directory.shared.ldap.schema.LoadableSchemaObject
          extended by org.apache.directory.shared.ldap.schema.Normalizer
              extended by org.apache.directory.shared.ldap.schema.normalizers.CachingNormalizer
All Implemented Interfaces:
java.io.Serializable, SchemaObject
Direct Known Subclasses:
CachingDeepTrimNormalizer, CachingDeepTrimToLowerNormalizer, CachingDnNormalizer

public class CachingNormalizer
extends Normalizer

Caches previously normalized values.

Version:
$Rev: 928935 $
Author:
Apache Directory Project
See Also:
Serialized Form

Field Summary
static int CACHE_MAX
          Cache maximum size default
protected  Normalizer normalizer
          The underlying decorated Normalizer
static long serialVersionUID
          The serial UID
 
Fields inherited from class org.apache.directory.shared.ldap.schema.AbstractSchemaObject
description, extensions, isEnabled, isObsolete, isReadOnly, locked, names, objectType, oid, schemaName, specification
 
Constructor Summary
CachingNormalizer(Normalizer normalizer)
          Creates a CachingNormalizer that decorates another normalizer using a default cache size.
CachingNormalizer(Normalizer normalizer, int cacheSz)
          Creates a CachingNormalizer that decorates another normalizer using a specified cache size.
 
Method Summary
 java.lang.String getOid()
          Overrides default behavior by returning the OID of the wrapped Normalizer.
 java.lang.String normalize(java.lang.String value)
          Gets the normalized value.
 Value<?> normalize(Value<?> value)
          Gets the normalized value.
 void setOid(java.lang.String oid)
          Overrides default behavior by setting the OID of the wrapped Normalizer.
 void setRegistries(Registries registries)
          Inject the Registries into the SchemaObject
 void setSchemaManager(SchemaManager schemaManager)
          Sets the SchemaManager
 
Methods inherited from class org.apache.directory.shared.ldap.schema.Normalizer
equals, toString
 
Methods inherited from class org.apache.directory.shared.ldap.schema.LoadableSchemaObject
copy, getBytecode, getFqcn, isValid, registerOid, setBytecode, setFqcn
 
Methods inherited from class org.apache.directory.shared.ldap.schema.AbstractSchemaObject
addExtension, addName, addToRegistries, clear, compareOid, copy, getDescription, getExtensions, getName, getNames, getObjectType, getSchemaName, getSpecification, hashCode, isDisabled, isEnabled, isObsolete, isReadOnly, lock, removeFromRegistries, setDescription, setEnabled, setExtensions, setNames, setNames, setObsolete, setReadOnly, setSchemaName, setSpecification
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

public static final long serialVersionUID
The serial UID

See Also:
Constant Field Values

CACHE_MAX

public static final int CACHE_MAX
Cache maximum size default

See Also:
Constant Field Values

normalizer

protected final Normalizer normalizer
The underlying decorated Normalizer

Constructor Detail

CachingNormalizer

public CachingNormalizer(Normalizer normalizer)
Creates a CachingNormalizer that decorates another normalizer using a default cache size. This Normalizer delegates

Parameters:
oid - The MR OID to use with this Normalizer
normalizer - the underlying Normalizer being decorated

CachingNormalizer

public CachingNormalizer(Normalizer normalizer,
                         int cacheSz)
Creates a CachingNormalizer that decorates another normalizer using a specified cache size.

Parameters:
normalizer - the underlying Normalizer being decorated
cacheSz - the maximum size of the name cache
Method Detail

getOid

public java.lang.String getOid()
Overrides default behavior by returning the OID of the wrapped Normalizer.

Specified by:
getOid in interface SchemaObject
Overrides:
getOid in class AbstractSchemaObject
Returns:
an OID for this SchemaObject or its MatchingRule if this SchemaObject is a MatchingRuleUse object

setOid

public void setOid(java.lang.String oid)
Overrides default behavior by setting the OID of the wrapped Normalizer.

Specified by:
setOid in interface SchemaObject
Overrides:
setOid in class AbstractSchemaObject
Parameters:
oid - the object identifier to set

normalize

public Value<?> normalize(Value<?> value)
                   throws LdapException
Gets the normalized value.

Specified by:
normalize in class Normalizer
Parameters:
value - the value to normalize. It must *not* be null !
Returns:
the normalized form for a value
Throws:
LdapException - if an error results during normalization

normalize

public java.lang.String normalize(java.lang.String value)
                           throws LdapException
Gets the normalized value.

Specified by:
normalize in class Normalizer
Parameters:
value - the value to normalize. It must *not* be null !
Returns:
the normalized form for a value
Throws:
LdapException - if an error results during normalization

setRegistries

public void setRegistries(Registries registries)
Inject the Registries into the SchemaObject

Specified by:
setRegistries in interface SchemaObject
Overrides:
setRegistries in class AbstractSchemaObject
Parameters:
registries - The Registries

setSchemaManager

public void setSchemaManager(SchemaManager schemaManager)
Sets the SchemaManager

Overrides:
setSchemaManager in class Normalizer
Parameters:
schemaManager - The SchemaManager


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