org.apache.directory.shared.ldap.schema.manager.impl
Class DefaultSchemaManager

java.lang.Object
  extended by org.apache.directory.shared.ldap.schema.manager.impl.DefaultSchemaManager
All Implemented Interfaces:
SchemaManager

public class DefaultSchemaManager
extends java.lang.Object
implements SchemaManager

The SchemaManager class : it handles all the schema operations (addition, removal, modification).

Version:
$Rev$, $Date$
Author:
Apache Directory Project

Field Summary
protected  EntityFactory factory
          the factory that generates respective SchemaObjects from LDIF entries
static boolean RELAXED
           
static boolean STRICT
          Two flags for RELAXED and STRUCT
 
Constructor Summary
DefaultSchemaManager(SchemaLoader loader)
          Creates a new instance of DefaultSchemaManager with the default schema schemaLoader
DefaultSchemaManager(SchemaLoader loader, DN namingContext)
          Creates a new instance of DefaultSchemaManager, for a specific naming context
 
Method Summary
 boolean add(SchemaObject schemaObject)
          Registers a new SchemaObject.
 boolean delete(SchemaObject schemaObject)
          Unregisters a new SchemaObject.
 boolean disable(Schema... schemas)
          Disables a set of Schemas, and returns true if all the schema have been disabled, with all the dependent schemas, and if the registries is still consistent.
 boolean disable(java.lang.String... schemaNames)
          Disables a set of Schemas, and returns true if all the schema have been disabled, with all the dependent schemas, and if the registries is still consistent.
 boolean disabledRelaxed(Schema... schemas)
          Disables a set of Schemas, and returns true if all the schema have been disabled, with all the dependent schemas.
 boolean disabledRelaxed(java.lang.String... schemas)
          Disables a set of Schemas, and returns true if all the schema have been disabled, with all the dependent schemas.
 boolean enable(Schema... schemas)
          Enables a set of Schemas, and returns true if all the schema have been enabled, with all the dependent schemas, and if the registries is still consistent.
 boolean enable(java.lang.String... schemaNames)
          Enables a set of Schemas, and returns true if all the schema have been enabled, with all the dependent schemas, and if the registries is still consistent.
 boolean enableRelaxed(Schema... schemas)
          Enables a set of Schemas, and returns true if all the schema have been enabled, with all the dependent schemas.
 boolean enableRelaxed(java.lang.String... schemas)
          Enables a set of Schemas, and returns true if all the schema have been enabled, with all the dependent schemas.
 AttributeTypeRegistry getAttributeTypeRegistry()
          Get an immutable reference on the AttributeType registry
 ComparatorRegistry getComparatorRegistry()
          Get an immutable reference on the Comparator registry
 java.util.List<Schema> getDisabled()
          
 DITContentRuleRegistry getDITContentRuleRegistry()
          Get an immutable reference on the DITContentRule registry
 DITStructureRuleRegistry getDITStructureRuleRegistry()
          Get an immutable reference on the DITStructureRule registry
 java.util.List<Schema> getEnabled()
          
 java.util.List<java.lang.Throwable> getErrors()
          
 OidRegistry getGlobalOidRegistry()
          Returns a reference to the global OidRegistry
 LdapSyntaxRegistry getLdapSyntaxRegistry()
          Get an immutable reference on the LdapSyntax registry
 Schema getLoadedSchema(java.lang.String schemaName)
          Gets a schema that has been loaded into these Registries.
 SchemaLoader getLoader()
          
 MatchingRuleRegistry getMatchingRuleRegistry()
          Get an immutable reference on the MatchingRule registry
 MatchingRuleUseRegistry getMatchingRuleUseRegistry()
          Get an immutable reference on the MatchingRuleUse registry
 NameFormRegistry getNameFormRegistry()
          Get an immutable reference on the NameForm registry
 DN getNamingContext()
           
 java.util.Map<java.lang.String,OidNormalizer> getNormalizerMapping()
          Get an immutable reference on the Normalizer mapping
 NormalizerRegistry getNormalizerRegistry()
          Get an immutable reference on the Normalizer registry
 ObjectClassRegistry getObjectClassRegistry()
          Get an immutable reference on the ObjectClass registry
 Registries getRegistries()
          
 SyntaxCheckerRegistry getSyntaxCheckerRegistry()
          Get an immutable reference on the SyntaxChecker registry
 void initialize()
          Initializes the SchemaService
 boolean isDisabled(Schema schema)
          Tells if the given Schema is disabled
 boolean isDisabled(java.lang.String schemaName)
          Tells if the given Schema is disabled
 boolean isDisabledAccepted()
          
 boolean isEnabled(Schema schema)
          Tells if the given Schema is enabled
 boolean isEnabled(java.lang.String schemaName)
          Tells if the given Schema is enabled
 boolean isRelaxed()
          Tells if the SchemaManager is permissive or if it must be checked against inconsistencies.
 boolean isSchemaLoaded(java.lang.String schemaName)
          Tells if the specific schema is loaded
 boolean isStrict()
          Tells if the SchemaManager is strict.
 java.util.Set<java.lang.String> listDependentSchemaNames(java.lang.String schemaName)
          Get the list of Schema names which has the given schema name as a dependence
 boolean load(Schema... schemas)
          Load some Schemas into the registries.
 boolean load(java.lang.String... schemaNames)
          Load some Schemas into the registries.
 boolean loadAllEnabled()
          Load all the enabled schema into the Registries.
 boolean loadAllEnabledRelaxed()
          Load all the enabled schema into the Registries.
 boolean loadDisabled(Schema... schemas)
          Load Schemas into the Registries, even if they are disabled.
 boolean loadDisabled(java.lang.String... schemaNames)
          Load Schemas into the Registries, even if they are disabled.
 boolean loadRelaxed(Schema... schemas)
          Load Schemas into the registries, even if there are some errors in the schemas.
 boolean loadRelaxed(java.lang.String... schemaNames)
          Load Schemas into the registries, even if there are some errors in the schemas.
 boolean loadWithDeps(Schema... schemas)
          Load some Schemas into the registries, and loads all of the schemas they depend on.
 boolean loadWithDeps(java.lang.String... schemas)
          Load some Schemas into the registries, and loads all of the schemas they depend on.
 boolean loadWithDepsRelaxed(Schema... schemas)
          Load some Schemas into the registries, and loads all of the schemas they depend on.
 boolean loadWithDepsRelaxed(java.lang.String... schemas)
          Load some Schemas into the registries, and loads all of the schemas they depend on.
 AttributeType lookupAttributeTypeRegistry(java.lang.String oid)
          Lookup for an AttributeType in the AttributeType registry
 LdapComparator<?> lookupComparatorRegistry(java.lang.String oid)
          Lookup for a Comparator in the Comparator registry
 LdapSyntax lookupLdapSyntaxRegistry(java.lang.String oid)
          Lookup for an LdapSyntax in the LdapSyntax registry
 MatchingRule lookupMatchingRuleRegistry(java.lang.String oid)
          Lookup for a MatchingRule in the MatchingRule registry
 Normalizer lookupNormalizerRegistry(java.lang.String oid)
          Lookup for a Normalizer in the Normalizer registry
 ObjectClass lookupObjectClassRegistry(java.lang.String oid)
          Lookup for a ObjectClass in the ObjectClass registry
 SyntaxChecker lookupSyntaxCheckerRegistry(java.lang.String oid)
          Lookup for a SyntaxChecker in the SyntaxChecker registry
 void setRegistries(Registries registries)
          Associate a new Registries to the SchemaManager
 void setRelaxed()
          Change the SchemaManager to a relaxed mode, where invalid SchemaObjects can be registered.
 void setSchemaLoader(SchemaLoader schemaLoader)
          Associate a Schema loader to this SchemaManager
 void setStrict()
          Change the SchemaManager to a strict mode, where invalid SchemaObjects cannot be registered.
 boolean unload(Schema... schemas)
          Unload the given set of Schemas
 boolean unload(java.lang.String... schemaNames)
          Unload the given set of Schemas
 SchemaObject unregisterAttributeType(java.lang.String attributeTypeOid)
          Removes the registered attributeType from the attributeTypeRegistry
 SchemaObject unregisterComparator(java.lang.String comparatorOid)
          Removes the registered Comparator from the ComparatorRegistry
 SchemaObject unregisterDitControlRule(java.lang.String ditControlRuleOid)
          Removes the registered DitControlRule from the DitControlRuleRegistry
 SchemaObject unregisterDitStructureRule(java.lang.String ditStructureRuleOid)
          Removes the registered DitStructureRule from the DitStructureRuleRegistry
 SchemaObject unregisterLdapSyntax(java.lang.String ldapSyntaxOid)
          Removes the registered LdapSyntax from the LdapSyntaxRegistry
 SchemaObject unregisterMatchingRule(java.lang.String matchingRuleOid)
          Removes the registered MatchingRule from the MatchingRuleRegistry
 SchemaObject unregisterMatchingRuleUse(java.lang.String matchingRuleUseOid)
          Removes the registered MatchingRuleUse from the MatchingRuleUseRegistry
 SchemaObject unregisterNameForm(java.lang.String nameFormOid)
          Removes the registered NameForm from the NameFormRegistry
 SchemaObject unregisterNormalizer(java.lang.String normalizerOid)
          Removes the registered Normalizer from the NormalizerRegistry
 SchemaObject unregisterObjectClass(java.lang.String objectClassOid)
          Removes the registered ObjectClass from the ObjectClassRegistry
 SchemaObject unregisterSyntaxChecker(java.lang.String syntaxCheckerOid)
          Removes the registered SyntaxChecker from the SyntaxCheckerRegistry
 boolean verify(Schema... schemas)
          Check that the Schemas are consistent regarding the current Registries.
 boolean verify(java.lang.String... schemas)
          Check that the Schemas are consistent regarding the current Registries.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

