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. relaxed/strict) controlled by the given schemaLoader
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
add(SchemaObject schemaObject)
Registers a new SchemaObject.boolean
delete(SchemaObject schemaObject)
Unregisters a new SchemaObject.boolean
disable(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
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
disabledRelaxed(String... schemas)
Disables a set of Schemas, and returns true if all the schema have been disabled, with all the dependent schemas.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
enable(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
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
enableRelaxed(String... schemas)
Enables a set of Schemas, and returns true if all the schema have been enabled, with all the dependent schemas.boolean
enableRelaxed(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()
AttributeType
getAttributeType(String oid)
Get an AttributeType in the AttributeType registry.AttributeTypeRegistry
getAttributeTypeRegistry()
Get an immutable reference on the AttributeType registryComparatorRegistry
getComparatorRegistry()
Get an immutable reference on the Comparator registryList<Schema>
getDisabled()
DitContentRuleRegistry
getDITContentRuleRegistry()
Get an immutable reference on the DitContentRule registryDitStructureRuleRegistry
getDITStructureRuleRegistry()
Get an immutable reference on the DitStructureRule registryList<Schema>
getEnabled()
SchemaErrorHandler
getErrorHandler()
List<Throwable>
getErrors()
OidRegistry
getGlobalOidRegistry()
Returns a reference to the global OidRegistryLdapSyntaxRegistry
getLdapSyntaxRegistry()
Get an immutable reference on the LdapSyntax registrySchema
getLoadedSchema(String schemaName)
Gets a schema that has been loaded into these Registries.MatchingRuleRegistry
getMatchingRuleRegistry()
Get an immutable reference on the MatchingRule registryMatchingRuleUseRegistry
getMatchingRuleUseRegistry()
Get an immutable reference on the MatchingRuleUse registryNameFormRegistry
getNameFormRegistry()
Get an immutable reference on the NameForm registryDn
getNamingContext()
Map<String,OidNormalizer>
getNormalizerMapping()
Get an immutable reference on the Normalizer mappingNormalizerRegistry
getNormalizerRegistry()
Get an immutable reference on the Normalizer registryObjectClassRegistry
getObjectClassRegistry()
Get an immutable reference on the ObjectClass registryRegistries
getRegistries()
SyntaxCheckerRegistry
getSyntaxCheckerRegistry()
Get an immutable reference on the SyntaxChecker registryvoid
initialize()
Initializes the SchemaServiceboolean
isDisabled(String schemaName)
Tells if the given Schema is disabledboolean
isDisabled(Schema schema)
Tells if the given Schema is disabledboolean
isDisabledAccepted()
Currently not implemented.boolean
isEnabled(String schemaName)
Tells if the given Schema is enabledboolean
isEnabled(Schema schema)
Tells if the given Schema is enabledboolean
isRelaxed()
Tells if the SchemaManager is permissive or if it must be checked against inconsistencies.boolean
isSchemaLoaded(String schemaName)
Tells if the specific schema is loadedboolean
isStrict()
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 dependenceboolean
load(String... schemaNames)
Load some Schemas into the registries.boolean
load(Schema... schemas)
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(String... schemaNames)
Load Schemas into the Registries, even if they are disabled.boolean
loadDisabled(Schema... schemas)
Load Schemas into the Registries, even if they are disabled.boolean
loadRelaxed(String... schemaNames)
Load Schemas into the registries, even if there are some errors in the schemas.boolean
loadRelaxed(Schema... schemas)
Load Schemas into the registries, even if there are some errors in the schemas.boolean
loadWithDeps(String... schemas)
Load some Schemas into the registries, and loads all of the schemas they depend on.boolean
loadWithDeps(Schema... schemas)
Load some Schemas into the registries, and loads all of the schemas they depend on.boolean
loadWithDepsRelaxed(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.AttributeType
lookupAttributeTypeRegistry(String oid)
Lookup for an AttributeType in the AttributeType registryLdapComparator<?>
lookupComparatorRegistry(String oid)
Lookup for a Comparator in the Comparator registryLdapSyntax
lookupLdapSyntaxRegistry(String oid)
Lookup for an LdapSyntax in the LdapSyntax registryMatchingRule
lookupMatchingRuleRegistry(String oid)
Lookup for a MatchingRule in the MatchingRule registryNormalizer
lookupNormalizerRegistry(String oid)
Lookup for a Normalizer in the Normalizer registryObjectClass
lookupObjectClassRegistry(String oid)
Lookup for a ObjectClass in the ObjectClass registrySyntaxChecker
lookupSyntaxCheckerRegistry(String oid)
Lookup for a SyntaxChecker in the SyntaxChecker registryvoid
setErrorHandler(SchemaErrorHandler errorHandler)
void
setRegistries(Registries registries)
Associate a new Registries to the SchemaManagervoid
setRelaxed()
Change the SchemaManager to a relaxed mode, where invalid SchemaObjects can be registered.void
setStrict()
Change the SchemaManager to a strict mode, where invalid SchemaObjects cannot be registered.boolean
unload(String... schemaNames)
Unload the given set of Schemasboolean
unload(Schema... schemas)
Unload the given set of SchemasSchemaObject
unregisterAttributeType(String attributeTypeOid)
Removes the registered attributeType from the attributeTypeRegistrySchemaObject
unregisterComparator(String comparatorOid)
Removes the registered Comparator from the ComparatorRegistrySchemaObject
unregisterDitControlRule(String ditControlRuleOid)
Removes the registered DitControlRule from the DitControlRuleRegistrySchemaObject
unregisterDitStructureRule(String ditStructureRuleOid)
Removes the registered DitStructureRule from the DitStructureRuleRegistrySchemaObject
unregisterLdapSyntax(String ldapSyntaxOid)
Removes the registered LdapSyntax from the LdapSyntaxRegistrySchemaObject
unregisterMatchingRule(String matchingRuleOid)
Removes the registered MatchingRule from the MatchingRuleRegistrySchemaObject
unregisterMatchingRuleUse(String matchingRuleUseOid)
Removes the registered MatchingRuleUse from the MatchingRuleUseRegistrySchemaObject
unregisterNameForm(String nameFormOid)
Removes the registered NameForm from the NameFormRegistrySchemaObject
unregisterNormalizer(String normalizerOid)
Removes the registered Normalizer from the NormalizerRegistrySchemaObject
unregisterObjectClass(String objectClassOid)
Removes the registered ObjectClass from the ObjectClassRegistrySchemaObject
unregisterSyntaxChecker(String syntaxCheckerOid)
Removes the registered SyntaxChecker from the SyntaxCheckerRegistryboolean
verify(String... schemas)
Check that the Schemas are consistent regarding the current Registries.boolean
verify(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
-
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:
disable
in 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:
disable
in 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:
disabledRelaxed
in 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:
disabledRelaxed
in 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:
getDisabled
in 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:
enable
in 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:
enable
in 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:
enableRelaxed
in 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:
enableRelaxed
in 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:
getEnabled
in interfaceSchemaManager
- Returns:
- the list of all the enabled schema
-
getAllSchemas
public List<Schema> getAllSchemas()
- Specified by:
getAllSchemas
in interfaceSchemaManager
- Returns:
- the list of all schemas
-
getErrors
public List<Throwable> getErrors()
- Specified by:
getErrors
in interfaceSchemaManager
- Returns:
- The errors obtained when checking the registries
-
getRegistries
public Registries getRegistries()
- Specified by:
getRegistries
in 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:
load
in 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:
load
in 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
-
loadAllEnabled
public boolean loadAllEnabled() throws LdapException
Load all the enabled schema into the Registries. The Registries is strict, any inconsistent schema will be rejected.- Specified by:
loadAllEnabled
in interfaceSchemaManager
- Returns:
- true if the schemas have been loaded
- Throws:
LdapException
- If something went wrong
-
loadAllEnabledRelaxed
public boolean loadAllEnabledRelaxed() throws LdapException
Load all the enabled schema into the Registries. The Registries is relaxed, even inconsistent schema will be loaded.- Specified by:
loadAllEnabledRelaxed
in 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:
loadDisabled
in 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:
loadDisabled
in 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:
loadRelaxed
in 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:
loadRelaxed
in 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:
loadWithDeps
in 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:
loadWithDeps
in 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:
loadWithDepsRelaxed
in 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:
loadWithDepsRelaxed
in 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:
setRegistries
in interfaceSchemaManager
- Parameters:
registries
- The new Registries
-
unload
public boolean unload(Schema... schemas) throws LdapException
Unload the given set of Schemas- Specified by:
unload
in 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:
unload
in 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:
verify
in 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:
verify
in 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:
getNamingContext
in interfaceSchemaManager
- Returns:
- the namingContext
-
initialize
public void initialize() throws LdapException
Initializes the SchemaService- Specified by:
initialize
in interfaceSchemaManager
- Throws:
LdapException
- If the initialization fails
-
getAttributeTypeRegistry
public AttributeTypeRegistry getAttributeTypeRegistry()
Get an immutable reference on the AttributeType registry- Specified by:
getAttributeTypeRegistry
in interfaceSchemaManager
- Returns:
- A reference to the AttributeType registry.
-
getComparatorRegistry
public ComparatorRegistry getComparatorRegistry()
Get an immutable reference on the Comparator registry- Specified by:
getComparatorRegistry
in interfaceSchemaManager
- Returns:
- A reference to the Comparator registry.
-
getDITContentRuleRegistry
public DitContentRuleRegistry getDITContentRuleRegistry()
Get an immutable reference on the DitContentRule registry- Specified by:
getDITContentRuleRegistry
in interfaceSchemaManager
- Returns:
- A reference to the DitContentRule registry.
-
getDITStructureRuleRegistry
public DitStructureRuleRegistry getDITStructureRuleRegistry()
Get an immutable reference on the DitStructureRule registry- Specified by:
getDITStructureRuleRegistry
in interfaceSchemaManager
- Returns:
- A reference to the DitStructureRule registry.
-
getMatchingRuleRegistry
public MatchingRuleRegistry getMatchingRuleRegistry()
Get an immutable reference on the MatchingRule registry- Specified by:
getMatchingRuleRegistry
in interfaceSchemaManager
- Returns:
- A reference to the MatchingRule registry.
-
getMatchingRuleUseRegistry
public MatchingRuleUseRegistry getMatchingRuleUseRegistry()
Get an immutable reference on the MatchingRuleUse registry- Specified by:
getMatchingRuleUseRegistry
in interfaceSchemaManager
- Returns:
- A reference to the MatchingRuleUse registry.
-
getNameFormRegistry
public NameFormRegistry getNameFormRegistry()
Get an immutable reference on the NameForm registry- Specified by:
getNameFormRegistry
in interfaceSchemaManager
- Returns:
- A reference to the NameForm registry.
-
getNormalizerRegistry
public NormalizerRegistry getNormalizerRegistry()
Get an immutable reference on the Normalizer registry- Specified by:
getNormalizerRegistry
in interfaceSchemaManager
- Returns:
- A reference to the Normalizer registry.
-
getObjectClassRegistry
public ObjectClassRegistry getObjectClassRegistry()
Get an immutable reference on the ObjectClass registry- Specified by:
getObjectClassRegistry
in interfaceSchemaManager
- Returns:
- A reference to the ObjectClass registry.
-
getLdapSyntaxRegistry
public LdapSyntaxRegistry getLdapSyntaxRegistry()
Get an immutable reference on the LdapSyntax registry- Specified by:
getLdapSyntaxRegistry
in interfaceSchemaManager
- Returns:
- A reference to the LdapSyntax registry.
-
getSyntaxCheckerRegistry
public SyntaxCheckerRegistry getSyntaxCheckerRegistry()
Get an immutable reference on the SyntaxChecker registry- Specified by:
getSyntaxCheckerRegistry
in 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:
lookupAttributeTypeRegistry
in 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:
getAttributeType
in 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:
lookupComparatorRegistry
in 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:
lookupMatchingRuleRegistry
in 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:
lookupNormalizerRegistry
in 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:
lookupObjectClassRegistry
in 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:
lookupLdapSyntaxRegistry
in 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:
lookupSyntaxCheckerRegistry
in 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:
add
in 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:
delete
in 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:
getNormalizerMapping
in interfaceSchemaManager
- Returns:
- A reference to the Normalizer mapping
-
getGlobalOidRegistry
public OidRegistry getGlobalOidRegistry()
Returns a reference to the global OidRegistry- Specified by:
getGlobalOidRegistry
in interfaceSchemaManager
- Returns:
- The the global OidRegistry
-
getLoadedSchema
public Schema getLoadedSchema(String schemaName)
Gets a schema that has been loaded into these Registries.- Specified by:
getLoadedSchema
in 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:
isSchemaLoaded
in 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:
unregisterAttributeType
in 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:
unregisterComparator
in 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:
unregisterDitControlRule
in 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:
unregisterDitStructureRule
in 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:
unregisterLdapSyntax
in 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:
unregisterMatchingRule
in 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:
unregisterMatchingRuleUse
in 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:
unregisterNameForm
in 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:
unregisterNormalizer
in 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:
unregisterObjectClass
in 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:
unregisterSyntaxChecker
in 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:
isRelaxed
in 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:
isStrict
in 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:
listDependentSchemaNames
in 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:
setRelaxed
in interfaceSchemaManager
-
setStrict
public void setStrict()
Change the SchemaManager to a strict mode, where invalid SchemaObjects cannot be registered.- Specified by:
setStrict
in 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:
isDisabled
in 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:
isDisabled
in 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:
isEnabled
in 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:
isEnabled
in interfaceSchemaManager
- Parameters:
schema
- The schema- Returns:
- true if the schema is enabled
-
-