View Javadoc

1   /*
2    *  Licensed to the Apache Software Foundation (ASF) under one
3    *  or more contributor license agreements.  See the NOTICE file
4    *  distributed with this work for additional information
5    *  regarding copyright ownership.  The ASF licenses this file
6    *  to you under the Apache License, Version 2.0 (the
7    *  "License"); you may not use this file except in compliance
8    *  with the License.  You may obtain a copy of the License at
9    *  
10   *    http://www.apache.org/licenses/LICENSE-2.0
11   *  
12   *  Unless required by applicable law or agreed to in writing,
13   *  software distributed under the License is distributed on an
14   *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   *  KIND, either express or implied.  See the License for the
16   *  specific language governing permissions and limitations
17   *  under the License. 
18   *  
19   */
20  package org.apache.directory.server.schema.bootstrap;
21  
22  
23  import javax.naming.NamingException;
24  
25  import org.apache.directory.server.schema.registries.Registries;
26  import org.apache.directory.shared.ldap.constants.SchemaConstants;
27  import org.apache.directory.shared.ldap.schema.AbstractSyntax;
28  import org.apache.directory.shared.ldap.schema.syntax.JavaByteSyntaxChecker;
29  import org.apache.directory.shared.ldap.schema.syntax.JavaIntegerSyntaxChecker;
30  import org.apache.directory.shared.ldap.schema.syntax.JavaLongSyntaxChecker;
31  import org.apache.directory.shared.ldap.schema.syntax.JavaShortSyntaxChecker;
32  import org.apache.directory.shared.ldap.schema.syntax.SyntaxChecker;
33  
34  
35  
36  /**
37   * A producer of Syntax objects for the apache schema.  This code has been
38   * automatically generated using schema files in the OpenLDAP format along with
39   * the directory plugin for maven.  This has been done to facilitate
40   * OpenLDAP schema interoperability.
41   *
42   * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
43   * @version $Rev$
44   */
45  public class ApacheSyntaxProducer extends AbstractBootstrapProducer
46  {
47      public ApacheSyntaxProducer()
48      {
49          super( ProducerTypeEnum.SYNTAX_PRODUCER );
50      }
51  
52  
53      // ------------------------------------------------------------------------
54      // BootstrapProducer Methods
55      // ------------------------------------------------------------------------
56  
57  
58      /**
59       * @see BootstrapProducer#produce(Registries, ProducerCallback)
60       */
61      public void produce( Registries registries, ProducerCallback cb )
62          throws NamingException
63      {
64          AbstractSyntax syntax = null;
65          
66          syntax = new AbstractSyntax( SchemaConstants.JAVA_BYTE_SYNTAX, "a syntax for java byte values", true )
67          {
68              private static final long serialVersionUID = 1L;
69              private final JavaByteSyntaxChecker JAVA_BYTE_SYNTAX_CHECKER = new JavaByteSyntaxChecker();
70  
71              public String getName()
72              {
73                  return "JAVA_BYTE";
74              }
75              
76              public String[] getNames()
77              {
78                  return new String[] { "JAVA_BYTE" };
79              }
80              
81              public SyntaxChecker getSyntaxChecker() throws NamingException
82              {
83                  return JAVA_BYTE_SYNTAX_CHECKER;
84              }
85          };
86          syntax.setSchema( "apache" );
87          cb.schemaObjectProduced( this, syntax.getOid(), syntax );
88  
89          syntax = new AbstractSyntax( SchemaConstants.JAVA_SHORT_SYNTAX, "a syntax for java short values", true )
90          {
91              private static final long serialVersionUID = 1L;
92              private final JavaShortSyntaxChecker JAVA_SHORT_SYNTAX_CHECKER = new JavaShortSyntaxChecker();
93  
94              public String getName()
95              {
96                  return "JAVA_SHORT";
97              }
98              
99              public String[] getNames()
100             {
101                 return new String[] { "JAVA_SHORT" };
102             }
103             
104             public SyntaxChecker getSyntaxChecker() throws NamingException
105             {
106                 return JAVA_SHORT_SYNTAX_CHECKER;
107             }
108         };
109         syntax.setSchema( "apache" );
110         cb.schemaObjectProduced( this, syntax.getOid(), syntax );
111 
112         syntax = new AbstractSyntax( SchemaConstants.JAVA_INT_SYNTAX, "a syntax for java int values", true )
113         {
114             private static final long serialVersionUID = 1L;
115             private final JavaIntegerSyntaxChecker JAVA_INT_SYNTAX_CHECKER = new JavaIntegerSyntaxChecker();
116 
117             public String getName()
118             {
119                 return "JAVA_INT";
120             }
121             
122             public String[] getNames()
123             {
124                 return new String[] { "JAVA_INT" };
125             }
126             
127             public SyntaxChecker getSyntaxChecker() throws NamingException
128             {
129                 return JAVA_INT_SYNTAX_CHECKER;
130             }
131         };
132         syntax.setSchema( "apache" );
133         cb.schemaObjectProduced( this, syntax.getOid(), syntax );
134 
135         syntax = new AbstractSyntax( SchemaConstants.JAVA_LONG_SYNTAX, "a syntax for java long values", true )
136         {
137             private static final long serialVersionUID = 1L;
138             private final JavaLongSyntaxChecker JAVA_LONG_SYNTAX_CHECKER = new JavaLongSyntaxChecker();
139 
140             public String getName()
141             {
142                 return "JAVA_LONG";
143             }
144             
145             public String[] getNames()
146             {
147                 return new String[] { "JAVA_LONG" };
148             }
149             
150             public SyntaxChecker getSyntaxChecker() throws NamingException
151             {
152                 return JAVA_LONG_SYNTAX_CHECKER;
153             }
154         };
155         syntax.setSchema( "apache" );
156         cb.schemaObjectProduced( this, syntax.getOid(), syntax );
157     }
158 }