factory

protected final EntityFactory factory
the factory that generates respective SchemaObjects from LDIF entries


STRICT

public static final boolean STRICT
Two flags for RELAXED and STRUCT

See Also:
Constant Field Values

RELAXED

public static final boolean RELAXED
See Also:
Constant Field Values
Constructor Detail

DefaultSchemaManager

public DefaultSchemaManager(SchemaLoader loader)
                     throws java.lang.Exception
Creates a new instance of DefaultSchemaManager with the default schema schemaLoader

Parameters:
loader - The schema loader to use
Throws:
java.lang.Exception

DefaultSchemaManager

public DefaultSchemaManager(SchemaLoader loader,
                            DN namingContext)
                     throws java.lang.Exception
Creates a new instance of DefaultSchemaManager, for a specific naming context

Parameters:
loader - The schema loader to use
namingContext - The associated NamingContext
Throws:
java.lang.Exception
Method Detail

disable

public boolean disable(Schema... schemas)
                throws java.lang.Exception
Disables a set of Schemas, and returns true if all the schema have been disabled, with all the dependent schemas, and if the registries is still consistent. If the modification is ok, the Registries will be updated.

Specified by:
disable in interface SchemaManager
Parameters:
schemas - The list of schemas to disable
Returns:
true if the Registries is still consistent, false otherwise.
Throws:
java.lang.Exception

