| #* |
| * Licensed to the Apache Software Foundation (ASF) under one |
| * or more contributor license agreements. See the NOTICE file |
| * distributed with this work for additional information |
| * regarding copyright ownership. The ASF licenses this file |
| * to you 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.directory.shared.ldap.schema.*; |
| import org.apache.directory.server.schema.registries.*; |
| |
| #if ( $package != "org.apache.directory.server.schema.bootstrap" ) |
| import org.apache.directory.server.schema.bootstrap.*; |
| #end |
| |
| #** |
| * A producer of schema attributeType 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 Eve<->OpenLDAP schema interoperability. |
| * |
| * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a> |
| * @version $Rev$ |
| *# |
| public class $classname extends AbstractBootstrapProducer |
| { |
| |
| public $classname() |
| { |
| super( ProducerTypeEnum.ATTRIBUTE_TYPE_PRODUCER ); |
| } |
| |
| |
| ## ------------------------------------------------------------------------ |
| ## BootstrapProducer Methods |
| ## ------------------------------------------------------------------------ |
| |
| |
| #** |
| * @see BootstrapProducer#produce( Registries, ProducerCallback ) |
| *# |
| public void produce( Registries registries, ProducerCallback cb ) |
| throws NamingException |
| { |
| ArrayList<String> names = new ArrayList<String>(); |
| BootstrapAttributeType attributeType; |
| |
| #foreach ( $attrType in $attrTypes ) |
| |
| ## -------------------------------------------------------------------- |
| ## AttributeType $attrType.getOid() $!attrType.getName() |
| ## -------------------------------------------------------------------- |
| |
| attributeType = newAttributeType( "$attrType.getOid()", registries ); |
| #if ( $attrType.getDescription() ) |
| #set( $desc = $attrType.getDescription().replaceAll("\"", "\\\"") ) |
| attributeType.setDescription( "$desc" ); |
| #end |
| attributeType.setCanUserModify( ! $attrType.isNoUserModification() ); |
| attributeType.setSingleValue( $attrType.isSingleValue() ); |
| attributeType.setCollective( $attrType.isCollective() ); |
| attributeType.setObsolete( $attrType.isObsolete() ); |
| attributeType.setLength( $attrType.getLength() ); |
| attributeType.setUsage( UsageEnum.getUsage( "$attrType.getUsage()" ) ); |
| #if ( $attrType.getSuperior() ) attributeType.setSuperiorId( "$attrType.getSuperior()" ); #end |
| #if ( $attrType.getEquality() ) attributeType.setEqualityId( "$attrType.getEquality()" ); |
| #end |
| #if ( $attrType.getSubstr() ) attributeType.setSubstrId( "$attrType.getSubstr()" );#end |
| #if ( $attrType.getOrdering() ) attributeType.setOrderingId( "$attrType.getOrdering()" );#end |
| #if ( $attrType.getSyntax() ) attributeType.setSyntaxId( "$attrType.getSyntax()" );#end |
| |
| #if ( $attrType.getNames() ) |
| names.clear(); |
| #foreach ( $name in $attrType.getNames() ) names.add( "$name" ); |
| #end |
| attributeType.setNames( names.toArray( EMPTY ) ); |
| #else |
| attributeType.setNames( EMPTY ); |
| #end |
| cb.schemaObjectProduced( this, "$attrType.getOid()", attributeType ); |
| |
| #end } |
| } |