org.opends.server.types
Class Schema

java.lang.Object
  extended by org.opends.server.types.Schema

@PublicAPI(stability=UNCOMMITTED,
           mayInstantiate=false,
           mayExtend=false,
           mayInvoke=true)
public final class Schema
extends java.lang.Object

This class defines a data structure that holds information about the components of the Directory Server schema. It includes the following kinds of elements:


Constructor Summary
Schema()
          Creates a new schema structure with all elements initialized but empty.
 
Method Summary
 void addExtraAttribute(java.lang.String name, Attribute attr)
          Add a new extra Attribute for this schema.
static void compareConcatenatedSchema(java.util.LinkedHashSet<java.lang.String> oldElements, java.util.LinkedHashSet<java.lang.String> newElements, AttributeType elementType, java.util.LinkedList<Modification> mods)
          Compares the provided sets of schema element definitions and writes any differences found into the given list of modifications.
 void deregisterApproximateMatchingRule(ApproximateMatchingRule matchingRule)
          Deregisters the provided approximate matching rule definition with this schema.
 void deregisterAttributeType(AttributeType attributeType)
          Deregisters the provided attribute type definition with this schema.
 void deregisterDITContentRule(DITContentRule ditContentRule)
          Deregisters the provided DIT content rule definition with this schema.
 void deregisterDITStructureRule(DITStructureRule ditStructureRule)
          Deregisters the provided DIT structure rule definition with this schema.
 void deregisterEqualityMatchingRule(EqualityMatchingRule matchingRule)
          Deregisters the provided equality matching rule definition with this schema.
 void deregisterMatchingRule(MatchingRule matchingRule)
          Deregisters the provided matching rule definition with this schema.
 void deregisterMatchingRuleUse(MatchingRuleUse matchingRuleUse)
          Deregisters the provided matching rule use definition with this schema.
 void deregisterNameForm(NameForm nameForm)
          Deregisters the provided name form definition with this schema.
 void deregisterObjectClass(ObjectClass objectClass)
          Deregisters the provided objectclass definition with this schema.
 void deregisterOrderingMatchingRule(OrderingMatchingRule matchingRule)
          Deregisters the provided ordering matching rule definition with this schema.
 void deregisterSubstringMatchingRule(SubstringMatchingRule matchingRule)
          Deregisters the provided substring matching rule definition with this schema.
 void deregisterSyntax(AttributeSyntax syntax)
          Deregisters the provided attribute syntax definition with this schema.
 void destroy()
          Destroys the structures maintained by the schema so that they are no longer usable.
 Schema duplicate()
          Creates a new Schema object that is a duplicate of this one.
