org.opends.server.types
Class DITStructureRule

java.lang.Object
  extended by org.opends.server.types.DITStructureRule
All Implemented Interfaces:
SchemaFileElement

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

This class defines a DIT structure rule, which is used to indicate the types of children that entries may have.


Constructor Summary
DITStructureRule(java.lang.String definition, java.util.Map<java.lang.String,java.lang.String> names, int ruleID, java.lang.String description, boolean isObsolete, NameForm nameForm, java.util.Set<DITStructureRule> superiorRules, java.util.Map<java.lang.String,java.util.List<java.lang.String>> extraProperties)
          Creates a new DIT structure rule with the provided information.
 
Method Summary
 boolean equals(java.lang.Object o)
          Indicates whether the provided object is equal to this DIT structure rule.
 java.lang.String getDefinition()
          Retrieves the definition string used to create this DIT structure rule.
 java.lang.String getDescription()
          Retrieves the description for this DIT structure rule.
 java.util.Map<java.lang.String,java.util.List<java.lang.String>> getExtraProperties()
          Retrieves a mapping between the names of any extra non-standard properties that may be associated with this DIT structure rule and the value for that property.
 java.util.List<java.lang.String> getExtraProperty(java.lang.String propertyName)
          Retrieves the value of the specified "extra" property for this DIT structure rule.
 NameForm getNameForm()
          Retrieves the name form for this DIT structure rule.
 java.lang.String getNameOrRuleID()
          Retrieves the name or rule ID for this DIT structure rule.
 java.util.Map<java.lang.String,java.lang.String> getNames()
          Retrieves the set of names that may be used to reference this DIT structure rule.
 int getRuleID()
          Retrieves the rule ID for this DIT structure rule.
 java.lang.String getSchemaFile()
          Retrieves the path to the schema file that contains the definition for this DIT structure rule.
 ObjectClass getStructuralClass()
          Retrieves the structural objectclass for the name form with which this DIT structure rule is associated.
 java.util.Set<DITStructureRule> getSuperiorRules()
          Retrieves the set of superior rules for this DIT structure rule.
 int hashCode()
          Retrieves the hash code for this DIT structure rule.
 boolean hasName(java.lang.String lowerName)
          Indicates whether this DIT structure rule has the specified name.
 boolean hasSuperiorRules()
          Indicates whether this DIT structure rule has one or more superior rules.
 boolean isObsolete()
          Indicates whether this DIT structure rule is declared "obsolete".
 DITStructureRule recreateFromDefinition()
          Creates a new instance of this DIT structure rule based on the definition string.
 void setExtraProperty(java.lang.String name, java.util.List<java.lang.String> values)
          Specifies the provided "extra" property for this DIT structure rule.
 void setExtraProperty(java.lang.String name, java.lang.String value)
          Specifies the provided "extra" property for this DIT structure rule.
 void setSchemaFile(java.lang.String schemaFile)
          Specifies the path to the schema file that contains the definition for this DIT structure rule.
 java.lang.String toString()
          Retrieves the string representation of this attribute type in the form specified in RFC 2252.
 void toString(java.lang.StringBuilder buffer, boolean includeFileElement)
          Appends a string representation of this attribute type in the form specified in RFC 2252 to the provided buffer.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DITStructureRule

public DITStructureRule(java.lang.String definition,
                        java.util.Map<java.lang.String,java.lang.String> names,
                        int ruleID,
                        java.lang.String description,
                        boolean isObsolete,
                        NameForm nameForm,
                        java.util.Set<DITStructureRule> superiorRules,
                        java.util.Map<java.lang.String,java.util.List<java.lang.String>> extraProperties)
Creates a new DIT structure rule with the provided information.

Parameters:
definition - The definition string used to create this DIT structure rule. It must not be null.
names - The set of names for this DIT structure rule, mapping the lowercase names to the user-defined values.
ruleID - The rule ID for this DIT structure rule.
description - The description for this DIT structure rule.
isObsolete - Indicates whether this DIT structure rule is declared "obsolete".
nameForm - The name form for this DIT structure rule.
superiorRules - References to the superior rules for this DIT structure rule.
extraProperties - The set of "extra" properties associated with this DIT structure rules.
Method Detail

getDefinition

public java.lang.String getDefinition()
Retrieves the definition string used to create this DIT structure rule.

Specified by:
getDefinition in interface SchemaFileElement
Returns:
The definition string used to create this DIT structure rule.

recreateFromDefinition

public DITStructureRule recreateFromDefinition()
                                        throws DirectoryException
Creates a new instance of this DIT structure rule based on the definition string. It will also preserve other state information associated with this DIT structure rule that is not included in the definition string (e.g., the name of the schema file with which it is associated).

Specified by:
recreateFromDefinition in interface SchemaFileElement
Returns:
The new instance of this DIT structure rule based on the definition string.
Throws:
DirectoryException - If a problem occurs while attempting to create a new DIT structure rule instance from the definition string.

getNames

