blob: d0ea011ea191912a7323d83d350fe330852da254 [file] [log] [blame]
Title: 4.2 - Schema Manager
NavPrev: 4.1-schema.html
NavPrevText: 4.1 - Schema
NavUp: 4-schema-management.html
NavUpText: 4 - Schema Management
NavNext: 5-ldap-security.html
NavNextText: 5 - LDAP Security
Notice: Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
.
http://www.apache.org/licenses/LICENSE-2.0
.
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
# 4.2 - Schema Manager
The API and the ApacheDS server components must to keep schema elements available to interrogate and use. This is done through what we call a **SchemaManager**. It hides the internal structure of the schema objects from the users.
## Contents
* [SchemaObjects](4.2.1-schema-objects.html)
* [AttributeTypes](4.2.1.1-attribute-types.html)
* [ObjectClasses](4.2.1.2-object-classes.html)
* [Syntaxes](4.2.1.3-syntaxes.html)
* [MatchingRules](4.2.1.4-matching-rules.html)
* [DITContentRules](4.2.1.5-dit-content-rules.html)
* [DITStructureRules](4.2.1.6-dit-structure-rules.html)
* [MatchingRuleUses](4.2.1.7-matching-rule-uses.html)
* [NameForms](4.2.1.8-name-forms.html)
* [ApacheDS Schema Elements](4.2.1.9-apacheds-schema-elements.html)
* [Registries](4.2.2-registries.html)
* [SchemaLoader](4.2.43-schema-loader.html)
## Introduction
The **SchemaManager** stores all the Schema elements (**[AttributeTypes (e)]()**, **[ObjectClasses (e)]()**, ... Internally, we store these elements into what is call a **Registries**. Registries are hives where each Schema Object is stored. Each schema element has a dedicated **Registry** associated with it. Think of it as a Map which returns a reference to a specific Schema Element according to its name or OID.
Note :
Each Schema Element is properly defined by one of its names or <b>OID</b>. The <b>OID</b> must be unique across all schema elements,
when the name can be used in different schema element (for instance, the <b>audio</b> <b>AttributeType</b> or <b>ObjectClass</b>)
From the user point of view, the **SchemaManager** is seen as a representation of the available LDAP schema elements. It can of course be extended, or modified, by adding or removing schema elements. For historic reasons, the schema elements are gathered into what we call a **schema**. Usually, this is what you load into a **schemaManager**
The server has one instance of a **SchemaManager**, which is used internally, and a users aren't allowed to control it. On the client side, we can load a **SchemaManager** either from the server (which will be a duplicated instance), or from existing schema files. We can even create a brand new **SchemaManager** and fill it with anything needed.
## The various pieces of the puzzle...
Creating a **SchemaManager** results in a complex structure being created, and involves a lot of other helper class. We will separate the description into three groups:
* The elements stored in the **SchemaManager**
* The containers in which those **SchemaObject** instances are stored, called **Registries**
* The classes used to initialize the **SchemaManager**, called the **SchemaLoader** (whch comes in various flavors)
## Getting a SchemaManager
The very first thing we do to access the schema elements is to gain access to the **SchemaManager**. This can be done in many ways:
* you can create one from scratch, and load it with the elements you want
* you can use a default **SchemaManager**, with some default schema elements
* you can create a **SchemaManager**, and load the schema elements from a destination
* last, not least - and probably the most interesting possibility -, you can connect to a LDAP server and load the schema from it.
We will show how to proceed in each of these four use cases.
## Using a SchemaManager
Let's first assume you have an instance of a **SchemaManager** (we will see later how to get such an instance).