static void genConcatenatedSchema(java.util.LinkedHashSet<java.lang.String> attributeTypes, java.util.LinkedHashSet<java.lang.String> objectClasses, java.util.LinkedHashSet<java.lang.String> nameForms, java.util.LinkedHashSet<java.lang.String> ditContentRules, java.util.LinkedHashSet<java.lang.String> ditStructureRules, java.util.LinkedHashSet<java.lang.String> matchingRuleUses)
          Reads the files contained in the schema directory and generates a concatenated view of their contents in the provided sets.
 ApproximateMatchingRule getApproximateMatchingRule(java.lang.String lowerName)
          Retrieves the approximate matching rule definition with the specified name or OID.
 java.util.concurrent.ConcurrentHashMap<java.lang.String,ApproximateMatchingRule> getApproximateMatchingRules()
          Retrieves the approximate matching rule definitions for this schema, as a mapping between the lowercase names and OIDs for the matching rule and the matching rule itself.
 AttributeType getAttributeType(java.lang.String lowerName)
          Retrieves the attribute type definition with the specified name or OID.
 java.util.concurrent.ConcurrentHashMap<java.lang.String,AttributeType> getAttributeTypes()
          Retrieves the attribute type definitions for this schema, as a mapping between the lowercase names and OIDs for the attribute type and the attribute type itself.
 java.util.LinkedHashSet<AttributeValue> getAttributeTypeSet()
          Retrieves the set of defined attribute types for this schema.
 DITContentRule getDITContentRule(ObjectClass objectClass)
          Retrieves the DIT content rule definition for the specified objectclass.
 java.util.concurrent.ConcurrentHashMap<ObjectClass,DITContentRule> getDITContentRules()
          Retrieves the DIT content rule definitions for this schema, as a mapping between the objectclass for the rule and the DIT content rule itself.
 java.util.LinkedHashSet<AttributeValue> getDITContentRuleSet()
          Retrieves the set of defined DIT content rules for this schema.
 DITStructureRule getDITStructureRule(int ruleID)
          Retrieves the DIT structure rule definition with the provided rule ID.
 DITStructureRule getDITStructureRule(NameForm nameForm)
          Retrieves the DIT structure rule definition for the provided name form.
 java.util.concurrent.ConcurrentHashMap<java.lang.Integer,DITStructureRule> getDITStructureRulesByID()
          Retrieves the DIT structure rule definitions for this schema, as a mapping between the rule ID for the rule and the DIT structure rule itself.
 java.util.concurrent.ConcurrentHashMap<NameForm,DITStructureRule> getDITStructureRulesByNameForm()
          Retrieves the DIT structure rule definitions for this schema, as a mapping between the name form for the rule and the DIT structure rule itself.
 java.util.LinkedHashSet<AttributeValue> getDITStructureRuleSet()
          Retrieves the set of defined DIT structure rules for this schema.
 EqualityMatchingRule getEqualityMatchingRule(java.lang.String lowerName)
          Retrieves the equality matching rule definition with the specified name or OID.
 java.util.concurrent.ConcurrentHashMap<java.lang.String,EqualityMatchingRule> getEqualityMatchingRules()
          Retrieves the equality matching rule definitions for this schema, as a mapping between the lowercase names and OIDs for the matching rule and the matching rule itself.
 java.util.Map<java.lang.String,Attribute> getExtraAttributes()
          Get the extraAttributes stored in this schema.
 MatchingRule getMatchingRule(java.lang.String lowerName)
          Retrieves the matching rule definition with the specified name or OID.
 java.util.concurrent.ConcurrentHashMap<java.lang.String,MatchingRule> getMatchingRules()
          Retrieves the entire set of matching rule definitions for this schema, as a mapping between the lowercase names and OIDs for the matching rule and the matching rule itself.
 java.util.LinkedHashSet<AttributeValue> getMatchingRuleSet()
          Retrieves the set of defined matching rules for this schema.
 MatchingRuleUse getMatchingRuleUse(MatchingRule matchingRule)
          Retrieves the matching rule use definition for the specified matching rule.
 java.util.concurrent.ConcurrentHashMap<MatchingRule,MatchingRuleUse> getMatchingRuleUses()
          Retrieves the matching rule use definitions for this schema, as a mapping between the matching rule for the matching rule use definition and the matching rule use itself.
 java.util.LinkedHashSet<AttributeValue> getMatchingRuleUseSet()
          Retrieves the set of defined matching rule uses for this schema.
 NameForm getNameForm(ObjectClass objectClass)
          Retrieves the name form definition for the specified objectclass.
 NameForm getNameForm(java.lang.String lowerName)
          Retrieves the name form definition with the provided name or OID.
 java.util.concurrent.ConcurrentHashMap<java.lang.String,NameForm> getNameFormsByNameOrOID()
          Retrieves the name form definitions for this schema, as a mapping between the names/OID for the name form and the name form itself.
 java.util.concurrent.ConcurrentHashMap<ObjectClass,NameForm> getNameFormsByObjectClass()
          Retrieves the name form definitions for this schema, as a mapping between the objectclass for the name form and the name form itself.
 java.util.LinkedHashSet<AttributeValue> getNameFormSet()
          Retrieves the set of defined name forms for this schema.
 ObjectClass getObjectClass(java.lang.String lowerName)
          Retrieves the objectclass definition with the specified name or OID.
 java.util.concurrent.ConcurrentHashMap<java.lang.String,ObjectClass> getObjectClasses()
          Retrieves the objectclass definitions for this schema, as a mapping between the lowercase names and OIDs for the objectclass and the objectclass itself.
 java.util.LinkedHashSet<AttributeValue> getObjectClassSet()
          Retrieves the set of defined objectclasses for this schema.
 long getOldestModificationTime()
          Retrieves the modification timestamp for the file in the schema configuration directory with the oldest last modified time.
 OrderingMatchingRule getOrderingMatchingRule(java.lang.String lowerName)
          Retrieves the ordering matching rule definition with the specified name or OID.
 java.util.concurrent.ConcurrentHashMap<java.lang.String,OrderingMatchingRule> getOrderingMatchingRules()
          Retrieves the ordering matching rule definitions for this schema, as a mapping between the lowercase names and OIDs for the matching rule and the matching rule itself.
 SubstringMatchingRule getSubstringMatchingRule(java.lang.String lowerName)
          Retrieves the substring matching rule definition with the specified name or OID.
 java.util.concurrent.ConcurrentHashMap<java.lang.String,SubstringMatchingRule> getSubstringMatchingRules()
          Retrieves the substring matching rule definitions for this schema, as a mapping between the lowercase names and OIDs for the matching rule and the matching rule itself.
 java.lang.Iterable<AttributeType> getSubTypes(AttributeType attributeType)
          Retrieves the set of subtypes registered for the given attribute type.
 AttributeSyntax getSyntax(java.lang.String lowerName)
          Retrieves the attribute syntax definition with the OID.
 java.util.concurrent.ConcurrentHashMap<java.lang.String,AttributeSyntax> getSyntaxes()
          Retrieves the attribute syntax definitions for this schema, as a mapping between the OID for the syntax and the syntax itself.
 java.util.LinkedHashSet<AttributeValue> getSyntaxSet()
          Retrieves the set of defined attribute syntaxes for this schema.
 long getYoungestModificationTime()
          Retrieves the modification timestamp for the file in the schema configuration directory with the youngest last modified time.
 boolean hasAttributeType(java.lang.String lowerName)
          Indicates whether this schema definition includes an attribute type with the provided name or OID.
 boolean hasDITContentRule(ObjectClass objectClass)
          Indicates whether this schema definition includes a DIT content rule for the provided objectclass.
 boolean hasDITStructureRule(int ruleID)
          Indicates whether this schema definition includes a DIT structure rule with the provided rule ID.
 boolean hasDITStructureRule(NameForm nameForm)
          Indicates whether this schema definition includes a DIT structure rule for the provided name form.
 boolean hasMatchingRule(java.lang.String lowerName)
          Indicates whether this schema definition includes a matching rule with the provided name or OID.
 boolean hasMatchingRuleUse(MatchingRule matchingRule)
          Indicates whether this schema definition includes a matching rule use for the provided matching rule.
 boolean hasNameForm(ObjectClass objectClass)
          Indicates whether this schema definition includes a name form for the specified objectclass.
 boolean hasNameForm(java.lang.String lowerName)
          Indicates whether this schema definition includes a name form with the specified name or OID.
 boolean hasObjectClass(java.lang.String lowerName)
          Indicates whether this schema definition includes an objectclass with the provided name or OID.
 boolean hasSyntax(java.lang.String lowerName)
          Indicates whether this schema definition includes an attribute syntax with the provided name or OID.