public java.util.Map<java.lang.String,java.lang.String> getNames()
Retrieves the set of names that may be used to reference this DIT structure rule. The returned mapping will be between an all lower-case form of the name and a name in the user-defined form (which may include mixed capitalization).

Returns:
The set of names that may be used to reference this DIT structure rule.

hasName

public boolean hasName(java.lang.String lowerName)
Indicates whether this DIT structure rule has the specified name.

Parameters:
lowerName - The lowercase name for which to make the determination.
Returns:
true if the specified name is assigned to this DIT structure rule, or false if not.

getRuleID

public int getRuleID()
Retrieves the rule ID for this DIT structure rule.

Returns:
The rule ID for this DIT structure rule.

getNameOrRuleID

public java.lang.String getNameOrRuleID()
Retrieves the name or rule ID for this DIT structure rule. If it has one or more names, then the primary name will be returned. If it does not have any names, then the rule ID will be returned.

Returns:
The name or rule ID for this DIT structure rule.

getSchemaFile

public java.lang.String getSchemaFile()
Retrieves the path to the schema file that contains the definition for this DIT structure rule.

Specified by:
getSchemaFile in interface SchemaFileElement
Returns:
The path to the schema file that contains the definition for this DIT structure rule, or null if it is not known or if it is not stored in any schema file.

setSchemaFile

public void setSchemaFile(java.lang.String schemaFile)
Specifies the path to the schema file that contains the definition for this DIT structure rule.

Specified by:
setSchemaFile in interface SchemaFileElement
Parameters:
schemaFile - The path to the schema file that contains the definition for this DIT structure rule.

getDescription

public java.lang.String getDescription()
Retrieves the description for this DIT structure rule.

Returns:
The description for this DIT structure rule.

getNameForm

public NameForm getNameForm()
Retrieves the name form for this DIT structure rule.

Returns:
The name form for this DIT structure rule.

getStructuralClass

public ObjectClass getStructuralClass()
Retrieves the structural objectclass for the name form with which this DIT structure rule is associated.

Returns:
The structural objectclass for the name form with which this DIT structure rule is associated.

getSuperiorRules

public java.util.Set<DITStructureRule> getSuperiorRules()
Retrieves the set of superior rules for this DIT structure rule.

Returns:
The set of superior rules for this DIT structure rule.

hasSuperiorRules

public boolean hasSuperiorRules()
Indicates whether this DIT structure rule has one or more superior rules.

Returns:
true if this DIT structure rule has one or more superior rules, or false if not.

isObsolete

public boolean isObsolete()
Indicates whether this DIT structure rule is declared "obsolete".

Returns:
true if this DIT structure rule is declared "obsolete", or false if not.

getExtraProperties

public java.util.Map<java.lang.String,java.util.List<java.lang.String>> getExtraProperties()
Retrieves a mapping between the names of any extra non-standard properties that may be associated with this DIT structure rule and the value for that property.

Returns:
A mapping between the names of any extra non-standard properties that may be associated with this DIT structure rule and the value for that property.

getExtraProperty

public java.util.List<java.lang.String> getExtraProperty(java.lang.String propertyName)
Retrieves the value of the specified "extra" property for this DIT structure rule.

Parameters:
propertyName - The name of the "extra" property for which to retrieve the value.
Returns:
The value of the specified "extra" property for this DIT structure rule, or null if no such property is defined.

setExtraProperty

public void setExtraProperty(java.lang.String name,
                             java.lang.String value)
Specifies the provided "extra" property for this DIT structure rule.

Parameters:
name - The name for the "extra" property. It must not be null.
value - The value for the "extra" property, or null if the property is to be removed.

setExtraProperty

public void setExtraProperty(java.lang.String name,
                             java.util.List<java.lang.String> values)
Specifies the provided "extra" property for this DIT structure rule.

Parameters:
name - The name for the "extra" property. It must not be null.
values - The set of value for the "extra" property, or null if the property is to be removed.

equals

public boolean equals(java.lang.Object o)
Indicates whether the provided object is equal to this DIT structure rule. The object will be considered equal if it is a DIT structure rule with the same OID as the current type.

Overrides:
equals in class java.lang.Object
Parameters:
o - The object for which to make the determination.
Returns:
true if the provided object is equal to this attribute, or false if not.

hashCode

public int hashCode()
Retrieves the hash code for this DIT structure rule. It will be equal to the rule ID.

Overrides:
hashCode in class java.lang.Object
Returns:
The hash code for this DIT structure rule.

toString

public java.lang.String toString()
Retrieves the string representation of this attribute type in the form specified in RFC 2252.

Overrides:
toString in class java.lang.Object
Returns:
The string representation of this attribute type in the form specified in RFC 2252.

toString

public void toString(java.lang.StringBuilder buffer,
                     boolean includeFileElement)
Appends a string representation of this attribute type in the form specified in RFC 2252 to the provided buffer.

Parameters:
buffer - The buffer to which the information should be appended.
includeFileElement - Indicates whether to include an "extra" property that specifies the path to the schema file from which this DIT structure rule was loaded.