/* * Copyright 2004 The Apache Software Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package $package; import java.util.ArrayList; import javax.naming.NamingException; import org.apache.ldap.common.schema.ObjectClassTypeEnum; #if ( $package != "org.apache.ldap.server.schema.bootstrap" ) import org.apache.ldap.server.schema.bootstrap.*; #end /** * A producer of schema objectClass definations for the $schema schema. This * code has been automatically generated using schema files in the OpenLDAP * format along with the directory plugin for maven. This has been done * to facilitate OpenLDAP schema interoperability. * * @author Apache Directory Project * @version $Rev$ */ public class $classname extends AbstractBootstrapProducer { public $classname() { super( ProducerTypeEnum.OBJECT_CLASS_PRODUCER ); } // ------------------------------------------------------------------------ // BootstrapProducer Methods // ------------------------------------------------------------------------ /** * @see BootstrapProducer#produce(BootstrapRegistries, ProducerCallback) */ public void produce( BootstrapRegistries registries, ProducerCallback cb ) throws NamingException { ArrayList array = new ArrayList(); BootstrapObjectClass objectClass; #foreach ( $objectClass in $objectClasses ) // -------------------------------------------------------------------- // ObjectClass $objectClass.getOid() $!objectClass.getName() // -------------------------------------------------------------------- objectClass = newObjectClass( "$objectClass.getOid()", registries ); objectClass.setObsolete( $objectClass.isObsolete() ); #if ( $objectClass.getDescription() ) objectClass.setDescription( "$objectClass.getDescription()" ); #end // set the objectclass type #if ( $objectClass.getClassType().getName() == "ABSTRACT" ) objectClass.setType( ObjectClassTypeEnum.ABSTRACT ); #elseif ( $objectClass.getClassType().getName() == "AUXILIARY" ) objectClass.setType( ObjectClassTypeEnum.AUXILIARY ); #elseif ( $objectClass.getClassType().getName() == "STRUCTURAL" ) objectClass.setType( ObjectClassTypeEnum.STRUCTURAL ); #end // set superior objectClasses #if ( $objectClass.getSuperiors() ) array.clear(); #foreach ( $id in $objectClass.getSuperiors() ) array.add( "$id" ); #end objectClass.setSuperClassIds( ( String[] ) array.toArray( EMPTY ) ); #else objectClass.setSuperClassIds( EMPTY ); #end // set must list #if ( $objectClass.getMust() ) array.clear(); #foreach ( $id in $objectClass.getMust() ) array.add( "$id" ); #end objectClass.setMustListIds( ( String[] ) array.toArray( EMPTY ) ); #else objectClass.setMustListIds( EMPTY ); #end // set may list #if ( $objectClass.getMay() ) array.clear(); #foreach ( $id in $objectClass.getMay() ) array.add( "$id" ); #end objectClass.setMayListIds( ( String[] ) array.toArray( EMPTY ) ); #else objectClass.setMayListIds( EMPTY ); #end // set names #if ( $objectClass.getNames() ) array.clear(); #foreach ( $id in $objectClass.getNames() ) array.add( "$id" ); #end objectClass.setNames( ( String[] ) array.toArray( EMPTY ) ); #else objectClass.setNames( EMPTY ); #end cb.schemaObjectProduced( this, "$objectClass.getOid()", objectClass ); #end } }