Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Note
titleWork in progress

This site is in the process of being reviewed and updated.

Introduction

Apache DS has to keep a lot of internal structures available from all the parts of the server. This is done through what we call the SchemaManager. It hide all the internal structure from the users.

SchemaManager

The SchemaManager stores Registries, which are hives where each SchemaObjects are stored. We also store some dedicated data structures :

...

  • globalOidRegistry : It stores the list of all the SchemaObject*s' OIDs. A *SchemaObject has a unique OID in a SchemaManager
  • <SchemaObject>Registry : A registry per SchemaObject type.
  • loadedSchemas : The list of all the loaded schemas
  • schemaObjectsBySchemaName : A list of all SchemaObjects per schema
  • usedBy : a map containing the list of SchemaObject referencing a given SchemaObject
  • using : a map containing the list of SchemaObject used by a given SchemaObject

SchemaObject Registries

For each different type of SchemaObject, we have a dedicated Registry.

The following diagram shows the class diagram for those registries :

SchemaObjects

We have 11 different SchemaObjects, 3 of them are Apache DS specific :

...

Note that the ObjectClassRegistry and the AttributeTypeRegistry contain a specific data structure
to keep a track of the descendants for each AT or OC.

AttributeType

Here are the fields stored in a AttributeType instance :

Name

default

description

N/A

extensions

N/A

isEnabled

TRUE

isObsolete

FALSE

isReadOnly

FALSE

names

No names

objectType

ATTRIBUTE_TYPE

oid

AT OID

schemaName

N/A

specification

not modifiable

canUserModify

TRUE

equality

MR reference

equalityOid

MR OID

isCollective

FALSE

isSingleValued

FALSE

ordering

MR reference

orderingOid

MR OID

substring

MR reference

substringOid

MR OID

superior

AT reference

superiorOid

MR OID

syntax

Syntax reference

syntaxLength

0

syntaxOid

Syntax OID

usage

userApplications

Adding an AttributeType

Register the AttributeType into the AttributeTypeRegistry :
update the AttributeTypeRegistry.byOid : add <oid, AttributeType>
for all the attributeType names, plus the oid,
update the AttributeTypeRegistry.byName : add <name, AttributeType>
update the AttributeTypeRegistry.byName : add <oid, AttributeType>
associate the AttributeType with the schema : <schema, set<SchemaObject>> += AttributeType
update the Registries.globalOidRegistry : add <oid, AttributeType>

...

NOTE : The OidNormalizerMap is probably useless

Modifying an AttributeType

We won't create a new object, but will update the existing one. The OID can't be changed

...

We will also have to check that the modified AT is still valid

Deleting an AttributeType

We can't delete an AttributeType if it's refered by an ObjectClass, or another AttributeType.
This is checked by verifying inthe usedBy table :

...

update the Registries.using map : remove the relation <AttributeType.oid, set<SchemaObject>>
update the Registries.usedBy map for each AT/MR/S referenced in the AttributeType :
<<AT/MR/S>.oid, set<SchemaObject>> -= AttributeType
remove the AttributeType from the oidToDescendant Map

Comparator

Here are the fields stored in a Comparator instance :

Name

default

description

N/A

extensions

N/A

isEnabled

TRUE

isObsolete

FALSE

isReadOnly

FALSE

names

No names

objectType

COMPARATOR

oid

MR OID

schemaName

N/A

specification

not modifiable

bytecode

not modifiable

fqcn

not modifiable

Adding a comparator

Register the comparator into the ComparatorRegistry :
update the ComparatorRegistry.byOid : add <oid, comparator>
update the ComparatorRegistry.byName : add <oid, comparator>
associate the Comparator with the schema : <schema, set<SchemaObject>> += comparator

Modifying a comparator

Nothing to do but update the comparator in place (replacing all the fields of the original comparator).

Note that all the fields are not modifiables.

Deleting a comparator

We can't delete a comparator if it is used by a MatchingRule. This is checked by verifying in
the usedBy table :

...

This is a more complex operation, as we may have some MatchingRules pointing on this object.
We have to :
remove the oid from the ComparatorRegistry.byOid
remove the oid from the ComparatorRegistry.byName
remove the Comparator from the bySchemaNameSchemaObject map : <schema, set<SchemaObject>> -= comparator

DITContentRule

Not Yet Implemented

DITStructureRule

Not Yet Implemented

MatchingRule

Here are the fields stored in a MatchingRule instance :

Name

default

description

N/A

extensions

N/A

isEnabled

TRUE

isObsolete

FALSE

isReadOnly

FALSE

names

No names

objectType

ATTRIBUTE_TYPE

oid

