You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2009/05/16 18:01:38 UTC

svn commit: r775490 - in /directory/apacheds/trunk/core-plugin/src/main/resources/org/apache/directory/server/core/tools/schema: ObjectClasses.template Schema.template typeless.template

Author: elecharny
Date: Sat May 16 16:01:37 2009
New Revision: 775490

URL: http://svn.apache.org/viewvc?rev=775490&view=rev
Log:
Improved the code generation for OC, schema and other elements, adding the ASF header, the class header and some javadoc + comments

Modified:
    directory/apacheds/trunk/core-plugin/src/main/resources/org/apache/directory/server/core/tools/schema/ObjectClasses.template
    directory/apacheds/trunk/core-plugin/src/main/resources/org/apache/directory/server/core/tools/schema/Schema.template
    directory/apacheds/trunk/core-plugin/src/main/resources/org/apache/directory/server/core/tools/schema/typeless.template

Modified: directory/apacheds/trunk/core-plugin/src/main/resources/org/apache/directory/server/core/tools/schema/ObjectClasses.template
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-plugin/src/main/resources/org/apache/directory/server/core/tools/schema/ObjectClasses.template?rev=775490&r1=775489&r2=775490&view=diff
==============================================================================
--- directory/apacheds/trunk/core-plugin/src/main/resources/org/apache/directory/server/core/tools/schema/ObjectClasses.template (original)
+++ directory/apacheds/trunk/core-plugin/src/main/resources/org/apache/directory/server/core/tools/schema/ObjectClasses.template Sat May 16 16:01:37 2009
@@ -17,19 +17,38 @@
  *  under the License. 
  *  
  *#
+/*
+ *  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.ObjectClassTypeEnum;
-import org.apache.directory.server.schema.registries.*;
+import org.apache.directory.server.schema.registries.Registries;
 
 #if ( $package != "org.apache.directory.server.schema.bootstrap" )
 import org.apache.directory.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
@@ -37,7 +56,7 @@
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
- *#
+ */
 public class $classname extends AbstractBootstrapProducer
 {
 
@@ -47,22 +66,21 @@
     }
 
 
