[jboss-cvs] JBossAS SVN: r104744 - projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed May 12 20:22:09 EDT 2010


Author: jeff.zhang
Date: 2010-05-12 20:22:09 -0400 (Wed, 12 May 2010)
New Revision: 104744

Added:
   projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/ConnMetaCodeGen.java
   projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/ConnSpecCodeGen.java
   projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/RaMetaCodeGen.java
Modified:
   projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/CciConnCodeGen.java
   projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/CciConnFactoryCodeGen.java
   projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/Definition.java
   projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/JCA16AnnoProfile.java
   projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/McCodeGen.java
   projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/McMetaCodeGen.java
Log:
[JBJCA-329] make CCI code generation optional, add ConnectionMetaData ResourceAdapterMetaData ConnectionSpec 

Modified: projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/CciConnCodeGen.java
===================================================================
--- projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/CciConnCodeGen.java	2010-05-13 00:05:37 UTC (rev 104743)
+++ projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/CciConnCodeGen.java	2010-05-13 00:22:09 UTC (rev 104744)
@@ -178,7 +178,7 @@
       writeLeftCurlyBracket(out, indent);
 
       writeIndent(out, indent + 1);
-      out.write("return null;");
+      out.write("return new MyConnectionMetaData();");
       writeRightCurlyBracket(out, indent);
       writeEol(out);
    }

Modified: projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/CciConnFactoryCodeGen.java
===================================================================
--- projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/CciConnFactoryCodeGen.java	2010-05-13 00:05:37 UTC (rev 104743)
+++ projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/CciConnFactoryCodeGen.java	2010-05-13 00:22:09 UTC (rev 104744)
@@ -149,7 +149,7 @@
       writeLeftCurlyBracket(out, indent);
 
       writeIndent(out, indent + 1);
-      out.write("return null;");
+      out.write("return new MyRaMetaData();");
       writeRightCurlyBracket(out, indent);
       writeEol(out);
    }

Added: projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/ConnMetaCodeGen.java
===================================================================
--- projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/ConnMetaCodeGen.java	                        (rev 0)
+++ projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/ConnMetaCodeGen.java	2010-05-13 00:22:09 UTC (rev 104744)
@@ -0,0 +1,141 @@
+/*
+ * 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 connection MetaData class CodeGen.
+ * 
+ * @author Jeff Zhang
+ * @version $Revision: $
+ */
+public class ConnMetaCodeGen extends AbstractCodeGen
+{
+   /**
+    * Output Metadata class
+    * @param def definition
+    * @param out Writer
+    * @throws IOException ioException
+    */
+   @Override
+   public void writeClassBody(Definition def, Writer out) throws IOException
+   {
+
+      out.write("public class " + getClassName(def) + " implements ConnectionMetaData");
+      writeLeftCurlyBracket(out, 0);
+      int indent = 1;
+      
+      writeDefaultConstructor(def, out, indent);
+
+      writeEIS(def, out, indent);
+      writeUsername (def, out, indent);
+      
+      writeRightCurlyBracket(out, 0);
+   }
+   
+   /**
+    * Output class import
+    * @param def definition
+    * @param out Writer
+    * @throws IOException ioException
+    */
+   @Override
+   public void writeImport(Definition def, Writer out) throws IOException
+   {
+      out.write("package " + def.getRaPackage() + ";");
+      writeEol(out);
+      writeEol(out);
+      out.write("import javax.resource.ResourceException;");
+      writeEol(out);
+      writeEol(out);
+      out.write("import javax.resource.cci.ConnectionMetaData;");
+      writeEol(out);
+      writeEol(out);
+   }
+   
+   /**
+    * get this class name
+    * @param def definition
+    * @return String class name
+    */
+   @Override
+   public String getClassName(Definition def)
+   {
+      return def.getConnMetaClass();
+   }
+   
+   /**
+    * Output eis info method
+    * @param def definition
+    * @param out Writer
+    * @param indent space number
+    * @throws IOException ioException
+    */
+   private void writeEIS(Definition def, Writer out, int indent) throws IOException
+   {
+      writeIndent(out, indent);
+      out.write("@Override");
+      writeEol(out);
+      writeIndent(out, indent);
+      out.write("public String getEISProductName() throws ResourceException");
+      writeLeftCurlyBracket(out, indent);
+      writeIndent(out, indent + 1);
+      out.write("return null; //TODO");
+      writeRightCurlyBracket(out, indent);
+      writeEol(out);
+      
+      writeIndent(out, indent);
+      out.write("@Override");
+      writeEol(out);
+      writeIndent(out, indent);
+      out.write("public String getEISProductVersion() throws ResourceException");
+      writeLeftCurlyBracket(out, indent);
+      writeIndent(out, indent + 1);
+      out.write("return null; //TODO");
+      writeRightCurlyBracket(out, indent);
+      writeEol(out);
+   }
+   
+   /**
+    * Output username method
+    * @param def definition
+    * @param out Writer
+    * @param indent space number
+    * @throws IOException ioException
+    */
+   private void writeUsername(Definition def, Writer out, int indent) throws IOException
+   {
+      writeIndent(out, indent);
+      out.write("@Override");
+      writeEol(out);
+      writeIndent(out, indent);
+      out.write("public String getUserName() throws ResourceException");
+      writeLeftCurlyBracket(out, indent);
+
+      writeIndent(out, indent + 1);
+      out.write("return null; //TODO");
+      writeRightCurlyBracket(out, indent);
+      writeEol(out);
+   }
+}

