1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.apache.directory.server.schema.bootstrap;
21
22
23 import javax.naming.NamingException;
24
25 import org.apache.directory.server.constants.MetaSchemaConstants;
26 import org.apache.directory.server.schema.registries.Registries;
27 import org.apache.directory.shared.ldap.NotImplementedException;
28 import org.apache.directory.shared.ldap.schema.Syntax;
29 import org.apache.directory.shared.ldap.schema.syntax.NumericOidSyntaxChecker;
30 import org.apache.directory.shared.ldap.schema.syntax.NumericStringSyntaxChecker;
31 import org.apache.directory.shared.ldap.schema.syntax.ObjectClassTypeSyntaxChecker;
32 import org.apache.directory.shared.ldap.schema.syntax.ObjectNameSyntaxChecker;
33 import org.apache.directory.shared.ldap.schema.syntax.OidSyntaxChecker;
34 import org.apache.directory.shared.ldap.schema.syntax.SyntaxChecker;
35
36
37
38
39
40
41
42
43
44 public class ApachemetaSyntaxProducer extends AbstractBootstrapProducer
45 {
46 public ApachemetaSyntaxProducer()
47 {
48 super( ProducerTypeEnum.SYNTAX_PRODUCER );
49 }
50
51
52
53
54
55
56
57
58
59
60 public void produce( Registries registries, ProducerCallback cb )
61 throws NamingException
62 {
63 Syntax syntax = null;
64
65 syntax = new NameOrNumericIdSyntax();
66 cb.schemaObjectProduced( this, syntax.getOid(), syntax );
67
68 syntax = new NumericOidSyntax();
69 cb.schemaObjectProduced( this, syntax.getOid(), syntax );
70
71 syntax = new ObjectClassTypeSyntax();
72 cb.schemaObjectProduced( this, syntax.getOid(), syntax );
73
74 syntax = new NumberSyntax();
75 cb.schemaObjectProduced( this, syntax.getOid(), syntax );
76
77 syntax = new ObjectNameSyntax();
78 cb.schemaObjectProduced( this, syntax.getOid(), syntax );
79 }
80
81
82 public static class NumericOidSyntax implements Syntax
83 {
84 private static final long serialVersionUID = 1L;
85 private final static String OID = "1.3.6.1.4.1.18060.0.4.0.0.2";
86 private final static SyntaxChecker CHECKER = new OidSyntaxChecker();
87 private final static String[] NAMES = new String[] { "numericOid" };
88
89 public final SyntaxChecker getSyntaxChecker() throws NamingException
90 {
91 return CHECKER;
92 }
93
94 public final boolean isHumanReadable()
95 {
96 return true;
97 }
98
99 public final String getDescription()
100 {
101 return "The syntax for numericoids.";
102 }
103
104 public final String getName()
105 {
106 return NAMES[0];
107 }
108
109 public final String[] getNamesRef()
110 {
111 return NAMES;
112 }
113
114 public final String getOid()
115 {
116 return OID;
117 }
118
119 public final boolean isObsolete()
120 {
121 return false;
122 }
123
124 public String getSchema()
125 {
126 return MetaSchemaConstants.SCHEMA_NAME;
127 }
128
129 public void setSchema( String schemaName )
130 {
131 throw new NotImplementedException();
132 }
133 }
134
135
136 public static class NameOrNumericIdSyntax implements Syntax
137 {
138 private static final long serialVersionUID = 1L;
139 private final static String OID = "1.3.6.1.4.1.18060.0.4.0.0.0";
140 private final static SyntaxChecker CHECKER = new NumericOidSyntaxChecker();
141 private final static String[] NAMES = new String[] { "nameOrOid" };
142
143 public final SyntaxChecker getSyntaxChecker() throws NamingException
144 {
145 return CHECKER;
146 }
147
148 public final boolean isHumanReadable()
149 {
150 return true;
151 }
152
153 public final String getDescription()
154 {
155 return "The syntax for either numeric ids or names.";
156 }
157
158 public final String getName()
159 {
160 return NAMES[0];
161 }
162
163 public final String[] getNamesRef()
164 {
165 return NAMES;
166 }
167
168 public final String getOid()
169 {
170 return OID;
171 }
172
173 public final boolean isObsolete()
174 {
175 return false;
176 }
177
178 public String getSchema()
179 {
180 return MetaSchemaConstants.SCHEMA_NAME;
181 }
182
183 public void setSchema( String schemaName )
184 {
185 throw new NotImplementedException();
186 }
187 }
188
189
190 public static class ObjectClassTypeSyntax implements Syntax
191 {
192 private static final long serialVersionUID = 1L;
193 private final static String OID = "1.3.6.1.4.1.18060.0.4.0.0.1";
194 private final static SyntaxChecker CHECKER = new ObjectClassTypeSyntaxChecker();
195 private final static String[] NAMES = new String[] { "objectClassType" };
196
197 public final SyntaxChecker getSyntaxChecker() throws NamingException
198 {
199 return CHECKER;
200 }
201
202 public final boolean isHumanReadable()
203 {
204 return true;
205 }
206
207 public final String getDescription()
208 {
209 return "The syntax for either numeric ids or names.";
210 }
211
212 public final String getName()
213 {
214 return NAMES[0];
215 }
216
217 public final String[] getNamesRef()
218 {
219 return NAMES;
220 }
221
222 public final String getOid()
223 {
224 return OID;
225 }
226
227 public final boolean isObsolete()
228 {
229 return false;
230 }
231
232 public String getSchema()
233 {
234 return MetaSchemaConstants.SCHEMA_NAME;
235 }
236
237 public void setSchema( String schemaName )
238 {
239 throw new NotImplementedException();
240 }
241 }
242
243
244 public static class NumberSyntax implements Syntax
245 {
246 private static final long serialVersionUID = 1L;
247 private final static String OID = "1.3.6.1.4.1.18060.0.4.0.0.4";
248 private final static SyntaxChecker CHECKER = new NumericStringSyntaxChecker();
249 private final static String[] NAMES = new String[] { "numeric" };
250
251 public final SyntaxChecker getSyntaxChecker() throws NamingException
252 {
253 return CHECKER;
254 }
255
256 public final boolean isHumanReadable()
257 {
258 return true;
259 }
260
261 public final String getDescription()
262 {
263 return "The syntax for numeric strings.";
264 }
265
266 public final String getName()
267 {
268 return NAMES[0];
269 }
270
271 public final String[] getNamesRef()
272 {
273 return NAMES;
274 }
275
276 public final String getOid()
277 {
278 return OID;
279 }
280
281 public final boolean isObsolete()
282 {
283 return false;
284 }
285
286 public String getSchema()
287 {
288 return MetaSchemaConstants.SCHEMA_NAME;
289 }
290
291 public void setSchema( String schemaName )
292 {
293 throw new NotImplementedException();
294 }
295 }
296
297 public static class ObjectNameSyntax implements Syntax
298 {
299 private static final long serialVersionUID = 1L;
300 private final static String OID = "1.3.6.1.4.1.18060.0.4.0.0.6";
301 private final static SyntaxChecker CHECKER = new ObjectNameSyntaxChecker();
302 private final static String[] NAMES = new String[] { "objectName" };
303
304 public final SyntaxChecker getSyntaxChecker() throws NamingException
305 {
306 return CHECKER;
307 }
308
309 public final boolean isHumanReadable()
310 {
311 return true;
312 }
313
314 public final String getDescription()
315 {
316 return "The syntax for object names.";
317 }
318
319 public final String getName()
320 {
321 return NAMES[0];
322 }
323
324 public final String[] getNamesRef()
325 {
326 return NAMES;
327 }
328
329 public final String getOid()
330 {
331 return OID;
332 }
333
334 public final boolean isObsolete()
335 {
336 return false;
337 }
338
339 public String getSchema()
340 {
341 return MetaSchemaConstants.SCHEMA_NAME;
342 }
343
344 public void setSchema( String schemaName )
345 {
346 throw new NotImplementedException();
347 }
348 }
349 }