static void readConcatenatedSchema(java.lang.String concatSchemaFile, java.util.LinkedHashSet<java.lang.String> attributeTypes, java.util.LinkedHashSet<java.lang.String> objectClasses, java.util.LinkedHashSet<java.lang.String> nameForms, java.util.LinkedHashSet<java.lang.String> ditContentRules, java.util.LinkedHashSet<java.lang.String> ditStructureRules, java.util.LinkedHashSet<java.lang.String> matchingRuleUses)
          Reads data from the specified concatenated schema file into the provided sets.
 void rebuildDependentElements(SchemaFileElement element)
          Recursively rebuilds all schema elements that are dependent upon the provided element.
 void registerApproximateMatchingRule(ApproximateMatchingRule matchingRule, boolean overwriteExisting)
          Registers the provided approximate matching rule with this schema.
 void registerAttributeType(AttributeType attributeType, boolean overwriteExisting)
          Registers the provided attribute type definition with this schema.
 void registerDITContentRule(DITContentRule ditContentRule, boolean overwriteExisting)
          Registers the provided DIT content rule definition with this schema.
 void registerDITStructureRule(DITStructureRule ditStructureRule, boolean overwriteExisting)
          Registers the provided DIT structure rule definition with this schema.
 void registerEqualityMatchingRule(EqualityMatchingRule matchingRule, boolean overwriteExisting)
          Registers the provided equality matching rule with this schema.
 void registerMatchingRule(MatchingRule matchingRule, boolean overwriteExisting)
          Registers the provided matching rule definition with this schema.
 void registerMatchingRuleUse(MatchingRuleUse matchingRuleUse, boolean overwriteExisting)
          Registers the provided matching rule use definition with this schema.
 void registerNameForm(NameForm nameForm, boolean overwriteExisting)
          Registers the provided name form definition with this schema.
 void registerObjectClass(ObjectClass objectClass, boolean overwriteExisting)
          Registers the provided objectclass definition with this schema.
 void registerOrderingMatchingRule(OrderingMatchingRule matchingRule, boolean overwriteExisting)
          Registers the provided ordering matching rule with this schema.
 void registerSubstringMatchingRule(SubstringMatchingRule matchingRule, boolean overwriteExisting)
          Registers the provided substring matching rule with this schema.
 void registerSyntax(AttributeSyntax syntax, boolean overwriteExisting)
          Registers the provided attribute syntax definition with this schema.
 void setOldestModificationTime(long oldestModificationTime)
          Sets the modification timestamp for the oldest file in the schema configuration directory.
 void setYoungestModificationTime(long youngestModificationTime)
          Sets the modification timestamp for the youngest file in the schema configuration directory.
static void writeConcatenatedSchema()
          Writes a single file containing all schema element definitions, which can be used on startup to determine whether the schema files were edited with the server offline.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Schema

public Schema()
Creates a new schema structure with all elements initialized but empty.

Method Detail

getAttributeTypes

public java.util.concurrent.ConcurrentHashMap<java.lang.String,AttributeType> getAttributeTypes()
Retrieves the attribute type definitions for this schema, as a mapping between the lowercase names and OIDs for the attribute type and the attribute type itself. Each attribute type may be associated with multiple keys (once for the OID and again for each name). The contents of the returned mapping must not be altered.

Returns:
The attribute type definitions for this schema.

getAttributeTypeSet

public java.util.LinkedHashSet<AttributeValue> getAttributeTypeSet()
Retrieves the set of defined attribute types for this schema.

Returns:
The set of defined attribute types for this schema.

hasAttributeType

public boolean hasAttributeType(java.lang.String lowerName)
Indicates whether this schema definition includes an attribute type with the provided name or OID.

Parameters:
lowerName - The name or OID for which to make the determination, formatted in all lowercase characters.
Returns:
true if this schema contains an attribute type with the provided name or OID, or false if not.

getAttributeType

public AttributeType getAttributeType(java.lang.String lowerName)
Retrieves the attribute type definition with the specified name or OID.

Parameters:
lowerName - The name or OID of the attribute type to retrieve, formatted in all lowercase characters.
Returns:
The requested attribute type, or null if no type is registered with the provided name or OID.

registerAttributeType

public void registerAttributeType(AttributeType attributeType,
                                  boolean overwriteExisting)
                           throws DirectoryException
Registers the provided attribute type definition with this schema.

Parameters:
attributeType - The attribute type to register with this schema.
overwriteExisting - Indicates whether to overwrite an existing mapping if there are any conflicts (i.e., another attribute type with the same OID or name).
Throws:
DirectoryException - If a conflict is encountered and the overwriteExisting flag is set to false

deregisterAttributeType

public void deregisterAttributeType(AttributeType attributeType)
Deregisters the provided attribute type definition with this schema.

Parameters:
attributeType - The attribute type to deregister with this schema.

getSubTypes

public java.lang.Iterable<AttributeType> getSubTypes(AttributeType attributeType)
Retrieves the set of subtypes registered for the given attribute type.

Parameters:
attributeType - The attribute type for which to retrieve the set of registered subtypes.
Returns:
The set of subtypes registered for the given attribute type, or an empty set if there are no subtypes registered for the attribute type.

getObjectClasses

