001    
002    /*
003     *  Licensed to the Apache Software Foundation (ASF) under one
004     *  or more contributor license agreements.  See the NOTICE file
005     *  distributed with this work for additional information
006     *  regarding copyright ownership.  The ASF licenses this file
007     *  to you under the Apache License, Version 2.0 (the
008     *  "License"); you may not use this file except in compliance
009     *  with the License.  You may obtain a copy of the License at
010     *  
011     *    http://www.apache.org/licenses/LICENSE-2.0
012     *  
013     *  Unless required by applicable law or agreed to in writing,
014     *  software distributed under the License is distributed on an
015     *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
016     *  KIND, either express or implied.  See the License for the
017     *  specific language governing permissions and limitations
018     *  under the License. 
019     *  
020     */
021    package org.apache.directory.server.schema.bootstrap;
022    
023    
024    import java.util.ArrayList;
025    import javax.naming.NamingException;
026    import org.apache.directory.shared.ldap.schema.ObjectClassTypeEnum;
027    import org.apache.directory.server.schema.registries.Registries;
028    
029    
030    /**
031     * A producer of schema objectClass definations for the java schema.  This
032     * code has been automatically generated using schema files in the OpenLDAP
033     * format along with the directory plugin for maven.  This has been done
034     * to facilitate OpenLDAP schema interoperability.
035     *
036     * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
037     */
038    public class JavaObjectClassProducer extends AbstractBootstrapProducer
039    {
040    
041        public JavaObjectClassProducer()
042        {
043            super( ProducerTypeEnum.OBJECT_CLASS_PRODUCER );
044        }
045    
046    
047        // ------------------------------------------------------------------------
048        // BootstrapProducer Methods
049        // ------------------------------------------------------------------------
050    
051    
052        /**
053         * @see BootstrapProducer#produce(Registries, ProducerCallback)
054         */
055        public void produce( Registries registries, ProducerCallback cb )
056            throws NamingException
057        {
058            ArrayList<String> array = new ArrayList<String>();
059            BootstrapObjectClass objectClass;
060    
061            // --------------------------------------------------------------------
062            // ObjectClass 1.3.6.1.4.1.42.2.27.4.2.1 
063            // --------------------------------------------------------------------
064    
065            objectClass = newObjectClass( "1.3.6.1.4.1.42.2.27.4.2.1", registries );
066            objectClass.setObsolete( false );
067    
068            objectClass.setDescription( "Container for a Java object" );
069            // set the objectclass type
070            objectClass.setType( ObjectClassTypeEnum.STRUCTURAL );
071    
072            // set superior objectClasses
073            array.clear();
074            array.add( "top" );
075            objectClass.setSuperClassIds( array.toArray( EMPTY ) );
076    
077            // set must list
078            array.clear();
079            array.add( "cn" );
080            objectClass.setMustListIds( array.toArray( EMPTY ) );
081    
082            // set may list
083            array.clear();
084            objectClass.setMayListIds( array.toArray( EMPTY ) );
085    
086            // set names
087            array.clear();
088            array.add( "javaContainer" );
089            objectClass.setNames( array.toArray( EMPTY ) );
090            cb.schemaObjectProduced( this, "1.3.6.1.4.1.42.2.27.4.2.1", objectClass );
091            // --------------------------------------------------------------------
092            // ObjectClass 1.3.6.1.4.1.42.2.27.4.2.4 
093            // --------------------------------------------------------------------
094    
095            objectClass = newObjectClass( "1.3.6.1.4.1.42.2.27.4.2.4", registries );
096            objectClass.setObsolete( false );
097    
098            objectClass.setDescription( "Java object representation" );
099            // set the objectclass type
100            objectClass.setType( ObjectClassTypeEnum.ABSTRACT );
101    
102            // set superior objectClasses
103            array.clear();
104            array.add( "top" );
105            objectClass.setSuperClassIds( array.toArray( EMPTY ) );
106    
107            // set must list
108            array.clear();
109            array.add( "javaClassName" );
110            objectClass.setMustListIds( array.toArray( EMPTY ) );
111    
112            // set may list
113            array.clear();
114            array.add( "javaClassNames" );
115            array.add( "javaCodebase" );
116            array.add( "javaDoc" );
117            array.add( "description" );
118            objectClass.setMayListIds( array.toArray( EMPTY ) );
119    
120            // set names
121            array.clear();
122            array.add( "javaObject" );
123            objectClass.setNames( array.toArray( EMPTY ) );
124            cb.schemaObjectProduced( this, "1.3.6.1.4.1.42.2.27.4.2.4", objectClass );
125            // --------------------------------------------------------------------
126            // ObjectClass 1.3.6.1.4.1.42.2.27.4.2.5 
127            // --------------------------------------------------------------------
128    
129            objectClass = newObjectClass( "1.3.6.1.4.1.42.2.27.4.2.5", registries );
130            objectClass.setObsolete( false );
131    
132            objectClass.setDescription( "Java serialized object" );
133            // set the objectclass type
134            objectClass.setType( ObjectClassTypeEnum.AUXILIARY );
135    
136            // set superior objectClasses
137            array.clear();
138            array.add( "javaObject" );
139            objectClass.setSuperClassIds( array.toArray( EMPTY ) );
140    
141            // set must list
142            array.clear();
143            array.add( "javaSerializedData" );
144            objectClass.setMustListIds( array.toArray( EMPTY ) );
145    
146            // set may list
147            array.clear();
148            objectClass.setMayListIds( array.toArray( EMPTY ) );
149    
150            // set names
151            array.clear();
152            array.add( "javaSerializedObject" );
153            objectClass.setNames( array.toArray( EMPTY ) );
154            cb.schemaObjectProduced( this, "1.3.6.1.4.1.42.2.27.4.2.5", objectClass );
155            // --------------------------------------------------------------------
156            // ObjectClass 1.3.6.1.4.1.42.2.27.4.2.8 
157            // --------------------------------------------------------------------
158    
159            objectClass = newObjectClass( "1.3.6.1.4.1.42.2.27.4.2.8", registries );
160            objectClass.setObsolete( false );
161    
162            objectClass.setDescription( "Java marshalled object" );
163            // set the objectclass type
164            objectClass.setType( ObjectClassTypeEnum.AUXILIARY );
165    
166            // set superior objectClasses
167            array.clear();
168            array.add( "javaObject" );
169            objectClass.setSuperClassIds( array.toArray( EMPTY ) );
170    
171            // set must list
172            array.clear();
173            array.add( "javaSerializedData" );
174            objectClass.setMustListIds( array.toArray( EMPTY ) );
175    
176            // set may list
177            array.clear();
178            objectClass.setMayListIds( array.toArray( EMPTY ) );
179    
180            // set names
181            array.clear();
182            array.add( "javaMarshalledObject" );
183            objectClass.setNames( array.toArray( EMPTY ) );
184            cb.schemaObjectProduced( this, "1.3.6.1.4.1.42.2.27.4.2.8", objectClass );
185            // --------------------------------------------------------------------
186            // ObjectClass 1.3.6.1.4.1.42.2.27.4.2.7 
187            // --------------------------------------------------------------------
188    
189            objectClass = newObjectClass( "1.3.6.1.4.1.42.2.27.4.2.7", registries );
190            objectClass.setObsolete( false );
191    
192            objectClass.setDescription( "JNDI reference" );
193            // set the objectclass type
194            objectClass.setType( ObjectClassTypeEnum.AUXILIARY );
195    
196            // set superior objectClasses
197            array.clear();
198            array.add( "javaObject" );
199            objectClass.setSuperClassIds( array.toArray( EMPTY ) );
200    
201            // set must list
202            array.clear();
203            objectClass.setMustListIds( array.toArray( EMPTY ) );
204    
205            // set may list
206            array.clear();
207            array.add( "javaReferenceAddress" );
208            array.add( "javaFactory" );
209            objectClass.setMayListIds( array.toArray( EMPTY ) );
210    
211            // set names
212            array.clear();
213            array.add( "javaNamingReference" );
214            objectClass.setNames( array.toArray( EMPTY ) );
215            cb.schemaObjectProduced( this, "1.3.6.1.4.1.42.2.27.4.2.7", objectClass );
216        }
217    }