[jboss-cvs] JBossAS SVN: r105407 - in projects/jboss-jca/trunk/codegenerator/src: main/resources and 1 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon May 31 04:02:46 EDT 2010


Author: jeff.zhang
Date: 2010-05-31 04:02:35 -0400 (Mon, 31 May 2010)
New Revision: 105407

Added:
   projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/AbstractXmlGen.java
   projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/BaseGen.java
   projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/BuildXmlGen.java
   projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/RaXmlGen.java
Removed:
   projects/jboss-jca/trunk/codegenerator/src/main/resources/ra.xml.template
Modified:
   projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/AbstractCodeGen.java
   projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/Main.java
   projects/jboss-jca/trunk/codegenerator/src/test/java/org/jboss/jca/codegenerator/JCA16AnnoProfileTestCase.java
Log:
[JBJCA-338] refactor XmlGen instead of template string replace

Modified: projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/AbstractCodeGen.java
===================================================================
--- projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/AbstractCodeGen.java	2010-05-31 07:21:52 UTC (rev 105406)
+++ projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/AbstractCodeGen.java	2010-05-31 08:02:35 UTC (rev 105407)
@@ -23,7 +23,6 @@
 
 import java.io.IOException;
 import java.io.Writer;
-import java.net.URL;
 import java.util.Locale;
 
 /**
@@ -32,7 +31,7 @@
  * @author Jeff Zhang
  * @version $Revision:$
  */