public java.util.concurrent.ConcurrentHashMap<java.lang.String,ObjectClass> getObjectClasses()
Retrieves the objectclass definitions for this schema, as a mapping between the lowercase names and OIDs for the objectclass and the objectclass itself. Each objectclass may be associated with multiple keys (once for the OID and again for each name). The contents of the returned mapping must not be altered.

Returns:
The objectclass definitions for this schema.

getObjectClassSet

public java.util.LinkedHashSet<AttributeValue> getObjectClassSet()
Retrieves the set of defined objectclasses for this schema.

Returns:
The set of defined objectclasses for this schema.

hasObjectClass

public boolean hasObjectClass(java.lang.String lowerName)
Indicates whether this schema definition includes an objectclass with the provided name or OID.

Parameters:
lowerName - The name or OID for which to make the determination, formatted in all lowercase characters.
Returns:
true if this schema contains an objectclass with the provided name or OID, or false if not.

getObjectClass

public ObjectClass getObjectClass(java.lang.String lowerName)
Retrieves the objectclass definition with the specified name or OID.

Parameters:
lowerName - The name or OID of the objectclass to retrieve, formatted in all lowercase characters.
Returns:
The requested objectclass, or null if no class is registered with the provided name or OID.

registerObjectClass

public void registerObjectClass(ObjectClass objectClass,
                                boolean overwriteExisting)
                         throws DirectoryException
Registers the provided objectclass definition with this schema.

Parameters:
objectClass - The objectclass to register with this schema.
overwriteExisting - Indicates whether to overwrite an existing mapping if there are any conflicts (i.e., another objectclass with the same OID or name).
Throws:
DirectoryException - If a conflict is encountered and the overwriteExisting flag is set to false.

deregisterObjectClass

public void deregisterObjectClass(ObjectClass objectClass)
Deregisters the provided objectclass definition with this schema.

Parameters:
objectClass - The objectclass to deregister with this schema.

getSyntaxes

public java.util.concurrent.ConcurrentHashMap<java.lang.String,AttributeSyntax> getSyntaxes()
Retrieves the attribute syntax definitions for this schema, as a mapping between the OID for the syntax and the syntax itself. Each syntax should only be present once, since its only key is its OID. The contents of the returned mapping must not be altered.

Returns:
The attribute syntax definitions for this schema.

getSyntaxSet

public java.util.LinkedHashSet<AttributeValue> getSyntaxSet()
Retrieves the set of defined attribute syntaxes for this schema.

Returns:
The set of defined attribute syntaxes for this schema.

hasSyntax

public boolean hasSyntax(java.lang.String lowerName)
Indicates whether this schema definition includes an attribute syntax with the provided name or OID.

Parameters:
lowerName - The name or OID for which to make the determination, formatted in all lowercase characters.
Returns:
true if this schema contains an attribute syntax with the provided name or OID, or false if not.

getSyntax

public AttributeSyntax getSyntax(java.lang.String lowerName)
Retrieves the attribute syntax definition with the OID.

Parameters:
lowerName - The OID of the attribute syntax to retrieve, formatted in all lowercase characters.
Returns:
The requested attribute syntax, or null if no syntax is registered with the provided OID.

registerSyntax

public void registerSyntax(AttributeSyntax syntax,
                           boolean overwriteExisting)
                    throws DirectoryException
Registers the provided attribute syntax definition with this schema.

Parameters:
syntax - The attribute syntax to register with this schema.
overwriteExisting - Indicates whether to overwrite an existing mapping if there are any conflicts (i.e., another attribute syntax with the same OID).
Throws:
DirectoryException - If a conflict is encountered and the overwriteExisting flag is set to false

deregisterSyntax

public void deregisterSyntax(AttributeSyntax syntax)
Deregisters the provided attribute syntax definition with this schema.

Parameters:
syntax - The attribute syntax to deregister with this schema.

getMatchingRules

public java.util.concurrent.ConcurrentHashMap<java.lang.String,MatchingRule> getMatchingRules()
Retrieves the entire set of matching rule definitions for this schema, as a mapping between the lowercase names and OIDs for the matching rule and the matching rule itself. Each matching rule may be associated with multiple keys (once for the OID and again for each name). This should be a superset of the sets of approximate, equality, ordering, and substring matching rules. The contents of the returned mapping must not be altered.

Returns:
The matching rule definitions for this schema.

getMatchingRuleSet

public java.util.LinkedHashSet<AttributeValue> getMatchingRuleSet()
Retrieves the set of defined matching rules for this schema.

Returns:
The set of defined matching rules for this schema.

hasMatchingRule

public boolean hasMatchingRule(java.lang.String lowerName)
Indicates whether this schema definition includes a matching rule with the provided name or OID.

Parameters:
lowerName - The name or OID for which to make the determination, formatted in all lowercase characters.
Returns:
true if this schema contains a matching rule with the provided name or OID, or false if not.

getMatchingRule

public MatchingRule getMatchingRule(java.lang.String lowerName)
Retrieves the matching rule definition with the specified name or OID.

Parameters:
lowerName - The name or OID of the matching rule to retrieve, formatted in all lowercase characters.
Returns:
The requested matching rule, or null if no rule is registered with the provided name or OID.

registerMatchingRule

public void registerMatchingRule(MatchingRule matchingRule,
                                 boolean overwriteExisting)
                          throws DirectoryException
Registers the provided matching rule definition with this schema.

Parameters:
matchingRule - The matching rule to register with this schema.
overwriteExisting - Indicates whether to overwrite an existing mapping if there are any conflicts (i.e., another matching rule with the same OID or name).
Throws:
DirectoryException - If a conflict is encountered and the overwriteExisting flag is set to false