AT OID

schemaName

N/A

ldapComparator

Comparator reference

ldapSyntax

Syntax reference

ldapSyntaxOid

The Syntax OID

normalizer

Normalizer reference

Adding a MatchingRule

Register the MatchingRule into the MatchingRuleRegistry :
update the MatchingRuleRegistry.byOid : add <oid, MatchingRule>
update the MatchingRuleRegistry.byName : add <oid, MatchingRule>
associate the MatchingRule with the schema : <schema, set<SchemaObject>> += MatchingRule
update the Registries.globalOidRegistry : add <oid, MatchingRule>

...

update the MatchingRule.syntax : SyntaxRegistry.lookup( syntaxoid )
update the MatchingRule.normalizer : NormalizerRegistry.lookup( matchingRule.oid )
update the MatchingRule.comparator : ComparatorRegistry.lookup( matchingRule.oid )
update the Registries.using map : <MatchingRule.oid, set<SchemaObject>> += syntax, normalizer, comparator
update the Registries.usedBy map :
<Syntax.oid, set<SchemaObject>> += MatchingRule
<Comparator.oid, set<SchemaObject>> += MatchingRule
<Normalizer.oid, set<SchemaObject>> += MatchingRule

Modifying a MatchingRule

We won't create a new object, but will update the existing one. The OID can't be changed

If we have changed the (N)ormalizer, the (S)yntax or the (C)omparator, when all the schema
modifications will be done, do the additional updates :
update the MatchingRule.<C/N/S> : <C/S/N>Registry.lookup( oid )
update the Registries.using map : <MatchingRule.oid, set<SchemaObject>> -= old <C/S/N>
update the Registries.using map : <MatchingRule.oid, set<SchemzObject>> += new <C/S/N>
update the Registries.usedBy map : <old <C/S/N>.oid, set<SchemaObject>> -= MatchingRule
update the Registries.usedBy map : <new <C/S/N>.oid, set<SchemaObject>> += MatchingRule

Deleting a MatchingRule

We can't delete a MatchingRule which is used by an AttributeType. This is checked by verifying in
the usedBy table :

...

update the Registries.using map : remove the relation <MatchingRule.oid, set<SchemaObject>>
update the Registries.usedBy map for each C/S/N referenced in the MatchingRule :
<<C/S/N>.oid, set<SchemaObject>> -= MatchingRule

MatchingRuleUse

Not Yet Implemented

NameForm

Not Yet Implemented

Normalizer (specific)

Here are the fields stored in a Normalizer instance :

Name

default

description

N/A

extensions

N/A

isEnabled

TRUE

isObsolete

FALSE

isReadOnly

FALSE

names

No names

objectType

NORMALIZER

oid

MR OID

schemaName

N/A

specification

not modifiable

bytecode

not modifiable

fqcn

not modifiable

Adding a Normalizer

Register the Normalizer into the NormalizerRegistry :
update the NormalizerRegistry.byOid : add <oid, Normalizer>
update the NormalizerRegistry.byName : add <oid, Normalizer>
associate the Normalizer with the schema : <schema, set<SchemaObject>> += Normalizer

Modifying a Normalizer

Nothing to do but update the Normalizer in place (replacing all the fields of the original Normalizer).

Note that all the fields are not modifiables.

Deleting a Normalizer

We can't delete a Normalizer if it is used by a MatchingRule. This is checked by verifying in
the usedBy table :

...

This is a more complex operation, as we may have some MatchingRules pointing on this object.
We have to :
remove the oid from the NormalizerRegistry.byOid
remove the oid from the NormalizerRegistry.byName
remove the Normalizer from the bySchemaNameSchemaObject map : <schema, set<SchemaObject>> -= Normalizer

ObjectClass

Here are the fields stored in a ObjectClass instance :

Name

default

description

N/A

extensions

N/A

isEnabled

TRUE

isObsolete

FALSE

isReadOnly

FALSE

names

No names

objectType

NORMALIZER

oid

MR OID

schemaName

N/A

specification

not modifiable

mayAttributeTypes

all the referenced MAY attributeType

mayAttributeTypeOids

all the referenced MAY attributeType's oid

mustAttributeTypes

all the referenced MUST attributeType

mustAttributeTypeOids

all the referenced MUST attributeType's oid

objectClassType

STRUCTURAL

superiors

all the inherited SUPERIOR

superiorOids

all the inherited SUPERIOR's oid

Adding an ObjectClass

