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

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu May 26 22:15:10 EDT 2011


Author: jeff.zhang
Date: 2011-05-26 22:15:08 -0400 (Thu, 26 May 2011)
New Revision: 111469

Modified:
   projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/code/McCodeGen.java
Log:
[JBJCA-586] NotSupportedOperation in ManagedConnection

Modified: projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/code/McCodeGen.java
===================================================================
--- projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/code/McCodeGen.java	2011-05-27 01:56:40 UTC (rev 111468)
+++ projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/code/McCodeGen.java	2011-05-27 02:15:08 UTC (rev 111469)
@@ -155,6 +155,8 @@
       out.write("import java.util.logging.Logger;");
       writeEol(out);
       writeEol(out);
+      out.write("import javax.resource.NotSupportedException;");
+      writeEol(out);
       out.write("import javax.resource.ResourceException;");
       writeEol(out);
       out.write("import javax.resource.spi.ConnectionEvent;");
@@ -549,11 +551,19 @@
       writeIndent(out, indent);
       out.write("public LocalTransaction getLocalTransaction() throws ResourceException");
       writeLeftCurlyBracket(out, indent);
-      writeIndent(out, indent + 1);
-      out.write("log.finest(\"getLocalTransaction()\");");
-      writeEol(out);
-      writeIndent(out, indent + 1);
-      out.write("return null;");
+      if (def.getSupportTransaction().equals("NoTransaction"))
+      {
+         writeIndent(out, indent + 1);
+         out.write("throw new NotSupportedException(\"LocalTransaction not supported\");");
+      }
+      else
+      {
+         writeIndent(out, indent + 1);
+         out.write("log.finest(\"getLocalTransaction()\");");
+         writeEol(out);
+         writeIndent(out, indent + 1);
+         out.write("return null;");
+      }
       writeRightCurlyBracket(out, indent);
       writeEol(out);
       
@@ -579,11 +589,20 @@
       writeIndent(out, indent);
       out.write("public XAResource getXAResource() throws ResourceException");
       writeLeftCurlyBracket(out, indent);
-      writeIndent(out, indent + 1);
-      out.write("log.finest(\"getXAResource()\");");
-      writeEol(out);
-      writeIndent(out, indent + 1);
-      out.write("return null;");
+      if (def.getSupportTransaction().equals("NoTransaction"))
+      {
+         writeIndent(out, indent + 1);
+         out.write("throw new NotSupportedException(\"GetXAResource not supported not supported\");");
+      }
+      else
+      {
+         writeIndent(out, indent + 1);
+         out.write("log.finest(\"getXAResource()\");");
+         writeEol(out);
+         writeIndent(out, indent + 1);
+         out.write("return null;");
+      }
+
       writeRightCurlyBracket(out, indent);
       writeEol(out);
    }



More information about the jboss-cvs-commits mailing list