org.opends.server.core
Class SchemaConfigManager

java.lang.Object
  extended by org.opends.server.core.SchemaConfigManager

public class SchemaConfigManager
extends java.lang.Object

This class defines a utility that will be used to manage the interaction with the Directory Server schema. It will be used to initially load all of the matching rules and attribute syntaxes that have been defined in the configuration, and will then read the actual schema definitions. At present, only attribute types and objectclasses are supported in the schema config files. Other components like DIT content rules, DIT structure rules, name forms, and matching rule use definitions will be ignored.


Constructor Summary
SchemaConfigManager()
          Creates a new instance of this schema config manager.
 
Method Summary
 Schema getSchema()
          Retrieves a reference to the schema information that has been read from the server configuration.
static java.lang.String getSchemaDirectoryPath()
          Retrieves the path to the directory containing the server schema files.
 void initializeAttributeSyntaxes()
          Initializes all the attribute syntaxes defined in the Directory Server configuration.
 void initializeMatchingRules()
          Initializes all the matching rules defined in the Directory Server configuration.
 void initializeSchemaFromFiles()
          Initializes all the attribute type, object class, name form, DIT content rule, DIT structure rule, and matching rule use definitions by reading the server schema files.
static java.util.List<Modification> loadSchemaFile(Schema schema, java.lang.String schemaFile)
          Loads the contents of the specified schema file into the provided schema.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SchemaConfigManager

public SchemaConfigManager()
Creates a new instance of this schema config manager.

Method Detail

getSchemaDirectoryPath

public static java.lang.String getSchemaDirectoryPath()
Retrieves the path to the directory containing the server schema files.

Returns:
The path to the directory containing the server schema files.

getSchema

public Schema getSchema()
Retrieves a reference to the schema information that has been read from the server configuration. Note that this information will not be complete until the initializeMatchingRules, initializeAttributeSyntaxes, and initializeAttributeTypesAndObjectClasses methods have been called.

Returns:
A reference to the schema information that has been read from the server configuration.

initializeMatchingRules

public void initializeMatchingRules()
                             throws ConfigException,
                                    InitializationException
Initializes all the matching rules defined in the Directory Server configuration. This should only be called at Directory Server startup.

Throws:
ConfigException - If a configuration problem causes the matching rule initialization process to fail.
InitializationException - If a problem occurs while initializing the matching rules that is not related to the server configuration.

initializeAttributeSyntaxes

public void initializeAttributeSyntaxes()
                                 throws ConfigException,
                                        InitializationException
Initializes all the attribute syntaxes defined in the Directory Server configuration. This should only be called at Directory Server startup.

Throws:
ConfigException - If a configuration problem causes the syntax initialization process to fail.
InitializationException - If a problem occurs while initializing the syntaxes that is not related to the server configuration.

initializeSchemaFromFiles

public void initializeSchemaFromFiles()
                               throws ConfigException,
                                      InitializationException
Initializes all the attribute type, object class, name form, DIT content rule, DIT structure rule, and matching rule use definitions by reading the server schema files. These files will be located in a single directory and will be processed in lexicographic order. However, to make the order easier to understand, they may be prefixed with a two digit number (with a leading zero if necessary) so that they will be read in numeric order. This should only be called at Directory Server startup.

Throws:
ConfigException - If a configuration problem causes the schema element initialization to fail.
InitializationException - If a problem occurs while initializing the schema elements that is not related to the server configuration.

loadSchemaFile

public static java.util.List<Modification> loadSchemaFile(Schema schema,
                                                          java.lang.String schemaFile)
                                                   throws ConfigException,
                                                          InitializationException
Loads the contents of the specified schema file into the provided schema.

Parameters:
schema - The schema in which the contents of the schema file are to be loaded.
schemaFile - The name of the schema file to be loaded into the provided schema.
Returns:
A list of the modifications that could be performed in order to obtain the contents of the file.
Throws:
ConfigException - If a configuration problem causes the schema element initialization to fail.
InitializationException - If a problem occurs while initializing the schema elements that is not related to the server configuration.