Class DefaultSchemaManager
- java.lang.Object
-
- org.apache.directory.api.ldap.schema.manager.impl.DefaultSchemaManager
-
- All Implemented Interfaces:
SchemaManager
public class DefaultSchemaManager extends Object implements SchemaManager
The SchemaManager class : it handles all the schema operations (addition, removal, modification).- Author:
- Apache Directory Project
-
-
Field Summary
-
Fields inherited from interface org.apache.directory.api.ldap.model.schema.SchemaManager
RELAXED, STRICT
-
-
Constructor Summary
Constructors Constructor Description DefaultSchemaManager()Creates a new instance of DefaultSchemaManager with LDIF based SchemaLoader, Strict schema validationDefaultSchemaManager(boolean relaxed, Collection<Schema> schemas)Creates a new instance of DefaultSchemaManager with the default schema schemaLoaderDefaultSchemaManager(Collection<Schema> schemas)Creates a new instance of DefaultSchemaManager with the default schema schemaLoader Strict schema validationDefaultSchemaManager(SchemaLoader schemaLoader)Creates a new instance of DefaultSchemaManager with the given schemaLoader Schema validation strictness (i.e.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanadd(SchemaObject schemaObject)Registers a new SchemaObject.protected SchemaObjectaddSchemaObject(Registries registries, SchemaObject schemaObject, Schema schema)Add the schemaObject into the registries.protected voidaddSchemaObjects(Schema schema, Registries registries)booleandelete(SchemaObject schemaObject)Unregisters a new SchemaObject.booleandisable(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.booleandisable(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.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.booleanenable(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.booleanenable(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.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.List<Schema>getAllSchemas()AttributeTypegetAttributeType(String oid)Get an AttributeType in the AttributeType registry.AttributeTypeRegistrygetAttributeTypeRegistry()Get an immutable reference on the AttributeType registryComparatorRegistrygetComparatorRegistry()Get an immutable reference on the Comparator registryList<Schema>getDisabled()DitContentRuleRegistrygetDITContentRuleRegistry()Get an immutable reference on the DitContentRule registryDitStructureRuleRegistrygetDITStructureRuleRegistry()Get an immutable reference on the DitStructureRule registryList<Schema>getEnabled()SchemaErrorHandlergetErrorHandler()List<Throwable>getErrors()OidRegistrygetGlobalOidRegistry()Returns a reference to the global OidRegistryLdapSyntaxRegistrygetLdapSyntaxRegistry()Get an immutable reference on the LdapSyntax registrySchemagetLoadedSchema(String schemaName)Gets a schema that has been loaded into these Registries.MatchingRuleRegistrygetMatchingRuleRegistry()Get an immutable reference on the MatchingRule registryMatchingRuleUseRegistrygetMatchingRuleUseRegistry()Get an immutable reference on the MatchingRuleUse registryNameFormRegistrygetNameFormRegistry()Get an immutable reference on the NameForm registryDngetNamingContext()Map<String,OidNormalizer>getNormalizerMapping()Get an immutable reference on the Normalizer mappingNormalizerRegistrygetNormalizerRegistry()Get an immutable reference on the Normalizer registryObjectClassRegistrygetObjectClassRegistry()Get an immutable reference on the ObjectClass registryRegistriesgetRegistries()SyntaxCheckerRegistrygetSyntaxCheckerRegistry()Get an immutable reference on the SyntaxChecker registryvoidinitialize()Initializes the SchemaServicebooleanisDisabled(String schemaName)Tells if the given Schema is disabledbooleanisDisabled(Schema schema)Tells if the given Schema is disabledbooleanisDisabledAccepted()Currently not implemented.booleanisEnabled(String schemaName)Tells if the given Schema is enabledbooleanisEnabled(Schema schema)Tells if the given Schema is enabledbooleanisRelaxed()Tells 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.Set<String>listDependentSchemaNames(String schemaName)Get the list of Schema names which has the given schema name as a dependencebooleanload(String... schemaNames)Load some Schemas into the registries.booleanload(Schema... schemas)Load some Schemas into the registries.booleanloadAllEnabled()Load all the enabled schema into the Registries.booleanloadAllEnabledRelaxed()Load all the enabled schema into the Registries.booleanloadDisabled(String... schemaNames)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... schemaNames)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.AttributeTypelookupAttributeTypeRegistry(String oid)Lookup for an AttributeType in the AttributeType registryLdapComparator<?>lookupComparatorRegistry(String oid)Lookup for a Comparator in the Comparator registryLdapSyntaxlookupLdapSyntaxRegistry(String oid)Lookup for an LdapSyntax in the LdapSyntax registryMatchingRulelookupMatchingRuleRegistry(String oid)Lookup for a MatchingRule in the MatchingRule registryNormalizerlookupNormalizerRegistry(String oid)Lookup for a Normalizer in the Normalizer registryObjectClasslookupObjectClassRegistry(String oid)Lookup for a ObjectClass in the ObjectClass registrySyntaxCheckerlookupSyntaxCheckerRegistry(String oid)Lookup for a SyntaxChecker in the SyntaxChecker registryvoidsetErrorHandler(SchemaErrorHandler errorHandler)voidsetRegistries(Registries registries)Associate a new Registries to the SchemaManagervoidsetRelaxed()Change the SchemaManager to a relaxed mode, where invalid SchemaObjects can be registered.voidsetStrict()Change the SchemaManager to a strict mode, where invalid SchemaObjects cannot be registered.booleanunload(String... schemaNames)Unload the given set of Schemasbooleanunload(Schema... schemas)Unload the given set of SchemasSchemaObjectunregisterAttributeType(String attributeTypeOid)Removes the registered attributeType from the attributeTypeRegistrySchemaObjectunregisterComparator(String comparatorOid)Removes the registered Comparator from the ComparatorRegistrySchemaObjectunregisterDitControlRule(String ditControlRuleOid)Removes the registered DitControlRule from the DitControlRuleRegistrySchemaObjectunregisterDitStructureRule(String ditStructureRuleOid)Removes the registered DitStructureRule from the DitStructureRuleRegistrySchemaObjectunregisterLdapSyntax(String ldapSyntaxOid)Removes the registered LdapSyntax from the LdapSyntaxRegistrySchemaObjectunregisterMatchingRule(String matchingRuleOid)Removes the registered MatchingRule from the MatchingRuleRegistrySchemaObjectunregisterMatchingRuleUse(String matchingRuleUseOid)Removes the registered MatchingRuleUse from the MatchingRuleUseRegistrySchemaObjectunregisterNameForm(String nameFormOid)Removes the registered NameForm from the NameFormRegistrySchemaObjectunregisterNormalizer(String normalizerOid)Removes the registered Normalizer from the NormalizerRegistrySchemaObjectunregisterObjectClass(String objectClassOid)Removes the registered ObjectClass from the ObjectClassRegistrySchemaObjectunregisterSyntaxChecker(String syntaxCheckerOid)Removes the registered SyntaxChecker from the SyntaxCheckerRegistrybooleanverify(String... schemas)Check that the Schemas are consistent regarding the current Registries.booleanverify(Schema... schemas)Check that the Schemas are consistent regarding the current Registries.
-
-
-
Constructor Detail
-
DefaultSchemaManager
public DefaultSchemaManager()
Creates a new instance of DefaultSchemaManager with LDIF based SchemaLoader, Strict schema validation
-
DefaultSchemaManager
public DefaultSchemaManager(Collection<Schema> schemas)
Creates a new instance of DefaultSchemaManager with the default schema schemaLoader Strict schema validation- Parameters:
schemas- The list of schema to load
-
DefaultSchemaManager
public DefaultSchemaManager(SchemaLoader schemaLoader)
Creates a new instance of DefaultSchemaManager with the given schemaLoader Schema validation strictness (i.e. relaxed/strict) controlled by the given schemaLoader- Parameters:
schemaLoader- The schemaLoader containing the schemas to load
-
DefaultSchemaManager
public DefaultSchemaManager(boolean relaxed, Collection<Schema> schemas)Creates a new instance of DefaultSchemaManager with the default schema schemaLoader- Parameters:
relaxed- If the schema manager should be relaxed or notschemas- The list of schema to load
-
-
Method Detail
-
addSchemaObjects
protected void addSchemaObjects(Schema schema, Registries registries) throws LdapException
- Throws:
LdapException
-
disable
public boolean disable(Schema... schemas) throws LdapException
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:
disablein interfaceSchemaManager- 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
public boolean disable(String... schemaNames) throws LdapException
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:
disablein interfaceSchemaManager- Parameters:
schemaNames- The list of schema names to disable- Returns:
- true if the Registries is still consistent, false otherwise.
- Throws:
LdapException- If something went wrong
-
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:
disabledRelaxedin interfaceSchemaManager- Parameters:
schemas- The list of schemas to disable- Returns:
- true if all the schemas have been disabled
-
disabledRelaxed
public boolean disabledRelaxed(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:
disabledRelaxedin interfaceSchemaManager- Parameters:
schemas- The list of schema names to disable- Returns:
- true if all the schemas have been disabled
-
getDisabled
public List<Schema> getDisabled()
- Specified by:
getDisabledin interfaceSchemaManager- Returns:
- the list of all the disabled schema
-
enable
public boolean enable(Schema... schemas) throws LdapException
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:
enablein interfaceSchemaManager- 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
public boolean enable(String... schemaNames) throws LdapException
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:
enablein interfaceSchemaManager- Parameters:
schemaNames- The list of schema name to enable- Returns:
- true if the Registries is still consistent, false otherwise.
- Throws:
LdapException- If something went wrong
-
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:
enableRelaxedin interfaceSchemaManager- Parameters:
schemas- The list of schemas to enable- Returns:
- true if all the schemas have been enabled
-
enableRelaxed
public boolean enableRelaxed(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:
enableRelaxedin interfaceSchemaManager- Parameters:
schemas- The list of schema names to enable- Returns:
- true if all the schemas have been enabled
-
getEnabled
public List<Schema> getEnabled()
- Specified by:
getEnabledin interfaceSchemaManager- Returns:
- the list of all the enabled schema
-
getAllSchemas
public List<Schema> getAllSchemas()
- Specified by:
getAllSchemasin interfaceSchemaManager- Returns:
- the list of all schemas
-
getErrors
public List<Throwable> getErrors()
- Specified by:
getErrorsin interfaceSchemaManager- Returns:
- The errors obtained when checking the registries
-
getRegistries
public Registries getRegistries()
- Specified by:
getRegistriesin interfaceSchemaManager- Returns:
- The Registries
-
isDisabledAccepted
public boolean isDisabledAccepted()
Currently not implemented.- Returns:
- Always FALSE
-
load
public boolean load(Schema... schemas) throws LdapException
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, theSchemaManager.getErrors()method will contain them- Specified by:
loadin interfaceSchemaManager- 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
public boolean load(String... schemaNames) throws LdapException
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, theSchemaManager.getErrors()method will contain them- Specified by:
loadin interfaceSchemaManager- Parameters:
schemaNames- the Schemas' name to load- Returns:
- true if the schemas have been loaded and the registries is consistent
- Throws:
LdapException- If something went wrong
-
addSchemaObject
protected SchemaObject addSchemaObject(Registries registries, SchemaObject schemaObject, Schema schema) throws LdapException
Add the schemaObject into the registries.- Parameters:
registries- The RegistriesschemaObject- The SchemaObject containing the SchemaObject descriptionschema- The associated schema- Returns:
- the created schemaObject instance
- Throws:
LdapException- If the registering failed
-
loadAllEnabled
public boolean loadAllEnabled() throws LdapExceptionLoad all the enabled schema into the Registries. The Registries is strict, any inconsistent schema will be rejected.- Specified by:
loadAllEnabledin interfaceSchemaManager- Returns:
- true if the schemas have been loaded
- Throws:
LdapException- If something went wrong
-
loadAllEnabledRelaxed
public boolean loadAllEnabledRelaxed() throws LdapExceptionLoad all the enabled schema into the Registries. The Registries is relaxed, even inconsistent schema will be loaded.- Specified by:
loadAllEnabledRelaxedin interfaceSchemaManager- Returns:
- true if the schemas have been loaded
- Throws:
LdapException- If something went wrong
-
loadDisabled
public boolean loadDisabled(Schema... schemas) throws LdapException
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, theSchemaManager.getErrors()method will contain them- Specified by:
loadDisabledin interfaceSchemaManager- Parameters:
schemas- The Schemas to load- Returns:
- true if the schemas have been loaded
- Throws:
LdapException- If something went wrong
-
loadDisabled
public boolean loadDisabled(String... schemaNames) throws LdapException
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, theSchemaManager.getErrors()method will contain them- Specified by:
loadDisabledin interfaceSchemaManager- Parameters:
schemaNames- The Schemas' name to load- Returns:
- true if the schemas have been loaded
- Throws:
LdapException- If something went wrong
-
loadRelaxed
public boolean loadRelaxed(Schema... schemas) throws LdapException
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, theSchemaManager.getErrors()method will contain them- Specified by:
loadRelaxedin interfaceSchemaManager- Parameters:
schemas- the Schemas to load, if enabled- Returns:
- true if the schemas have been loaded
- Throws:
LdapException- If something went wrong
-
loadRelaxed
public boolean loadRelaxed(String... schemaNames) throws LdapException
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, theSchemaManager.getErrors()method will contain them- Specified by:
loadRelaxedin interfaceSchemaManager- Parameters:
schemaNames- 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
-
loadWithDeps
public boolean loadWithDeps(Schema... schemas) throws LdapException
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, theSchemaManager.getErrors()method will contain them- Specified by:
loadWithDepsin interfaceSchemaManager- 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
public boolean loadWithDeps(String... schemas) throws LdapException
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, theSchemaManager.getErrors()method will contain them- Specified by:
loadWithDepsin interfaceSchemaManager- 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
-
loadWithDepsRelaxed
public boolean loadWithDepsRelaxed(Schema... schemas) throws LdapException
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, theSchemaManager.getErrors()method will contain them- Specified by:
loadWithDepsRelaxedin interfaceSchemaManager- Parameters:
schemas- the Schemas to load- Returns:
- true if the schemas have been loaded
- Throws:
LdapException- If something went wrong
-
loadWithDepsRelaxed
public boolean loadWithDepsRelaxed(String... schemas) throws LdapException
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, theSchemaManager.getErrors()method will contain them- Specified by:
loadWithDepsRelaxedin interfaceSchemaManager- Parameters:
schemas- the Schemas' name to load- Returns:
- true if the schemas have been loaded
- Throws:
LdapException- If something went wrong
-
setRegistries
public void setRegistries(Registries registries)
Associate a new Registries to the SchemaManager- Specified by:
setRegistriesin interfaceSchemaManager- Parameters:
registries- The new Registries
-
unload
public boolean unload(Schema... schemas) throws LdapException
Unload the given set of Schemas- Specified by:
unloadin interfaceSchemaManager- Parameters:
schemas- The list of Schema to unload- Returns:
- True if all the schemas have been unloaded
- Throws:
LdapException- If something went wrong
-
unload
public boolean unload(String... schemaNames) throws LdapException
Unload the given set of Schemas- Specified by:
unloadin interfaceSchemaManager- Parameters:
schemaNames- The list of Schema to unload- Returns:
- True if all the schemas have been unloaded
- Throws:
LdapException- If something went wrong
-
verify
public boolean verify(Schema... schemas) throws LdapException
Check that the Schemas are consistent regarding the current Registries.- Specified by:
verifyin interfaceSchemaManager- Parameters:
schemas- The schemas to check- Returns:
- true if the schemas can be loaded in the registries
- Throws:
LdapException- if something went wrong
-
verify
public boolean verify(String... schemas) throws LdapException
Check that the Schemas are consistent regarding the current Registries.- Specified by:
verifyin interfaceSchemaManager- Parameters:
schemas- The schema names to check- Returns:
- true if the schemas can be loaded in the registries
- Throws:
LdapException- if something went wrong
-
getNamingContext
public Dn getNamingContext()
- Specified by:
getNamingContextin interfaceSchemaManager- Returns:
- the namingContext
-
initialize
public void initialize() throws LdapExceptionInitializes the SchemaService- Specified by:
initializein interfaceSchemaManager- Throws:
LdapException- If the initialization fails
-
getAttributeTypeRegistry
public AttributeTypeRegistry getAttributeTypeRegistry()
Get an immutable reference on the AttributeType registry- Specified by:
getAttributeTypeRegistryin interfaceSchemaManager- Returns:
- A reference to the AttributeType registry.
-
getComparatorRegistry
public ComparatorRegistry getComparatorRegistry()
Get an immutable reference on the Comparator registry- Specified by:
getComparatorRegistryin interfaceSchemaManager- Returns:
- A reference to the Comparator registry.
-
getDITContentRuleRegistry
public DitContentRuleRegistry getDITContentRuleRegistry()
Get an immutable reference on the DitContentRule registry- Specified by:
getDITContentRuleRegistryin interfaceSchemaManager- Returns:
- A reference to the DitContentRule registry.
-
getDITStructureRuleRegistry
public DitStructureRuleRegistry getDITStructureRuleRegistry()
Get an immutable reference on the DitStructureRule registry- Specified by:
getDITStructureRuleRegistryin interfaceSchemaManager- Returns:
- A reference to the DitStructureRule registry.
-
getMatchingRuleRegistry
public MatchingRuleRegistry getMatchingRuleRegistry()
Get an immutable reference on the MatchingRule registry- Specified by:
getMatchingRuleRegistryin interfaceSchemaManager- Returns:
- A reference to the MatchingRule registry.
-
getMatchingRuleUseRegistry
public MatchingRuleUseRegistry getMatchingRuleUseRegistry()
Get an immutable reference on the MatchingRuleUse registry- Specified by:
getMatchingRuleUseRegistryin interfaceSchemaManager- Returns:
- A reference to the MatchingRuleUse registry.
-
getNameFormRegistry
public NameFormRegistry getNameFormRegistry()
Get an immutable reference on the NameForm registry- Specified by:
getNameFormRegistryin interfaceSchemaManager- Returns:
- A reference to the NameForm registry.
-
getNormalizerRegistry
public NormalizerRegistry getNormalizerRegistry()
Get an immutable reference on the Normalizer registry- Specified by:
getNormalizerRegistryin interfaceSchemaManager- Returns:
- A reference to the Normalizer registry.
-
getObjectClassRegistry
public ObjectClassRegistry getObjectClassRegistry()
Get an immutable reference on the ObjectClass registry- Specified by:
getObjectClassRegistryin interfaceSchemaManager- Returns:
- A reference to the ObjectClass registry.
-
getLdapSyntaxRegistry
public LdapSyntaxRegistry getLdapSyntaxRegistry()
Get an immutable reference on the LdapSyntax registry- Specified by:
getLdapSyntaxRegistryin interfaceSchemaManager- Returns:
- A reference to the LdapSyntax registry.
-
getSyntaxCheckerRegistry
public SyntaxCheckerRegistry getSyntaxCheckerRegistry()
Get an immutable reference on the SyntaxChecker registry- Specified by:
getSyntaxCheckerRegistryin interfaceSchemaManager- Returns:
- A reference to the SyntaxChecker registry.
-
lookupAttributeTypeRegistry
public AttributeType lookupAttributeTypeRegistry(String oid) throws LdapException
Lookup for an AttributeType in the AttributeType registry- Specified by:
lookupAttributeTypeRegistryin interfaceSchemaManager- 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
public AttributeType getAttributeType(String oid)
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.- Specified by:
getAttributeTypein interfaceSchemaManager- Parameters:
oid- the OID we are looking for- Returns:
- The found AttributeType, or null if not found
-
lookupComparatorRegistry
public LdapComparator<?> lookupComparatorRegistry(String oid) throws LdapException
Lookup for a Comparator in the Comparator registry- Specified by:
lookupComparatorRegistryin interfaceSchemaManager- 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
public MatchingRule lookupMatchingRuleRegistry(String oid) throws LdapException
Lookup for a MatchingRule in the MatchingRule registry- Specified by:
lookupMatchingRuleRegistryin interfaceSchemaManager- 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
public Normalizer lookupNormalizerRegistry(String oid) throws LdapException
Lookup for a Normalizer in the Normalizer registry- Specified by:
lookupNormalizerRegistryin interfaceSchemaManager- 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
public ObjectClass lookupObjectClassRegistry(String oid) throws LdapException
Lookup for a ObjectClass in the ObjectClass registry- Specified by:
lookupObjectClassRegistryin interfaceSchemaManager- 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
public LdapSyntax lookupLdapSyntaxRegistry(String oid) throws LdapException
Lookup for an LdapSyntax in the LdapSyntax registry- Specified by:
lookupLdapSyntaxRegistryin interfaceSchemaManager- 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
public SyntaxChecker lookupSyntaxCheckerRegistry(String oid) throws LdapException
Lookup for a SyntaxChecker in the SyntaxChecker registry- Specified by:
lookupSyntaxCheckerRegistryin interfaceSchemaManager- Parameters:
oid- the OID we are looking for- Returns:
- The found SyntaxChecker
- Throws:
LdapException- if the OID is not found in the SyntaxChecker registry
-
add
public boolean add(SchemaObject schemaObject) throws LdapException
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:
addin interfaceSchemaManager- 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
public boolean delete(SchemaObject schemaObject) throws LdapException
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:
deletein interfaceSchemaManager- 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
-
getNormalizerMapping
public Map<String,OidNormalizer> getNormalizerMapping()
Get an immutable reference on the Normalizer mapping- Specified by:
getNormalizerMappingin interfaceSchemaManager- Returns:
- A reference to the Normalizer mapping
-
getGlobalOidRegistry
public OidRegistry getGlobalOidRegistry()
Returns a reference to the global OidRegistry- Specified by:
getGlobalOidRegistryin interfaceSchemaManager- Returns:
- The the global OidRegistry
-
getLoadedSchema
public Schema getLoadedSchema(String schemaName)
Gets a schema that has been loaded into these Registries.- Specified by:
getLoadedSchemain interfaceSchemaManager- Parameters:
schemaName- the name of the schema to lookup- Returns:
- the loaded Schema if one corresponding to the name exists
-
isSchemaLoaded
public boolean isSchemaLoaded(String schemaName)
Tells if the specific schema is loaded- Specified by:
isSchemaLoadedin interfaceSchemaManager- Parameters:
schemaName- The schema we want to check- Returns:
- true if the schema is laoded
-
unregisterAttributeType
public SchemaObject unregisterAttributeType(String attributeTypeOid) throws LdapException
Removes the registered attributeType from the attributeTypeRegistry- Specified by:
unregisterAttributeTypein interfaceSchemaManager- Parameters:
attributeTypeOid- the attributeType OID to unregister- Returns:
- the unregistred AtttributeType
- Throws:
LdapException- if the attributeType is invalid
-
unregisterComparator
public SchemaObject unregisterComparator(String comparatorOid) throws LdapException
Removes the registered Comparator from the ComparatorRegistry- Specified by:
unregisterComparatorin interfaceSchemaManager- Parameters:
comparatorOid- the Comparator OID to unregister- Returns:
- the unregistred Comparator
- Throws:
LdapException- if the Comparator is invalid
-
unregisterDitControlRule
public SchemaObject unregisterDitControlRule(String ditControlRuleOid) throws LdapException
Removes the registered DitControlRule from the DitControlRuleRegistry- Specified by:
unregisterDitControlRulein interfaceSchemaManager- Parameters:
ditControlRuleOid- the DitControlRule OID to unregister- Returns:
- the unregistred DitControlRule
- Throws:
LdapException- if the DitControlRule is invalid
-
unregisterDitStructureRule
public SchemaObject unregisterDitStructureRule(String ditStructureRuleOid) throws LdapException
Removes the registered DitStructureRule from the DitStructureRuleRegistry- Specified by:
unregisterDitStructureRulein interfaceSchemaManager- Parameters:
ditStructureRuleOid- the DitStructureRule OID to unregister- Returns:
- the unregistred DitStructureRule
- Throws:
LdapException- if the DitStructureRule is invalid
-
unregisterLdapSyntax
public SchemaObject unregisterLdapSyntax(String ldapSyntaxOid) throws LdapException
Removes the registered LdapSyntax from the LdapSyntaxRegistry- Specified by:
unregisterLdapSyntaxin interfaceSchemaManager- Parameters:
ldapSyntaxOid- the LdapSyntax OID to unregister- Returns:
- the unregistred Syntax
- Throws:
LdapException- if the LdapSyntax is invalid
-
unregisterMatchingRule
public SchemaObject unregisterMatchingRule(String matchingRuleOid) throws LdapException
Removes the registered MatchingRule from the MatchingRuleRegistry- Specified by:
unregisterMatchingRulein interfaceSchemaManager- Parameters:
matchingRuleOid- the MatchingRuleRule OID to unregister- Returns:
- the unregistred MatchingRule
- Throws:
LdapException- if the MatchingRule is invalid
-
unregisterMatchingRuleUse
public SchemaObject unregisterMatchingRuleUse(String matchingRuleUseOid) throws LdapException
Removes the registered MatchingRuleUse from the MatchingRuleUseRegistry- Specified by:
unregisterMatchingRuleUsein interfaceSchemaManager- Parameters:
matchingRuleUseOid- the MatchingRuleUse OID to unregister- Returns:
- the unregistred MatchingRuleUse
- Throws:
LdapException- if the MatchingRuleUse is invalid
-
unregisterNameForm
public SchemaObject unregisterNameForm(String nameFormOid) throws LdapException
Removes the registered NameForm from the NameFormRegistry- Specified by:
unregisterNameFormin interfaceSchemaManager- Parameters:
nameFormOid- the NameForm OID to unregister- Returns:
- the unregistred NameForm
- Throws:
LdapException- if the NameForm is invalid
-
unregisterNormalizer
public SchemaObject unregisterNormalizer(String normalizerOid) throws LdapException
Removes the registered Normalizer from the NormalizerRegistry- Specified by:
unregisterNormalizerin interfaceSchemaManager- Parameters:
normalizerOid- the Normalizer OID to unregister- Returns:
- the unregistred Normalizer
- Throws:
LdapException- if the Normalizer is invalid
-
unregisterObjectClass
public SchemaObject unregisterObjectClass(String objectClassOid) throws LdapException
Removes the registered ObjectClass from the ObjectClassRegistry- Specified by:
unregisterObjectClassin interfaceSchemaManager- Parameters:
objectClassOid- the ObjectClass OID to unregister- Returns:
- the unregistred ObjectClass
- Throws:
LdapException- if the ObjectClass is invalid
-
unregisterSyntaxChecker
public SchemaObject unregisterSyntaxChecker(String syntaxCheckerOid) throws LdapException
Removes the registered SyntaxChecker from the SyntaxCheckerRegistry- Specified by:
unregisterSyntaxCheckerin interfaceSchemaManager- Parameters:
syntaxCheckerOid- the SyntaxChecker OID to unregister- Returns:
- the unregistred SyntaxChecker
- 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.- Specified by:
isRelaxedin interfaceSchemaManager- Returns:
- True if SchemaObjects can be added even if they break the consistency
-
isStrict
public boolean isStrict()
Tells if the SchemaManager is strict.- Specified by:
isStrictin interfaceSchemaManager- Returns:
- True if SchemaObjects cannot be added if they break the consistency
-
listDependentSchemaNames
public Set<String> listDependentSchemaNames(String schemaName)
Get the list of Schema names which has the given schema name as a dependence- Specified by:
listDependentSchemaNamesin interfaceSchemaManager- 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.- Specified by:
setRelaxedin interfaceSchemaManager
-
setStrict
public void setStrict()
Change the SchemaManager to a strict mode, where invalid SchemaObjects cannot be registered.- Specified by:
setStrictin interfaceSchemaManager
-
getErrorHandler
public SchemaErrorHandler getErrorHandler()
-
setErrorHandler
public void setErrorHandler(SchemaErrorHandler errorHandler)
-
isDisabled
public boolean isDisabled(String schemaName)
Tells if the given Schema is disabled- Specified by:
isDisabledin interfaceSchemaManager- 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:
isDisabledin interfaceSchemaManager- Parameters:
schema- The schema- Returns:
- true if the schema is disabled
-
isEnabled
public boolean isEnabled(String schemaName)
Tells if the given Schema is enabled- Specified by:
isEnabledin interfaceSchemaManager- 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:
isEnabledin interfaceSchemaManager- Parameters:
schema- The schema- Returns:
- true if the schema is enabled
-
-