[jboss-cvs] JBossAS SVN: r104650 - 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
Mon May 10 22:05:51 EDT 2010
Author: jeff.zhang
Date: 2010-05-10 22:05:51 -0400 (Mon, 10 May 2010)
New Revision: 104650
Modified:
projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/McfCodeGen.java
Log:
[JBJCA-319] make ResourceAdapterAssociation code generation optional
Modified: projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/McfCodeGen.java
===================================================================
--- projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/McfCodeGen.java 2010-05-11 01:59:54 UTC (rev 104649)
+++ projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/McfCodeGen.java 2010-05-11 02:05:51 UTC (rev 104650)
@@ -67,11 +67,14 @@
out.write("private static Logger log = Logger.getLogger(" + getClassName(def) + ".class);");
writeEol(out);
writeEol(out);
+ if (def.isImplRaAssociation())
+ {
+ writeIndent(out, indent);
+ out.write("private ResourceAdapter ra;");
+ writeEol(out);
+ writeEol(out);
+ }
writeIndent(out, indent);
- out.write("private ResourceAdapter ra;");
- writeEol(out);
- writeEol(out);
- writeIndent(out, indent);
out.write("private PrintWriter logwriter;");
writeEol(out);
writeEol(out);
@@ -177,13 +180,11 @@
writeIndent(out, indent);
out.write("public Object createConnectionFactory(ConnectionManager cxManager) throws ResourceException");
writeLeftCurlyBracket(out, indent);
+ if (def.isImplRaAssociation())
+ {
+ writeIfRaNull(out, indent);
+ }
writeIndent(out, indent + 1);
- out.write("if (ra == null)");
- writeEol(out);
- writeIndent(out, indent + 2);
- out.write("throw new IllegalStateException(\"RA is null\");");
- writeEol(out);
- writeIndent(out, indent + 1);
out.write("log.debug(\"call createConnectionFactory\");");
writeEol(out);
writeIndent(out, indent + 1);
@@ -194,17 +195,31 @@
writeIndent(out, indent);
out.write("public Object createConnectionFactory() throws ResourceException");
writeLeftCurlyBracket(out, indent);
+ if (def.isImplRaAssociation())
+ {
+ writeIfRaNull(out, indent);
+ }
+
writeIndent(out, indent + 1);
+ out.write("return createConnectionFactory(new MyConnectionManager());");
+ writeRightCurlyBracket(out, indent);
+ writeEol(out);
+ }
+
+ /**
+ * Output if (ra == null)
+ * @param out Writer
+ * @param indent space number
+ * @throws IOException ioException
+ */
+ private void writeIfRaNull(Writer out, int indent) throws IOException
+ {
+ writeIndent(out, indent + 1);
out.write("if (ra == null)");
writeEol(out);
writeIndent(out, indent + 2);
out.write("throw new IllegalStateException(\"RA is null\");");
writeEol(out);
-
- writeIndent(out, indent + 1);
- out.write("return createConnectionFactory(new MyConnectionManager());");
- writeRightCurlyBracket(out, indent);
- writeEol(out);
}
/**
@@ -222,13 +237,11 @@
writeIndent(out, indent + 2);
out.write("ConnectionRequestInfo cxRequestInfo) throws ResourceException");
writeLeftCurlyBracket(out, indent);
+ if (def.isImplRaAssociation())
+ {
+ writeIfRaNull(out, indent);
+ }
writeIndent(out, indent + 1);
- out.write("if (ra == null)");
- writeEol(out);
- writeIndent(out, indent + 2);
- out.write("throw new IllegalStateException(\"RA is null\");");
- writeEol(out);
- writeIndent(out, indent + 1);
out.write("log.debug(\"call createManagedConnection\");");
writeEol(out);
writeIndent(out, indent + 1);
@@ -242,13 +255,11 @@
writeIndent(out, indent + 2);
out.write("Subject subject, ConnectionRequestInfo cxRequestInfo) throws ResourceException");
writeLeftCurlyBracket(out, indent);
+ if (def.isImplRaAssociation())
+ {
+ writeIfRaNull(out, indent);
+ }
writeIndent(out, indent + 1);
- out.write("if (ra == null)");
- writeEol(out);
- writeIndent(out, indent + 2);
- out.write("throw new IllegalStateException(\"RA is null\");");
- writeEol(out);
- writeIndent(out, indent + 1);
out.write("log.debug(\"call matchManagedConnections\");");
writeEol(out);
writeIndent(out, indent + 1);
More information about the jboss-cvs-commits
mailing list