Register the ObjectClass into the ObjectClassRegistry :
update the ObjectClassRegistry.byOid : add <oid, ObjectClass>
for all the ObjectClass names, plus the oid,
update the ObjectClassRegistry.byName : add <name, ObjectClass>
update the ObjectClassRegistry.byName : add <oid, ObjectClass>
associate the ObjectClassType with the schema : <schema, set<SchemaObject>> += ObjectClass
update the Registries.globalOidRegistry : add <oid, ObjectClass>

...

  • If the ObjectClass is ABSTRACT, then it can inherit from a STRUCTURAL or AUXILIARY ObjectClass
  • If the ObjectClass is AUXILIARY, then it can't inherit from a STRUCTURAL ObjectClass
  • If the ObjectClass is STRUCTURAL, then it can't inherit from a AUXILIARY ObjectClass

Modifying an ObjectClass

We won't create a new object, but will update the existing one. The OID can't be changed

We will also have to check that the modified AT is still valid

Deleting an ObjectClass

We can't delete an Objectlass if it's refered by another ObjectClass.
This is checked by verifying inthe usedBy table :

...

update the Registries.using map : remove the relation <ObjectClass.oid, set<SchemaObject>>

Syntax

Here are the fields stored in a Syntax instance :

Name

default

description

N/A

extensions

N/A

isEnabled

TRUE

isObsolete

FALSE

isReadOnly

FALSE

names

No names

objectType

ATTRIBUTE_TYPE

oid

AT OID

schemaName

N/A

isHumanReadable

FALSE

syntaxChecker

SC reference

Adding a Syntax

Register the Syntax into the SyntaxRegistry :
update the SyntaxRegistry.byOid : add <oid, Syntax>
update the SyntaxRegistry.byName : add <oid, Syntax>
associate the Syntax with the schema : <schema, set<SchemaObject>> += Syntax
update the Registries.globalOidRegistry : add <oid, Syntax>

...

update the Syntax.syntaxChecker : SyntaxCheckerRegistry.lookup( oid )
update the Registries.using map : <Syntax.oid, set<SchemaObject>> += SyntaxChecker
update the Registries.usedBy map : <SyntaxChecker.oid, set<SchemaObject>> += Syntax

Modifying a Syntax

We won't create a new object, but will update the existing one. The OID can't be changed

If we have changed the SyntaxChecker, when all the schema modifications will be done, do the
additional updates :
update the Syntax.syntaxChecker : SyntaxCheckerRegistry.lookup( oid )
update the Registries.using map : <Syntax.oid, set<SchemaObject>> -= old SyntaxChecker
update the Registries.using map : <Syntax.oid, set<SchemaObject>> += new SyntaxChecker
update the Registries.usedBy map : <old SyntaxChecker.oid, set<SchemaObject>> -= Syntax
update the Registries.usedBy map : <new SyntaxChecker.oid, set<SchemaObject>> += Syntax

Deleting a Syntax

We can't delete a Syntax which is used by either a MatchingRule or an AttributeType. This is checked by verifying in
the usedBy table :

...

update the Registries.using map : remove the relation <Syntax.oid, set<SchemaObject>>
update the Registries.usedBy map : <SyntaxChecker.oid, set<SchemaObject>> -= Syntax

SyntaxChecker (specific)

Here are the fields stored in a SyntaxChecker instance :

Name

default

description

N/A

extensions

N/A

isEnabled

TRUE

isObsolete

FALSE

isReadOnly

FALSE

names

No names

objectType

SYNTAX_CHECKER

oid

SYNTAX OID

schemaName

N/A

specification

not modifiable

bytecode

not modifiable

fqcn

not modifiable

Adding a SyntaxChecker

Register the SyntaxChecker into the SyntaxCheckerRegistry :
update the SyntaxCheckerRegistry.byOid : add <oid, SyntaxChecker>
update the SyntaxCheckerRegistry.byName : add <oid, SyntaxChecker>
associate the SyntaxChecker with the schema : <schema, set<SchemaObject>> += SyntaxChecker

Modifying a SyntaxChecker

Nothing to do but update the SyntaxChecker in place (replacing all the fields of the original SyntaxChecker).

Note that all the fields are not modifiables.

Deleting a SyntaxChecker

We can't delete a SyntaxChecker if it is used by a Syntax. This is checked by verifying in
the usedBy table :

...

This is a more complex operation, as we may have some Syntax pointing on this object.
We have to :
remove the oid from the SyntaxCheckerRegistry.byOid
remove the oid from the SyntaxCheckerRegistry.byName
remove the SyntaxChecker from the bySchemaNameSchemaObject map : <schema, set<SchemaObject>> -= SyntaxChecker

SyntaxCheckers list

  We can see that we may have many syntax checkers. The list are given in RFC 2252, RFC 4517 and RFC 4523:

...