You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-dev@db.apache.org by tf...@apache.org on 2011/07/19 15:57:05 UTC

svn commit: r1148326 - in /db/torque/torque4/trunk/torque-generator: ./ src/main/java/org/apache/torque/generator/configuration/ src/main/java/org/apache/torque/generator/configuration/outlet/ src/test/java/org/apache/torque/generator/configuration/out...

Author: tfischer
Date: Tue Jul 19 13:57:01 2011
New Revision: 1148326

URL: http://svn.apache.org/viewvc?rev=1148326&view=rev
Log:
Ease implementation of other template languages, and added a test case using groovy

Added:
    db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/outlet/ReflectionOutletSaxHandlerFactory.java
    db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/outlet/TypedOutletSaxHandlerFactory.java
      - copied, changed from r1004554, db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/outlet/OutletSaxHandlerFactory.java
    db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/outlet/UntypedOutletSaxHandlerFactory.java
    db/torque/torque4/trunk/torque-generator/src/test/java/org/apache/torque/generator/configuration/outlet/GroovyOutletSaxHandler.java
    db/torque/torque4/trunk/torque-generator/src/test/java/org/apache/torque/generator/configuration/outlet/OtherTemplateLanguageTest.java
    db/torque/torque4/trunk/torque-generator/src/test/java/org/apache/torque/generator/template/groovy/
    db/torque/torque4/trunk/torque-generator/src/test/java/org/apache/torque/generator/template/groovy/GroovyOutlet.java
    db/torque/torque4/trunk/torque-generator/src/test/otherTemplateLanguages/
    db/torque/torque4/trunk/torque-generator/src/test/otherTemplateLanguages/groovyOutlet.xsd
    db/torque/torque4/trunk/torque-generator/src/test/otherTemplateLanguages/src/
    db/torque/torque4/trunk/torque-generator/src/test/otherTemplateLanguages/src/main/
    db/torque/torque4/trunk/torque-generator/src/test/otherTemplateLanguages/src/main/torque-gen/
    db/torque/torque4/trunk/torque-generator/src/test/otherTemplateLanguages/src/main/torque-gen/conf/
    db/torque/torque4/trunk/torque-generator/src/test/otherTemplateLanguages/src/main/torque-gen/conf/control.xml
    db/torque/torque4/trunk/torque-generator/src/test/otherTemplateLanguages/src/main/torque-gen/outlets/
    db/torque/torque4/trunk/torque-generator/src/test/otherTemplateLanguages/src/main/torque-gen/outlets/outlets.xml
    db/torque/torque4/trunk/torque-generator/src/test/otherTemplateLanguages/src/main/torque-gen/src/
    db/torque/torque4/trunk/torque-generator/src/test/otherTemplateLanguages/src/main/torque-gen/src/source.xml
    db/torque/torque4/trunk/torque-generator/src/test/otherTemplateLanguages/src/main/torque-gen/templates/
    db/torque/torque4/trunk/torque-generator/src/test/otherTemplateLanguages/src/main/torque-gen/templates/template.groovy
Removed:
    db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/outlet/OutletSaxHandlerFactory.java
Modified:
    db/torque/torque4/trunk/torque-generator/pom.xml
    db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/OutletTypes.java
    db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/outlet/JavaOutletSaxHandlerFactory.java
    db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/outlet/OutletConfigurationSaxHandler.java
    db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/outlet/VelocityOutletSaxHandlerFactory.java

Modified: db/torque/torque4/trunk/torque-generator/pom.xml
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/pom.xml?rev=1148326&r1=1148325&r2=1148326&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-generator/pom.xml (original)
+++ db/torque/torque4/trunk/torque-generator/pom.xml Tue Jul 19 13:57:01 2011
@@ -99,6 +99,11 @@
       <version>10.5.3.0_1</version>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>org.codehaus.groovy</groupId>
+      <artifactId>groovy-all</artifactId>
+      <version>1.6.0</version>
+    </dependency>
   </dependencies>
 
   <build>

Modified: db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/OutletTypes.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/OutletTypes.java?rev=1148326&r1=1148325&r2=1148326&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/OutletTypes.java (original)
+++ db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/OutletTypes.java Tue Jul 19 13:57:01 2011
@@ -19,12 +19,16 @@ package org.apache.torque.generator.conf
  * under the License.
  */
 
+import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 
 import org.apache.torque.generator.configuration.outlet.JavaOutletSaxHandlerFactory;