disable

public boolean disable(java.lang.String... schemaNames)
                throws java.lang.Exception
Disables a set of Schemas, and returns true if all the schema have been disabled, with all the dependent schemas, and if the registries is still consistent. If the modification is ok, the Registries will be updated.

Specified by:
disable in interface SchemaManager
Parameters:
schemaNames - The list of schema names to disable
Returns:
true if the Registries is still consistent, false otherwise.
Throws:
java.lang.Exception

disabledRelaxed

public boolean disabledRelaxed(Schema... schemas)
Disables a set of Schemas, and returns true if all the schema have been disabled, with all the dependent schemas. The Registries is not checked and can be inconsistent after this operation If the modification is ok, the Registries will be updated.

Specified by:
disabledRelaxed in interface SchemaManager
Parameters:
schemas - The list of schemas to disable
Returns:
true if all the schemas have been disabled

disabledRelaxed

public boolean disabledRelaxed(java.lang.String... schemas)
Disables a set of Schemas, and returns true if all the schema have been disabled, with all the dependent schemas. The Registries is not checked and can be inconsistent after this operation If the modification is ok, the Registries will be updated.

Specified by:
disabledRelaxed in interface SchemaManager
Parameters:
schemas - The list of schema names to disable
Returns:
true if all the schemas have been disabled

getDisabled

public java.util.List<Schema> getDisabled()

Specified by:
getDisabled in interface SchemaManager
Returns:
the list of all the disabled schema

enable

public boolean enable(Schema... schemas)
               throws java.lang.Exception
Enables a set of Schemas, and returns true if all the schema have been enabled, with all the dependent schemas, and if the registries is still consistent. If the modification is ok, the Registries will be updated.

Specified by:
enable in interface SchemaManager
Parameters:
schemas - The list of schemas to enable
Returns:
true if the Registries is still consistent, false otherwise.
Throws:
java.lang.Exception

enable

public boolean enable(java.lang.String... schemaNames)
               throws java.lang.Exception
Enables a set of Schemas, and returns true if all the schema have been enabled, with all the dependent schemas, and if the registries is still consistent. If the modification is ok, the Registries will be updated.

Specified by:
enable in interface SchemaManager
Parameters:
schemaNames - The list of schema name to enable
Returns:
true if the Registries is still consistent, false otherwise.
Throws:
java.lang.Exception

enableRelaxed

public boolean enableRelaxed(Schema... schemas)
Enables a set of Schemas, and returns true if all the schema have been enabled, with all the dependent schemas. No check is done, the Registries might become inconsistent after this operation.