deregisterMatchingRule

public void deregisterMatchingRule(MatchingRule matchingRule)
Deregisters the provided matching rule definition with this schema.

Parameters:
matchingRule - The matching rule to deregister with this schema.

getApproximateMatchingRules

public java.util.concurrent.ConcurrentHashMap<java.lang.String,ApproximateMatchingRule> getApproximateMatchingRules()
Retrieves the approximate matching rule definitions for this schema, as a mapping between the lowercase names and OIDs for the matching rule and the matching rule itself. Each matching rule may be associated with multiple keys (once for the OID and again for each name). The contents of the returned mapping must not be altered.

Returns:
The approximate matching rule definitions for this schema.

getApproximateMatchingRule

public ApproximateMatchingRule getApproximateMatchingRule(java.lang.String lowerName)
Retrieves the approximate matching rule definition with the specified name or OID.

Parameters:
lowerName - The name or OID of the matching rule to retrieve, formatted in all lowercase characters.
Returns:
The requested matching rule, or null if no approximate matching rule is registered with the provided name or OID.

registerApproximateMatchingRule

public void registerApproximateMatchingRule(ApproximateMatchingRule matchingRule,
                                            boolean overwriteExisting)
                                     throws DirectoryException
Registers the provided approximate matching rule with this schema.

Parameters:
matchingRule - The approximate matching rule to register.
overwriteExisting - Indicates whether to overwrite an existing mapping if there are any conflicts (i.e., another matching rule with the same OID or name).
Throws:
DirectoryException - If a conflict is encountered and the overwriteExisting flag is set to false

deregisterApproximateMatchingRule

public void deregisterApproximateMatchingRule(ApproximateMatchingRule matchingRule)
Deregisters the provided approximate matching rule definition with this schema.

Parameters:
matchingRule - The approximate matching rule to deregister with this schema.

getEqualityMatchingRules

public java.util.concurrent.ConcurrentHashMap<java.lang.String,EqualityMatchingRule> getEqualityMatchingRules()
Retrieves the equality matching rule definitions for this schema, as a mapping between the lowercase names and OIDs for the matching rule and the matching rule itself. Each matching rule may be associated with multiple keys (once for the OID and again for each name). The contents of the returned mapping must not be altered.

Returns:
The equality matching rule definitions for this schema.

getEqualityMatchingRule

public EqualityMatchingRule getEqualityMatchingRule(java.lang.String lowerName)
Retrieves the equality matching rule definition with the specified name or OID.

Parameters:
lowerName - The name or OID of the matching rule to retrieve, formatted in all lowercase characters.
Returns:
The requested matching rule, or null if no equality matching rule is registered with the provided name or OID.

registerEqualityMatchingRule

public void registerEqualityMatchingRule(EqualityMatchingRule matchingRule,
                                         boolean overwriteExisting)
                                  throws DirectoryException
Registers the provided equality matching rule with this schema.

Parameters:
matchingRule - The equality matching rule to register.
overwriteExisting - Indicates whether to overwrite an existing mapping if there are any conflicts (i.e., another matching rule with the same OID or name).
Throws:
DirectoryException - If a conflict is encountered and the overwriteExisting flag is set to false

deregisterEqualityMatchingRule

public void deregisterEqualityMatchingRule(EqualityMatchingRule matchingRule)
Deregisters the provided equality matching rule definition with this schema.

Parameters:
matchingRule - The equality matching rule to deregister with this schema.

getOrderingMatchingRules

public java.util.concurrent.ConcurrentHashMap<java.lang.String,OrderingMatchingRule> getOrderingMatchingRules()
Retrieves the ordering matching rule definitions for this schema, as a mapping between the lowercase names and OIDs for the matching rule and the matching rule itself. Each matching rule may be associated with multiple keys (once for the OID and again for each name). The contents of the returned mapping must not be altered.

Returns:
The ordering matching rule definitions for this schema.

getOrderingMatchingRule

public OrderingMatchingRule getOrderingMatchingRule(java.lang.String lowerName)
Retrieves the ordering matching rule definition with the specified name or OID.

Parameters:
lowerName - The name or OID of the matching rule to retrieve, formatted in all lowercase characters.
Returns:
The requested matching rule, or null if no ordering matching rule is registered with the provided name or OID.

registerOrderingMatchingRule

public void registerOrderingMatchingRule(OrderingMatchingRule matchingRule,
                                         boolean overwriteExisting)
                                  throws DirectoryException
Registers the provided ordering matching rule with this schema.

Parameters:
matchingRule - The ordering matching rule to register.
overwriteExisting - Indicates whether to overwrite an existing mapping if there are any conflicts (i.e., another matching rule with the same OID or name).
Throws:
DirectoryException - If a conflict is encountered and the overwriteExisting flag is set to false

deregisterOrderingMatchingRule

public void deregisterOrderingMatchingRule(OrderingMatchingRule matchingRule)
Deregisters the provided ordering matching rule definition with this schema.

Parameters:
matchingRule - The ordering matching rule to deregister with this schema.

getSubstringMatchingRules

public java.util.concurrent.ConcurrentHashMap<java.lang.String,SubstringMatchingRule> getSubstringMatchingRules()
Retrieves the substring matching rule definitions for this schema, as a mapping between the lowercase names and OIDs for the matching rule and the matching rule itself. Each matching rule may be associated with multiple keys (once for the OID and again for each name). The contents of the returned mapping must not be altered.

