001 /*
002 * CDDL HEADER START
003 *
004 * The contents of this file are subject to the terms of the
005 * Common Development and Distribution License, Version 1.0 only
006 * (the "License"). You may not use this file except in compliance
007 * with the License.
008 *
009 * You can obtain a copy of the license at
010 * docs/licenses/cddl.txt
011 * or http://www.opensource.org/licenses/cddl1.php.
012 * See the License for the specific language governing permissions
013 * and limitations under the License.
014 *
015 * When distributing Covered Code, include this CDDL HEADER in each
016 * file and include the License file at
017 * docs/licenses/cddl.txt. If applicable,
018 * add the following below this CDDL HEADER, with the fields enclosed
019 * by brackets "[]" replaced with your own identifying information:
020 * Portions Copyright [yyyy] [name of copyright owner]
021 *
022 * CDDL HEADER END
023 *
024 *
025 * Copyright 2010-2013 UnboundID Corp.
026 */
027 package com.unboundid.directory.sdk.common.schema;
028
029
030
031 import java.util.Map;
032
033 import com.unboundid.util.NotExtensible;
034 import com.unboundid.util.ThreadSafety;
035 import com.unboundid.util.ThreadSafetyLevel;
036
037
038
039 /**
040 * This interface provides a number of methods that may be used to interact with
041 * the server schema.
042 */
043 @NotExtensible()
044 @ThreadSafety(level=ThreadSafetyLevel.INTERFACE_THREADSAFE)
045 public interface Schema
046 {
047 /**
048 * Retrieves the set of attribute types defined in the server schema, mapped
049 * from lowercase name or OID to the attribute type definition. Each
050 * attribute type definition may be included in the map multiple times with
051 * each of its names as well as its OID.
052 *
053 * @return The set of attribute types defined in the server schema, mapped
054 * from lowercase name or OID to the attribute type definition.
055 */
056 Map<String,AttributeType> getAttributeTypesByName();
057
058
059
060 /**
061 * Retrieves the specified attribute type from the server schema, optionally
062 * creating a new attribute type with the specified name if none is defined.
063 *
064 * @param name The name or OID of the attribute type to retrieve.
065 * @param returnDefault Indicates whether to create a new attribute type
066 * with the given name and a default settings if no
067 * such attribute is defined in the server schema.
068 *
069 * @return The requested attribute type, or {@code null} if no such attribute
070 * is defined in the schema and a default type should not be
071 * returned.
072 */
073 AttributeType getAttributeType(final String name,
074 final boolean returnDefault);
075
076
077
078 /**
079 * Retrieves the set of object classes defined in the server schema, mapped
080 * from lowercase name or OID to the object class definition. Each object
081 * class definition may be included in the map multiple times with each of its
082 * names as well as its OID.
083 *
084 * @return The set of object classes defined in the server schema, mapped
085 * from lowercase name or OID to the object class definition.
086 */
087 Map<String,ObjectClass> getObjectClassesByName();
088
089
090
091 /**
092 * Retrieves the specified object class from the server schema, optionally
093 * creating a new class with the specified name if none is defined.
094 *
095 * @param name The name or OID of the object class to retrieve.
096 * @param returnDefault Indicates whether to create a new object class
097 * with the given name and a default settings if no
098 * such object class is defined in the server schema.
099 *
100 * @return The requested object class, or {@code null} if no such object
101 * class is defined in the schema and a default class should not be
102 * returned.
103 */
104 ObjectClass getObjectClass(final String name, final boolean returnDefault);
105
106
107
108 /**
109 * Retrieves the set of attribute syntaxes defined in the schema, mapped from
110 * OID to the corresponding attribute syntax.
111 *
112 * @return The set of attribute syntaxes defined in the server schema, mapped
113 * from OID to the attribute syntax definition.
114 */
115 Map<String,AttributeSyntax> getAttributeSyntaxesByOID();
116
117
118
119 /**
120 * Retrieves the attribute syntax with the specified OID, if available.
121 *
122 * @param oid The OID of the attribute syntax to retrieve.
123 *
124 * @return The requested attribute syntax, or {@code null} if there is no
125 * such syntax defined in the server.
126 */
127 AttributeSyntax getAttributeSyntax(final String oid);
128
129
130
131 /**
132 * Retrieves the set of matching rules defined in the server schema, mapped
133 * from lowercase name or OID to the matching rule definition. Each
134 * matching rule definition may be included in the map multiple times with
135 * each of its names as well as its OID.
136 *
137 * @return The set of matching rules defined in the server schema, mapped
138 * from lowercase name or OID to the matching rule definition.
139 */
140 Map<String,MatchingRule> getMatchingRulesByName();
141
142
143
144 /**
145 * Retrieves the specified matching rule from the server schema.
146 *
147 * @param name The name or OID of the matching rule to retrieve.
148 *
149 * @return The requested matching rule, or {@code null} if no such matching
150 * rule is defined in the schema.
151 */
152 MatchingRule getMatchingRule(final String name);
153
154
155
156 /**
157 * Retrieves the set of name forms defined in the server schema, mapped from
158 * structural object class to the corresponding name form definition.
159 *
160 * @return The set of name forms defined in the server schema, mapped from
161 * structural object class to the corresponding name form definition.
162 */
163 Map<ObjectClass,NameForm> getNameFormsByStructuralClass();
164
165
166
167 /**
168 * Retrieves the specified name form from the server schema.
169 *
170 * @param name The name or OID of the name form to retrieve.
171 *
172 * @return The requested name form, or {@code null} if there is no name form
173 * with the specified name or OID.
174 */
175 NameForm getNameForm(final String name);
176
177
178
179 /**
180 * Retrieves the specified name form from the server schema.
181 *
182 * @param structuralClass The structural object class for which to retrieve
183 * the corresponding name form.
184 *
185 * @return The requested name form, or {@code null} if there is no name form
186 * associated with the specified structural object class.
187 */
188 NameForm getNameForm(final ObjectClass structuralClass);
189
190
191
192 /**
193 * Retrieves the set of DIT content rules defined in the server schema, mapped
194 * from structural object class to the corresponding DIT structure rule
195 * definition.
196 *
197 * @return The set of DIT content rules defined in the server schema, mapped
198 * from structural object class to the corresponding DIT content
199 * rule definition.
200 */
201 Map<ObjectClass,DITContentRule> getDITContentRulesByStructuralClass();
202
203
204
205 /**
206 * Retrieves the specified DIT content rule from the server schema.
207 *
208 * @param structuralClass The structural object class for which to retrieve
209 * the corresponding DIT content rule.
210 *
211 * @return The requested DIT content rule, or {@code null} if no such DIT
212 * content rule is defined in the server schema.
213 */
214 DITContentRule getDITContentRule(final ObjectClass structuralClass);
215
216
217
218 /**
219 * Retrieves the set of DIT structure rules defined in the server schema,
220 * mapped from rule ID to the corresponding DIT structure rule definition.
221 *
222 * @return The set of DIT structure rules defined in the server schema,
223 * mapped from rule ID to the corresponding DIT structure rule
224 * definition.
225 */
226 Map<Integer,DITStructureRule> getDITStructureRulesByRuleID();
227
228
229
230 /**
231 * Retrieves the specified DIT structure rule from the server schema.
232 *
233 * @param ruleID The rule ID for the DIT structure rule to retrieve.
234 *
235 * @return The requested DIT structure rule, or {@code null} if no such DIT
236 * structure rule is defined in the server schema.
237 */
238 DITStructureRule getDITStructureRule(final int ruleID);
239
240
241
242 /**
243 * Retrieves the specified DIT structure rule from the server schema.
244 *
245 * @param nameForm The name form for which to retrieve the corresponding DIT
246 * structure rule.
247 *
248 * @return The requested DIT structure rule, or {@code null} if no such DIT
249 * structure rule is defined in the server schema.
250 */
251 DITStructureRule getDITStructureRule(final NameForm nameForm);
252
253
254
255 /**
256 * Retrieves the set of matching rule uses defined in the server schema,
257 * mapped from matching rule to its corresponding matching rule use.
258 *
259 * @return The set of matching rule uses defined in the server schema, mapped
260 * from matching rule to its corresponding matching rule use.
261 */
262 Map<MatchingRule,MatchingRuleUse> getMatchingRuleUsesByMatchingRule();
263
264
265
266 /**
267 * Retrieves the specified matching rule use from the server schema.
268 *
269 * @param matchingRule The matching rule for which to retrieve the
270 * corresponding matching rule use.
271 *
272 * @return The requested matching rule use, or {@code null} if there is no
273 * matching rule use associated with the provided matching rule.
274 */
275 MatchingRuleUse getMatchingRuleUse(final MatchingRule matchingRule);
276 }