-public abstract class AbstractCodeGen
+public abstract class AbstractCodeGen extends BaseGen
 {
    /**
     * generate code
@@ -50,20 +49,6 @@
    
 
    /**
-    * Output class head, for example license
-    * @param def definition
-    * @param out Writer
-    * @throws IOException ioException
-    */
-   void writeheader(Definition def, Writer out) throws IOException
-   {
-      URL headerFile = AbstractCodeGen.class.getResource("/header.template");
-      String headerString = Utils.readFileIntoString(headerFile);
-      out.write(headerString);
-      writeEol(out);
-   }
-
-   /**
     * Output class comment
     * @param def definition
     * @param out Writer
@@ -100,7 +85,7 @@
 
 
    /**
-    * Output ResourceAdapater class
+    * Output class
     * @param def definition
     * @param out Writer
     * @throws IOException ioException
@@ -108,16 +93,6 @@
    public abstract void writeClassBody(Definition def, Writer out) throws IOException;
 
    /**
-    * Output eol 
-    * @param out Writer
-    * @throws IOException ioException
-    */
-   void writeEol(Writer out) throws IOException
-   {
-      out.write("\n");
-   }
-   
-   /**
     * Output left curly bracket
     * @param out Writer
     * @param indent space number
@@ -144,18 +119,6 @@
       out.write("}");
       writeEol(out);
    }
-   
-   /**
-    * Output space
-    * @param out Writer
-    * @param indent space number
-    * @throws IOException ioException
-    */
-   void writeIndent(Writer out, int indent) throws IOException
-   {
-      for (int i = 0; i < indent; i++)
-         out.write("   ");      
-   }
 
    /**
     * Output Default Constructor

Added: projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/AbstractXmlGen.java
===================================================================
--- projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/AbstractXmlGen.java	                        (rev 0)
+++ projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/AbstractXmlGen.java	2010-05-31 08:02:35 UTC (rev 105407)
@@ -0,0 +1,53 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.jca.codegenerator;
+
+import java.io.IOException;
+import java.io.Writer;
+
+/**
+ * A AbstractXmlGen.
+ * 
+ * @author Jeff Zhang
+ * @version $Revision: $
+ */
+public abstract class AbstractXmlGen extends BaseGen
+{
+   /**
+    * generate code
+    * @param def Definition 
+    * @param out Writer
+    * @throws IOException ioException
+    */
+   public void generate(Definition def, Writer out) throws IOException
+   {
+      writeXmlBody(def, out);
+   }
+   
+   /**
+    * Output xml
+    * @param def definition
+    * @param out Writer
+    * @throws IOException ioException
+    */
+   public abstract void writeXmlBody(Definition def, Writer out) throws IOException;
+}

Added: projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/BaseGen.java
===================================================================
--- projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/BaseGen.java	                        (rev 0)
+++ projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/BaseGen.java	2010-05-31 08:02:35 UTC (rev 105407)
@@ -0,0 +1,71 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.jca.codegenerator;
+
+import java.io.IOException;
+import java.io.Writer;
+import java.net.URL;
+
+/**
+ * Base Generation class.
+ * 
+ * @author Jeff Zhang
+ * @version $Revision: $
+ */
+public class BaseGen
+{
+   /**
+    * Output eol 
+    * @param out Writer
+    * @throws IOException ioException
+    */
+   void writeEol(Writer out) throws IOException
+   {
+      out.write("\n");
+   }
+   
+   /**
+    * Output space
+    * @param out Writer
+    * @param indent space number
+    * @throws IOException ioException
+    */
+   void writeIndent(Writer out, int indent) throws IOException
+   {
+      for (int i = 0; i < indent; i++)
+         out.write("   ");      
+   }
+
+   /**
+    * Output class head, for example license
+    * @param def definition
+    * @param out Writer
+    * @throws IOException ioException
+    */
+   void writeheader(Definition def, Writer out) throws IOException
+   {
+      URL headerFile = BaseGen.class.getResource("/header.template");
+      String headerString = Utils.readFileIntoString(headerFile);
+      out.write(headerString);
+      writeEol(out);
+   }
+}

Added: projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/BuildXmlGen.java
===================================================================
--- projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/BuildXmlGen.java	                        (rev 0)
+++ projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/BuildXmlGen.java	2010-05-31 08:02:35 UTC (rev 105407)
@@ -0,0 +1,50 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.jca.codegenerator;
+
+import java.io.IOException;
+import java.io.Writer;
+import java.net.URL;
+
+/**
+ * A BuildXmlGen.
+ * 
+ * @author Jeff Zhang
+ * @version $Revision: $
+ */
+public class BuildXmlGen extends AbstractXmlGen
+{
+   @Override
+   public void writeXmlBody(Definition def, Writer out) throws IOException
+   {
+      out.write("<!--");
+      writeEol(out);
+      writeheader(def, out);
+      out.write("-->");
+      writeEol(out);
+      writeEol(out);
+      
+      URL buildFile = BuildXmlGen.class.getResource("/build.xml.template");
+      String buildString = Utils.readFileIntoString(buildFile);
+      out.write(buildString);
+   }
+}

Modified: projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/Main.java
===================================================================
--- projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/Main.java	2010-05-31 07:21:52 UTC (rev 105406)
+++ projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/Main.java	2010-05-31 08:02:35 UTC (rev 105407)
@@ -26,12 +26,9 @@
 import java.io.FileWriter;
 import java.io.IOException;
 import java.io.InputStreamReader;
-import java.net.URL;
 import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.List;
 import java.util.Locale;
-import java.util.Map;
 import java.util.ResourceBundle;
 
 /**
@@ -217,96 +214,6 @@
    }
 
    /**
-    * generate ra.xml
-    * @param def Definition
-    * @param outputDir output directory
-    * @throws IOException ioException
-    */
-   private static void generateRaXml(Definition def, String outputDir) throws IOException
-   {
-      FileWriter rafw = Utils.createFile("ra.xml", outputDir + File.separatorChar + "META-INF");
-      URL templateFile = Main.class.getResource("/ra.xml.template");
-      String raString = Utils.readFileIntoString(templateFile);
-      Template template = new SimpleTemplate(raString);
-      Map<String, String> varMap = new HashMap<String, String>();
-      varMap.put("package.name", def.getRaPackage());
-      varMap.put("ra.class", def.getRaPackage() + "." + def.getRaClass());
-      varMap.put("mcf.class", def.getRaPackage() + "." + def.getMcfClass());
-      if (!def.isUseCciConnection())
-      {
-         varMap.put("cf.interface", def.getRaPackage() + "." + def.getCfInterfaceClass());
-         varMap.put("cf.class", def.getRaPackage() + "." + def.getCfClass());
-         varMap.put("conn.interface", def.getRaPackage() + "." + def.getConnInterfaceClass());
-         varMap.put("conn.class", def.getRaPackage() + "." + def.getConnImplClass());
-      }
-      else
-      {
-         varMap.put("cf.interface", "javax.resource.cci.ConnectionFactory");
-         varMap.put("cf.class", def.getRaPackage() + "." + def.getCciConnFactoryClass());
-         varMap.put("conn.interface", "javax.resource.cci.Connection");
-         varMap.put("conn.class", def.getRaPackage() + "." + def.getCciConnClass());
-      }
-      List<ConfigPropType> listRaProps = def.getRaConfigProps();
-      if (listRaProps.size() > 0)
-      {
-         String raProps = extractPropString(listRaProps);
-         varMap.put("ra.config.props", raProps);
-      }
-      List<ConfigPropType> listMcfProps = def.getMcfConfigProps();
-      if (listMcfProps.size() > 0)
-      {
-         String raProps = extractPropString(listMcfProps);
-         varMap.put("mcf.config.props", raProps);
-      }
-      
-      if (def.isSupportInbound() && !def.isUseAnnotation())
-      {
-         StringBuilder inboundString = new StringBuilder();
-         inboundString.append("<inbound-resourceadapter>\n");
-         inboundString.append("         <messageadapter>\n");
-         inboundString.append("           <messagelistener>\n");
-         inboundString.append("             <messagelistener-type>");
-         inboundString.append(def.getRaPackage()).append(".").append(def.getMlClass());
-         inboundString.append("</messagelistener-type>\n");
-         inboundString.append("             <activationspec>\n");
-         inboundString.append("                <activationspec-class>");
-         inboundString.append(def.getRaPackage()).append(".").append(def.getAsClass());
-         inboundString.append("</activationspec-class>\n");
-         inboundString.append("             </activationspec>\n");
-         inboundString.append("           </messagelistener>\n");
-         inboundString.append("         </messageadapter>\n");
-         inboundString.append("      </inbound-resourceadapter>\n");
-         varMap.put("inbound", inboundString.toString());
-      }
-      
-      template.process(varMap, rafw);
-      rafw.close();
-   }
-
-   /**
-    * extract properties string
-    * 
-    * @param listPropType
-    * @return String properties string
-    */
-   private static String extractPropString(List<ConfigPropType> listPropType)
-   {
-      StringBuilder props = new StringBuilder();
-      if (listPropType.size() > 0)
-      {
-         props.append("<config-property>\n");
-         for (ConfigPropType prop : listPropType)
-         {
-            props.append("         <config-property-name>" + prop.getName() + "</config-property-name>\n");
-            props.append("         <config-property-type>java.lang." + prop.getType() + "</config-property-type>\n");
-            props.append("         <config-property-value>" + prop.getValue() + "</config-property-value>\n");
-         }
-         props.append("      </config-property>\n");
-      }
-      return props.toString();
-   }
-
-   /**
     * Input Properties
     * @param classname belong to which java class
     * @param dbconf ResourceBundle
@@ -383,12 +290,24 @@
    {
       //ant build.xml
       FileWriter antfw = Utils.createFile("build.xml", outputDir);
-      URL buildFile = Main.class.getResource("/build.xml.template");
-      String buildString = Utils.readFileIntoString(buildFile);
-      antfw.write(buildString);
+      BuildXmlGen bxGen = new BuildXmlGen();
+      bxGen.generate(null, antfw);
       antfw.close();
    }
 
+   /**
+    * generate ra.xml
+    * @param def Definition
+    * @param outputDir output directory
+    * @throws IOException ioException
+    */
+   private static void generateRaXml(Definition def, String outputDir) throws IOException
+   {
+      FileWriter rafw = Utils.createFile("ra.xml", outputDir + File.separatorChar + "META-INF");
+      RaXmlGen raGen = new RaXmlGen();
+      raGen.generate(def, rafw);
+      rafw.close();
+   }
    
    /**
     * Tool usage

Added: projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/RaXmlGen.java
===================================================================
--- projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/RaXmlGen.java	                        (rev 0)
+++ projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/RaXmlGen.java	2010-05-31 08:02:35 UTC (rev 105407)
@@ -0,0 +1,256 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.jca.codegenerator;
+
+import java.io.IOException;
+import java.io.Writer;
+import java.util.List;
+
+/**
+ * A BuildXmlGen.
+ * 
+ * @author Jeff Zhang
+ * @version $Revision: $
+ */
+public class RaXmlGen extends AbstractXmlGen
+{
+   @Override
+   public void writeXmlBody(Definition def, Writer out) throws IOException
+   {
+      out.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
+      writeEol(out);
+      writeEol(out);
+      out.write("<connector xmlns=\"http://java.sun.com/xml/ns/javaee\"");
+      writeEol(out);
+      out.write("           xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"");
+      writeEol(out);
+      out.write("           xsi:schemaLocation=\"http://java.sun.com/xml/ns/javaee");
+      writeEol(out);
+      out.write("           http://java.sun.com/xml/ns/j2ee/connector_1_6.xsd\"");
+      writeEol(out);
+      out.write("           version=\"1.6\" metadata-complete=\"true\">");
+      writeEol(out);
+      writeEol(out);
+      int indent = 1;
+      writeIndent(out, indent);
+      out.write("<vendor-name>Red Hat Middleware LLC</vendor-name>");
+      writeEol(out);
+      writeIndent(out, indent);
+      out.write("<eis-type>Test RA</eis-type>");
+      writeEol(out);
+      writeIndent(out, indent);
+      out.write("<resourceadapter-version>0.1</resourceadapter-version>");
+      writeEol(out);
+      writeIndent(out, indent);
+      out.write("<resourceadapter>");
+      writeEol(out);
+      writeIndent(out, indent + 1);
+      out.write("<resourceadapter-class>" + def.getRaPackage() + "." + def.getRaClass() + "</resourceadapter-class>");
+      writeEol(out);
+      
+      writeConfigPropsXml(def.getRaConfigProps(), out, indent + 1, false);
+      writeOutbound(def, out, indent + 1);
+      if (def.isSupportInbound())
+         writeInbound(def, out, indent + 1);
+      
+      writeIndent(out, indent);
+      out.write("</resourceadapter>");
+      writeEol(out);
+      out.write("</connector>");
+      writeEol(out);
+   }
+   
+   /**
+    * Output config props xml part
+    * @param props config properties
+    * @param out Writer
+    * @param indent space number
+    * @param required support required
+    * @throws IOException ioException
+    */
+   private void writeConfigPropsXml(List<ConfigPropType> props, 
+      Writer out, int indent, boolean required) throws IOException
+   {
+      if (props == null || props.size() == 0)
+         return;
+      if (required)
+      {
+         for (ConfigPropType prop : props)
+         {
+            if (prop.isRequired())
+            {
+               writeIndent(out, indent);
+               out.write("<required-config-property>");
+               writeEol(out);
+               
+               writeIndent(out, indent + 1);
+               out.write("<config-property-name>" + prop.getName() + "</config-property-name>");
+               writeEol(out);
+
+               writeIndent(out, indent);
+               out.write("</required-config-property>");
+               writeEol(out);
+            }
+         }
+         writeEol(out);
+      }
+      
+
+      for (ConfigPropType prop : props)
+      {
+         writeIndent(out, indent);
+         out.write("<config-property>");
+         writeEol(out);
+         
+         writeIndent(out, indent + 1);
+         out.write("<config-property-name>" + prop.getName() + "</config-property-name>");
+         writeEol(out);
+         writeIndent(out, indent + 1);
+         out.write("<config-property-type>java.lang." + prop.getType() + "</config-property-type>");
+         writeEol(out);
+         writeIndent(out, indent + 1);
+         out.write("<config-property-value>" + prop.getValue() + "</config-property-value>");
+         writeEol(out);
+         
+         writeIndent(out, indent);
+         out.write("</config-property>");
+         writeEol(out);
+         writeEol(out);
+      }
+
+   }
+   
+   /**
+    * Output inbound xml part
+    * @param def definition
+    * @param out Writer
+    * @param indent space number
+    * @throws IOException ioException
+    */
+   private void writeInbound(Definition def, Writer out, int indent) throws IOException
+   {
+      writeIndent(out, indent);
+      out.write("<inbound-resourceadapter>");
+      writeEol(out);
+      writeIndent(out, indent + 1);
+      out.write("<messageadapter>");
+      writeEol(out);
+      writeIndent(out, indent + 2);
+      out.write("<messagelistener>");
+      writeEol(out);
+      writeIndent(out, indent + 3);
+      out.write("<messagelistener-type>" + def.getRaPackage() + "." + def.getMlClass() + "</messagelistener-type>");
+      writeEol(out);
+      writeIndent(out, indent + 3);
+      out.write("<activationspec>");
+      writeEol(out);
+      writeIndent(out, indent + 4);
+      out.write("<activationspec-class>" + def.getRaPackage() + "." + def.getAsClass() + "</activationspec-class>");
+      writeEol(out);
+      
+      writeConfigPropsXml(def.getAsConfigProps(), out, indent + 4, true);
+      writeIndent(out, indent + 3);
+      out.write("</activationspec>");
+      writeEol(out);
+      writeIndent(out, indent + 2);
+      out.write("</messagelistener>");
+      writeEol(out);
+      writeIndent(out, indent + 1);
+      out.write("</messageadapter>");
+      writeEol(out);
+      writeIndent(out, indent);
+      out.write("</inbound-resourceadapter>");
+      writeEol(out);
+   }
+   
+   
+   /**
+    * Output outbound xml part
+    * @param def definition
+    * @param out Writer
+    * @param indent space number
+    * @throws IOException ioException
+    */
+   private void writeOutbound(Definition def, Writer out, int indent) throws IOException
+   {
+      writeIndent(out, indent);
+      out.write("<outbound-resourceadapter>");
+      writeEol(out);
+      writeIndent(out, indent + 1);
+      out.write("<connection-definition>");
+      writeEol(out);
+      writeIndent(out, indent + 2);
+      out.write("<managedconnectionfactory-class>" + def.getRaPackage() + "." + 
+         def.getMcfClass() + "</managedconnectionfactory-class>");
+      writeEol(out);
+      writeConfigPropsXml(def.getMcfConfigProps(), out, indent + 2, false);
+      
+      if (!def.isUseCciConnection())
+      {
+         writeIndent(out, indent + 2);
+         out.write("<connectionfactory-interface>" + def.getRaPackage() + "." + 
+            def.getCfInterfaceClass() + "</connectionfactory-interface>");
+         writeEol(out);
+         writeIndent(out, indent + 2);
+         out.write("<connectionfactory-impl-class>" + def.getRaPackage() + "." + 
+            def.getCfClass() + "</connectionfactory-impl-class>");
+         writeEol(out);
+         writeIndent(out, indent + 2);
+         out.write("<connection-interface>" + def.getRaPackage() + "." + 
+            def.getConnInterfaceClass() + "</connection-interface>");
+         writeEol(out);
+         writeIndent(out, indent + 2);
+         out.write("<connection-impl-class>" + def.getRaPackage() + "." + 
+            def.getConnImplClass() + "</connection-impl-class>");
+         writeEol(out);
+      }
+      else
+      {
+         writeIndent(out, indent + 2);
+         out.write("<connectionfactory-interface>javax.resource.cci.ConnectionFactory</connectionfactory-interface>");
+         writeEol(out);
+         writeIndent(out, indent + 2);
+         out.write("<connectionfactory-impl-class>" + def.getRaPackage() + "." + 
+            def.getCciConnFactoryClass() + "</connectionfactory-impl-class>");
+         writeEol(out);
+         writeIndent(out, indent + 2);
+         out.write("<connection-interface>javax.resource.cci.Connection</connection-interface>");
+         writeEol(out);
+         writeIndent(out, indent + 2);
+         out.write("<connection-impl-class>" + def.getRaPackage() + "." + 
+            def.getCciConnClass() + "</connection-impl-class>");
+         writeEol(out);
+      }
+      writeIndent(out, indent + 1);
+      out.write("</connection-definition>");
+      writeEol(out);
+      writeIndent(out, indent + 1);
+      out.write("<transaction-support>NoTransaction</transaction-support>");
+      writeEol(out);
+      writeIndent(out, indent + 1);
+      out.write("<reauthentication-support>false</reauthentication-support>");
+      writeEol(out);
+      writeIndent(out, indent);
+      out.write("</outbound-resourceadapter>");
+      writeEol(out);
+   }
+}

Deleted: projects/jboss-jca/trunk/codegenerator/src/main/resources/ra.xml.template
===================================================================
--- projects/jboss-jca/trunk/codegenerator/src/main/resources/ra.xml.template	2010-05-31 07:21:52 UTC (rev 105406)
+++ projects/jboss-jca/trunk/codegenerator/src/main/resources/ra.xml.template	2010-05-31 08:02:35 UTC (rev 105407)
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!-- $Id $ -->
-
-<connector xmlns="http://java.sun.com/xml/ns/javaee"
-           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-           xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
-           http://java.sun.com/xml/ns/j2ee/connector_1_6.xsd"
-           version="1.6" metadata-complete="true">
-
-   <vendor-name>Red Hat Middleware LLC</vendor-name>
-   <eis-type>Test RA</eis-type>
-   <resourceadapter-version>0.1</resourceadapter-version>
-
-   <resourceadapter>
-      <resourceadapter-class>${ra.class}</resourceadapter-class>
-
-      ${ra.config.props}
-      <outbound-resourceadapter>
-         <connection-definition>
-            <managedconnectionfactory-class>${mcf.class}</managedconnectionfactory-class>
-         ${mcf.config.props}
-            
-            <connectionfactory-interface>${cf.interface}</connectionfactory-interface>
-            <connectionfactory-impl-class>${cf.class}</connectionfactory-impl-class>
-            <connection-interface>${conn.interface}</connection-interface>
-            <connection-impl-class>${conn.class}</connection-impl-class>
-         </connection-definition>
-         <transaction-support>NoTransaction</transaction-support>
-         <reauthentication-support>false</reauthentication-support>
-      </outbound-resourceadapter>
-      
-      ${inbound}
-   </resourceadapter>
-</connector>
\ No newline at end of file

Modified: projects/jboss-jca/trunk/codegenerator/src/test/java/org/jboss/jca/codegenerator/JCA16AnnoProfileTestCase.java
===================================================================
--- projects/jboss-jca/trunk/codegenerator/src/test/java/org/jboss/jca/codegenerator/JCA16AnnoProfileTestCase.java	2010-05-31 07:21:52 UTC (rev 105406)
+++ projects/jboss-jca/trunk/codegenerator/src/test/java/org/jboss/jca/codegenerator/JCA16AnnoProfileTestCase.java	2010-05-31 08:02:35 UTC (rev 105407)
@@ -54,7 +54,7 @@
       def.setRaClass("BaseResourceAdapter");
 
       List<ConfigPropType> props = new ArrayList<ConfigPropType>();
-      ConfigPropType config = new ConfigPropType("myProp", "String", "Hello");
+      ConfigPropType config = new ConfigPropType("myProp", "String", "Hello", false);
       props.add(config);
       def.setRaConfigProps(props);
       




More information about the jboss-cvs-commits mailing list