Interface SchemaManager
public interface SchemaManager
A class used to manage access to the Schemas and Registries. It's associated
with a SchemaLoader, in charge of loading the schemas from the disk.
- Author:
- Apache Directory Project
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionbooleanadd(SchemaObject schemaObject) Registers a new SchemaObject.booleandelete(SchemaObject schemaObject) Unregisters a new SchemaObject.booleanDisables 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.booleanDisables 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.booleandisabledRelaxed(String... schemas) Disables a set of Schemas, and returns true if all the schema have been disabled, with all the dependent schemas.booleandisabledRelaxed(Schema... schemas) Disables a set of Schemas, and returns true if all the schema have been disabled, with all the dependent schemas.booleanEnables 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.booleanEnables 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.booleanenableRelaxed(String... schemas) Enables a set of Schemas, and returns true if all the schema have been enabled, with all the dependent schemas.booleanenableRelaxed(Schema... schemas) Enables a set of Schemas, and returns true if all the schema have been enabled, with all the dependent schemas.getAttributeType(String oid) Get an AttributeType in the AttributeType registry.Get an immutable reference on the AttributeType registryGet an immutable reference on the Comparator registryGet an immutable reference on the DitContentRule registryGet an immutable reference on the DitStructureRule registryReturns a reference to the global OidRegistryGet an immutable reference on the LdapSyntax registrygetLoadedSchema(String schemaName) Gets a schema that has been loaded into these Registries.Get an immutable reference on the MatchingRule registryGet an immutable reference on the MatchingRuleUse registryGet an immutable reference on the NameForm registryGet an immutable reference on the Normalizer mappingGet an immutable reference on the Normalizer registryGet an immutable reference on the ObjectClass registryGet an immutable reference on the SyntaxChecker registryvoidInitializes the SchemaServicebooleanisDisabled(String schemaName) Tells if the given Schema is disabledbooleanisDisabled(Schema schema) Tells if the given Schema is disabledbooleanTells if the given Schema is enabledbooleanTells if the given Schema is enabledbooleanTells if the SchemaManager is permissive or if it must be checked against inconsistencies.booleanisSchemaLoaded(String schemaName) Tells if the specific schema is loadedbooleanisStrict()Tells if the SchemaManager is strict.listDependentSchemaNames(String schemaName) Get the list of Schema names which has the given schema name as a dependencebooleanLoad some Schemas into the registries.booleanLoad some Schemas into the registries.booleanLoad all the enabled schema into the Registries.booleanLoad all the enabled schema into the Registries.booleanloadDisabled(String... schemas) Load Schemas into the Registries, even if they are disabled.booleanloadDisabled(Schema... schemas) Load Schemas into the Registries, even if they are disabled.booleanloadRelaxed(String... schemas) Load Schemas into the registries, even if there are some errors in the schemas.booleanloadRelaxed(Schema... schemas) Load Schemas into the registries, even if there are some errors in the schemas.booleanloadWithDeps(String... schemas) Load some Schemas into the registries, and loads all of the schemas they depend on.booleanloadWithDeps(Schema... schemas) Load some Schemas into the registries, and loads all of the schemas they depend on.booleanloadWithDepsRelaxed(String... schemas) Load some Schemas into the registries, and loads all of the schemas they depend on.booleanloadWithDepsRelaxed(Schema... schemas) Load some Schemas into the registries, and loads all of the schemas they depend on.Lookup for an AttributeType in the AttributeType registryLookup for a Comparator in the Comparator registryLookup for an LdapSyntax in the LdapSyntax registryLookup for a MatchingRule in the MatchingRule registryLookup for a Normalizer in the Normalizer registryLookup for a ObjectClass in the ObjectClass registryLookup for a SyntaxChecker in the SyntaxChecker registryvoidsetRegistries(Registries registries) Associate a new Registries to the SchemaManagervoidSet the SchemaManager to a RELAXED modevoidSet the SchemaManager to a STRICT modebooleanUnload the given set of SchemasbooleanUnload the given set of SchemasunregisterAttributeType(String attributeTypeOid) Removes the registered attributeType from the attributeTypeRegistryunregisterComparator(String comparatorOid) Removes the registered Comparator from the ComparatorRegistryunregisterDitControlRule(String ditControlRuleOid) Removes the registered DitControlRule from the DitControlRuleRegistryunregisterDitStructureRule(String ditStructureRuleOid) Removes the registered DitStructureRule from the DitStructureRuleRegistryunregisterLdapSyntax(String ldapSyntaxOid) Removes the registered LdapSyntax from the LdapSyntaxRegistryunregisterMatchingRule(String matchingRuleOid) Removes the registered MatchingRule from the MatchingRuleRegistryunregisterMatchingRuleUse(String matchingRuleUseOid) Removes the registered MatchingRuleUse from the MatchingRuleUseRegistryunregisterNameForm(String nameFormOid) Removes the registered NameForm from the NameFormRegistryunregisterNormalizer(String normalizerOid) Removes the registered Normalizer from the NormalizerRegistryunregisterObjectClass(String objectClassOid) Removes the registered ObjectClass from the ObjectClassRegistryunregisterSyntaxChecker(String syntaxCheckerOid) Removes the registered SyntaxChecker from the SyntaxCheckerRegistrybooleanCheck that the Schemas are consistent regarding the current Registries.booleanCheck that the Schemas are consistent regarding the current Registries.
-
Field Details
-
STRICT
static final boolean STRICTTwo flags for RELAXED and STRICT, this is STRICT- See Also:
-
RELAXED
static final boolean RELAXEDTwo flags for RELAXED and STRICT, this is RELAXED- See Also:
-
-
Method Details
-
load
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, thegetErrors()method will contain them- Parameters:
schemas- the Schemas to load- Returns:
- true if the schemas have been loaded and the registries is consistent
- Throws:
LdapException- If something went wrong
-
load
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, thegetErrors()method will contain them- Parameters:
schemas- the Schemas' name to load- Returns:
- true if the schemas have been loaded and the registries is consistent
- Throws:
LdapException- If something went wrong
-
loadWithDeps
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, thegetErrors()method will contain them- Parameters:
schemas- the Schemas to load- Returns:
- true if the schemas have been loaded and the registries is consistent
- Throws:
LdapException- If something went wrong
-
loadWithDeps
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, thegetErrors()method will contain them- Parameters:
schemas- the Schemas' name to load- Returns:
- true if the schemas have been loaded and the registries is consistent
- Throws:
LdapException- If something went wrong
-
loadRelaxed
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, thegetErrors()method will contain them- Parameters:
schemas- the Schemas to load, if enabled- Returns:
- true if the schemas have been loaded
- Throws:
LdapException- If something went wrong
-
loadRelaxed
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, thegetErrors()method will contain them- Parameters:
schemas- the Schemas' name to load, if enabled- Returns:
- true if the schemas have been loaded and the registries is consistent
- Throws:
LdapException- If something went wrong
-
loadWithDepsRelaxed
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, thegetErrors()method will contain them- Parameters:
schemas- the Schemas to load- Returns:
- true if the schemas have been loaded
- Throws:
LdapException- If something went wrong
-
loadWithDepsRelaxed
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, thegetErrors()method will contain them- Parameters:
schemas- the Schemas' name to load- Returns:
- true if the schemas have been loaded
- Throws:
LdapException- If something went wrong
-
loadDisabled
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, thegetErrors()method will contain them- Parameters:
schemas- The Schemas to load- Returns:
- true if the schemas have been loaded
- Throws:
LdapException- If something went wrong
-
loadDisabled
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, thegetErrors()method will contain them- Parameters:
schemas- The Schemas' name to load- Returns:
- true if the schemas have been loaded
- Throws:
LdapException- If something went wrong
-
loadAllEnabled
Load all the enabled schema into the Registries. The Registries is strict, any inconsistent schema will be rejected.- Returns:
- true if the schemas have been loaded
- Throws:
LdapException- If something went wrong
-
loadAllEnabledRelaxed
Load all the enabled schema into the Registries. The Registries is relaxed, even inconsistent schema will be loaded.- Returns:
- true if the schemas have been loaded
- Throws:
LdapException- If something went wrong
-
unload
Unload the given set of Schemas- Parameters:
schemas- The list of Schema to unload- Returns:
- True if all the schemas have been unloaded
- Throws:
LdapException- If something went wrong
-
unload
Unload the given set of Schemas- Parameters:
schemas- The list of Schema to unload- Returns:
- True if all the schemas have been unloaded
- Throws:
LdapException- If something went wrong
-
enable
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.- Parameters:
schemas- The list of schemas to enable- Returns:
- true if the Registries is still consistent, false otherwise.
- Throws:
LdapException- If something went wrong
-
enable
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.- Parameters:
schemas- The list of schema name to enable- Returns:
- true if the Registries is still consistent, false otherwise.
- Throws:
LdapException- If something went wrong
-
enableRelaxed
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.- Parameters:
schemas- The list of schemas to enable- Returns:
- true if all the schemas have been enabled
-
enableRelaxed
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.- Parameters:
schemas- The list of schema names to enable- Returns:
- true if all the schemas have been enabled
-
getEnabled
Collection<Schema> getEnabled()- Returns:
- the list of all the enabled schema
-
getAllSchemas
Collection<Schema> getAllSchemas()- Returns:
- the list of all schemas
-
isEnabled
Tells if the given Schema is enabled- Parameters:
schemaName- The schema name- Returns:
- true if the schema is enabled
-
isEnabled
Tells if the given Schema is enabled- Parameters:
schema- The schema- Returns:
- true if the schema is enabled
-
disable
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.- Parameters:
schemas- The list of schemas to disable- Returns:
- true if the Registries is still consistent, false otherwise.
- Throws:
LdapException- If something went wrong
-
disable
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.- Parameters:
schemas- The list of schema names to disable- Returns:
- true if the Registries is still consistent, false otherwise.
- Throws:
LdapException- If something went wrong
-
disabledRelaxed
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.- Parameters:
schemas- The list of schemas to disable- Returns:
- true if all the schemas have been disabled
-
disabledRelaxed
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.- Parameters:
schemas- The list of schema names to disable- Returns:
- true if all the schemas have been disabled
-
getDisabled
-
isDisabled
Tells if the given Schema is disabled- Parameters:
schemaName- The schema name- Returns:
- true if the schema is disabled
-
isDisabled
Tells if the given Schema is disabled- Parameters:
schema- The schema- Returns:
- true if the schema is disabled
-
isRelaxed
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
-
setRelaxed
void setRelaxed()Set the SchemaManager to a RELAXED mode -
isStrict
boolean isStrict()Tells if the SchemaManager is strict.- Returns:
- True if SchemaObjects cannot be added if they break the consistency
-
setStrict
void setStrict()Set the SchemaManager to a STRICT mode -
verify
Check that the Schemas are consistent regarding the current Registries.- Parameters:
schemas- The schemas to check- Returns:
- true if the schemas can be loaded in the registries
- Throws:
LdapException- if something went wrong
-
verify
Check that the Schemas are consistent regarding the current Registries.- Parameters:
schemas- The schema names to check- Returns:
- true if the schemas can be loaded in the registries
- Throws:
LdapException- if something went wrong
-
getRegistries
Registries getRegistries()- Returns:
- The Registries
-
lookupAttributeTypeRegistry
Lookup for an AttributeType in the AttributeType registry- Parameters:
oid- the OID we are looking for- Returns:
- The found AttributeType
- Throws:
LdapException- if the OID is not found in the AttributeType registry
-
getAttributeType
Get an AttributeType in the AttributeType registry. This method won't throw an exception if the AttributeTyp is not found, it will just return null.- Parameters:
oid- the OID we are looking for- Returns:
- The found AttributeType, or null if not found
-
lookupComparatorRegistry
Lookup for a Comparator in the Comparator registry- Parameters:
oid- the OID we are looking for- Returns:
- The found Comparator
- Throws:
LdapException- if the OID is not found in the Comparator registry
-
lookupMatchingRuleRegistry
Lookup for a MatchingRule in the MatchingRule registry- Parameters:
oid- the OID we are looking for- Returns:
- The found MatchingRule
- Throws:
LdapException- if the OID is not found in the MatchingRule registry
-
lookupNormalizerRegistry
Lookup for a Normalizer in the Normalizer registry- Parameters:
oid- the OID we are looking for- Returns:
- The found Normalizer
- Throws:
LdapException- if the OID is not found in the Normalizer registry
-
lookupObjectClassRegistry
Lookup for a ObjectClass in the ObjectClass registry- Parameters:
oid- the OID we are looking for- Returns:
- The found ObjectClass
- Throws:
LdapException- if the OID is not found in the ObjectClass registry
-
lookupLdapSyntaxRegistry
Lookup for an LdapSyntax in the LdapSyntax registry- Parameters:
oid- the OID we are looking for- Returns:
- The found LdapSyntax
- Throws:
LdapException- if the OID is not found in the LdapSyntax registry
-
lookupSyntaxCheckerRegistry
Lookup for a SyntaxChecker in the SyntaxChecker registry- Parameters:
oid- the OID we are looking for- Returns:
- The found SyntaxChecker
- Throws:
LdapException- if the OID is not found in the SyntaxChecker registry
-
getAttributeTypeRegistry
AttributeTypeRegistry getAttributeTypeRegistry()Get an immutable reference on the AttributeType registry- Returns:
- A reference to the AttributeType registry.
-
getComparatorRegistry
ComparatorRegistry getComparatorRegistry()Get an immutable reference on the Comparator registry- Returns:
- A reference to the Comparator registry.
-
getDITContentRuleRegistry
DitContentRuleRegistry getDITContentRuleRegistry()Get an immutable reference on the DitContentRule registry- Returns:
- A reference to the DitContentRule registry.
-
getDITStructureRuleRegistry
DitStructureRuleRegistry getDITStructureRuleRegistry()Get an immutable reference on the DitStructureRule registry- Returns:
- A reference to the DitStructureRule registry.
-
getMatchingRuleRegistry
MatchingRuleRegistry getMatchingRuleRegistry()Get an immutable reference on the MatchingRule registry- Returns:
- A reference to the MatchingRule registry.
-
getMatchingRuleUseRegistry
MatchingRuleUseRegistry getMatchingRuleUseRegistry()Get an immutable reference on the MatchingRuleUse registry- Returns:
- A reference to the MatchingRuleUse registry.
-
getNormalizerRegistry
NormalizerRegistry getNormalizerRegistry()Get an immutable reference on the Normalizer registry- Returns:
- A reference to the Normalizer registry.
-
getNameFormRegistry
NameFormRegistry getNameFormRegistry()Get an immutable reference on the NameForm registry- Returns:
- A reference to the NameForm registry.
-
getObjectClassRegistry
ObjectClassRegistry getObjectClassRegistry()Get an immutable reference on the ObjectClass registry- Returns:
- A reference to the ObjectClass registry.
-
getLdapSyntaxRegistry
LdapSyntaxRegistry getLdapSyntaxRegistry()Get an immutable reference on the LdapSyntax registry- Returns:
- A reference to the LdapSyntax registry.
-
getSyntaxCheckerRegistry
SyntaxCheckerRegistry getSyntaxCheckerRegistry()Get an immutable reference on the SyntaxChecker registry- Returns:
- A reference to the SyntaxChecker registry.
-
getNormalizerMapping
Map<String, OidNormalizer> getNormalizerMapping()Get an immutable reference on the Normalizer mapping- Returns:
- A reference to the Normalizer mapping
-
setRegistries
Associate a new Registries to the SchemaManager- Parameters:
registries- The new Registries
-
getErrors
-
getNamingContext
Dn getNamingContext()- Returns:
- the namingContext
-
initialize
Initializes the SchemaService- Throws:
LdapException- If the initialization fails
-
add
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.- Parameters:
schemaObject- the SchemaObject to register- Returns:
- true if the addition has been made, false if there were some errors
- Throws:
LdapException- if the SchemaObject is already registered or the registration operation is not supported
-
delete
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.- Parameters:
schemaObject- the SchemaObject to unregister- Returns:
- true if the deletion has been made, false if there were some errors
- Throws:
LdapException- if the SchemaObject is not registered or the deletion operation is not supported
-
unregisterAttributeType
Removes the registered attributeType from the attributeTypeRegistry- Parameters:
attributeTypeOid- the attributeType OID to unregister- Returns:
- the unregistred AtttributeType
- Throws:
LdapException- if the attributeType is invalid
-
unregisterComparator
Removes the registered Comparator from the ComparatorRegistry- Parameters:
comparatorOid- the Comparator OID to unregister- Returns:
- the unregistred Comparator
- Throws:
LdapException- if the Comparator is invalid
-
unregisterDitControlRule
Removes the registered DitControlRule from the DitControlRuleRegistry- Parameters:
ditControlRuleOid- the DitControlRule OID to unregister- Returns:
- the unregistred DitControlRule
- Throws:
LdapException- if the DitControlRule is invalid
-
unregisterDitStructureRule
Removes the registered DitStructureRule from the DitStructureRuleRegistry- Parameters:
ditStructureRuleOid- the DitStructureRule OID to unregister- Returns:
- the unregistred DitStructureRule
- Throws:
LdapException- if the DitStructureRule is invalid
-
unregisterMatchingRule
Removes the registered MatchingRule from the MatchingRuleRegistry- Parameters:
matchingRuleOid- the MatchingRuleRule OID to unregister- Returns:
- the unregistred MatchingRule
- Throws:
LdapException- if the MatchingRule is invalid
-
unregisterMatchingRuleUse
Removes the registered MatchingRuleUse from the MatchingRuleUseRegistry- Parameters:
matchingRuleUseOid- the MatchingRuleUse OID to unregister- Returns:
- the unregistred MatchingRuleUse
- Throws:
LdapException- if the MatchingRuleUse is invalid
-
unregisterNameForm
Removes the registered NameForm from the NameFormRegistry- Parameters:
nameFormOid- the NameForm OID to unregister- Returns:
- the unregistred NameForm
- Throws:
LdapException- if the NameForm is invalid
-
unregisterNormalizer
Removes the registered Normalizer from the NormalizerRegistry- Parameters:
normalizerOid- the Normalizer OID to unregister- Returns:
- the unregistred Normalizer
- Throws:
LdapException- if the Normalizer is invalid
-
unregisterObjectClass
Removes the registered ObjectClass from the ObjectClassRegistry- Parameters:
objectClassOid- the ObjectClass OID to unregister- Returns:
- the unregistred ObjectClass
- Throws:
LdapException- if the ObjectClass is invalid
-
unregisterLdapSyntax
Removes the registered LdapSyntax from the LdapSyntaxRegistry- Parameters:
ldapSyntaxOid- the LdapSyntax OID to unregister- Returns:
- the unregistred Syntax
- Throws:
LdapException- if the LdapSyntax is invalid
-
unregisterSyntaxChecker
Removes the registered SyntaxChecker from the SyntaxCheckerRegistry- Parameters:
syntaxCheckerOid- the SyntaxChecker OID to unregister- Returns:
- the unregistred SyntaxChecker
- Throws:
LdapException- if the SyntaxChecker is invalid
-
getGlobalOidRegistry
OidRegistry getGlobalOidRegistry()Returns a reference to the global OidRegistry- Returns:
- The the global OidRegistry
-
getLoadedSchema
-
isSchemaLoaded
Tells if the specific schema is loaded- Parameters:
schemaName- The schema we want to check- Returns:
- true if the schema is laoded
-
listDependentSchemaNames
-