Class Registries
java.lang.Object
org.apache.directory.api.ldap.model.schema.registries.Registries
- All Implemented Interfaces:
Cloneable, SchemaLoaderListener
Document this class.
- Author:
- Apache Directory Project
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected DefaultAttributeTypeRegistryThe AttributeType registryprotected DefaultComparatorRegistryThe LdapSyntax registryprotected DefaultDitContentRuleRegistryThe DitContentRule registryprotected DefaultDitStructureRuleRegistryThe DitStructureRule registryprotected OidRegistry<SchemaObject> The global OID registryprotected DefaultLdapSyntaxRegistryThe LdapSyntax registryA String name to Schema object map for the schemas loaded into this registry.protected DefaultMatchingRuleRegistryThe MatchingRule registryprotected DefaultMatchingRuleUseRegistryThe MatchingRuleUse registryprotected DefaultNameFormRegistryThe NameForm registryprotected DefaultNormalizerRegistryThe Normalizer registryprotected DefaultObjectClassRegistryThe ObjectClass registrystatic final booleanThe relaxed modestatic final booleanThe strict modeprotected DefaultSyntaxCheckerRegistryThe SyntaxChecker registryprotected Map<SchemaObjectWrapper, Set<SchemaObjectWrapper>> A map storing a relation between a SchemaObject and all the referencing SchemaObjects.protected Map<SchemaObjectWrapper, Set<SchemaObjectWrapper>> A map storing a relation between a SchemaObject and all the SchemaObjects it uses. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(SchemaObject schemaObject, boolean check) Applies the added SchemaObject to the given registervoidaddReference(SchemaObject base, SchemaObject referenced) Add an association between a SchemaObject an the SchemaObject it refersCreate a new schema association with its contentvoidassociateWithSchema(SchemaObject schemaObject) Store the given SchemaObject in the Map associating SchemaObjetcs to their related Schema.voidbuildReference(SchemaObject schemaObject) Build the SchemaObject referencesvoidBuild the usedBy and using references from the stored elements.booleancheck()Check the registries for invalid relations.voidAttempts to resolve the dependent schema objects of all entities that refer to other objects within the registries.voidclear()Clear the registries from all its elementsclone()Clone the Registries.booleancontains(SchemaObject schemaObject) Tells if the given SchemaObject is present in one schema.voiddelCrossReferences(AttributeType attributeType) Add the SchemaObjectReferences.voiddelCrossReferences(MatchingRule matchingRule) Delete the MR references (using and usedBy) : MR -> C MR -> N MR -> Svoiddelete(SchemaObject schemaObject) Remove the given SchemaObject from the registriesvoiddelReference(SchemaObject base, SchemaObject referenced) Delete an association between a SchemaObject an the SchemaObject it refersvoiddissociateFromSchema(SchemaObject schemaObject) Store the given SchemaObject in the Map associating SchemaObjetcs to their related Schema.Dump the UsedBy data structure as a StringDump the Using data structure as a StringgetLoadedSchema(String schemaName) Gets a schema that has been loaded into these Registries.Gets an unmodifiable Map of schema names to loaded Schema objects.Get an OID from a name.getReferencing(SchemaObject schemaObject) Check that we can remove a given SchemaObject without breaking some of its references.getUsedBy(SchemaObject schemaObject) Gets the Set of SchemaObjects referencing the given SchemaObjectgetUsing(SchemaObject schemaObject) Gets the Set of SchemaObjects referenced by the given SchemaObjectbooleanTells if the Registries accept disabled elements.booleanisReferenced(SchemaObject schemaObject) Checks if a specific SchemaObject is referenced by any other SchemaObject.booleanTells if the Registries is permissive or if it must be checked against inconsistencies.booleanisSchemaLoaded(String schemaName) Checks to see if a particular Schema is loaded.booleanisStrict()Tells if the Registries is strict.voidremoveReference(SchemaObject schemaObject) Unlink the SchemaObject referencesvoidschemaLoaded(Schema schema) Merely adds the schema to the set of loaded schemas.voidschemaUnloaded(Schema schema) Merely removes the schema from the set of loaded schemas.voidsetDisabledAccepted(boolean disabledAccepted) Change the Registries behavior regarding disabled SchemaObject element.voidsetErrorHandler(SchemaErrorHandler errorHandler) voidChange the Registries to a relaxed mode, where invalid SchemaObjects can be registered.voidChange the Registries to a strict mode, where invalid SchemaObjects cannot be registered.toString()
-
Field Details
-
loadedSchemas
-
attributeTypeRegistry
The AttributeType registry -
objectClassRegistry
The ObjectClass registry -
comparatorRegistry
The LdapSyntax registry -
ditContentRuleRegistry
The DitContentRule registry -
ditStructureRuleRegistry
The DitStructureRule registry -
matchingRuleRegistry
The MatchingRule registry -
matchingRuleUseRegistry
The MatchingRuleUse registry -
nameFormRegistry
The NameForm registry -
normalizerRegistry
The Normalizer registry -
globalOidRegistry
The global OID registry -
syntaxCheckerRegistry
The SyntaxChecker registry -
ldapSyntaxRegistry
The LdapSyntax registry -
STRICT
public static final boolean STRICTThe strict mode- See Also:
-
RELAXED
public static final boolean RELAXEDThe relaxed mode- See Also:
-
usedBy
A map storing a relation between a SchemaObject and all the referencing SchemaObjects. -
using
A map storing a relation between a SchemaObject and all the SchemaObjects it uses.
-
-
Constructor Details
-
Registries
public Registries()Creates a new instance of Registries.
-
-
Method Details
-
getAttributeTypeRegistry
- Returns:
- The AttributeType registry
-
getComparatorRegistry
- Returns:
- The Comparator registry
-
getDitContentRuleRegistry
- Returns:
- The DitContentRule registry
-
getDitStructureRuleRegistry
- Returns:
- The DitStructureRule registry
-
getMatchingRuleRegistry
- Returns:
- The MatchingRule registry
-
getMatchingRuleUseRegistry
- Returns:
- The MatchingRuleUse registry
-
getNameFormRegistry
- Returns:
- The NameForm registry
-
getNormalizerRegistry
- Returns:
- The Normalizer registry
-
getObjectClassRegistry
- Returns:
- The ObjectClass registry
-
getGlobalOidRegistry
- Returns:
- The global Oid registry
-
getSyntaxCheckerRegistry
- Returns:
- The SyntaxChecker registry
-
getLdapSyntaxRegistry
- Returns:
- The LdapSyntax registry
-
getOid
-
getLoadedSchema
-
isSchemaLoaded
Checks to see if a particular Schema is loaded.- Parameters:
schemaName- the name of the Schema to check- Returns:
- true if the Schema is loaded, false otherwise
-
checkRefInteg
public void checkRefInteg()Attempts to resolve the dependent schema objects of all entities that refer to other objects within the registries. Null references will be handed appropriately. The order in which the SchemaObjects must be :- 1) Normalizers, Comparators and SyntaxCheckers (as they depend on nothing)
- 2) Syntaxes (depend on SyntaxCheckers)
- 3) MatchingRules (depend on Syntaxes, Normalizers and Comparators
- 4) AttributeTypes (depend on MatchingRules, Syntaxes and AttributeTypes : in this case, we first handle the superior)
- 5) ObjectClasses (depend on AttributeTypes and ObjectClasses)
Later, when we will support them :- 6) MatchingRuleUses (depend on matchingRules and AttributeTypes)
- 7) DitContentRules (depend on ObjectClasses and AttributeTypes)
- 8) NameForms (depends on ObjectClasses and AttributeTypes)
- 9) DitStructureRules (depends onNameForms and DitStructureRules)
-
delCrossReferences
Add the SchemaObjectReferences. This method does nothing, it's just a catch all. The other methods will be called for each specific schemaObject public void addCrossReferences( SchemaObject schemaObject ) { // Do nothing : it's a catch all method. } /** Delete the AT references (using and usedBy) : AT -> MR (for EQUALITY, ORDERING and SUBSTR) AT -> S AT -> AT- Parameters:
attributeType- The AttributeType to remove
-
delCrossReferences
Delete the MR references (using and usedBy) : MR -> C MR -> N MR -> S- Parameters:
matchingRule- The MatchinRule refere ce to delete
-
buildReference
Build the SchemaObject references- Parameters:
schemaObject- The SchemaObject to add
-
removeReference
Unlink the SchemaObject references- Parameters:
schemaObject- The SchemaObject to remove
-
buildReferences
public void buildReferences()Build the usedBy and using references from the stored elements. -
add
Applies the added SchemaObject to the given register- Parameters:
schemaObject- The SchemaObject to addcheck- A flag set when we want the schema checks to be done- Throws:
LdapException- If we weren't able to add the SchemaObject
-
delete
Remove the given SchemaObject from the registries- Parameters:
schemaObject- The SchemaObject to delete- Throws:
LdapException- If the deletion failed
-
schemaLoaded
Merely adds the schema to the set of loaded schemas. Does not actually do any work to add schema objects to registries. Listener method called to indicate a loader or other agent finished loading the schema objects for a schema into the Registries.- Specified by:
schemaLoadedin interfaceSchemaLoaderListener- Parameters:
schema- the Schema that was loaded
-
schemaUnloaded
Merely removes the schema from the set of loaded schemas. Does not actually do any work to remove schema objects from registries. Listener method called to indicate an agent finished loading the schema objects for a schema into the Registries.- Specified by:
schemaUnloadedin interfaceSchemaLoaderListener- Parameters:
schema- the Schema that was unloaded
-
getLoadedSchemas
-
getObjectBySchemaName
- Returns:
- Gets a reference to the Map associating a schemaName to its contained SchemaObjects
-
contains
Tells if the given SchemaObject is present in one schema. The schema may be disabled.- Parameters:
schemaObject- The schemaObject we are looking for- Returns:
- true if the schemaObject is present in a schema
-
addSchema
Create a new schema association with its content- Parameters:
schemaName- The schema name- Returns:
- A set containing the associations
-
associateWithSchema
Store the given SchemaObject in the Map associating SchemaObjetcs to their related Schema.- Parameters:
schemaObject- The schemaObject to register
-
dissociateFromSchema
Store the given SchemaObject in the Map associating SchemaObjetcs to their related Schema.- Parameters:
schemaObject- The schemaObject to register- Throws:
LdapException- If there is a problem
-
isReferenced
Checks if a specific SchemaObject is referenced by any other SchemaObject.- Parameters:
schemaObject- The SchemaObject we are looking for- Returns:
- true if there is at least one SchemaObjetc referencing the given one
-
getUsedBy
Gets the Set of SchemaObjects referencing the given SchemaObject- Parameters:
schemaObject- The SchemaObject we are looking for- Returns:
- The Set of referencing SchemaObject, or null
-
dumpUsedBy
Dump the UsedBy data structure as a String- Returns:
- The UsedBy data structure
-
dumpUsing
Dump the Using data structure as a String- Returns:
- The Using data structure
-
getUsing
Gets the Set of SchemaObjects referenced by the given SchemaObject- Parameters:
schemaObject- The SchemaObject we are looking for- Returns:
- The Set of referenced SchemaObject, or null
-
addReference
Add an association between a SchemaObject an the SchemaObject it refers- Parameters:
base- The base SchemaObjectreferenced- The referenced SchemaObject
-
delReference
Delete an association between a SchemaObject an the SchemaObject it refers- Parameters:
base- The base SchemaObjectreferenced- The referenced SchemaObject
-
check
public boolean check()Check the registries for invalid relations. This check stops at the first error.- Returns:
- true if the Registries is consistent, false otherwise
-
clone
Clone the Registries. This is done in two steps : - first clone the SchemaObjetc registries - second restore the relation between them- Overrides:
clonein classObject- Throws:
CloneNotSupportedException
-
isRelaxed
public boolean isRelaxed()Tells if the Registries is permissive or if it must be checked against inconsistencies.- Returns:
- True if SchemaObjects can be added even if they break the consistency
-
isStrict
public boolean isStrict()Tells if the Registries is strict.- Returns:
- True if SchemaObjects cannot be added if they break the consistency
-
setRelaxed
public void setRelaxed()Change the Registries to a relaxed mode, where invalid SchemaObjects can be registered. -
setStrict
public void setStrict()Change the Registries to a strict mode, where invalid SchemaObjects cannot be registered. -
getErrorHandler
-
setErrorHandler
-
isDisabledAccepted
public boolean isDisabledAccepted()Tells if the Registries accept disabled elements.- Returns:
- True if disabled SchemaObjects can be added
-
getReferencing
Check that we can remove a given SchemaObject without breaking some of its references. We will return the list of refereing objects.- Parameters:
schemaObject- The SchemaObject to remove- Returns:
- The list of SchemaObjects referencing the SchemaObjetc we want to remove
-
setDisabledAccepted
public void setDisabledAccepted(boolean disabledAccepted) Change the Registries behavior regarding disabled SchemaObject element.- Parameters:
disabledAccepted- Iffalse, then the Registries won't accept disabled SchemaObject or enabled SchemaObject from disabled schema
-
clear
Clear the registries from all its elements- Throws:
LdapException- If something goes wrong
-
toString
-