org.apache.directory.shared.ldap.schema.registries
Class DefaultDITStructureRuleRegistry

java.lang.Object
  extended by org.apache.directory.shared.ldap.schema.registries.DefaultSchemaObjectRegistry<DITStructureRule>
      extended by org.apache.directory.shared.ldap.schema.registries.DefaultDITStructureRuleRegistry
All Implemented Interfaces:
java.lang.Iterable<DITStructureRule>, DITStructureRuleRegistry, SchemaObjectRegistry<DITStructureRule>

public class DefaultDITStructureRuleRegistry
extends DefaultSchemaObjectRegistry<DITStructureRule>
implements DITStructureRuleRegistry

A DITStructureRule registry's service default implementation.

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

Field Summary
protected  java.util.Map<java.lang.Integer,DITStructureRule> byRuleId
          a map of DITStructureRule looked up by RuleId
 
Fields inherited from class org.apache.directory.shared.ldap.schema.registries.DefaultSchemaObjectRegistry
byName, oidRegistry, schemaObjectType
 
Constructor Summary
DefaultDITStructureRuleRegistry()
          Creates a new default NormalizerRegistry instance.
 
Method Summary
 boolean contains(int ruleId)
          Checks to see if an DITStructureRule exists in the registry, by its ruleId.
 DefaultDITStructureRuleRegistry copy()
          Copy the DITStructureRuleRegistry
 java.lang.String getSchemaName(int ruleId)
          Gets the name of the schema this schema object is associated with.
 java.util.Iterator<DITStructureRule> iterator()
          Gets an iterator over the registered schema objects in the registry.
 DITStructureRule lookup(int ruleId)
          Looks up an dITStructureRule by its unique Object IDentifier or by its name.
 void register(DITStructureRule ditStructureRule)
          Registers a new SchemaObject with this registry.
 void renameSchema(java.lang.String originalSchemaName, java.lang.String newSchemaName)
          Modify all the SchemaObject using a schemaName when this name changes.
 java.util.Iterator<java.lang.Integer> ruleIdIterator()
          Gets an iterator over the registered ruleId in the registry.
 void unregister(int ruleId)
          Unregisters a DITStructureRule using it's rule identifier.
 void unregisterSchemaElements(java.lang.String schemaName)
          Unregisters all SchemaObjects defined for a specific schema from this registry.
 
Methods inherited from class org.apache.directory.shared.ldap.schema.registries.DefaultSchemaObjectRegistry
clear, contains, copy, get, getOidByName, getSchemaName, getType, lookup, oidsIterator, size, toString, unregister, unregister
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.directory.shared.ldap.schema.registries.SchemaObjectRegistry
clear, contains, get, getOidByName, getSchemaName, getType, lookup, oidsIterator, size, unregister, unregister
 

Field Detail

byRuleId

protected java.util.Map<java.lang.Integer,DITStructureRule> byRuleId
a map of DITStructureRule looked up by RuleId

Constructor Detail

DefaultDITStructureRuleRegistry

public DefaultDITStructureRuleRegistry()
Creates a new default NormalizerRegistry instance.

Method Detail

contains

public boolean contains(int ruleId)
Checks to see if an DITStructureRule exists in the registry, by its ruleId.

Specified by:
contains in interface DITStructureRuleRegistry
Returns:
true if a DITStructureRule definition exists for the ruleId, false otherwise

iterator

public java.util.Iterator<DITStructureRule> iterator()
Gets an iterator over the registered schema objects in the registry.

Specified by:
iterator in interface java.lang.Iterable<DITStructureRule>
Specified by:
iterator in interface DITStructureRuleRegistry
Specified by:
iterator in interface SchemaObjectRegistry<DITStructureRule>
Overrides:
iterator in class DefaultSchemaObjectRegistry<DITStructureRule>
Returns:
an Iterator of homogeneous schema objects

ruleIdIterator

public java.util.Iterator<java.lang.Integer> ruleIdIterator()
Gets an iterator over the registered ruleId in the registry.

Specified by:
ruleIdIterator in interface DITStructureRuleRegistry
Returns:
an Iterator of ruleId

getSchemaName

public java.lang.String getSchemaName(int ruleId)
                               throws LdapException
Gets the name of the schema this schema object is associated with.

Specified by:
getSchemaName in interface DITStructureRuleRegistry
Returns:
the schema name
Throws:
LdapException - if the schema object does not exist

register

public void register(DITStructureRule ditStructureRule)
              throws LdapException
Registers a new SchemaObject with this registry.

Specified by:
register in interface DITStructureRuleRegistry
Specified by:
register in interface SchemaObjectRegistry<DITStructureRule>
Overrides:
register in class DefaultSchemaObjectRegistry<DITStructureRule>
Parameters:
ditStructureRule - the SchemaObject to register
Throws:
LdapException - if the SchemaObject is already registered or the registration operation is not supported

lookup

public DITStructureRule lookup(int ruleId)
                        throws LdapException
Looks up an dITStructureRule by its unique Object IDentifier or by its name.

Specified by:
lookup in interface DITStructureRuleRegistry
Parameters:
ruleId - the rule identifier for the DITStructureRule
Returns:
the DITStructureRule instance for rule identifier
Throws:
LdapException - if the DITStructureRule does not exist

unregister

public void unregister(int ruleId)
                throws LdapException
Unregisters a DITStructureRule using it's rule identifier.

Specified by:
unregister in interface DITStructureRuleRegistry
Parameters:
ruleId - the rule identifier for the DITStructureRule to unregister
Throws:
LdapException - if no such DITStructureRule exists

unregisterSchemaElements

public void unregisterSchemaElements(java.lang.String schemaName)
Unregisters all SchemaObjects defined for a specific schema from this registry.

Specified by:
unregisterSchemaElements in interface DITStructureRuleRegistry
Specified by:
unregisterSchemaElements in interface SchemaObjectRegistry<DITStructureRule>
Overrides:
unregisterSchemaElements in class DefaultSchemaObjectRegistry<DITStructureRule>
Parameters:
schemaName - the name of the schema whose SchemaObjects will be removed from

renameSchema

public void renameSchema(java.lang.String originalSchemaName,
                         java.lang.String newSchemaName)
Modify all the SchemaObject using a schemaName when this name changes.

Specified by:
renameSchema in interface DITStructureRuleRegistry
Specified by:
renameSchema in interface SchemaObjectRegistry<DITStructureRule>
Overrides:
renameSchema in class DefaultSchemaObjectRegistry<DITStructureRule>
Parameters:
originalSchemaName - The original Schema name
newSchemaName - The new Schema name

copy

public DefaultDITStructureRuleRegistry copy()
Copy the DITStructureRuleRegistry

Specified by:
copy in interface DITStructureRuleRegistry
Specified by:
copy in interface SchemaObjectRegistry<DITStructureRule>
Returns:
SchemaObjectRegistry The copied registry


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