Specified by:
enableRelaxed in interface SchemaManager
Parameters:
schemas - The list of schemas to enable
Returns:
true if all the schemas have been enabled

enableRelaxed

public boolean enableRelaxed(java.lang.String... schemas)
Enables a set of Schemas, and returns true if all the schema have been enabled, with all the dependent schemas. No check is done, the Registries might become inconsistent after this operation.

Specified by:
enableRelaxed in interface SchemaManager
Parameters:
schemas - The list of schema names to enable
Returns:
true if all the schemas have been enabled

getEnabled

public java.util.List<Schema> getEnabled()

Specified by:
getEnabled in interface SchemaManager
Returns:
the list of all the enabled schema

getErrors

public java.util.List<java.lang.Throwable> getErrors()

Specified by:
getErrors in interface SchemaManager
Returns:
The errors obtained when checking the registries

getRegistries

public Registries getRegistries()

Specified by:
getRegistries in interface SchemaManager
Returns:
The Registries

isDisabledAccepted

public boolean isDisabledAccepted()


load

public boolean load(Schema... schemas)
             throws java.lang.Exception
Load some Schemas into the registries. The Registries is checked after the schemas have been loaded, and if there is an error, the method returns false and the registries is kept intact.
The Schemas must be enabled, and only enabled SchemaObject will be loaded.
If any error was met, the SchemaManager.getErrors() method will contain them

Specified by:
load in interface SchemaManager
Parameters:
schemas - the Schemas to load
Returns:
true if the schemas have been loaded and the registries is consistent
Throws:
java.lang.Exception - @TODO

load

public boolean load(java.lang.String... schemaNames)
             throws java.lang.Exception
Load some Schemas into the registries. The Registries is checked after the schemas have been loaded, and if there is an error, the method returns false and the registries is kept intact.
The Schemas must be enabled, and only enabled SchemaObject will be loaded.
If any error was met, the SchemaManager.getErrors() method will contain them

Specified by:
load in interface SchemaManager
Parameters:
schemaNames - the Schemas' name to load
Returns:
true if the schemas have been loaded and the registries is consistent
Throws:
java.lang.Exception - @TODO

loadAllEnabled

public boolean loadAllEnabled()
                       throws java.lang.Exception
Load all the enabled schema into the Registries. The Registries is strict, any inconsistent schema will be rejected.

Specified by:
loadAllEnabled in interface SchemaManager
Returns:
true if the schemas have been loaded
Throws:
java.lang.Exception - @TODO

loadAllEnabledRelaxed

public boolean loadAllEnabledRelaxed()
                              throws java.lang.Exception
Load all the enabled schema into the Registries. The Registries is relaxed, even inconsistent schema will be loaded.

Specified by:
loadAllEnabledRelaxed in interface SchemaManager
Returns:
true if the schemas have been loaded
Throws:
java.lang.Exception - @TODO

loadDisabled

public boolean loadDisabled(Schema... schemas)
                     throws java.lang.Exception
Load Schemas into the Registries, even if they are disabled. The disabled SchemaObject from an enabled schema will also be loaded. The Registries will be checked after the schemas have been loaded. Even if we have errors, the Registries will be updated.
If any error was met, the SchemaManager.getErrors() method will contain them

Specified by:
loadDisabled in interface SchemaManager
Parameters:
schemas - The Schemas to load
Returns:
true if the schemas have been loaded
Throws:
java.lang.Exception - @TODO

loadDisabled

public boolean loadDisabled(java.lang.String... schemaNames)
                     throws java.lang.Exception
Load Schemas into the Registries, even if they are disabled. The disabled SchemaObject from an enabled schema will also be loaded. The Registries will be checked after the schemas have been loaded. Even if we have errors, the Registries will be updated.
If any error was met, the SchemaManager.getErrors() method will contain them

Specified by:
loadDisabled in interface SchemaManager
Parameters:
schemaNames - The Schemas' name to load
Returns:
true if the schemas have been loaded
Throws:
java.lang.Exception - @TODO

loadRelaxed

public boolean loadRelaxed(Schema... schemas)
                    throws java.lang.Exception
Load Schemas into the registries, even if there are some errors in the schemas. The Registries is checked after the schemas have been loaded. Even if we have errors, the registries will be updated.
The Schemas must be enabled, and only enabled SchemaObject will be loaded.
If any error was met, the SchemaManager.getErrors() method will contain them

Specified by:
loadRelaxed in interface SchemaManager
Parameters:
schemas - the Schemas to load, if enabled
Returns:
true if the schemas have been loaded
Throws:
java.lang.Exception - @TODO