Returns:
The substring matching rule definitions for this schema.

getSubstringMatchingRule

public SubstringMatchingRule getSubstringMatchingRule(java.lang.String lowerName)
Retrieves the substring matching rule definition with the specified name or OID.

Parameters:
lowerName - The name or OID of the matching rule to retrieve, formatted in all lowercase characters.
Returns:
The requested matching rule, or null if no substring matching rule is registered with the provided name or OID.

registerSubstringMatchingRule

public void registerSubstringMatchingRule(SubstringMatchingRule matchingRule,
                                          boolean overwriteExisting)
                                   throws DirectoryException
Registers the provided substring matching rule with this schema.

Parameters:
matchingRule - The substring matching rule to register.
overwriteExisting - Indicates whether to overwrite an existing mapping if there are any conflicts (i.e., another matching rule with the same OID or name).
Throws:
DirectoryException - If a conflict is encountered and the overwriteExisting flag is set to false

deregisterSubstringMatchingRule

public void deregisterSubstringMatchingRule(SubstringMatchingRule matchingRule)
Deregisters the provided substring matching rule definition with this schema.

Parameters:
matchingRule - The substring matching rule to deregister with this schema.

getMatchingRuleUses

public java.util.concurrent.ConcurrentHashMap<MatchingRule,MatchingRuleUse> getMatchingRuleUses()
Retrieves the matching rule use definitions for this schema, as a mapping between the matching rule for the matching rule use definition and the matching rule use itself. Each matching rule use should only be present once, since its only key is its matching rule. The contents of the returned mapping must not be altered.

Returns:
The matching rule use definitions for this schema.

getMatchingRuleUseSet

public java.util.LinkedHashSet<AttributeValue> getMatchingRuleUseSet()
Retrieves the set of defined matching rule uses for this schema.

Returns:
The set of defined matching rule uses for this schema.

hasMatchingRuleUse

public boolean hasMatchingRuleUse(MatchingRule matchingRule)
Indicates whether this schema definition includes a matching rule use for the provided matching rule.

Parameters:
matchingRule - The matching rule for which to make the determination.
Returns:
true if this schema contains a matching rule use for the provided matching rule, or false if not.

getMatchingRuleUse

public MatchingRuleUse getMatchingRuleUse(MatchingRule matchingRule)
Retrieves the matching rule use definition for the specified matching rule.

Parameters:
matchingRule - The matching rule for which to retrieve the matching rule use definition.
Returns:
The matching rule use definition, or null if none exists for the specified matching rule.

registerMatchingRuleUse

public void registerMatchingRuleUse(MatchingRuleUse matchingRuleUse,
                                    boolean overwriteExisting)
                             throws DirectoryException
Registers the provided matching rule use definition with this schema.

Parameters:
matchingRuleUse - The matching rule use definition to register.
overwriteExisting - Indicates whether to overwrite an existing mapping if there are any conflicts (i.e., another matching rule use with the same matching rule).
Throws:
DirectoryException - If a conflict is encountered and the overwriteExisting flag is set to false

deregisterMatchingRuleUse

public void deregisterMatchingRuleUse(MatchingRuleUse matchingRuleUse)
Deregisters the provided matching rule use definition with this schema.

Parameters:
matchingRuleUse - The matching rule use to deregister with this schema.

getDITContentRules

public java.util.concurrent.ConcurrentHashMap<ObjectClass,DITContentRule> getDITContentRules()
Retrieves the DIT content rule definitions for this schema, as a mapping between the objectclass for the rule and the DIT content rule itself. Each DIT content rule should only be present once, since its only key is its objectclass. The contents of the returned mapping must not be altered.

Returns:
The DIT content rule definitions for this schema.

getDITContentRuleSet

public java.util.LinkedHashSet<AttributeValue> getDITContentRuleSet()
Retrieves the set of defined DIT content rules for this schema.

Returns:
The set of defined DIT content rules for this schema.

hasDITContentRule

public boolean hasDITContentRule(ObjectClass objectClass)
Indicates whether this schema definition includes a DIT content rule for the provided objectclass.

Parameters:
objectClass - The objectclass for which to make the determination.
Returns:
true if this schema contains a DIT content rule for the provided objectclass, or false if not.

getDITContentRule

public DITContentRule getDITContentRule(ObjectClass objectClass)
Retrieves the DIT content rule definition for the specified objectclass.

Parameters:
objectClass - The objectclass for the DIT content rule to retrieve.
Returns:
The requested DIT content rule, or null if no DIT content rule is registered with the provided objectclass.

registerDITContentRule

public void registerDITContentRule(DITContentRule ditContentRule,
                                   boolean overwriteExisting)
                            throws DirectoryException
Registers the provided DIT content rule definition with this schema.

Parameters:
ditContentRule - The DIT content rule to register.
overwriteExisting - Indicates whether to overwrite an existing mapping if there are any conflicts (i.e., another DIT content rule with the same objectclass).
Throws:
DirectoryException - If a conflict is encountered and the overwriteExisting flag is set to false

deregisterDITContentRule

public void deregisterDITContentRule(DITContentRule ditContentRule)
Deregisters the provided DIT content rule definition with this schema.

Parameters:
ditContentRule - The DIT content rule to deregister with this schema.

getDITStructureRuleSet

public java.util.LinkedHashSet<AttributeValue> getDITStructureRuleSet()
Retrieves the set of defined DIT structure rules for this schema.

Returns:
The set of defined DIT structure rules for this schema.

getDITStructureRulesByID