Added: projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/ConnSpecCodeGen.java
===================================================================
--- projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/ConnSpecCodeGen.java	                        (rev 0)
+++ projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/ConnSpecCodeGen.java	2010-05-13 00:22:09 UTC (rev 104744)
@@ -0,0 +1,82 @@
+/*
+ * 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 connection Spec class CodeGen.
+ * 
+ * @author Jeff Zhang
+ * @version $Revision: $
+ */
+public class ConnSpecCodeGen extends AbstractCodeGen
+{
+   /**
+    * Output connection Spec class
+    * @param def definition
+    * @param out Writer
+    * @throws IOException ioException
+    */
+   @Override
+   public void writeClassBody(Definition def, Writer out) throws IOException
+   {
+
+      out.write("public class " + getClassName(def) + " implements ConnectionSpec");
+      writeLeftCurlyBracket(out, 0);
+      int indent = 1;
+      
+      writeDefaultConstructor(def, out, indent);
+      
+      writeRightCurlyBracket(out, 0);
+   }
+   
+   /**
+    * Output class import
+    * @param def definition
+    * @param out Writer
+    * @throws IOException ioException
+    */
+   @Override
+   public void writeImport(Definition def, Writer out) throws IOException
+   {
+      out.write("package " + def.getRaPackage() + ";");
+      writeEol(out);
+      writeEol(out);
+      out.write("import javax.resource.cci.ConnectionSpec ;");
+      writeEol(out);
+      writeEol(out);
+   }
+   
+   /**
+    * get this class name
+    * @param def definition
+    * @return String class name
+    */
+   @Override
+   public String getClassName(Definition def)
+   {
+      return def.getConnSpecClass();
+   }
+
+}

Modified: projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/Definition.java
===================================================================
--- projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/Definition.java	2010-05-13 00:05:37 UTC (rev 104743)
+++ projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/Definition.java	2010-05-13 00:22:09 UTC (rev 104744)
@@ -70,6 +70,13 @@
    /** connection manage class name */
    private String cmClass;
    
+   /** connection metadata class name */
+   private String connMetaClass;
+   /** connection spec class name */
+   private String connSpecClass;
+   /** resource adapater metadata class name */
+   private String raMetaClass;
+   
    /**
     * Set the outputDir.
     * 
@@ -352,7 +359,7 @@
    public String getMcMetaClass()
    {
       if (mcMetaClass == null || mcMetaClass.equals(""))
-         mcMetaClass = "MyConnectionMetaData";
+         mcMetaClass = "MyManagedConnectionMetaData";
       return mcMetaClass;
    }
 
@@ -418,4 +425,70 @@
       return cfInterfaceClass;
    }
 
+   /**
+    * Set the connMetaClass.
+    * 
+    * @param connMetaClass The connMetaClass to set.
+    */
+   public void setConnMetaClass(String connMetaClass)
+   {
+      this.connMetaClass = connMetaClass;
+   }
+
+   /**
+    * Get the connMetaClass.
+    * 
+    * @return the connMetaClass.
+    */
+   public String getConnMetaClass()
+   {
+      if (connMetaClass == null || connMetaClass.equals(""))
+         connMetaClass = "MyConnectionMetaData";
+      return connMetaClass;
+   }
+
+   /**
+    * Set the connSpecClass.
+    * 
+    * @param connSpecClass The connSpecClass to set.
+    */
+   public void setConnSpecClass(String connSpecClass)
+   {
+      this.connSpecClass = connSpecClass;
+   }
+
+   /**
+    * Get the connSpecClass.
+    * 
+    * @return the connSpecClass.
+    */
+   public String getConnSpecClass()
+   {
+      if (connSpecClass == null || connSpecClass.equals(""))
+         connSpecClass = "MyConnectionSpec";
+      return connSpecClass;
+   }
+
+   /**
+    * Set the raMetaClass.
+    * 
+    * @param raMetaClass The raMetaClass to set.
+    */
+   public void setRaMetaClass(String raMetaClass)
+   {
+      this.raMetaClass = raMetaClass;
+   }
+
+   /**
+    * Get the raMetaClass.
+    * 
+    * @return the raMetaClass.
+    */
+   public String getRaMetaClass()
+   {
+      if (raMetaClass == null || raMetaClass.equals(""))
+         raMetaClass = "MyRaMetaData";
+      return raMetaClass;
+   }
+
 }