loadRelaxed

public boolean loadRelaxed(java.lang.String... schemaNames)
                    throws java.lang.Exception
Load Schemas into the registries, even if there are some errors in the schemas. The Registries is checked after the schemas have been loaded. Even if we have errors, the registries will be updated.
The Schemas must be enabled, and only enabled SchemaObject will be loaded.
If any error was met, the SchemaManager.getErrors() method will contain them

Specified by:
loadRelaxed in interface SchemaManager
Parameters:
schemaNames - the Schemas' name to load, if enabled
Returns:
true if the schemas have been loaded and the registries is consistent
Throws:
java.lang.Exception - @TODO

loadWithDeps

public boolean loadWithDeps(Schema... schemas)
                     throws java.lang.Exception
Load some Schemas into the registries, and loads all of the schemas they depend on. The Registries is checked after the schemas have been loaded, and if there is an error, the method returns false and the registries is kept intact.
The Schemas must be enabled, and only enabled SchemaObject will be loaded.
If any error was met, the SchemaManager.getErrors() method will contain them

Specified by:
loadWithDeps in interface SchemaManager
Parameters:
schemas - the Schemas to load
Returns:
true if the schemas have been loaded and the registries is consistent
Throws:
java.lang.Exception - @TODO

loadWithDeps

public boolean loadWithDeps(java.lang.String... schemas)
                     throws java.lang.Exception
Load some Schemas into the registries, and loads all of the schemas they depend on. The Registries is checked after the schemas have been loaded, and if there is an error, the method returns false and the registries is kept intact.
The Schemas must be enabled, and only enabled SchemaObject will be loaded.
If any error was met, the SchemaManager.getErrors() method will contain them

Specified by:
loadWithDeps in interface SchemaManager
Parameters:
schemas - the Schemas' name to load
Returns:
true if the schemas have been loaded and the registries is consistent
Throws:
java.lang.Exception - @TODO

loadWithDepsRelaxed

public boolean loadWithDepsRelaxed(Schema... schemas)
                            throws java.lang.Exception
Load some Schemas into the registries, and loads all of the schemas they depend on. The Registries is checked after the schemas have been loaded. Even if we have errors, the registries will be updated.
The Schemas must be enabled, and only enabled SchemaObject will be loaded.
If any error was met, the SchemaManager.getErrors() method will contain them

Specified by:
loadWithDepsRelaxed in interface SchemaManager
Parameters:
schemas - the Schemas to load
Returns:
true if the schemas have been loaded
Throws:
java.lang.Exception - @TODO

loadWithDepsRelaxed

public boolean loadWithDepsRelaxed(java.lang.String... schemas)
                            throws java.lang.Exception
Load some Schemas into the registries, and loads all of the schemas they depend on. The Registries is checked after the schemas have been loaded. Even if we have errors, the registries will be updated.
The Schemas must be enabled, and only enabled SchemaObject will be loaded.
If any error was met, the SchemaManager.getErrors() method will contain them

Specified by:
loadWithDepsRelaxed in interface SchemaManager
Parameters:
schemas - the Schemas' name to load
Returns:
true if the schemas have been loaded
Throws:
java.lang.Exception - @TODO

setRegistries

public void setRegistries(Registries registries)
Associate a new Registries to the SchemaManager

Specified by:
setRegistries in interface SchemaManager
Parameters:
registries - The new Registries

unload

public boolean unload(Schema... schemas)
               throws java.lang.Exception
Unload the given set of Schemas

Specified by:
unload in interface SchemaManager
Parameters:
schemas - The list of Schema to unload
Returns:
True if all the schemas have been unloaded
Throws:
java.lang.Exception

unload

public boolean unload(java.lang.String... schemaNames)
               throws java.lang.Exception
Unload the given set of Schemas

Specified by:
unload in interface SchemaManager
Parameters:
schemaNames - The list of Schema to unload
Returns:
True if all the schemas have been unloaded
Throws:
java.lang.Exception

verify

public boolean verify(Schema... schemas)
               throws java.lang.Exception
Check that the Schemas are consistent regarding the current Registries.

Specified by:
verify in interface SchemaManager
Parameters:
schemas - The schemas to check
Returns:
true if the schemas can be loaded in the registries
Throws:
java.lang.Exception - if something went wrong

verify

public boolean verify(java.lang.String... schemas)
               throws java.lang.Exception
Check that the Schemas are consistent regarding the current Registries.

Specified by:
verify in interface SchemaManager
Parameters:
schemas - The schema names to check
Returns:
true if the schemas can be loaded in the registries
Throws:
java.lang.Exception - if something went wrong