public java.util.concurrent.ConcurrentHashMap<java.lang.Integer,DITStructureRule> getDITStructureRulesByID()
Retrieves the DIT structure rule definitions for this schema, as a mapping between the rule ID for the rule and the DIT structure rule itself. Each DIT structure rule should only be present once, since its only key is its rule ID. The contents of the returned mapping must not be altered.

Returns:
The DIT structure rule definitions for this schema.

getDITStructureRulesByNameForm

public java.util.concurrent.ConcurrentHashMap<NameForm,DITStructureRule> getDITStructureRulesByNameForm()
Retrieves the DIT structure rule definitions for this schema, as a mapping between the name form for the rule and the DIT structure rule itself. Each DIT structure rule should only be present once, since its only key is its name form. The contents of the returned mapping must not be altered.

Returns:
The DIT structure rule definitions for this schema.

hasDITStructureRule

public boolean hasDITStructureRule(int ruleID)
Indicates whether this schema definition includes a DIT structure rule with the provided rule ID.

Parameters:
ruleID - The rule ID for which to make the determination.
Returns:
true if this schema contains a DIT structure rule with the provided rule ID, or false if not.

hasDITStructureRule

public boolean hasDITStructureRule(NameForm nameForm)
Indicates whether this schema definition includes a DIT structure rule for the provided name form.

Parameters:
nameForm - The name form for which to make the determination.
Returns:
true if this schema contains a DIT structure rule for the provided name form, or false if not.

getDITStructureRule

public DITStructureRule getDITStructureRule(int ruleID)
Retrieves the DIT structure rule definition with the provided rule ID.

Parameters:
ruleID - The rule ID for the DIT structure rule to retrieve.
Returns:
The requested DIT structure rule, or null if no DIT structure rule is registered with the provided rule ID.

getDITStructureRule

public DITStructureRule getDITStructureRule(NameForm nameForm)
Retrieves the DIT structure rule definition for the provided name form.

Parameters:
nameForm - The name form for the DIT structure rule to retrieve.
Returns:
The requested DIT structure rule, or null if no DIT structure rule is registered with the provided name form.

registerDITStructureRule

public void registerDITStructureRule(DITStructureRule ditStructureRule,
                                     boolean overwriteExisting)
                              throws DirectoryException
Registers the provided DIT structure rule definition with this schema.

Parameters:
ditStructureRule - The DIT structure rule to register.
overwriteExisting - Indicates whether to overwrite an existing mapping if there are any conflicts (i.e., another DIT structure rule with the same name form).
Throws:
DirectoryException - If a conflict is encountered and the overwriteExisting flag is set to false

deregisterDITStructureRule

public void deregisterDITStructureRule(DITStructureRule ditStructureRule)
Deregisters the provided DIT structure rule definition with this schema.

Parameters:
ditStructureRule - The DIT structure rule to deregister with this schema.

getNameFormSet

public java.util.LinkedHashSet<AttributeValue> getNameFormSet()
Retrieves the set of defined name forms for this schema.

Returns:
The set of defined name forms for this schema.

getNameFormsByObjectClass

public java.util.concurrent.ConcurrentHashMap<ObjectClass,NameForm> getNameFormsByObjectClass()
Retrieves the name form definitions for this schema, as a mapping between the objectclass for the name form and the name form itself. Each name form should only be present once, since its only key is its objectclass. The contents of the returned mapping must not be altered.

Returns:
The name form definitions for this schema.

getNameFormsByNameOrOID

public java.util.concurrent.ConcurrentHashMap<java.lang.String,NameForm> getNameFormsByNameOrOID()
Retrieves the name form definitions for this schema, as a mapping between the names/OID for the name form and the name form itself. Each name form may be present multiple times with different names and its OID. The contents of the returned mapping must not be altered.

Returns:
The name form definitions for this schema.

hasNameForm

public boolean hasNameForm(ObjectClass objectClass)
Indicates whether this schema definition includes a name form for the specified objectclass.

Parameters:
objectClass - The objectclass for which to make the determination.
Returns:
true if this schema contains a name form for the provided objectclass, or false if not.

hasNameForm

public boolean hasNameForm(java.lang.String lowerName)
Indicates whether this schema definition includes a name form with the specified name or OID.

Parameters:
lowerName - The name or OID for which to make the determination, formatted in all lowercase characters.
Returns:
true if this schema contains a name form with the provided name or OID, or false if not.

getNameForm

public NameForm getNameForm(ObjectClass objectClass)
Retrieves the name form definition for the specified objectclass.

Parameters:
objectClass - The objectclass for the name form to retrieve.
Returns:
The requested name form, or null if no name form is registered with the provided objectClass.

getNameForm

public NameForm getNameForm(java.lang.String lowerName)
Retrieves the name form definition with the provided name or OID.

Parameters:
lowerName - The name or OID of the name form to retrieve, formatted in all lowercase characters.
Returns:
The requested name form, or null if no name form is registered with the provided name or OID.

registerNameForm

public void registerNameForm(NameForm nameForm,
                             boolean overwriteExisting)
                      throws DirectoryException
Registers the provided name form definition with this schema.

Parameters:
nameForm - The name form definition to register.
overwriteExisting - Indicates whether to overwrite an existing mapping if there are any conflicts (i.e., another name form with the same objectclass).
Throws:
DirectoryException - If a conflict is encountered and the overwriteExisting flag is set to false

deregisterNameForm

public void deregisterNameForm(NameForm nameForm)
Deregisters the provided name form definition with this schema.

Parameters:
nameForm - The name form definition to deregister.

getOldestModificationTime

