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

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

public class ImmutableDITStructureRuleRegistry
extends java.lang.Object
implements DITStructureRuleRegistry

An immutable wrapper of the DITStructureRule registry.

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

Constructor Summary
ImmutableDITStructureRuleRegistry(DITStructureRuleRegistry ditStructureRuleRegistry)
          Creates a new instance of ImmutableDITStructureRuleRegistry.
 
Method Summary
 void clear()
          Clear the registry from all its content
 boolean contains(int ruleId)
          Checks to see if an DITStructureRule exists in the registry, by its ruleId.
 boolean contains(java.lang.String oid)
          Checks to see if an SchemaObject exists in the registry, by its OID or name.
 ImmutableDITStructureRuleRegistry copy()
          Copy the DITStructureRuleRegistry
 SchemaObject get(java.lang.String oid)
          Gets the SchemaObject associated with a given OID.
 java.lang.String getOidByName(java.lang.String name)
          Gets the numericOid for a name/alias if one is associated.
 java.lang.String getSchemaName(int ruleId)
          Gets the name of the schema this schema object is associated with.
 java.lang.String getSchemaName(java.lang.String oid)
          Gets the name of the schema this schema object is associated with.
 SchemaObjectType getType()
          
 java.util.Iterator<DITStructureRule> iterator()
          Gets an iterator over the registered descriptions in the registry.
 DITStructureRule lookup(int ruleId)
          Looks up an dITStructureRule by its unique Object IDentifier or by its name.
 DITStructureRule lookup(java.lang.String oid)
          Looks up a SchemaObject by its unique Object Identifier or by name.
 java.util.Iterator<java.lang.String> oidsIterator()
          Gets an iterator over the registered schema objects'OID in the registry.
 void register(DITStructureRule ditStructureRule)
          Registers a new DITStructureRule with this registry.
 void renameSchema(java.lang.String originalSchemaName, java.lang.String newSchemaName)
          Modify all the DITStructureRule using a schemaName when this name changes.
 java.util.Iterator<java.lang.Integer> ruleIdIterator()
          Gets an iterator over the registered ruleId in the registry.
 int size()
          
 DITStructureRule unregister(DITStructureRule schemaObject)
          Removes the SchemaObject registered with this registry.
 void unregister(int ruleId)
          Unregisters a DITStructureRule using it's rule identifier.
 DITStructureRule unregister(java.lang.String numericOid)
          Removes the SchemaObject registered with this registry, using its numeric OID.
 void unregisterSchemaElements(java.lang.String schemaName)
          Unregisters all DITStructureRules defined for a specific schema from this registry.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ImmutableDITStructureRuleRegistry

public ImmutableDITStructureRuleRegistry(DITStructureRuleRegistry ditStructureRuleRegistry)
Creates a new instance of ImmutableDITStructureRuleRegistry.

Parameters:
ditStructureRuleRegistry - The wrapped DITStructureRule registry
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 descriptions 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>
Returns:
an Iterator of descriptions

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 DITStructureRule with this registry.

Specified by:
register in interface DITStructureRuleRegistry
Specified by:
register in interface SchemaObjectRegistry<DITStructureRule>
Parameters:
ditStructureRule - the DITStructureRule to register
Throws:
LdapException - if the DITStructureRule 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)
                              throws LdapException
Unregisters all DITStructureRules defined for a specific schema from this registry.

Specified by:
unregisterSchemaElements in interface DITStructureRuleRegistry
Specified by:
unregisterSchemaElements in interface SchemaObjectRegistry<DITStructureRule>
Parameters:
schemaName - the name of the schema whose syntaxCheckers will be removed from
Throws:
LdapException - if no such SchemaElement exists

renameSchema

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

Specified by:
renameSchema in interface DITStructureRuleRegistry
Specified by:
renameSchema in interface SchemaObjectRegistry<DITStructureRule>
Parameters:
originalSchemaName - The original Schema name
newSchemaName - The new Schema name
Throws:
LdapException - if the schema can't be renamed

copy

public ImmutableDITStructureRuleRegistry copy()
Copy the DITStructureRuleRegistry

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

size

public int size()

Specified by:
size in interface SchemaObjectRegistry<DITStructureRule>
Returns:
The number of AttributeType stored

contains

public boolean contains(java.lang.String oid)
Checks to see if an SchemaObject exists in the registry, by its OID or name.

Specified by:
contains in interface SchemaObjectRegistry<DITStructureRule>
Parameters:
oid - the object identifier or name of the SchemaObject
Returns:
true if a SchemaObject definition exists for the oid, false otherwise

getOidByName

public java.lang.String getOidByName(java.lang.String name)
                              throws LdapException
Gets the numericOid for a name/alias if one is associated. To prevent lookup failures due to case variance in the name, a failure to lookup the OID, will trigger a lookup using a lower cased version of the name and the name that failed to match will automatically be associated with the OID.

Specified by:
getOidByName in interface SchemaObjectRegistry<DITStructureRule>
Parameters:
name - The name we are looking the oid for
Returns:
The numericOID associated with this name
Throws:
LdapException - If the OID can't be found

getSchemaName

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

Specified by:
getSchemaName in interface SchemaObjectRegistry<DITStructureRule>
Returns:
the schema name
Throws:
LdapException - if the schema object does not exist

getType

public SchemaObjectType getType()

Specified by:
getType in interface SchemaObjectRegistry<DITStructureRule>
Returns:
the type

lookup

public DITStructureRule lookup(java.lang.String oid)
                        throws LdapException
Looks up a SchemaObject by its unique Object Identifier or by name.

Specified by:
lookup in interface SchemaObjectRegistry<DITStructureRule>
Parameters:
oid - the object identifier or name
Returns:
the SchemaObject instance for the id
Throws:
LdapException - if the SchemaObject does not exist

oidsIterator

public java.util.Iterator<java.lang.String> oidsIterator()
Gets an iterator over the registered schema objects'OID in the registry.

Specified by:
oidsIterator in interface SchemaObjectRegistry<DITStructureRule>
Returns:
an Iterator of OIDs

unregister

public DITStructureRule unregister(java.lang.String numericOid)
                            throws LdapException
Removes the SchemaObject registered with this registry, using its numeric OID.

Specified by:
unregister in interface SchemaObjectRegistry<DITStructureRule>
Parameters:
numericOid - the numeric identifier
Throws:
LdapException - if the numeric identifier is invalid

get

public SchemaObject get(java.lang.String oid)
Gets the SchemaObject associated with a given OID.

Specified by:
get in interface SchemaObjectRegistry<DITStructureRule>
Parameters:
oid - The SchemaObject's OID we are looking for
Returns:
The SchemaObject, if any. Null otherwise

clear

public void clear()
           throws LdapException
Clear the registry from all its content

Specified by:
clear in interface SchemaObjectRegistry<DITStructureRule>
Throws:
LdapException

unregister

public DITStructureRule unregister(DITStructureRule schemaObject)
                            throws LdapException
Removes the SchemaObject registered with this registry.

Specified by:
unregister in interface SchemaObjectRegistry<DITStructureRule>
Throws:
LdapException - if the schemaObject can't be unregistered is invalid


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