setSchemaLoader

public void setSchemaLoader(SchemaLoader schemaLoader)
Associate a Schema loader to this SchemaManager

Specified by:
setSchemaLoader in interface SchemaManager
Parameters:
schemaLoader - The schema loader to use

getNamingContext

public DN getNamingContext()
Specified by:
getNamingContext in interface SchemaManager
Returns:
the namingContext

initialize

public void initialize()
                throws java.lang.Exception
Initializes the SchemaService

Specified by:
initialize in interface SchemaManager
Throws:
java.lang.Exception - If the initialization fails

getLoader

public SchemaLoader getLoader()

Specified by:
getLoader in interface SchemaManager
Returns:
The used loader

getAttributeTypeRegistry

public AttributeTypeRegistry getAttributeTypeRegistry()
Get an immutable reference on the AttributeType registry

Specified by:
getAttributeTypeRegistry in interface SchemaManager
Returns:
A reference to the AttributeType registry.

getComparatorRegistry

public ComparatorRegistry getComparatorRegistry()
Get an immutable reference on the Comparator registry

Specified by:
getComparatorRegistry in interface SchemaManager
Returns:
A reference to the Comparator registry.

getDITContentRuleRegistry

public DITContentRuleRegistry getDITContentRuleRegistry()
Get an immutable reference on the DITContentRule registry

Specified by:
getDITContentRuleRegistry in interface SchemaManager
Returns:
A reference to the DITContentRule registry.

getDITStructureRuleRegistry

public DITStructureRuleRegistry getDITStructureRuleRegistry()
Get an immutable reference on the DITStructureRule registry

Specified by:
getDITStructureRuleRegistry in interface SchemaManager
Returns:
A reference to the DITStructureRule registry.

getMatchingRuleRegistry

public MatchingRuleRegistry getMatchingRuleRegistry()
Get an immutable reference on the MatchingRule registry

Specified by:
getMatchingRuleRegistry in interface SchemaManager
Returns:
A reference to the MatchingRule registry.

getMatchingRuleUseRegistry

public MatchingRuleUseRegistry getMatchingRuleUseRegistry()
Get an immutable reference on the MatchingRuleUse registry

Specified by:
getMatchingRuleUseRegistry in interface SchemaManager
Returns:
A reference to the MatchingRuleUse registry.

getNameFormRegistry

public NameFormRegistry getNameFormRegistry()
Get an immutable reference on the NameForm registry

Specified by:
getNameFormRegistry in interface SchemaManager
Returns:
A reference to the NameForm registry.

getNormalizerRegistry

public NormalizerRegistry getNormalizerRegistry()
Get an immutable reference on the Normalizer registry

Specified by:
getNormalizerRegistry in interface SchemaManager
Returns:
A reference to the Normalizer registry.

getObjectClassRegistry

public ObjectClassRegistry getObjectClassRegistry()
Get an immutable reference on the ObjectClass registry

Specified by:
getObjectClassRegistry in interface SchemaManager
Returns:
A reference to the ObjectClass registry.

getLdapSyntaxRegistry

public LdapSyntaxRegistry getLdapSyntaxRegistry()
Get an immutable reference on the LdapSyntax registry

Specified by:
getLdapSyntaxRegistry in interface SchemaManager
Returns:
A reference to the LdapSyntax registry.

getSyntaxCheckerRegistry

public SyntaxCheckerRegistry getSyntaxCheckerRegistry()
Get an immutable reference on the SyntaxChecker registry

Specified by:
getSyntaxCheckerRegistry in interface SchemaManager
Returns:
A reference to the SyntaxChecker registry.

lookupAttributeTypeRegistry

public AttributeType lookupAttributeTypeRegistry(java.lang.String oid)
                                          throws LdapException
Lookup for an AttributeType in the AttributeType registry

Specified by:
lookupAttributeTypeRegistry in interface SchemaManager
Returns:
The found AttributeType
Throws:
LdapException - if the OID is not found in the AttributeType registry

lookupComparatorRegistry

public LdapComparator<?> lookupComparatorRegistry(java.lang.String oid)
                                           throws LdapException
Lookup for a Comparator in the Comparator registry

Specified by:
lookupComparatorRegistry in interface SchemaManager
Returns:
The found Comparator
Throws:
LdapException - if the OID is not found in the Comparator registry

lookupMatchingRuleRegistry

public MatchingRule lookupMatchingRuleRegistry(java.lang.String oid)
                                        throws LdapException
Lookup for a MatchingRule in the MatchingRule registry

Specified by:
lookupMatchingRuleRegistry in interface SchemaManager
Returns:
The found MatchingRule
Throws:
LdapException - if the OID is not found in the MatchingRule registry

