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 mozilla 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 MozillaObjectClassProducer extends AbstractBootstrapProducer
039    {
040    
041        public MozillaObjectClassProducer()
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.13769.2.2.1 
063            // --------------------------------------------------------------------
064    
065            objectClass = newObjectClass( "1.3.6.1.4.1.13769.2.2.1", registries );
066            objectClass.setObsolete( false );
067    
068            // set the objectclass type
069            objectClass.setType( ObjectClassTypeEnum.STRUCTURAL );
070    
071            // set superior objectClasses
072            array.clear();
073            array.add( "inetOrgPerson" );
074            objectClass.setSuperClassIds( array.toArray( EMPTY ) );
075    
076            // set must list
077            array.clear();
078            objectClass.setMustListIds( array.toArray( EMPTY ) );
079    
080            // set may list
081            array.clear();
082            array.add( "mozillaNickname" );
083            array.add( "mozillaUseHtmlMail" );
084            array.add( "mozillaSecondEmail" );
085            array.add( "mozillaPostalAddress2" );
086            array.add( "mozillaHomePostalAddress2" );
087            array.add( "mozillaHomeLocalityName" );
088            array.add( "mozillaHomeState" );
089            array.add( "mozillaHomePostalCode" );
090            array.add( "mozillaHomeCountryName" );
091            array.add( "mozillaHomeFriendlyCountryName" );
092            array.add( "mozillaHomeUrl" );
093            array.add( "mozillaWorkUrl" );
094            array.add( "mozillaCustom1" );
095            array.add( "mozillaCustom2" );
096            array.add( "mozillaCustom3" );
097            array.add( "mozillaCustom4" );
098            array.add( "nsAIMid" );
099            array.add( "c" );
100            array.add( "co" );
101            objectClass.setMayListIds( array.toArray( EMPTY ) );
102    
103            // set names
104            array.clear();
105            array.add( "mozillaAbPersonObsolete" );
106            objectClass.setNames( array.toArray( EMPTY ) );
107            cb.schemaObjectProduced( this, "1.3.6.1.4.1.13769.2.2.1", objectClass );
108        }
109    }