-import org.apache.torque.generator.configuration.outlet.OutletSaxHandlerFactory;
+import org.apache.torque.generator.configuration.outlet.ReflectionOutletSaxHandlerFactory;
+import org.apache.torque.generator.configuration.outlet.TypedOutletSaxHandlerFactory;
+import org.apache.torque.generator.configuration.outlet.UntypedOutletSaxHandlerFactory;
 import org.apache.torque.generator.configuration.outlet.VelocityOutletSaxHandlerFactory;
 
 /**
@@ -34,12 +38,19 @@ import org.apache.torque.generator.confi
 public class OutletTypes
 {
     /**
-     * A map containing all known OutletSaxHandlerFactories,
+     * A map containing all typed OutletSaxHandlerFactories,
      * keyed by the type of the outlet.
      */
-    private Map<String, OutletSaxHandlerFactory>
-        outletHandlerFactories
-            = new HashMap<String, OutletSaxHandlerFactory>();
+    private Map<String, TypedOutletSaxHandlerFactory>
+        typedOutletHandlerFactories
+            = new HashMap<String, TypedOutletSaxHandlerFactory>();
+
+    /**
+     * A List containing all untyped OutletSaxHandlerFactories.
+     */
+    private List<UntypedOutletSaxHandlerFactory>
+        untypedOutletHandlerFactories
+            = new ArrayList<UntypedOutletSaxHandlerFactory>();
 
     /**
      * Constructor. Creates a new instance containing the mappings to the
@@ -47,13 +58,15 @@ public class OutletTypes
      */
     public OutletTypes()
     {
-        // register default outlet types
+        // register default outlet handler factories
         try
         {
-            registerOutletHandlerFactory(
+            registerTypedOutletHandlerFactory(
                     new VelocityOutletSaxHandlerFactory());
-            registerOutletHandlerFactory(
+            registerTypedOutletHandlerFactory(
                     new JavaOutletSaxHandlerFactory());
+            registerUntypedOutletHandlerFactory(
+                    new ReflectionOutletSaxHandlerFactory());
         }
         catch (ConfigurationException e)
         {
@@ -72,16 +85,17 @@ public class OutletTypes
      * @throws ConfigurationException if a factory already exists
      *          for the type of the outlet.
      */
-    public void registerOutletHandlerFactory(
-            OutletSaxHandlerFactory factory)
+    public void registerTypedOutletHandlerFactory(
+            TypedOutletSaxHandlerFactory factory)
         throws ConfigurationException
     {
         if (factory == null)
         {
             throw new NullPointerException("factory must not be null");
         }
-        OutletSaxHandlerFactory oldFactory
-            = outletHandlerFactories.get(factory.getType());
+        String type = factory.getType();
+        TypedOutletSaxHandlerFactory oldFactory
+            = typedOutletHandlerFactories.get(type);
         if (oldFactory != null)
         {
             throw new ConfigurationException(
@@ -94,18 +108,50 @@ public class OutletTypes
                         + " it has the class "
                         + oldFactory.getClass().getName());
         }
-        outletHandlerFactories.put(factory.getType(), factory);
+        typedOutletHandlerFactories.put(factory.getType(), factory);
+    }
+
+    /**
+     * Registers a untyped handler.
+     *
+     * @param factory the factory which can handle outlets of different types
+     *
+     * @throws NullPointerException if factory is null.
+     * @throws ConfigurationException if a factory already exists
+     *          for the type of the outlet.
+     */
+    public void registerUntypedOutletHandlerFactory(
+            UntypedOutletSaxHandlerFactory factory)
+        throws ConfigurationException
+    {
+        if (factory == null)
+        {
+            throw new NullPointerException("factory must not be null");
+        }
+        untypedOutletHandlerFactories.add(factory);
     }
 
     /**
-     * Returns an unmodifiable  map containing all the outlet handler
+     * Returns an unmodifiable map containing all typed outlet handler
      * factories, keyed by their type.
      *
-     * @return all outlet handler factories, not null.
+     * @return all typed outlet handler factories, not null.
+     */
+    public Map<String, TypedOutletSaxHandlerFactory>
+        getTypedOutletHandlerFactories()
+    {
+        return Collections.unmodifiableMap(typedOutletHandlerFactories);
+    }
+
+    /**
+     * Returns an unmodifiable list containing all untyped outlet handler
+     * factories.
+     *
+     * @return all untyped outlet handler factories, not null.
      */
-    public Map<String, OutletSaxHandlerFactory>
-        getOutletHandlerFactories()
+    public List<UntypedOutletSaxHandlerFactory>
+        getUntypedOutletHandlerFactories()
     {
-        return Collections.unmodifiableMap(outletHandlerFactories);
+        return Collections.unmodifiableList(untypedOutletHandlerFactories);
     }
 }

Modified: db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/outlet/JavaOutletSaxHandlerFactory.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/outlet/JavaOutletSaxHandlerFactory.java?rev=1148326&r1=1148325&r2=1148326&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/outlet/JavaOutletSaxHandlerFactory.java (original)
+++ db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/outlet/JavaOutletSaxHandlerFactory.java Tue Jul 19 13:57:01 2011
@@ -29,7 +29,7 @@ import org.xml.sax.SAXException;
  * Creates Java outlet SAX handlers.
  */
 public class JavaOutletSaxHandlerFactory
-        implements OutletSaxHandlerFactory
+        implements TypedOutletSaxHandlerFactory
 {
     /**
      * The type of the outlets which can be processed by the

Modified: db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/outlet/OutletConfigurationSaxHandler.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/outlet/OutletConfigurationSaxHandler.java?rev=1148326&r1=1148325&r2=1148326&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/outlet/OutletConfigurationSaxHandler.java (original)
+++ db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/outlet/OutletConfigurationSaxHandler.java Tue Jul 19 13:57:01 2011
@@ -32,6 +32,7 @@ import org.apache.commons.logging.LogFac
 import org.apache.torque.generator.configuration.ConfigurationEntityResolver;
 import org.apache.torque.generator.configuration.ConfigurationHandlers;
 import org.apache.torque.generator.configuration.ConfigurationProvider;
+import org.apache.torque.generator.configuration.OutletTypes;
 import org.apache.torque.generator.configuration.SaxHelper;
 import org.apache.torque.generator.configuration.XMLConstants;
 import org.apache.torque.generator.configuration.mergepoint.MergepointMapping;
@@ -270,18 +271,50 @@ public class OutletConfigurationSaxHandl
             String outletType)
         throws SAXException
     {
-        OutletSaxHandlerFactory delegateHandlerFactory
-                = configurationHandlers.getOutletTypes()
-                    .getOutletHandlerFactories()
-                    .get(outletType);
-        if (delegateHandlerFactory == null)
+        OutletTypes outletTypes = configurationHandlers.getOutletTypes();
+        TypedOutletSaxHandlerFactory typedHandlerFactory
+                = outletTypes.getTypedOutletHandlerFactories().get(outletType);
+        if (typedHandlerFactory != null)
+        {
+            OutletSaxHandler outletSaxHandler
+                    = typedHandlerFactory.getOutletSaxHandler(
+                            outletName,
+                            configurationProvider,
+                            projectPaths,
+                            configurationHandlers);
+            return outletSaxHandler;
+        }
+        UntypedOutletSaxHandlerFactory untypedHandlerFactory = null;
+        for (UntypedOutletSaxHandlerFactory candidate
+                : outletTypes.getUntypedOutletHandlerFactories())
+        {
+            if (! (candidate instanceof 
+                    UntypedOutletSaxHandlerFactory))
+            {
+                throw new SAXException(
+                        "OutletSaxHandlerFactory of type " 
+                            + candidate.getClass()
+                                .getName()
+                            + " has returned null as type but is not"
+                            + " of type UntypedOutletSaxHandlerFactory;"
+                            + " this is an error.");
+            }
+            if (((UntypedOutletSaxHandlerFactory) candidate).canHandle(
+                    outletType))
+            {
+                untypedHandlerFactory = candidate;
+                break;
+            }
+        }
+        if (untypedHandlerFactory == null)
         {
             throw new SAXException(
                     "Unknown outlet type: "
                         + outletType);
         }
         OutletSaxHandler outletSaxHandler
-                = delegateHandlerFactory.getOutletSaxHandler(
+                = untypedHandlerFactory.getOutletSaxHandler(
+                        outletType,
                         outletName,
                         configurationProvider,
                         projectPaths,

Added: db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/outlet/ReflectionOutletSaxHandlerFactory.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/outlet/ReflectionOutletSaxHandlerFactory.java?rev=1148326&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/outlet/ReflectionOutletSaxHandlerFactory.java (added)
+++ db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/outlet/ReflectionOutletSaxHandlerFactory.java Tue Jul 19 13:57:01 2011
@@ -0,0 +1,228 @@
+package org.apache.torque.generator.configuration.outlet;
+
+/*
+ * 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.
+ */
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.torque.generator.configuration.ConfigurationHandlers;
+import org.apache.torque.generator.configuration.ConfigurationProvider;
+import org.apache.torque.generator.configuration.paths.ProjectPaths;
+import org.apache.torque.generator.qname.QualifiedName;
+import org.xml.sax.SAXException;
+
+/**
+ * Creates outlet SAX handlers using reflection and a naming convention.
+ */
+public class ReflectionOutletSaxHandlerFactory
+        implements UntypedOutletSaxHandlerFactory
+{
+    /**
+     * The suffix for SAX handler class names.
+     */
+    private static final String SAX_HANDLER_CLASSNAME_SUFFIX 
+        = "SaxHandler";
+    
+    /**
+     * The default package for SAX handler class names.
+     */
+    private static final String DEFAULT_PACKAGE 
+        = "org.apache.torque.generator.configuration.outlet";
+
+    /** The class log. */
+    private static Log log = LogFactory.getLog(
+            ReflectionOutletSaxHandlerFactory.class);
+    
+    /**
+     * The package for the handler class.
+     */
+    private String saxHandlerPackage = DEFAULT_PACKAGE;
+
+    /**
+     * Creates a ReflectionOutletSaxHandlerFactory with the default 
+     * sax handler package.
+     */
+    public ReflectionOutletSaxHandlerFactory()
+    {
+    }
+
+    /**
+     * Creates a ReflectionOutletSaxHandlerFactory with the default 
+     * sax handler package.
+     * 
+     * @param saxHandlerPackage the package where the Sax handlers reside.
+     */
+    public ReflectionOutletSaxHandlerFactory(String saxHandlerPackage)
+    {
+        this.saxHandlerPackage = saxHandlerPackage;
+    }
+
+    /**
+     * Returns the outlet type which can be handled by the
+     * OutletSaxHandlers created by this factory.
+     *
+     * @return null.
+     */
+    public String getType()
+    {
+        return null;
+    }
+
+    /**
+     * Returns a OutletSaxHandler for reading the configuration of
+     * the outlet. This implementation uses the provided name
+     * as outlet name.
+     *
+     * @param outletType the type of the outlet, not null.
+     * @param outletName the name for the outlet which configuration
+     *        will be read in by the generated SaxHandlerFactory,
+     *        or null if the name of the outlet should be determined from
+     *        the parsed XML.
+     * @param configurationProvider The access object for the configuration
+     *        files, not null.
+     * @param projectPaths The paths of the surrounding project, not null.
+     * @param configurationHandlers the available configuration handlers,
+     *        not null.
+     *
+     * @return a new VelocityOutletSaxHandler.
+     */
+    public final OutletSaxHandler getOutletSaxHandler(
+            String outletType,
+            QualifiedName outletName,
+            ConfigurationProvider configurationProvider,
+            ProjectPaths projectPaths,
+            ConfigurationHandlers configurationHandlers)
+         throws SAXException
+    {
+        String fullyQualifiedSaxHandlerName 
+                = getFullyQualifiedHandlerClassName(outletType);
+
+        Class<?> handlerClass;
+        try
+        {
+            handlerClass = Class.forName(fullyQualifiedSaxHandlerName);
+        } 
+        catch (ClassNotFoundException e)
+        {
+           // should not happen, because otherwise canHandle() would not 
+            // have returned true
+            throw new RuntimeException(e);
+        }
+
+        Constructor<?> constructor;
+        try
+        {
+            constructor = handlerClass.getConstructor(
+                QualifiedName.class,
+                ConfigurationProvider.class,
+                ProjectPaths.class,
+                ConfigurationHandlers.class);
+        }
+        catch (NoSuchMethodException e)
+        {
+            throw new SAXException("Class " + handlerClass.getName()
+                    + " has no constructor for types "
+                    + QualifiedName.class.getName() + ","
+                    + ConfigurationProvider.class.getName() + ","
+                    + ProjectPaths.class.getName() + ","
+                    + ConfigurationHandlers.class.getName());
+        }
+
+        OutletSaxHandler outletSaxHandler;
+        try
+        {
+            outletSaxHandler = (OutletSaxHandler) constructor.newInstance(
+                    outletName,
+                    configurationProvider,
+                    projectPaths,
+                    configurationHandlers);
+        } 
+        catch (IllegalArgumentException e)
+        {
+            // should not happen, we have checked arguments before
+            throw new RuntimeException(e);
+        }
+        catch (InstantiationException e)
+        {
+            throw new SAXException("The class " 
+                    + handlerClass.getName() + " is abstract",
+                e);
+        }
+        catch (IllegalAccessException e)
+        {
+            throw new SAXException("Constructor of class " 
+                    + handlerClass.getName() + " is inaccessible",
+                e);
+        }
+        catch (InvocationTargetException e)
+        {
+            throw new SAXException("Constructor of class " 
+                    + handlerClass.getName() + " has thrown an exception",
+                    e);
+        }
+         return outletSaxHandler;
+    }
+
+    public boolean canHandle(String type)
+    {
+        String fullyQualifiedSaxHandlerName 
+                = getFullyQualifiedHandlerClassName(type);
+        log.debug("canHandle: Using class name " 
+                + fullyQualifiedSaxHandlerName);
+
+        Class<?> handlerClass;
+        try
+        {
+            handlerClass = Class.forName(fullyQualifiedSaxHandlerName);
+        } 
+        catch (ClassNotFoundException e)
+        {
+            log.debug("canHandle: class does not exist, returning false");
+            return false;
+        }
+        if (! OutletSaxHandler.class.isAssignableFrom(handlerClass))
+        {
+            log.debug("canHandle: class is no OutletSaxHandler" 
+                    + "returning false");
+            return false;
+        }
+        return true;
+    }
+
+    /**
+     * Returns the fully qualified class name of the handler class
+     * for a given type.
+     * 
+     * @param type the type to determine the handler for.
+     * 
+     * @return the fully qualified class name, not null.
+     */
+    protected String getFullyQualifiedHandlerClassName(String type)
+    {
+        String saxHandlerClassName = StringUtils.capitalize(type)
+                + SAX_HANDLER_CLASSNAME_SUFFIX;
+        String fullyQualifiedSaxHandlerName = saxHandlerPackage + "." 
+                + saxHandlerClassName;
+        return fullyQualifiedSaxHandlerName;
+    }
+}

Copied: db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/outlet/TypedOutletSaxHandlerFactory.java (from r1004554, db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/outlet/OutletSaxHandlerFactory.java)
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/outlet/TypedOutletSaxHandlerFactory.java?p2=db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/outlet/TypedOutletSaxHandlerFactory.java&p1=db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/outlet/OutletSaxHandlerFactory.java&r1=1004554&r2=1148326&rev=1148326&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/outlet/OutletSaxHandlerFactory.java (original)
+++ db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/outlet/TypedOutletSaxHandlerFactory.java Tue Jul 19 13:57:01 2011
@@ -29,7 +29,7 @@ import org.xml.sax.SAXException;
  * Classes implementing this interface are responsible for creating
  * <code>OutletSaxHandler</code>s for a specific outlet type.
  */
-public abstract interface OutletSaxHandlerFactory
+public abstract interface TypedOutletSaxHandlerFactory
 {
     /**
      * Returns the outlet type handled by the OutletSaxHandlers which are

Added: db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/outlet/UntypedOutletSaxHandlerFactory.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/outlet/UntypedOutletSaxHandlerFactory.java?rev=1148326&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/outlet/UntypedOutletSaxHandlerFactory.java (added)
+++ db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/outlet/UntypedOutletSaxHandlerFactory.java Tue Jul 19 13:57:01 2011
@@ -0,0 +1,72 @@
+package org.apache.torque.generator.configuration.outlet;
+
+import org.apache.torque.generator.configuration.ConfigurationHandlers;
+import org.apache.torque.generator.configuration.ConfigurationProvider;
+import org.apache.torque.generator.configuration.paths.ProjectPaths;
+import org.apache.torque.generator.qname.QualifiedName;
+import org.xml.sax.SAXException;
+
+/*
+ * 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.
+ */
+
+
+/**
+ * Classes implementing this interface can create creating
+ * <code>OutletSaxHandler</code>s for more than one outlet type.
+ */
+public abstract interface UntypedOutletSaxHandlerFactory
+{
+    /**
+     * Returns whether the handler can create OutletSaxHandlers for the given
+     * type.
+     *
+     * @return true if the type is supported, false if not.
+     */
+    boolean canHandle(String type);
+
+    /**
+     * Returns a OutletSaxHandler for reading in the configuration of
+     * a outlet. The SAX Handler is used as a delegate handler
+     * whenever a outlet element with the matching type
+     * is encountered in a outlet configuration file.
+     *
+     * @param outletType the type of the outlet, not null.
+     * @param outletName the name for the outlet which configuration
+     *        will be read in by the generated SaxHandlerFactory,
+     *        or null if the name of the outlet should be determined from
+     *        the parsed XML.
+     * @param configurationProvider The access object for the configuration
+     *        files, not null.
+     * @param projectPaths The paths of the surrounding project, not null.
+     * @param configurationHandlers the available configuration handlers,
+     *        not null.
+     *
+     * @return a SAX delegate handler for parsing the configuration with the
+     *           given type.
+     * @throws SAXException if the SAX Handler for the outlet can
+     *           not be created from the given XML element.
+     */
+    OutletSaxHandler getOutletSaxHandler(
+            String outletType,
+            QualifiedName outletName,
+            ConfigurationProvider configurationProvider,
+            ProjectPaths projectPaths,
+            ConfigurationHandlers configurationHandlers)
+        throws SAXException;
+}

Modified: db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/outlet/VelocityOutletSaxHandlerFactory.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/outlet/VelocityOutletSaxHandlerFactory.java?rev=1148326&r1=1148325&r2=1148326&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/outlet/VelocityOutletSaxHandlerFactory.java (original)
+++ db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/outlet/VelocityOutletSaxHandlerFactory.java Tue Jul 19 13:57:01 2011
@@ -29,7 +29,7 @@ import org.xml.sax.SAXException;
  * Creates Velocity outlet SAX handlers.
  */
 public class VelocityOutletSaxHandlerFactory
-        implements OutletSaxHandlerFactory
+        implements TypedOutletSaxHandlerFactory
 {
     /**
      * The type of the outlets which can be processed by the

Added: db/torque/torque4/trunk/torque-generator/src/test/java/org/apache/torque/generator/configuration/outlet/GroovyOutletSaxHandler.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/test/java/org/apache/torque/generator/configuration/outlet/GroovyOutletSaxHandler.java?rev=1148326&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/test/java/org/apache/torque/generator/configuration/outlet/GroovyOutletSaxHandler.java (added)
+++ db/torque/torque4/trunk/torque-generator/src/test/java/org/apache/torque/generator/configuration/outlet/GroovyOutletSaxHandler.java Tue Jul 19 13:57:01 2011
@@ -0,0 +1,129 @@
+package org.apache.torque.generator.configuration.outlet;
+
+/*
+ * 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.
+ */
+
+import static org.apache.torque.generator.configuration.outlet.OutletConfigurationTags.OUTLET_NAME_ATTRIBUTE;
+import static org.apache.torque.generator.configuration.outlet.OutletConfigurationTags.OUTLET_PATH_ATTRIBUTE;
+
+import org.apache.torque.generator.configuration.ConfigurationException;
+import org.apache.torque.generator.configuration.ConfigurationHandlers;
+import org.apache.torque.generator.configuration.ConfigurationProvider;
+import org.apache.torque.generator.configuration.paths.ProjectPaths;
+import org.apache.torque.generator.qname.QualifiedName;
+import org.apache.torque.generator.template.groovy.GroovyOutlet;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+/**
+ * Handles a declaration of a velocity outlet within a outlet
+ * configuration file.
+ */
+class GroovyOutletSaxHandler extends OutletSaxHandler
+{
+    /**
+     * Constructor.
+     *
+     * @param outletName the name for the outlet which configuration
+     *        will be read in by the generated SaxHandlerFactory,
+     *        or null if the name of the outlet should be determined from
+     *        the parsed XML.
+     * @param configurationProvider The access object for the configuration
+     *        files, not null.
+     * @param projectPaths The paths of the surrounding project, not null.
+     * @param configurationHandlers the available configuration handlers,
+     *        not null.
+     *
+     * @throws SAXException if an error occurs during creation of the outlet.
+     */
+    public GroovyOutletSaxHandler(
+            QualifiedName outletName,
+            ConfigurationProvider configurationProvider,
+            ProjectPaths projectPaths,
+            ConfigurationHandlers configurationHandlers)
+       throws SAXException
+    {
+        super(outletName,
+               configurationProvider,
+               projectPaths,
+               configurationHandlers);
+    }
+
+    /**
+     * Instantiates and configures a groovy outlet.
+     *
+     * @param outletName the name for the outlet which configuration
+     *        will be read in by the generated SaxHandlerFactory,
+     *        or null if the name of the outlet should be determined from
+     *        the parsed xml.
+     * @param uri - The Namespace URI, or the empty string if the
+     *        element has no Namespace URI or if Namespace processing is not
+     *        being performed.
+     * @param localName - The local name (without prefix), or
+     *        the empty string if Namespace processing is not being performed.
+     * @param rawName - The qualified name (with prefix), or the empty string if
+     *        qualified names are not available.
+     * @param attributes - The attributes attached to the element.
+     *          If there are no attributes, it shall be an empty Attributes
+     *          object.
+     *
+     * @return the created outlet, not null.
+     *
+     * @throws SAXException if an error occurs during creation.
+     */
+    protected GroovyOutlet createOutlet(
+            QualifiedName outletName,
+            String uri,
+            String localName,
+            String rawName,
+            Attributes attributes)
+        throws SAXException
+    {
+        if (outletName == null)
+        {
+            String nameAttribute
+                    = attributes.getValue(OUTLET_NAME_ATTRIBUTE);
+            if (nameAttribute == null)
+            {
+                throw new SAXException("The attribute "
+                        + OUTLET_NAME_ATTRIBUTE
+                        + " must be set on the element "
+                        + rawName
+                        + " for Groovy Outlets");
+            }
+            outletName = new QualifiedName(nameAttribute);
+        }
+
+        String path = attributes.getValue(OUTLET_PATH_ATTRIBUTE);
+
+        try
+        {
+            GroovyOutlet result
+                    = new GroovyOutlet(
+                        outletName,
+                        getConfigurationProvider(),
+                        path);
+            return result;
+        }
+        catch (ConfigurationException e)
+        {
+            throw new SAXException(e);
+        }
+    }
+}

Added: db/torque/torque4/trunk/torque-generator/src/test/java/org/apache/torque/generator/configuration/outlet/OtherTemplateLanguageTest.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/test/java/org/apache/torque/generator/configuration/outlet/OtherTemplateLanguageTest.java?rev=1148326&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/test/java/org/apache/torque/generator/configuration/outlet/OtherTemplateLanguageTest.java (added)
+++ db/torque/torque4/trunk/torque-generator/src/test/java/org/apache/torque/generator/configuration/outlet/OtherTemplateLanguageTest.java Tue Jul 19 13:57:01 2011
@@ -0,0 +1,82 @@
+package org.apache.torque.generator.configuration.outlet;
+
+/*
+ * 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.
+ */
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.torque.generator.configuration.UnitDescriptor;
+import org.apache.torque.generator.configuration.paths.CustomProjectPaths;
+import org.apache.torque.generator.configuration.paths.DefaultTorqueGeneratorPaths;
+import org.apache.torque.generator.configuration.paths.Maven2DirectoryProjectPaths;
+import org.apache.torque.generator.control.Controller;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Tests that another template language can easily integrated.
+ * 
+ * @version $Id: $
+ */
+public class OtherTemplateLanguageTest
+{
+    private static final File TARGET_DIR 
+            = new File("target/test/otherTemplateLanguages");
+
+    private static final File OUTPUT_FILE 
+            = new File(TARGET_DIR, "output.txt");
+
+    @Before
+    public void setUp() throws Exception
+    {
+        FileUtils.deleteDirectory(TARGET_DIR);
+    }
+
+    /**
+     * Tests that Groovy outlets can be used.
+     *
+     * @throws Exception if an error occurs.
+     */
+    @Test
+    public void testOtherTemplateLanguages() throws Exception
+    {
+        Controller controller = new Controller();
+        List<UnitDescriptor> unitDescriptors = new ArrayList<UnitDescriptor>();
+        CustomProjectPaths projectPaths = new CustomProjectPaths(
+                new Maven2DirectoryProjectPaths(
+                        new File("src/test/otherTemplateLanguages")));
+        projectPaths.setNewFileTargetDir(TARGET_DIR);
+        unitDescriptors.add(new UnitDescriptor(
+                UnitDescriptor.Packaging.DIRECTORY,
+                projectPaths,
+                new DefaultTorqueGeneratorPaths()));
+        controller.run(unitDescriptors);
+        // TODO: check outcome against reference file
+        assertTrue(OUTPUT_FILE.exists());
+        assertEquals(
+                "groovy test output",
+                FileUtils.readFileToString(OUTPUT_FILE));
+    }
+}

Added: db/torque/torque4/trunk/torque-generator/src/test/java/org/apache/torque/generator/template/groovy/GroovyOutlet.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/test/java/org/apache/torque/generator/template/groovy/GroovyOutlet.java?rev=1148326&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/test/java/org/apache/torque/generator/template/groovy/GroovyOutlet.java (added)
+++ db/torque/torque4/trunk/torque-generator/src/test/java/org/apache/torque/generator/template/groovy/GroovyOutlet.java Tue Jul 19 13:57:01 2011
@@ -0,0 +1,110 @@
+package org.apache.torque.generator.template.groovy;
+
+/*
+ * 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.
+ */
+
+import groovy.lang.Binding;
+import groovy.lang.GroovyShell;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.torque.generator.GeneratorException;
+import org.apache.torque.generator.configuration.ConfigurationException;
+import org.apache.torque.generator.configuration.ConfigurationProvider;
+import org.apache.torque.generator.control.ControllerState;
+import org.apache.torque.generator.qname.QualifiedName;
+import org.apache.torque.generator.template.TemplateOutletImpl;
+
+
+/**
+ * A Outlet which uses a groovy script for generation.
+ */
+public class GroovyOutlet extends TemplateOutletImpl
+{
+    /**
+     * The name under which the Torque generator interface will be put
+     * into the context.
+     */
+    public static final String TORQUE_GEN_CONTEXT_NAME = "torqueGen";
+
+    /** The log. */
+    private static Log log = LogFactory.getLog(GroovyOutlet.class);
+
+    /**
+     * Constructs a new GroovyOutlet.
+     *
+     * @param name the name of this outlet, not null.
+     * @param configurationProvider the provider for reading the templates,
+     *        not null.
+     * @param path the path to the templates, not null.
+     *
+     * @throws NullPointerException if name, path or directories are null.
+     * @throws ConfigurationException if an error occurs while reading the
+     *         template.
+     */
+    public GroovyOutlet(
+            QualifiedName name,
+            ConfigurationProvider configurationProvider,
+            String path)
+        throws ConfigurationException
+    {
+        super(name,
+              configurationProvider,
+              path,
+              null,
+              null);
+    }
+
+    /**
+     * Executes the generation process; the result is returned.
+     *
+     * @param controllerState the current controller state.
+     *
+     * @return the result of the generation, not null.
+     *
+     * @see org.apache.torque.generator.outlet.Outlet#execute(ControllerState)
+     */
+    @Override
+    public String execute(ControllerState controllerState)
+        throws GeneratorException
+
+    {
+        if (log.isDebugEnabled())
+        {
+            log.debug("Start executing GroovyOutlet " + getName());
+        }
+
+        try
+        {
+            Binding binding = new Binding();
+            GroovyShell shell = new GroovyShell(binding);
+
+            String result = (String) shell.evaluate(
+                    getContent(controllerState));
+            return result;
+        }
+        finally
+        {
+            if (log.isDebugEnabled())
+            {
+                log.debug("End executing GroovyOutlet " + getName());
+            }
+        }
+    }
+}

Added: db/torque/torque4/trunk/torque-generator/src/test/otherTemplateLanguages/groovyOutlet.xsd
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/test/otherTemplateLanguages/groovyOutlet.xsd?rev=1148326&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/test/otherTemplateLanguages/groovyOutlet.xsd (added)
+++ db/torque/torque4/trunk/torque-generator/src/test/otherTemplateLanguages/groovyOutlet.xsd Tue Jul 19 13:57:01 2011
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+
+<schema xmlns="http://www.w3.org/2001/XMLSchema" 
+    xmlns:configuration="http://db.apache.org/torque/4.0/generator/configuration"
+    targetNamespace="http://db.apache.org/torque/4.0/generator/configuration"
+    elementFormDefault="qualified"
+    attributeFormDefault="unqualified">
+
+  <include schemaLocation="http://db.apache.org/torque/4.0/generator/configuration.xsd"/>
+
+  <complexType name="groovyOutlet">
+    <complexContent>
+      <extension base="configuration:baseOutlet">
+        <attribute name="path" type="string" use="required"/>
+      </extension>
+    </complexContent>
+  </complexType>
+
+</schema>

Added: db/torque/torque4/trunk/torque-generator/src/test/otherTemplateLanguages/src/main/torque-gen/conf/control.xml
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/test/otherTemplateLanguages/src/main/torque-gen/conf/control.xml?rev=1148326&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/test/otherTemplateLanguages/src/main/torque-gen/conf/control.xml (added)
+++ db/torque/torque4/trunk/torque-generator/src/test/otherTemplateLanguages/src/main/torque-gen/conf/control.xml Tue Jul 19 13:57:01 2011
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+
+<control loglevel="debug"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://db.apache.org/torque/4.0/generator/configuration http://db.apache.org/torque/4.0/generator/configuration.xsd"
+    xmlns="http://db.apache.org/torque/4.0/generator/configuration">
+  <output name="output" file="output.txt">
+    <source xsi:type="fileSource" elements="root" format="xml">
+      <include>source.xml</include>
+    </source>
+    <outlet name="testGroovyOutlet"/>
+  </output>
+</control>
+  
\ No newline at end of file

Added: db/torque/torque4/trunk/torque-generator/src/test/otherTemplateLanguages/src/main/torque-gen/outlets/outlets.xml
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/test/otherTemplateLanguages/src/main/torque-gen/outlets/outlets.xml?rev=1148326&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/test/otherTemplateLanguages/src/main/torque-gen/outlets/outlets.xml (added)
+++ db/torque/torque4/trunk/torque-generator/src/test/otherTemplateLanguages/src/main/torque-gen/outlets/outlets.xml Tue Jul 19 13:57:01 2011
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+
+<outlets xmlns="http://db.apache.org/torque/4.0/generator/configuration"
+    xsi:schemaLocation="http://db.apache.org/torque/4.0/generator/configuration src/test/otherTemplateLanguages/groovyOutlet.xsd"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+  <outlet name="testGroovyOutlet"
+      xsi:type="groovyOutlet"
+      path="template.groovy">
+  </outlet>
+</outlets>
\ No newline at end of file

Added: db/torque/torque4/trunk/torque-generator/src/test/otherTemplateLanguages/src/main/torque-gen/src/source.xml
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/test/otherTemplateLanguages/src/main/torque-gen/src/source.xml?rev=1148326&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/test/otherTemplateLanguages/src/main/torque-gen/src/source.xml (added)
+++ db/torque/torque4/trunk/torque-generator/src/test/otherTemplateLanguages/src/main/torque-gen/src/source.xml Tue Jul 19 13:57:01 2011
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+
+<root>
+  <element>
+  </element>
+</root>
\ No newline at end of file

Added: db/torque/torque4/trunk/torque-generator/src/test/otherTemplateLanguages/src/main/torque-gen/templates/template.groovy
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/test/otherTemplateLanguages/src/main/torque-gen/templates/template.groovy?rev=1148326&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/test/otherTemplateLanguages/src/main/torque-gen/templates/template.groovy (added)
+++ db/torque/torque4/trunk/torque-generator/src/test/otherTemplateLanguages/src/main/torque-gen/templates/template.groovy Tue Jul 19 13:57:01 2011
@@ -0,0 +1,19 @@
+/*
+ * 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.
+ */
+return 'groovy test output'
\ No newline at end of file



---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org