[jboss-cvs] JBossAS SVN: r109035 - in projects/jboss-jca/trunk/codegenerator/src/main: java/org/jboss/jca/codegenerator/xml and 1 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Sun Oct 31 22:27:42 EDT 2010
Author: jeff.zhang
Date: 2010-10-31 22:27:42 -0400 (Sun, 31 Oct 2010)
New Revision: 109035
Added:
projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/xml/IronjacamarXmlGen.java
projects/jboss-jca/trunk/codegenerator/src/main/resources/ironjacamar.xml.template
Modified:
projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/BaseProfile.java
Log:
[JBJCA-456] Generate ironjacamar.xml file
Modified: projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/BaseProfile.java
===================================================================
--- projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/BaseProfile.java 2010-11-01 01:40:23 UTC (rev 109034)
+++ projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/BaseProfile.java 2010-11-01 02:27:42 UTC (rev 109035)
@@ -24,6 +24,7 @@
import org.jboss.jca.codegenerator.code.AbstractCodeGen;
import org.jboss.jca.codegenerator.xml.BuildIvyXmlGen;
import org.jboss.jca.codegenerator.xml.BuildXmlGen;
+import org.jboss.jca.codegenerator.xml.IronjacamarXmlGen;
import org.jboss.jca.codegenerator.xml.IvySettingsXmlGen;
import org.jboss.jca.codegenerator.xml.IvyXmlGen;
import org.jboss.jca.codegenerator.xml.PomXmlGen;
@@ -72,6 +73,7 @@
generateAntXml(def, def.getOutputDir());
generateRaXml(def, def.getOutputDir());
+ generateIronjacamarXml(def, def.getOutputDir());
}
/**
@@ -290,6 +292,27 @@
return null;
}
+ /**
+ * generate ant ironjacamar.xml
+ * @param def Definition
+ * @param outputDir output directory
+ */
+ void generateIronjacamarXml(Definition def, String outputDir)
+ {
+ try
+ {
+ outputDir = outputDir + File.separatorChar + "src" + File.separatorChar +
+ "main" + File.separatorChar + "resources";
+ FileWriter ijfw = Utils.createFile("ironjacamar.xml", outputDir + File.separatorChar + "META-INF");
+ IronjacamarXmlGen ijxGen = new IronjacamarXmlGen();
+ ijxGen.generate(def, ijfw);
+ ijfw.close();
+ }
+ catch (IOException ioe)
+ {
+ ioe.printStackTrace();
+ }
+ }
/**
* generate test code
Added: projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/xml/IronjacamarXmlGen.java
===================================================================
--- projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/xml/IronjacamarXmlGen.java (rev 0)
+++ projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/xml/IronjacamarXmlGen.java 2010-11-01 02:27:42 UTC (rev 109035)
@@ -0,0 +1,65 @@
+/*
+ * 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.xml;
+
+import org.jboss.jca.codegenerator.Definition;
+import org.jboss.jca.codegenerator.SimpleTemplate;
+import org.jboss.jca.codegenerator.Template;
+import org.jboss.jca.codegenerator.Utils;
+
+import java.io.IOException;
+import java.io.Writer;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * A IvyXmlGen.
+ *
+ * @author Jeff Zhang
+ * @version $Revision: $
+ */
+public class IronjacamarXmlGen 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 = IronjacamarXmlGen.class.getResource("/ironjacamar.xml.template");
+ String buildString = Utils.readFileIntoString(buildFile);
+
+
+ Map<String, String> map = new HashMap<String, String>();
+ map.put("transaction", def.getSupportTransaction());
+ map.put("mcf.class", def.getMcfClass());
+ map.put("jndi.name", "java:/eis/" + def.getDefaultValue());
+ map.put("pool.name", def.getDefaultValue());
+ Template template = new SimpleTemplate(buildString);
+ template.process(map, out);
+ }
+}
Added: projects/jboss-jca/trunk/codegenerator/src/main/resources/ironjacamar.xml.template
===================================================================
--- projects/jboss-jca/trunk/codegenerator/src/main/resources/ironjacamar.xml.template (rev 0)
+++ projects/jboss-jca/trunk/codegenerator/src/main/resources/ironjacamar.xml.template 2010-11-01 02:27:42 UTC (rev 109035)
@@ -0,0 +1,19 @@
+<ironjacamar>
+ <transaction-support>${transaction}</transaction-support>
+ <connection-definitions>
+ <connection-definition class-name="${mcf.class}" enabled="true" jndi-name="${jndi.name}" pool-name="${pool.name}">
+ <config-property name="UserName"></config-property>
+ <config-property name="Password"></config-property>
+ <pool>
+ <min-pool-size>0</min-pool-size>
+ <max-pool-size>20</max-pool-size>
+ </pool>
+ <security>
+ </security>
+ <timeout>
+ <blocking-timeout-millis>5000</blocking-timeout-millis>
+ <idle-timeout-minutes>15</idle-timeout-minutes>
+ </timeout>
+ </connection-definition>
+ </connection-definitions>
+</ironjacamar>
\ No newline at end of file
More information about the jboss-cvs-commits
mailing list