lookupNormalizerRegistry

public Normalizer lookupNormalizerRegistry(java.lang.String oid)
                                    throws LdapException
Lookup for a Normalizer in the Normalizer registry

Specified by:
lookupNormalizerRegistry in interface SchemaManager
Returns:
The found Normalizer
Throws:
LdapException - if the OID is not found in the Normalizer registry

lookupObjectClassRegistry

public ObjectClass lookupObjectClassRegistry(java.lang.String oid)
                                      throws LdapException
Lookup for a ObjectClass in the ObjectClass registry

Specified by:
lookupObjectClassRegistry in interface SchemaManager
Returns:
The found ObjectClass
Throws:
LdapException - if the OID is not found in the ObjectClass registry

lookupLdapSyntaxRegistry

public LdapSyntax lookupLdapSyntaxRegistry(java.lang.String oid)
                                    throws LdapException
Lookup for an LdapSyntax in the LdapSyntax registry

Specified by:
lookupLdapSyntaxRegistry in interface SchemaManager
Returns:
The found LdapSyntax
Throws:
LdapException - if the OID is not found in the LdapSyntax registry

lookupSyntaxCheckerRegistry

public SyntaxChecker lookupSyntaxCheckerRegistry(java.lang.String oid)
                                          throws LdapException
Lookup for a SyntaxChecker in the SyntaxChecker registry

Specified by:
lookupSyntaxCheckerRegistry in interface SchemaManager
Returns:
The found SyntaxChecker
Throws:
LdapException - if the OID is not found in the SyntaxChecker registry

add

public boolean add(SchemaObject schemaObject)
            throws java.lang.Exception
Registers a new SchemaObject. The registries will be updated only if it's consistent after this addition, if the SchemaManager is in Strict mode. If something went wrong during this operation, the SchemaManager.getErrors() will give the list of generated errors.

Specified by:
add in interface SchemaManager
Parameters:
schemaObject - the SchemaObject to register
Returns:
true if the addition has been made, false if there were some errors
Throws:
java.lang.Exception - if the SchemaObject is already registered or the registration operation is not supported

delete

public boolean delete(SchemaObject schemaObject)
               throws java.lang.Exception
Unregisters a new SchemaObject. The registries will be updated only if it's consistent after this deletion, if the SchemaManager is in Strict mode. If something went wrong during this operation, the SchemaManager.getErrors() will give the list of generated errors.

Specified by:
delete in interface SchemaManager
Parameters:
schemaObject - the SchemaObject to unregister
Returns:
true if the deletion has been made, false if there were some errors
Throws:
java.lang.Exception - if the SchemaObject is not registered or the deletion operation is not supported

getNormalizerMapping

public java.util.Map<java.lang.String,OidNormalizer> getNormalizerMapping()
Get an immutable reference on the Normalizer mapping

Specified by:
getNormalizerMapping in interface SchemaManager
Returns:
A reference to the Normalizer mapping

getGlobalOidRegistry

public OidRegistry getGlobalOidRegistry()
Returns a reference to the global OidRegistry

Specified by:
getGlobalOidRegistry in interface SchemaManager
Returns:
The the global OidRegistry

getLoadedSchema

public Schema getLoadedSchema(java.lang.String schemaName)
Gets a schema that has been loaded into these Registries.

Specified by:
getLoadedSchema in interface SchemaManager
Parameters:
schemaName - the name of the schema to lookup
Returns:
the loaded Schema if one corresponding to the name exists

isSchemaLoaded

public boolean isSchemaLoaded(java.lang.String schemaName)
Tells if the specific schema is loaded

Specified by:
isSchemaLoaded in interface SchemaManager
Parameters:
schemaName - The schema we want to check
Returns:
true if the schema is laoded

unregisterAttributeType

public SchemaObject unregisterAttributeType(java.lang.String attributeTypeOid)
                                     throws LdapException
Removes the registered attributeType from the attributeTypeRegistry

Specified by:
unregisterAttributeType in interface SchemaManager
Throws:
LdapException - if the attributeType is invalid

unregisterComparator

public SchemaObject unregisterComparator(java.lang.String comparatorOid)
                                  throws LdapException
Removes the registered Comparator from the ComparatorRegistry

Specified by:
unregisterComparator in interface SchemaManager
Throws:
LdapException - if the Comparator is invalid

unregisterDitControlRule

public SchemaObject unregisterDitControlRule(java.lang.String ditControlRuleOid)
                                      throws LdapException
Removes the registered DitControlRule from the DitControlRuleRegistry