-    ## ------------------------------------------------------------------------
-    ## BootstrapProducer Methods
-    ## ------------------------------------------------------------------------
+    // ------------------------------------------------------------------------
+    // BootstrapProducer Methods
+    // ------------------------------------------------------------------------
 
 
-    #**
+    /**
      * @see BootstrapProducer#produce(Registries, ProducerCallback)
-     *#
+     */
     public void produce( Registries registries, ProducerCallback cb )
         throws NamingException
     {
         ArrayList<String> array = new ArrayList<String>();
         BootstrapObjectClass objectClass;
 
-        #foreach ( $objectClass in $objectClasses )
-
+#foreach ( $objectClass in $objectClasses )
         // --------------------------------------------------------------------
         // ObjectClass $objectClass.getOid() $!objectClass.getName()
         // --------------------------------------------------------------------
@@ -70,59 +88,63 @@
         objectClass = newObjectClass( "$objectClass.getOid()", registries );
         objectClass.setObsolete( $objectClass.isObsolete() );
 
-        #if ( $objectClass.getDescription() )
+#if ( $objectClass.getDescription() )
 #set( $desc = $objectClass.getDescription().replaceAll("\"", "\\\"") )
-objectClass.setDescription( "$desc" );
-        #end
-// set the objectclass type
-        #if ( $objectClass.getClassType().getValue() == 0 )
-objectClass.setType( ObjectClassTypeEnum.ABSTRACT );
-        #elseif ( $objectClass.getClassType().getValue() == 1 )
-objectClass.setType( ObjectClassTypeEnum.AUXILIARY );
-        #elseif ( $objectClass.getClassType().getValue() == 2 )
-objectClass.setType( ObjectClassTypeEnum.STRUCTURAL );
-        #end
+        objectClass.setDescription( "$desc" );
+#end
+        // set the objectclass type
+#if ( $objectClass.getClassType().getValue() == 0 )
+        objectClass.setType( ObjectClassTypeEnum.ABSTRACT );
+#elseif ( $objectClass.getClassType().getValue() == 1 )
+        objectClass.setType( ObjectClassTypeEnum.AUXILIARY );
+#elseif ( $objectClass.getClassType().getValue() == 2 )
+        objectClass.setType( ObjectClassTypeEnum.STRUCTURAL );
+#end
 
         // set superior objectClasses
-        #if ( $objectClass.getSuperiors() )
-array.clear();
-       #foreach ( $id in $objectClass.getSuperiors() ) array.add( "$id" );
-       #end
- objectClass.setSuperClassIds( array.toArray( EMPTY ) );
-        #else
- objectClass.setSuperClassIds( EMPTY );
-        #end
+#if ( $objectClass.getSuperiors() )
+        array.clear();
+#foreach ( $id in $objectClass.getSuperiors() ) 
+        array.add( "$id" );
+#end
+        objectClass.setSuperClassIds( 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( array.toArray( EMPTY ) );
-        #else
- objectClass.setMustListIds( EMPTY );
-        #end
+#if ( $objectClass.getMust() )
+        array.clear();
+#foreach ( $id in $objectClass.getMust() )
+        array.add( "$id" );
+#end
+        objectClass.setMustListIds( 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( array.toArray( EMPTY ) );
-        #else
- objectClass.setMayListIds( EMPTY );
-        #end
+#if ( $objectClass.getMay() )
+        array.clear();
+#foreach ( $id in $objectClass.getMay() ) 
+        array.add( "$id" );
+#end
+        objectClass.setMayListIds( 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( array.toArray( EMPTY ) );
-        #else
- objectClass.setNames( EMPTY );
-        #end
-cb.schemaObjectProduced( this, "$objectClass.getOid()", objectClass );
-
- #end   }
+#if ( $objectClass.getNames() )
+        array.clear();
+#foreach ( $id in $objectClass.getNames() ) 
+        array.add( "$id" );
+#end
+        objectClass.setNames( array.toArray( EMPTY ) );
+#else
+        objectClass.setNames( EMPTY );
+#end
+        cb.schemaObjectProduced( this, "$objectClass.getOid()", objectClass );
+#end
+    }
 }

Modified: directory/apacheds/trunk/core-plugin/src/main/resources/org/apache/directory/server/core/tools/schema/Schema.template
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-plugin/src/main/resources/org/apache/directory/server/core/tools/schema/Schema.template?rev=775490&r1=775489&r2=775490&view=diff
==============================================================================
--- directory/apacheds/trunk/core-plugin/src/main/resources/org/apache/directory/server/core/tools/schema/Schema.template (original)
+++ directory/apacheds/trunk/core-plugin/src/main/resources/org/apache/directory/server/core/tools/schema/Schema.template Sat May 16 16:01:37 2009
@@ -17,6 +17,25 @@
  *  under the License. 
  *  
  *#
+/*
+ *  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;
 
 
@@ -27,13 +46,13 @@
 #end
 
 
-#**
+/**
  * Top level $schema schema class.  This code has been automatically generated
  * using the directory plugin for maven.
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
- *#
+ */
 public class $classname extends AbstractBootstrapSchema
 {
     public $classname()
@@ -41,12 +60,12 @@
         super( "$owner", "$schema", "$package" );
 
         ArrayList<String> list = new ArrayList<String>();
-        #if ( $deps )
-list.clear();
-       #foreach ( $name in $deps ) list.add( "$name" );
-       #end
- setDependencies( list.toArray( DEFAULT_DEPS ) );#else
- setDependencies( DEFAULT_DEPS );#end
-
+#if ( $deps )
+        list.clear();
+#foreach ( $name in $deps ) 
+        list.add( "$name" );
+#end
+        setDependencies( list.toArray( DEFAULT_DEPS ) );#else
+        setDependencies( DEFAULT_DEPS );#end
     }
 }

Modified: directory/apacheds/trunk/core-plugin/src/main/resources/org/apache/directory/server/core/tools/schema/typeless.template
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-plugin/src/main/resources/org/apache/directory/server/core/tools/schema/typeless.template?rev=775490&r1=775489&r2=775490&view=diff
==============================================================================
--- directory/apacheds/trunk/core-plugin/src/main/resources/org/apache/directory/server/core/tools/schema/typeless.template (original)
+++ directory/apacheds/trunk/core-plugin/src/main/resources/org/apache/directory/server/core/tools/schema/typeless.template Sat May 16 16:01:37 2009
@@ -17,18 +17,37 @@
  *  under the License. 
  *  
  *#
+/*
+ *  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 javax.naming.NamingException;
-import org.apache.directory.server.schema.registries.*;
+import org.apache.directory.server.schema.registries.Registries;
 
 #if ( $package != "org.apache.directory.server.schema.bootstrap" )
 import org.apache.directory.server.schema.bootstrap.*;
 #end
 
 
-#**
+/**
  * A producer of $type objects 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
@@ -36,7 +55,7 @@
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
- *#
+ */
 public class $classname extends AbstractBootstrapProducer
 {
     public $classname()
@@ -45,14 +64,14 @@
     }
 
 
-    ## ------------------------------------------------------------------------
-    ## BootstrapProducer Methods
-    ## ------------------------------------------------------------------------
+    // ------------------------------------------------------------------------
+    // BootstrapProducer Methods
+    // ------------------------------------------------------------------------
 
 
-    #**
+    /**
      * @see BootstrapProducer#produce(Registries, ProducerCallback)
-     *#
+     */
     public void produce( Registries registries, ProducerCallback cb )
         throws NamingException
     {