public class Registries extends java.lang.Object implements SchemaLoaderListener, java.lang.Cloneable
| Modifier and Type | Field and Description |
|---|---|
protected DefaultAttributeTypeRegistry |
attributeTypeRegistry
The AttributeType registry
|
protected DefaultComparatorRegistry |
comparatorRegistry
The LdapSyntax registry
|
private boolean |
disabledAccepted
A flag indicating that disabled SchemaObject are accepted
|
protected DefaultDitContentRuleRegistry |
ditContentRuleRegistry
The DitContentRule registry
|
protected DefaultDitStructureRuleRegistry |
ditStructureRuleRegistry
The DitStructureRule registry
|
protected OidRegistry<SchemaObject> |
globalOidRegistry
The global OID registry
|
private boolean |
isRelaxed
A flag indicating that the Registries is relaxed or not
|
protected DefaultLdapSyntaxRegistry |
ldapSyntaxRegistry
The LdapSyntax registry
|
protected java.util.Map<java.lang.String,Schema> |
loadedSchemas
A String name to Schema object map for the schemas loaded into this
registry.
|
private static org.slf4j.Logger |
LOG
A logger for this class
|
protected DefaultMatchingRuleRegistry |
matchingRuleRegistry
The MatchingRule registry
|
protected DefaultMatchingRuleUseRegistry |
matchingRuleUseRegistry
The MatchingRuleUse registry
|
protected DefaultNameFormRegistry |
nameFormRegistry
The NameForm registry
|
protected DefaultNormalizerRegistry |
normalizerRegistry
The Normalizer registry
|
protected DefaultObjectClassRegistry |
objectClassRegistry
The ObjectClass registry
|
static boolean |
RELAXED |
private java.util.Map<java.lang.String,java.util.Set<SchemaObjectWrapper>> |
schemaObjects
A map storing all the schema objects associated with a schema
|
static boolean |
STRICT
Two flags for RELAXED and STRUCT
|
protected DefaultSyntaxCheckerRegistry |
syntaxCheckerRegistry
The SyntaxChecker registry
|
protected java.util.Map<SchemaObjectWrapper,java.util.Set<SchemaObjectWrapper>> |
usedBy
A map storing a relation between a SchemaObject and all the
referencing SchemaObjects.
|
protected java.util.Map<SchemaObjectWrapper,java.util.Set<SchemaObjectWrapper>> |
using
A map storing a relation between a SchemaObject and all the
SchemaObjects it uses.
|
| Constructor and Description |
|---|
Registries()
Creates a new instance of Registries.
|
| Modifier and Type | Method and Description |
|---|---|
java.util.List<java.lang.Throwable> |
add(java.util.List<java.lang.Throwable> errors,
SchemaObject schemaObject,
boolean check)
Applies the added SchemaObject to the given register
|
void |
addReference(SchemaObject base,
SchemaObject referenced)
Add an association between a SchemaObject an the SchemaObject it refers
|
java.util.Set<SchemaObjectWrapper> |
addSchema(java.lang.String schemaName)
Create a new schema association with its content
|
private void |
addUsedBy(SchemaObject referee,
SchemaObject reference)
Add an association between a SchemaObject an the SchemaObject that refers it
|
private void |
addUsing(SchemaObject reference,
SchemaObject referee)
Add an association between a SchemaObject an the SchemaObject it refers
|
void |
associateWithSchema(java.util.List<java.lang.Throwable> errors,
SchemaObject schemaObject)
Store the given SchemaObject in the Map associating SchemaObjetcs to their
related Schema.
|
private void |
buildAttributeTypeReferences(java.util.List<java.lang.Throwable> errors)
Build the AttributeType references.
|
private void |
buildComparatorReferences(java.util.List<java.lang.Throwable> errors)
Build the Comparator references
|
private void |
buildDitContentRuleReferences(java.util.List<java.lang.Throwable> errors)
Build the DitContentRule references
|
private void |
buildDitStructureRuleReferences(java.util.List<java.lang.Throwable> errors)
Build the DitStructureRule references
|
private void |
buildLdapSyntaxReferences(java.util.List<java.lang.Throwable> errors)
Build the Syntax references
|
private void |
buildMatchingRuleReferences(java.util.List<java.lang.Throwable> errors)
Build the MatchingRule references
|
private void |
buildMatchingRuleUseReferences(java.util.List<java.lang.Throwable> errors)
Build the MatchingRuleUse references
|
private void |
buildNameFormReferences(java.util.List<java.lang.Throwable> errors)
Build the NameForm references
|
private void |
buildNormalizerReferences(java.util.List<java.lang.Throwable> errors)
Build the Normalizer references
|
private void |
buildObjectClassReferences(java.util.List<java.lang.Throwable> errors)
Build the ObjectClasses references
|
void |
buildReference(java.util.List<java.lang.Throwable> errors,
SchemaObject schemaObject)
Build the SchemaObject references
|
java.util.List<java.lang.Throwable> |
buildReferences()
Build the usedBy and using references from the stored elements.
|
private void |
buildSyntaxCheckerReferences(java.util.List<java.lang.Throwable> errors)
Build the SyntaxChecker references
|
boolean |
check()
Check the registries for invalid relations.
|
private boolean |
checkReferences(SchemaObject reference,
SchemaObject referee,
java.lang.String message) |
java.util.List<java.lang.Throwable> |
checkRefInteg()
Attempts to resolve the dependent schema objects of all entities that
refer to other objects within the registries.
|
void |
clear()
Clear the registries from all its elements
|
Registries |
clone()
Clone the Registries.
|
boolean |
contains(SchemaObject schemaObject)
Tells if the given SchemaObject is present in one schema.
|
void |
delCrossReferences(AttributeType attributeType)
Add the SchemaObjectReferences.
|
void |
delCrossReferences(MatchingRule matchingRule)
Delete the MR references (using and usedBy) :
MR -> C
MR -> N
MR -> S
|
java.util.List<java.lang.Throwable> |
delete(java.util.List<java.lang.Throwable> errors,
SchemaObject schemaObject)
Remove the given SchemaObject from the registries
|
void |
delReference(SchemaObject base,
SchemaObject referenced)
Delete an association between a SchemaObject an the SchemaObject it refers
|
private void |
delUsedBy(SchemaObject referee,
SchemaObject reference)
Del an association between a SchemaObject an the SchemaObject that refers it
|
private void |
delUsing(SchemaObject reference,
SchemaObject referee)
Del an association between a SchemaObject an the SchemaObject it refers
|
void |
dissociateFromSchema(java.util.List<java.lang.Throwable> errors,
SchemaObject schemaObject)
Store the given SchemaObject in the Map associating SchemaObjetcs to their
related Schema.
|
void |
dissociateFromSchema(SchemaObject schemaObject)
Remove the given SchemaObject from the Map associating SchemaObjetcs to their
related Schema.
|
private java.lang.String |
dump(java.lang.String op,
SchemaObject reference,
SchemaObject referee)
Dump the reference operation as a String
|
java.lang.String |
dumpUsedBy()
Dump the UsedBy data structure as a String
|
java.lang.String |
dumpUsing()
Dump the Using data structure as a String
|
AttributeTypeRegistry |
getAttributeTypeRegistry() |
ComparatorRegistry |
getComparatorRegistry() |
DitContentRuleRegistry |
getDitContentRuleRegistry() |
DitStructureRuleRegistry |
getDitStructureRuleRegistry() |
OidRegistry<SchemaObject> |
getGlobalOidRegistry() |
LdapSyntaxRegistry |
getLdapSyntaxRegistry() |
Schema |
getLoadedSchema(java.lang.String schemaName)
Gets a schema that has been loaded into these Registries.
|
java.util.Map<java.lang.String,Schema> |
getLoadedSchemas()
Gets an unmodifiable Map of schema names to loaded Schema objects.
|
MatchingRuleRegistry |
getMatchingRuleRegistry() |
MatchingRuleUseRegistry |
getMatchingRuleUseRegistry() |
private java.util.List<AttributeType> |
getMustRecursive(java.util.List<AttributeType> musts,
java.util.Set<ObjectClass> processed,
ObjectClass objectClass) |
NameFormRegistry |
getNameFormRegistry() |
NormalizerRegistry |
getNormalizerRegistry() |
java.util.Map<java.lang.String,java.util.Set<SchemaObjectWrapper>> |
getObjectBySchemaName() |
ObjectClassRegistry |
getObjectClassRegistry() |
java.lang.String |
getOid(java.lang.String name)
Get an OID from a name.
|
java.util.Set<SchemaObjectWrapper> |
getReferencing(SchemaObject schemaObject)
Check that we can remove a given SchemaObject without breaking some of its references.
|
private java.lang.String |
getSchemaName(SchemaObject schemaObject)
Retrieve the schema name for a specific SchemaObject, or return "other" if none is found.
|
SyntaxCheckerRegistry |
getSyntaxCheckerRegistry() |
java.util.Set<SchemaObjectWrapper> |
getUsedBy(SchemaObject schemaObject)
Gets the Set of SchemaObjects referencing the given SchemaObject
|
java.util.Set<SchemaObjectWrapper> |
getUsing(SchemaObject schemaObject)
Gets the Set of SchemaObjects referenced by the given SchemaObject
|
boolean |
isDisabledAccepted()
Tells if the Registries accept disabled elements.
|
boolean |
isReferenced(SchemaObject schemaObject)
Checks if a specific SchemaObject is referenced by any other SchemaObject.
|
boolean |
isRelaxed()
Tells if the Registries is permissive or if it must be checked
against inconsistencies.
|
boolean |
isSchemaLoaded(java.lang.String schemaName)
Checks to see if a particular Schema is loaded.
|
boolean |
isStrict()
Tells if the Registries is strict.
|
private void |
register(java.util.List<java.lang.Throwable> errors,
SchemaObject schemaObject)
Register the given SchemaObject into the associated Registry
|
void |
removeReference(java.util.List<java.lang.Throwable> errors,
SchemaObject schemaObject)
Unlink the SchemaObject references
|
private void |
resolve(AttributeType attributeType,
java.util.List<java.lang.Throwable> errors)
Check the inheritance, and the existence of MatchingRules and LdapSyntax
for an attribute
|
private void |
resolve(LdapComparator<?> comparator,
java.util.List<java.lang.Throwable> errors)
Attempts to resolve the LdapComparator
|
private void |
resolve(LdapSyntax syntax,
java.util.List<java.lang.Throwable> errors)
Attempts to resolve the SyntaxChecker associated with a Syntax.
|
private void |
resolve(MatchingRule matchingRule,
java.util.List<java.lang.Throwable> errors)
Check if the Comparator, Normalizer and the syntax are
existing for a matchingRule.
|
private void |
resolve(Normalizer normalizer,
java.util.List<java.lang.Throwable> errors)
Attempts to resolve the Normalizer
|
private void |
resolve(ObjectClass objectClass,
java.util.List<java.lang.Throwable> errors) |
private void |
resolve(SyntaxChecker syntaxChecker,
java.util.List<java.lang.Throwable> errors)
Attempts to resolve the SyntaxChecker
|
private void |
resolveRecursive(AttributeType attributeType,
java.util.Set<java.lang.String> processed,
java.util.List<java.lang.Throwable> errors)
Check AttributeType referential integrity
|
private void |
resolveRecursive(ObjectClass objectClass,
java.util.Set<java.lang.String> processed,
java.util.List<java.lang.Throwable> errors) |
void |
schemaLoaded(Schema schema)
Merely adds the schema to the set of loaded schemas.
|
void |
schemaUnloaded(Schema schema)
Merely removes the schema from the set of loaded schemas.
|
void |
setDisabledAccepted(boolean disabledAccepted)
Change the Registries behavior regarding disabled SchemaObject element.
|
void |
setRelaxed()
Change the Registries to a relaxed mode, where invalid SchemaObjects
can be registered.
|
void |
setStrict()
Change the Registries to a strict mode, where invalid SchemaObjects
cannot be registered.
|
java.lang.String |
toString() |
private SchemaObject |
unregister(java.util.List<java.lang.Throwable> errors,
SchemaObject schemaObject)
Unregister a SchemaObject from the registries
|
private static final org.slf4j.Logger LOG
protected java.util.Map<java.lang.String,Schema> loadedSchemas
protected DefaultAttributeTypeRegistry attributeTypeRegistry
protected DefaultObjectClassRegistry objectClassRegistry
protected DefaultComparatorRegistry comparatorRegistry
protected DefaultDitContentRuleRegistry ditContentRuleRegistry
protected DefaultDitStructureRuleRegistry ditStructureRuleRegistry
protected DefaultMatchingRuleRegistry matchingRuleRegistry
protected DefaultMatchingRuleUseRegistry matchingRuleUseRegistry
protected DefaultNameFormRegistry nameFormRegistry
protected DefaultNormalizerRegistry normalizerRegistry
protected OidRegistry<SchemaObject> globalOidRegistry
protected DefaultSyntaxCheckerRegistry syntaxCheckerRegistry
protected DefaultLdapSyntaxRegistry ldapSyntaxRegistry
private java.util.Map<java.lang.String,java.util.Set<SchemaObjectWrapper>> schemaObjects
private boolean isRelaxed
private boolean disabledAccepted
public static final boolean STRICT
public static final boolean RELAXED
protected java.util.Map<SchemaObjectWrapper,java.util.Set<SchemaObjectWrapper>> usedBy
protected java.util.Map<SchemaObjectWrapper,java.util.Set<SchemaObjectWrapper>> using
public AttributeTypeRegistry getAttributeTypeRegistry()
public ComparatorRegistry getComparatorRegistry()
public DitContentRuleRegistry getDitContentRuleRegistry()
public DitStructureRuleRegistry getDitStructureRuleRegistry()
public MatchingRuleRegistry getMatchingRuleRegistry()
public MatchingRuleUseRegistry getMatchingRuleUseRegistry()
public NameFormRegistry getNameFormRegistry()
public NormalizerRegistry getNormalizerRegistry()
public ObjectClassRegistry getObjectClassRegistry()
public OidRegistry<SchemaObject> getGlobalOidRegistry()
public SyntaxCheckerRegistry getSyntaxCheckerRegistry()
public LdapSyntaxRegistry getLdapSyntaxRegistry()
public java.lang.String getOid(java.lang.String name)
name - The name we are looking atpublic Schema getLoadedSchema(java.lang.String schemaName)
schemaName - the name of the schema to lookuppublic boolean isSchemaLoaded(java.lang.String schemaName)
schemaName - the name of the Schema to checkpublic java.util.List<java.lang.Throwable> checkRefInteg()
public void delCrossReferences(AttributeType attributeType)
private void buildAttributeTypeReferences(java.util.List<java.lang.Throwable> errors)
private void buildComparatorReferences(java.util.List<java.lang.Throwable> errors)
private void buildDitContentRuleReferences(java.util.List<java.lang.Throwable> errors)
private void buildDitStructureRuleReferences(java.util.List<java.lang.Throwable> errors)
public void delCrossReferences(MatchingRule matchingRule)
public void buildReference(java.util.List<java.lang.Throwable> errors,
SchemaObject schemaObject)
public void removeReference(java.util.List<java.lang.Throwable> errors,
SchemaObject schemaObject)
private void buildMatchingRuleReferences(java.util.List<java.lang.Throwable> errors)
private void buildMatchingRuleUseReferences(java.util.List<java.lang.Throwable> errors)
private void buildNameFormReferences(java.util.List<java.lang.Throwable> errors)
private void buildNormalizerReferences(java.util.List<java.lang.Throwable> errors)
private void buildObjectClassReferences(java.util.List<java.lang.Throwable> errors)
private void buildLdapSyntaxReferences(java.util.List<java.lang.Throwable> errors)
private void buildSyntaxCheckerReferences(java.util.List<java.lang.Throwable> errors)
public java.util.List<java.lang.Throwable> buildReferences()
private void resolve(LdapSyntax syntax, java.util.List<java.lang.Throwable> errors)
syntax - the LdapSyntax to resolve the SyntaxChecker oferrors - the list of errors to add exceptions toprivate void resolve(Normalizer normalizer, java.util.List<java.lang.Throwable> errors)
normalizer - the Normalizererrors - the list of errors to add exceptions toprivate void resolve(LdapComparator<?> comparator, java.util.List<java.lang.Throwable> errors)
comparator - the LdapComparatorerrors - the list of errors to add exceptions toprivate void resolve(SyntaxChecker syntaxChecker, java.util.List<java.lang.Throwable> errors)
normalizer - the SyntaxCheckererrors - the list of errors to add exceptions toprivate void resolve(MatchingRule matchingRule, java.util.List<java.lang.Throwable> errors)
private void resolveRecursive(AttributeType attributeType, java.util.Set<java.lang.String> processed, java.util.List<java.lang.Throwable> errors)
private void resolve(AttributeType attributeType, java.util.List<java.lang.Throwable> errors)
private java.util.List<AttributeType> getMustRecursive(java.util.List<AttributeType> musts, java.util.Set<ObjectClass> processed, ObjectClass objectClass)
private void resolve(ObjectClass objectClass, java.util.List<java.lang.Throwable> errors)
private void resolveRecursive(ObjectClass objectClass, java.util.Set<java.lang.String> processed, java.util.List<java.lang.Throwable> errors)
public java.util.List<java.lang.Throwable> add(java.util.List<java.lang.Throwable> errors,
SchemaObject schemaObject,
boolean check)
throws LdapException
LdapExceptionpublic java.util.List<java.lang.Throwable> delete(java.util.List<java.lang.Throwable> errors,
SchemaObject schemaObject)
throws LdapException
LdapExceptionpublic void schemaLoaded(Schema schema)
schemaLoaded in interface SchemaLoaderListenerschema - the Schema that was loadedpublic void schemaUnloaded(Schema schema)
schemaUnloaded in interface SchemaLoaderListenerschema - the Schema that was unloadedpublic java.util.Map<java.lang.String,Schema> getLoadedSchemas()
public java.util.Map<java.lang.String,java.util.Set<SchemaObjectWrapper>> getObjectBySchemaName()
private java.lang.String getSchemaName(SchemaObject schemaObject)
public boolean contains(SchemaObject schemaObject)
schemaObject - The schemaObject we are looking forpublic java.util.Set<SchemaObjectWrapper> addSchema(java.lang.String schemaName)
schemaName - The schema nameprivate void register(java.util.List<java.lang.Throwable> errors,
SchemaObject schemaObject)
throws LdapException
LdapExceptionpublic void associateWithSchema(java.util.List<java.lang.Throwable> errors,
SchemaObject schemaObject)
schemaObject - The schemaObject to registerLdapException - If there is a problempublic void dissociateFromSchema(java.util.List<java.lang.Throwable> errors,
SchemaObject schemaObject)
throws LdapException
schemaObject - The schemaObject to registerLdapException - If there is a problemprivate SchemaObject unregister(java.util.List<java.lang.Throwable> errors, SchemaObject schemaObject) throws LdapException
schemaObject - The SchemaObject we want to deregisterLdapException - If the removal failedpublic void dissociateFromSchema(SchemaObject schemaObject) throws LdapException
schemaObject - The schemaObject to removeLdapException - If there is a problempublic boolean isReferenced(SchemaObject schemaObject)
schemaObject - The SchemaObject we are looking forpublic java.util.Set<SchemaObjectWrapper> getUsedBy(SchemaObject schemaObject)
schemaObject - The SchemaObject we are looking forpublic java.lang.String dumpUsedBy()
public java.lang.String dumpUsing()
public java.util.Set<SchemaObjectWrapper> getUsing(SchemaObject schemaObject)
schemaObject - The SchemaObject we are looking forprivate void addUsing(SchemaObject reference, SchemaObject referee)
reference - The base SchemaObjectreferee - The SchemaObject pointing on the referencepublic void addReference(SchemaObject base, SchemaObject referenced)
base - The base SchemaObjectreferenced - The referenced SchemaObjectprivate void addUsedBy(SchemaObject referee, SchemaObject reference)
reference - The base SchemaObjectreferee - The SchemaObject pointing on the referenceprivate void delUsing(SchemaObject reference, SchemaObject referee)
reference - The base SchemaObjectreferee - The SchemaObject pointing on the referenceprivate void delUsedBy(SchemaObject referee, SchemaObject reference)
reference - The base SchemaObjectreferee - The SchemaObject pointing on the referencepublic void delReference(SchemaObject base, SchemaObject referenced)
base - The base SchemaObjectreferenced - The referenced SchemaObjectprivate java.lang.String dump(java.lang.String op,
SchemaObject reference,
SchemaObject referee)
private boolean checkReferences(SchemaObject reference, SchemaObject referee, java.lang.String message)
public boolean check()
public Registries clone() throws java.lang.CloneNotSupportedException
clone in class java.lang.Objectjava.lang.CloneNotSupportedExceptionpublic boolean isRelaxed()
public boolean isStrict()
public void setRelaxed()
public void setStrict()
public boolean isDisabledAccepted()
public java.util.Set<SchemaObjectWrapper> getReferencing(SchemaObject schemaObject)
schemaObject - The SchemaObject to removepublic void setDisabledAccepted(boolean disabledAccepted)
disabledAccepted - If false, then the Registries won't accept
disabled SchemaObject or enabled SchemaObject from disabled schemapublic void clear()
throws LdapException
LdapException - If something goes wrongpublic java.lang.String toString()
toString in class java.lang.ObjectObject.toString()