Modified: projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/JCA16AnnoProfile.java
===================================================================
--- projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/JCA16AnnoProfile.java	2010-05-13 00:05:37 UTC (rev 104743)
+++ projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/JCA16AnnoProfile.java	2010-05-13 00:22:09 UTC (rev 104744)
@@ -66,6 +66,9 @@
          generateClassCode(def, "CciConnFactory");
          generateClassCode(def, "McMeta");
          generateClassCode(def, "Cm");
+         generateClassCode(def, "ConnMeta");
+         generateClassCode(def, "RaMeta");
+         generateClassCode(def, "ConnSpec");
       }
    }
 

Modified: projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/McCodeGen.java
===================================================================
--- projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/McCodeGen.java	2010-05-13 00:05:37 UTC (rev 104743)
+++ projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/McCodeGen.java	2010-05-13 00:22:09 UTC (rev 104744)
@@ -283,7 +283,7 @@
       
       writeIndent(out, indent + 1);
       if (def.isUseCciConnection())
-         out.write("return new MyConnectionMetaData();");
+         out.write("return new MyManagedConnectionMetaData();");
       else
          out.write("return null;");
       writeRightCurlyBracket(out, indent);

Modified: projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/McMetaCodeGen.java
===================================================================
--- projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/McMetaCodeGen.java	2010-05-13 00:05:37 UTC (rev 104743)
+++ projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/McMetaCodeGen.java	2010-05-13 00:22:09 UTC (rev 104744)
@@ -87,7 +87,7 @@
    }
    
    /**
-    * Output close method
+    * Output eis info method
     * @param def definition
     * @param out Writer
     * @param indent space number
@@ -119,7 +119,7 @@
    }
 
    /**
-    * Output Interaction method
+    * Output max connection method
     * @param def definition
     * @param out Writer
     * @param indent space number
@@ -141,7 +141,7 @@
    }
    
    /**
-    * Output LocalTransaction method
+    * Output username method
     * @param def definition
     * @param out Writer
     * @param indent space number

Added: projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/RaMetaCodeGen.java
===================================================================
--- projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/RaMetaCodeGen.java	                        (rev 0)
+++ projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/RaMetaCodeGen.java	2010-05-13 00:22:09 UTC (rev 104744)
@@ -0,0 +1,203 @@
+/*
+ * 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 resource adapter MetaData class CodeGen.
+ * 
+ * @author Jeff Zhang
+ * @version $Revision: $
+ */
+public class RaMetaCodeGen extends AbstractCodeGen
+{
+   /**
+    * Output Metadata class
+    * @param def definition
+    * @param out Writer
+    * @throws IOException ioException
+    */
+   @Override
+   public void writeClassBody(Definition def, Writer out) throws IOException
+   {
+
+      out.write("public class " + getClassName(def) + " implements ResourceAdapterMetaData");
+      writeLeftCurlyBracket(out, 0);
+      int indent = 1;
+      
+      writeDefaultConstructor(def, out, indent);
+
+      writeInfo(def, out, indent);
+      writeSupport (def, out, indent);
+      
+      writeRightCurlyBracket(out, 0);
+   }
+   
+   /**
+    * Output class import
+    * @param def definition
+    * @param out Writer
+    * @throws IOException ioException
+    */
+   @Override
+   public void writeImport(Definition def, Writer out) throws IOException
+   {
+      out.write("package " + def.getRaPackage() + ";");
+      writeEol(out);
+      writeEol(out);
+      out.write("import javax.resource.cci.ResourceAdapterMetaData;");
+      writeEol(out);
+      writeEol(out);
+   }
+   
+   /**
+    * get this class name
+    * @param def definition
+    * @return String class name
+    */
+   @Override
+   public String getClassName(Definition def)
+   {
+      return def.getRaMetaClass();
+   }
+   
+   /**
+    * Output info method
+    * @param def definition
+    * @param out Writer
+    * @param indent space number
+    * @throws IOException ioException
+    */
+   private void writeInfo(Definition def, Writer out, int indent) throws IOException
+   {
+      writeIndent(out, indent);
+      out.write("@Override");
+      writeEol(out);
+      writeIndent(out, indent);
+      out.write("public String getAdapterVersion()");
+      writeLeftCurlyBracket(out, indent);
+      writeIndent(out, indent + 1);
+      out.write("return null; //TODO");
+      writeRightCurlyBracket(out, indent);
+      writeEol(out);
+      
+      writeIndent(out, indent);
+      out.write("@Override");
+      writeEol(out);
+      writeIndent(out, indent);
+      out.write("public String getAdapterVendorName()");
+      writeLeftCurlyBracket(out, indent);
+      writeIndent(out, indent + 1);
+      out.write("return null; //TODO");
+      writeRightCurlyBracket(out, indent);
+      writeEol(out);
+      
+      writeIndent(out, indent);
+      out.write("@Override");
+      writeEol(out);
+      writeIndent(out, indent);
+      out.write("public String getAdapterName()");
+      writeLeftCurlyBracket(out, indent);
+      writeIndent(out, indent + 1);
+      out.write("return null; //TODO");
+      writeRightCurlyBracket(out, indent);
+      writeEol(out);
+      
+      writeIndent(out, indent);
+      out.write("@Override");
+      writeEol(out);
+      writeIndent(out, indent);
+      out.write("public String getAdapterShortDescription()");
+      writeLeftCurlyBracket(out, indent);
+      writeIndent(out, indent + 1);
+      out.write("return null; //TODO");
+      writeRightCurlyBracket(out, indent);
+      writeEol(out);
+      
+      writeIndent(out, indent);
+      out.write("@Override");
+      writeEol(out);
+      writeIndent(out, indent);
+      out.write("public String getSpecVersion()");
+      writeLeftCurlyBracket(out, indent);
+      writeIndent(out, indent + 1);
+      out.write("return null; //TODO");
+      writeRightCurlyBracket(out, indent);
+      writeEol(out);
+   }
+   
+   /**
+    * Output support method
+    * @param def definition
+    * @param out Writer
+    * @param indent space number
+    * @throws IOException ioException
+    */
+   private void writeSupport(Definition def, Writer out, int indent) throws IOException
+   {
+      writeIndent(out, indent);
+      out.write("@Override");
+      writeEol(out);
+      writeIndent(out, indent);
+      out.write("public String[] getInteractionSpecsSupported()");
+      writeLeftCurlyBracket(out, indent);
+      writeIndent(out, indent + 1);
+      out.write("return null; //TODO");
+      writeRightCurlyBracket(out, indent);
+      writeEol(out);
+      
+      writeIndent(out, indent);
+      out.write("@Override");
+      writeEol(out);
+      writeIndent(out, indent);
+      out.write("public boolean supportsExecuteWithInputAndOutputRecord()");
+      writeLeftCurlyBracket(out, indent);
+      writeIndent(out, indent + 1);
+      out.write("return false; //TODO");
+      writeRightCurlyBracket(out, indent);
+      writeEol(out);
+      
+      writeIndent(out, indent);
+      out.write("@Override");
+      writeEol(out);
+      writeIndent(out, indent);
+      out.write("public boolean supportsExecuteWithInputRecordOnly()");
+      writeLeftCurlyBracket(out, indent);
+      writeIndent(out, indent + 1);
+      out.write("return false; //TODO");
+      writeRightCurlyBracket(out, indent);
+      writeEol(out);
+      
+      writeIndent(out, indent);
+      out.write("@Override");
+      writeEol(out);
+      writeIndent(out, indent);
+      out.write("public boolean supportsLocalTransactionDemarcation()");
+      writeLeftCurlyBracket(out, indent);
+      writeIndent(out, indent + 1);
+      out.write("return false; //TODO");
+      writeRightCurlyBracket(out, indent);
+      writeEol(out);
+   }
+}




More information about the jboss-cvs-commits mailing list