Specified by:
unregisterDitControlRule in interface SchemaManager
Throws:
LdapException - if the DitControlRule is invalid

unregisterDitStructureRule

public SchemaObject unregisterDitStructureRule(java.lang.String ditStructureRuleOid)
                                        throws LdapException
Removes the registered DitStructureRule from the DitStructureRuleRegistry

Specified by:
unregisterDitStructureRule in interface SchemaManager
Throws:
LdapException - if the DitStructureRule is invalid

unregisterLdapSyntax

public SchemaObject unregisterLdapSyntax(java.lang.String ldapSyntaxOid)
                                  throws LdapException
Removes the registered LdapSyntax from the LdapSyntaxRegistry

Specified by:
unregisterLdapSyntax in interface SchemaManager
Throws:
LdapException - if the LdapSyntax is invalid

unregisterMatchingRule

public SchemaObject unregisterMatchingRule(java.lang.String matchingRuleOid)
                                    throws LdapException
Removes the registered MatchingRule from the MatchingRuleRegistry

Specified by:
unregisterMatchingRule in interface SchemaManager
Throws:
LdapException - if the MatchingRule is invalid

unregisterMatchingRuleUse

public SchemaObject unregisterMatchingRuleUse(java.lang.String matchingRuleUseOid)
                                       throws LdapException
Removes the registered MatchingRuleUse from the MatchingRuleUseRegistry

Specified by:
unregisterMatchingRuleUse in interface SchemaManager
Throws:
LdapException - if the MatchingRuleUse is invalid

unregisterNameForm

public SchemaObject unregisterNameForm(java.lang.String nameFormOid)
                                throws LdapException
Removes the registered NameForm from the NameFormRegistry

Specified by:
unregisterNameForm in interface SchemaManager
Throws:
LdapException - if the NameForm is invalid

unregisterNormalizer

public SchemaObject unregisterNormalizer(java.lang.String normalizerOid)
                                  throws LdapException
Removes the registered Normalizer from the NormalizerRegistry

Specified by:
unregisterNormalizer in interface SchemaManager
Throws:
LdapException - if the Normalizer is invalid

unregisterObjectClass

public SchemaObject unregisterObjectClass(java.lang.String objectClassOid)
                                   throws LdapException
Removes the registered ObjectClass from the ObjectClassRegistry

Specified by:
unregisterObjectClass in interface SchemaManager
Throws:
LdapException - if the ObjectClass is invalid

unregisterSyntaxChecker

public SchemaObject unregisterSyntaxChecker(java.lang.String syntaxCheckerOid)
                                     throws LdapException
Removes the registered SyntaxChecker from the SyntaxCheckerRegistry

Specified by:
unregisterSyntaxChecker in interface SchemaManager
Throws:
LdapException - if the SyntaxChecker is invalid

isRelaxed

public boolean isRelaxed()
Tells if the SchemaManager is permissive or if it must be checked against inconsistencies.

Returns:
True if SchemaObjects can be added even if they break the consistency

isStrict

public boolean isStrict()
Tells if the SchemaManager is strict.

Returns:
True if SchemaObjects cannot be added if they break the consistency

listDependentSchemaNames

public java.util.Set<java.lang.String> listDependentSchemaNames(java.lang.String schemaName)
Get the list of Schema names which has the given schema name as a dependence

Specified by:
listDependentSchemaNames in interface SchemaManager
Parameters:
schemaName - The Schema name for which we want to get the list of dependent schemas
Returns:
The list of dependent schemas

setRelaxed

public void setRelaxed()
Change the SchemaManager to a relaxed mode, where invalid SchemaObjects can be registered.


setStrict

public void setStrict()
Change the SchemaManager to a strict mode, where invalid SchemaObjects cannot be registered.


isDisabled

public boolean isDisabled(java.lang.String schemaName)
Tells if the given Schema is disabled

Specified by:
isDisabled in interface SchemaManager
Parameters:
schemaName - The schema name
Returns:
true if the schema is disabled

isDisabled

public boolean isDisabled(Schema schema)
Tells if the given Schema is disabled

Specified by:
isDisabled in interface SchemaManager
Parameters:
schema - The schema
Returns:
true if the schema is disabled

isEnabled

public boolean isEnabled(java.lang.String schemaName)
Tells if the given Schema is enabled

Specified by:
isEnabled in interface SchemaManager
Parameters:
schemaName - The schema name
Returns:
true if the schema is enabled

isEnabled

public boolean isEnabled(Schema schema)
Tells if the given Schema is enabled

Specified by:
isEnabled in interface SchemaManager
Parameters:
schema - The schema
Returns:
true if the schema is enabled


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