public long getOldestModificationTime()
Retrieves the modification timestamp for the file in the schema configuration directory with the oldest last modified time.

Returns:
The modification timestamp for the file in the schema configuration directory with the oldest last modified time.

setOldestModificationTime

public void setOldestModificationTime(long oldestModificationTime)
Sets the modification timestamp for the oldest file in the schema configuration directory.

Parameters:
oldestModificationTime - The modification timestamp for the oldest file in the schema configuration directory.

getYoungestModificationTime

public long getYoungestModificationTime()
Retrieves the modification timestamp for the file in the schema configuration directory with the youngest last modified time.

Returns:
The modification timestamp for the file in the schema configuration directory with the youngest last modified time.

setYoungestModificationTime

public void setYoungestModificationTime(long youngestModificationTime)
Sets the modification timestamp for the youngest file in the schema configuration directory.

Parameters:
youngestModificationTime - The modification timestamp for the youngest file in the schema configuration directory.

rebuildDependentElements

public void rebuildDependentElements(SchemaFileElement element)
                              throws DirectoryException
Recursively rebuilds all schema elements that are dependent upon the provided element. This must be invoked whenever an existing schema element is modified in order to ensure that any elements that depend on it should also be recreated to reflect the change.

The following conditions create dependencies between schema elements:

Parameters:
element - The element for which to recursively rebuild all dependent elements.
Throws:
DirectoryException - If a problem occurs while rebuilding any of the schema elements.

duplicate

public Schema duplicate()
Creates a new Schema object that is a duplicate of this one. It elements may be added and removed from the duplicate without impacting this version.

Returns:
A new Schema object that is a duplicate of this one.

getExtraAttributes

public java.util.Map<java.lang.String,Attribute> getExtraAttributes()
Get the extraAttributes stored in this schema.

Returns:
The extraAttributes stored in this schema.

addExtraAttribute

public void addExtraAttribute(java.lang.String name,
                              Attribute attr)
Add a new extra Attribute for this schema.

Parameters:
name - The identifier of the extra Attribute.
attr - The extra attribute that must be added to this Schema.

writeConcatenatedSchema

public static void writeConcatenatedSchema()
Writes a single file containing all schema element definitions, which can be used on startup to determine whether the schema files were edited with the server offline.


genConcatenatedSchema

public static void genConcatenatedSchema(java.util.LinkedHashSet<java.lang.String> attributeTypes,
                                         java.util.LinkedHashSet<java.lang.String> objectClasses,
                                         java.util.LinkedHashSet<java.lang.String> nameForms,
                                         java.util.LinkedHashSet<java.lang.String> ditContentRules,
                                         java.util.LinkedHashSet<java.lang.String> ditStructureRules,
                                         java.util.LinkedHashSet<java.lang.String> matchingRuleUses)
                                  throws java.io.IOException
Reads the files contained in the schema directory and generates a concatenated view of their contents in the provided sets.

Parameters:
attributeTypes - The set into which to place the attribute types read from the schema files.
objectClasses - The set into which to place the object classes read from the schema files.
nameForms - The set into which to place the name forms read from the schema files.
ditContentRules - The set into which to place the DIT content rules read from the schema files.
ditStructureRules - The set into which to place the DIT structure rules read from the schema files.
matchingRuleUses - The set into which to place the matching rule uses read from the schema files.
Throws:
java.io.IOException - If a problem occurs while reading the schema file elements.

readConcatenatedSchema

public static void readConcatenatedSchema(java.lang.String concatSchemaFile,
                                          java.util.LinkedHashSet<java.lang.String> attributeTypes,
                                          java.util.LinkedHashSet<java.lang.String> objectClasses,
                                          java.util.LinkedHashSet<java.lang.String> nameForms,
                                          java.util.LinkedHashSet<java.lang.String> ditContentRules,
                                          java.util.LinkedHashSet<java.lang.String> ditStructureRules,
                                          java.util.LinkedHashSet<java.lang.String> matchingRuleUses)
                                   throws java.io.IOException
Reads data from the specified concatenated schema file into the provided sets.

Parameters:
concatSchemaFile - The path to the concatenated schema file to be read.
attributeTypes - The set into which to place the attribute types read from the concatenated schema file.
objectClasses - The set into which to place the object classes read from the concatenated schema file.
nameForms - The set into which to place the name forms read from the concatenated schema file.
ditContentRules - The set into which to place the DIT content rules read from the concatenated schema file.
ditStructureRules - The set into which to place the DIT structure rules read from the concatenated schema file.
matchingRuleUses - The set into which to place the matching rule uses read from the concatenated schema file.
Throws:
java.io.IOException - If a problem occurs while reading the schema file elements.

compareConcatenatedSchema

public static void compareConcatenatedSchema(java.util.LinkedHashSet<java.lang.String> oldElements,
                                             java.util.LinkedHashSet<java.lang.String> newElements,
                                             AttributeType elementType,
                                             java.util.LinkedList<Modification> mods)
Compares the provided sets of schema element definitions and writes any differences found into the given list of modifications.

Parameters:
oldElements - The set of elements of the specified type read from the previous concatenated schema files.
newElements - The set of elements of the specified type read from the server's current schema.
elementType - The attribute type associated with the schema element being compared.
mods - The list of modifications into which any identified differences should be written.

destroy

@PublicAPI(stability=PRIVATE,
           mayInstantiate=false,
           mayExtend=false,
           mayInvoke=true)
public void destroy()
Destroys the structures maintained by the schema so that they are no longer usable. This should only be called at the end of the server shutdown process, and it can help detect inappropriate cached references.