[jboss-cvs] JBossAS SVN: r111682 - in projects/jboss-jca/trunk: as and 11 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Jun 28 08:27:24 EDT 2011


Author: jesper.pedersen
Date: 2011-06-28 08:27:24 -0400 (Tue, 28 Jun 2011)
New Revision: 111682

Added:
   projects/jboss-jca/trunk/as/
   projects/jboss-jca/trunk/as/build.xml
   projects/jboss-jca/trunk/as/src/
   projects/jboss-jca/trunk/as/src/main/
   projects/jboss-jca/trunk/as/src/main/java/
   projects/jboss-jca/trunk/as/src/main/java/org/
   projects/jboss-jca/trunk/as/src/main/java/org/jboss/
   projects/jboss-jca/trunk/as/src/main/java/org/jboss/jca/
   projects/jboss-jca/trunk/as/src/main/java/org/jboss/jca/as/
   projects/jboss-jca/trunk/as/src/main/java/org/jboss/jca/as/upgrader/
   projects/jboss-jca/trunk/as/src/main/java/org/jboss/jca/as/upgrader/Http.java
   projects/jboss-jca/trunk/as/src/main/java/org/jboss/jca/as/upgrader/Main.java
   projects/jboss-jca/trunk/as/src/main/java/org/jboss/jca/as/upgrader/ModuleXml.java
   projects/jboss-jca/trunk/as/src/main/java/org/jboss/jca/as/upgrader/package.html
   projects/jboss-jca/trunk/as/src/main/resources/
   projects/jboss-jca/trunk/as/src/main/resources/as-upgrader.bat
   projects/jboss-jca/trunk/as/src/main/resources/as-upgrader.sh
Modified:
   projects/jboss-jca/trunk/build.xml
   projects/jboss-jca/trunk/doc/userguide/en-US/modules/download.xml
   projects/jboss-jca/trunk/doc/userguide/en-US/modules/installation.xml
   projects/jboss-jca/trunk/ivy.xml
   projects/jboss-jca/trunk/sjc/build.xml
Log:
[JBJCA-608] JBoss Application Server Upgrader

Added: projects/jboss-jca/trunk/as/build.xml
===================================================================
--- projects/jboss-jca/trunk/as/build.xml	                        (rev 0)
+++ projects/jboss-jca/trunk/as/build.xml	2011-06-28 12:27:24 UTC (rev 111682)
@@ -0,0 +1,153 @@
+<!--
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, 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.
+-->
+<project name="ironjacamar-as" 
+         default="compile" 
+         xmlns:ivy="antlib:org.apache.ivy.ant">
+
+  <!-- ================================= 
+       Properties              
+       ================================= -->
+  <property name="build.as.dir" value="${build.dir}/as" />
+
+  <!-- ================================= 
+       Target: compile
+       ================================= -->
+  <target name="compile">
+    <mkdir dir="${build.as.dir}" />
+
+    <javac srcdir="src"
+           destdir="${build.as.dir}"
+           classpathref="sjc.lib.path.id"
+           debug="${javac.debug}"
+           deprecation="${javac.deprecation}"
+           optimize="${javac.optimize}"
+           includeAntRuntime="false">
+      <compilerarg value="-proc:none"/>
+    </javac> 
+
+  </target>
+
+  <!-- ================================= 
+       Target: jars
+       ================================= -->
+  <target name="jars" depends="compile">
+    <jar destfile="${target.dir}/${name}-as.jar"
+         basedir="${build.as.dir}"
+         index="true"
+         indexMetaInf="true"
+         update="true"
+         level="9"
+         excludes="**/*.java">
+      <manifest>
+        <attribute name="Main-Class" value="org.jboss.jca.as.upgrader.Main"/>
+        <attribute name="Implementation-Title" value="IronJacamar AS tools"/>
+        <attribute name="Implementation-Version" value="${major}.${minor}.${patch}.${type}"/>
+        <attribute name="Implementation-Vendor" value="The IronJacamar project (http://www.jboss.org/ironjacamar)"/>
+        <attribute name="Implementation-Vendor-Id" value="org.jboss"/>
+      </manifest>
+    </jar>
+
+  </target>
+
+  <!-- ================================= 
+       Target: docs
+       ================================= -->
+  <target name="docs" depends="compile">
+    <mkdir dir="${target.dir}/docs/spec"/>
+    <javadoc packagenames="org.*"
+             sourcepath="src/main/java"
+             destdir="${target.dir}/docs/as"
+             doclet="org.jboss.apiviz.APIviz"
+             docletpathref="sjc.lib.path.id"
+             author="true"
+             version="true"
+             windowtitle="IronJacamar AS tools"
+             doctitle="IronJacamar AS tools"
+             use="true"
+             additionalparam="-author -version"
+             classpath="${build.as.dir}"
+             classpathref="sjc.lib.path.id"
+             bottom="Copyright &#169; 2011 Red Hat Middleware LLC (http://www.jboss.com/)">
+      <link offline="true" href="http://java.sun.com/j2se/5/docs/api/" packagelistLoc="${java.home}/../docs/api"/>
+    </javadoc>
+    <copy todir="${target.dir}/docs/spec" overwrite="true">
+      <fileset dir="${tools.dir}/api"/>
+    </copy>
+  </target>
+
+  <!-- ================================= 
+       Target: artifacts
+       ================================= -->
+  <target name="artifacts" depends="jars">
+
+    <jar destfile="${target.dir}/${name}-as-sources.jar"
+         basedir="src/main/java"
+         index="true"
+         indexMetaInf="true"
+         update="true"
+         level="9">
+      <manifest>
+        <attribute name="Implementation-Title" value="IronJacamar AS tools - Sources"/>
+        <attribute name="Implementation-Version" value="${major}.${minor}.${patch}.${type}"/>
+        <attribute name="Implementation-Vendor" value="The IronJacamar project (http://www.jboss.org/ironjacamar)"/>
+        <attribute name="Implementation-Vendor-Id" value="org.jboss"/>
+      </manifest>
+    </jar>
+
+    <mkdir dir="${build.as.dir}/docs"/>
+    <javadoc packagenames="org.*"
+             sourcepath="src/main/java"
+             destdir="${build.as.dir}/docs"
+             doclet="org.jboss.apiviz.APIviz"
+             docletpathref="sjc.lib.path.id"
+             author="true"
+             version="true"
+             windowtitle="IronJacamar AS tools"
+             doctitle="IronJacamar AS tools"
+             use="true"
+             additionalparam="-author -version"
+             classpath="${build.as.dir}"
+             classpathref="sjc.lib.path.id"
+             bottom="Copyright &#169; 2011 Red Hat Middleware LLC (http://www.jboss.com/)">
+      <link offline="true" href="http://java.sun.com/j2se/5/docs/api/" packagelistLoc="${java.home}/../docs/api"/>
+    </javadoc>
+    <copy todir="${build.as.dir}/docs" overwrite="true">
+      <fileset dir="${tools.dir}/api"/>
+    </copy>
+
+    <jar destfile="${target.dir}/${name}-as-javadoc.jar"
+         basedir="${build.as.dir}/docs"
+         index="true"
+         indexMetaInf="true"
+         update="true"
+         level="9">
+      <manifest>
+        <attribute name="Implementation-Title" value="IronJacamar AS tools - JavaDoc"/>
+        <attribute name="Implementation-Version" value="${major}.${minor}.${patch}.${type}"/>
+        <attribute name="Implementation-Vendor" value="The IronJacamar project (http://www.jboss.org/ironjacamar)"/>
+        <attribute name="Implementation-Vendor-Id" value="org.jboss"/>
+      </manifest>
+    </jar>
+
+  </target>
+
+</project>

Added: projects/jboss-jca/trunk/as/src/main/java/org/jboss/jca/as/upgrader/Http.java
===================================================================
--- projects/jboss-jca/trunk/as/src/main/java/org/jboss/jca/as/upgrader/Http.java	                        (rev 0)
+++ projects/jboss-jca/trunk/as/src/main/java/org/jboss/jca/as/upgrader/Http.java	2011-06-28 12:27:24 UTC (rev 111682)
@@ -0,0 +1,111 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, 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.as.upgrader;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.net.URLConnection;
+
+/**
+ * Support the http:// protocol
+ */
+public class Http
+{
+   /**
+    * Constructor
+    */
+   public Http()
+   {
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public boolean download(String path, File target)
+   {
+      boolean redirect = HttpURLConnection.getFollowRedirects();
+      HttpURLConnection.setFollowRedirects(true);
+
+      InputStream is = null;
+      OutputStream os = null;
+      try
+      {
+         URL u = new URL(path);
+         URLConnection connection = u.openConnection();
+
+         connection.connect();
+
+         is = new BufferedInputStream(connection.getInputStream(), 8192);
+         os = new BufferedOutputStream(new FileOutputStream(target), 8192);
+
+         int b;
+         while ((b = is.read()) != -1)
+         {
+            os.write(b);
+         }
+
+         os.flush();
+
+         return true;
+      }
+      catch (Throwable t)
+      {
+         // Nothing to do
+      }
+      finally
+      {
+         if (is != null)
+         {
+            try
+            {
+               is.close();
+            }
+            catch (IOException ignore)
+            {
+               // Ignore
+            }
+         }
+         if (os != null)
+         {
+            try
+            {
+               os.close();
+            }
+            catch (IOException ignore)
+            {
+               // Ignore
+            }
+         }
+
+         HttpURLConnection.setFollowRedirects(redirect);
+      }
+
+      return false;
+   }
+}

Added: projects/jboss-jca/trunk/as/src/main/java/org/jboss/jca/as/upgrader/Main.java
===================================================================
--- projects/jboss-jca/trunk/as/src/main/java/org/jboss/jca/as/upgrader/Main.java	                        (rev 0)
+++ projects/jboss-jca/trunk/as/src/main/java/org/jboss/jca/as/upgrader/Main.java	2011-06-28 12:27:24 UTC (rev 111682)
@@ -0,0 +1,476 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, 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.as.upgrader;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+/**
+ * The AS upgrader application - updates the IronJacamar distribution inside
+ * the JBoss Application Server
+ * 
+ * @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>
+ */
+public class Main
+{
+   /** REpository */
+   public static final String REPOSITORY =
+      "http://repository.jboss.org/nexus/content/groups/public/org/jboss/ironjacamar";
+
+   /**
+    * API artifacts
+    */
+   public static final String[] API_ARTIFACTS = {
+      "ironjacamar-common-api",
+      "ironjacamar-common-spi",
+      "ironjacamar-core-api"
+   };
+
+   /**
+    * Implementation artifacts
+    */
+   public static final String[] IMPLEMENTATION_ARTIFACTS = {
+      "ironjacamar-common-impl",
+      "ironjacamar-core-impl",
+      "ironjacamar-deployers-common",
+      "ironjacamar-validator",
+   };
+
+   /**
+    * JDBC artifacts
+    */
+   public static final String[] JDBC_ARTIFACTS = {
+      "ironjacamar-jdbc"
+   };
+
+   /**
+    * Main
+    * 
+    * @param args command line arguments
+    */
+   public static void main(String[] args)
+   {
+      if (args.length == 2)
+      {
+         try
+         {
+            String version = args[0];
+            String asPath = args[1];
+
+            File asRoot = new File(asPath);
+
+            if (asRoot.exists() && isValid(asRoot))
+            {
+               System.out.println("Version: " + version);
+               System.out.println("AS installation: " + asPath);
+               System.out.println("");
+
+               File downloadDirectory = download(version);
+
+               move(asRoot);
+
+               install(asRoot, version);
+
+               delete(downloadDirectory);
+
+               System.out.println("");
+               System.out.println("Upgrade successful");
+            }
+            else
+            {
+               System.err.println("AS installation not found: " + asPath);
+            }
+         }
+         catch (Throwable t)
+         {
+            System.out.println("");
+            System.out.println("Upgrade unsuccessful");
+
+            System.err.println("Error: " + t.getMessage());
+            t.printStackTrace();
+         }
+      }
+      else
+      {
+         usage();
+      }
+   }
+
+   /**
+    * Tool usage
+    */
+   private static void usage()
+   {
+      System.out.println("Usage: as-upgrader <version> <as-installation>");
+   }
+
+   /**
+    * Is valid AS installation root
+    * @param root The root
+    * @return True if valid, otherwise false
+    */
+   private static boolean isValid(File root)
+   {
+      File f = new File(root, "modules" + File.separator + "org" + File.separator + "jboss" +
+                        File.separator + "ironjacamar");
+
+      return f.exists();
+   }
+
+   /**
+    * Download
+    * @param version The version
+    * @return The download directory
+    * @exception Throwable If an error occurs
+    */
+   private static File download(String version) throws Throwable
+   {
+      File toDirectory = new File(System.getProperty("java.io.tmp"), "ij");
+
+      delete(toDirectory);
+
+      toDirectory.mkdirs();
+
+      for (String artifact : API_ARTIFACTS)
+      {
+         downloadArtifact(artifact, version, toDirectory);
+      }
+
+      for (String artifact : IMPLEMENTATION_ARTIFACTS)
+      {
+         downloadArtifact(artifact, version, toDirectory);
+      }
+
+      for (String artifact : JDBC_ARTIFACTS)
+      {
+         downloadArtifact(artifact, version, toDirectory);
+      }
+
+      System.out.println("Download: Done");
+
+      return toDirectory;
+   }
+
+   /**
+    * Download artifact
+    * @param name The artifact name
+    * @param version The version
+    * @param dest The destination
+    * @exception Throwable If an error occurs
+    */
+   private static void downloadArtifact(String name, String version, File destination) throws Throwable
+   {
+      Http downloader = new Http();
+
+      String fileName = name + "-" + version + ".jar";
+      String path = REPOSITORY + "/" + name + "/" + version + "/" + fileName;
+
+      if (!downloader.download(path, new File(destination, fileName)))
+         throw new IOException("Could not download: " + path);
+   }
+
+   /**
+    * Move the old version
+    * @param root The root
+    * @exception Throwable If an error occurs
+    */
+   private static void move(File root) throws Throwable
+   {
+      File ijRoot = new File(root, "modules" + File.separator + "org" + File.separator + "jboss" +
+                             File.separator + "ironjacamar");
+
+      File apiRoot = new File(ijRoot, "api");
+      File implRoot = new File(ijRoot, "impl");
+      File jdbcRoot = new File(ijRoot, "jdbcadapters");
+
+      String oldVersion = getVersion(new File(apiRoot, "main"));
+
+      File apiOld = new File(apiRoot, oldVersion);
+      delete(apiOld);
+
+      if (!new File(apiRoot, "main").renameTo(apiOld))
+         throw new IOException("Could not rename old api main");
+
+      File implOld = new File(implRoot, oldVersion);
+      delete(implOld);
+
+      if (!new File(implRoot, "main").renameTo(implOld))
+         throw new IOException("Could not rename old impl main");
+
+      File jdbcOld = new File(jdbcRoot, oldVersion);
+      delete(jdbcOld);
+
+      if (!new File(jdbcRoot, "main").renameTo(jdbcOld))
+         throw new IOException("Could not rename old JDBC main");
+
+      System.out.println("Moving old installation (" + oldVersion + "): Done");
+   }
+
+   /**
+    * Get the version of an IronJacamar installation
+    * @param root The root
+    * @return The version
+    * @exception Throwable If an error occurs
+    */
+   private static String getVersion(File root) throws Throwable
+   {
+      for (File f : root.listFiles())
+      {
+         if (f.isFile() && f.getName().startsWith("ironjacamar"))
+         {
+            String name = f.getName();
+            int firstDot = name.indexOf(".");
+            int jar = name.indexOf(".jar");
+
+            return name.substring(firstDot - 1, jar);
+         }
+      }
+
+      throw new IOException("Unable to identify old version");
+   }
+
+   /**
+    * Recursive delete
+    * @param f The file handler
+    * @exception IOException Thrown if a file could not be deleted
+    */
+   private static void delete(File f) throws IOException
+   {
+      if (f != null && f.exists())
+      {
+         File[] files = f.listFiles();
+         if (files != null)
+         {
+            for (int i = 0; i < files.length; i++)
+            {
+               if (files[i].isDirectory())
+               {
+                  delete(files[i]);
+               } 
+               else
+               {
+                  if (!files[i].delete())
+                     throw new IOException("Could not delete " + files[i]);
+               }
+            }
+         }
+         if (!f.delete())
+            throw new IOException("Could not delete " + f);
+      }
+   }
+
+   /**
+    * Copy
+    * @param src The source
+    * @param dest The destination
+    * @exception IOException Thrown if a file could not be deleted
+    */
+   private static void copy(File src, File dest) throws IOException
+   {
+      if (src == null)
+         throw new IllegalArgumentException("Src is null");
+
+      if (dest == null)
+         throw new IllegalArgumentException("Dest is null");
+
+      if (!src.exists())
+         throw new IOException("Source doesn't exist: " + src.getAbsolutePath());
+
+      if (!src.canRead())
+         throw new IOException("Source can't be read: " + src.getAbsolutePath());
+
+      if (src.isDirectory())
+      {
+         if (!dest.exists())
+         {
+            if (!dest.mkdirs())
+               throw new IOException("Could not create directory: " + dest.getAbsolutePath());
+         }
+          
+         String list[] = src.list();
+         for (int i = 0; i < list.length; i++)
+         {
+            File srcFile = new File(src, list[i]);
+            File destFile = new File(dest, list[i]); 
+            copy(srcFile, destFile);
+         }
+      }
+      else
+      {
+         InputStream in = null;
+         OutputStream out = null;
+
+         byte[] buffer = new byte[8192];
+
+         int bytesRead;
+
+         try
+         {
+            in =  new BufferedInputStream(new FileInputStream(src), 8192);
+            out = new BufferedOutputStream(new FileOutputStream(dest), 8192);
+
+            while ((bytesRead = in.read(buffer)) >= 0)
+            {
+               out.write(buffer, 0, bytesRead);
+            }
+
+            out.flush();
+         }
+         catch (IOException e)
+         {
+            IOException wrapper = new IOException("Unable to copy file: " +
+                                                  src.getAbsolutePath() + " to " + dest.getAbsolutePath());
+            wrapper.initCause(e);
+            wrapper.setStackTrace(e.getStackTrace());
+            throw wrapper;
+         }
+         finally
+         {
+            if (in != null)
+            {
+               try
+               {
+                  in.close();
+               }
+               catch (IOException ioe)
+               {
+                  // Ignore
+               }
+            }
+
+            if (out != null)
+            {
+               try
+               {
+                  out.close();
+               }
+               catch (IOException ioe)
+               {
+                  // Ignore
+               }
+            }
+         }
+      }
+   }
+
+   /**
+    * Install
+    * @param root The root
+    * @param version The version
+    * @exception Throwable If an error occurs
+    */
+   private static void install(File root, String version) throws Throwable
+   {
+      File fromDirectory = new File(System.getProperty("java.io.tmp"), "ij");
+
+      File ijRoot = new File(root, "modules" + File.separator + "org" + File.separator + "jboss" +
+                             File.separator + "ironjacamar");
+      File apiRoot = new File(ijRoot, "api");
+      File implRoot = new File(ijRoot, "impl");
+      File jdbcRoot = new File(ijRoot, "jdbcadapters");
+
+      File apiMain = new File(apiRoot, "main");
+      apiMain.mkdirs();
+
+      for (String artifact : API_ARTIFACTS)
+      {
+         installArtifact(fromDirectory, artifact, version, apiMain);
+      }
+
+      File apiModuleXml = new File(apiMain, "module.xml");
+      FileWriter fw = new FileWriter(apiModuleXml);
+
+      for (String s : ModuleXml.getApi(version))
+      {
+         fw.write(s);
+         fw.write("\n");
+      }
+
+      fw.flush();
+      fw.close();
+
+      File implMain = new File(implRoot, "main");
+      implMain.mkdirs();
+
+      for (String artifact : IMPLEMENTATION_ARTIFACTS)
+      {
+         installArtifact(fromDirectory, artifact, version, implMain);
+      }
+
+      File implModuleXml = new File(implMain, "module.xml");
+      fw = new FileWriter(implModuleXml);
+
+      for (String s : ModuleXml.getImplementation(version))
+      {
+         fw.write(s);
+         fw.write("\n");
+      }
+
+      fw.flush();
+      fw.close();
+
+      File jdbcMain = new File(jdbcRoot, "main");
+      jdbcMain.mkdirs();
+
+      for (String artifact : JDBC_ARTIFACTS)
+      {
+         installArtifact(fromDirectory, artifact, version, jdbcMain);
+      }
+
+      File jdbcModuleXml = new File(jdbcMain, "module.xml");
+      fw = new FileWriter(jdbcModuleXml);
+
+      for (String s : ModuleXml.getJdbc(version))
+      {
+         fw.write(s);
+         fw.write("\n");
+      }
+
+      fw.flush();
+      fw.close();
+
+      System.out.println("Installing new version: Done");
+   }
+
+   /**
+    * Install artifact
+    * @param from The from directory
+    * @param artifact The artifact name
+    * @param version The version
+    * @param to The to directory
+    * @exception Throwable If an error occurs
+    */
+   private static void installArtifact(File from, String artifact, String version, File to) throws Throwable
+   {
+      File src = new File(from, artifact + "-" + version + ".jar");
+      File dest = new File(to, artifact + "-" + version + ".jar");
+
+      copy(src, dest);
+   }
+}

Added: projects/jboss-jca/trunk/as/src/main/java/org/jboss/jca/as/upgrader/ModuleXml.java
===================================================================
--- projects/jboss-jca/trunk/as/src/main/java/org/jboss/jca/as/upgrader/ModuleXml.java	                        (rev 0)
+++ projects/jboss-jca/trunk/as/src/main/java/org/jboss/jca/as/upgrader/ModuleXml.java	2011-06-28 12:27:24 UTC (rev 111682)
@@ -0,0 +1,186 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, 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.as.upgrader;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * module.xml definitions
+ * 
+ * @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>
+ */
+public class ModuleXml
+{
+   private static final String HEADER[] = {
+      "<?xml version=\"1.0\" encoding=\"UTF-8\"?>",
+      "",
+      "<!--",
+      "  ~ JBoss, Home of Professional Open Source.",
+      "  ~ Copyright 2011, Red Hat, Inc., 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.",
+      " -->"
+   };
+
+   /**
+    * Get the API definiton
+    * @param version The version
+    * @return The value
+    */
+   public static List<String> getApi(String version)
+   {
+      List<String> result = new ArrayList<String>();
+
+      for (String s : HEADER)
+      {
+         result.add(s);
+      }
+
+      result.add("");
+
+      result.add("<module xmlns=\"urn:jboss:module:1.0\" name=\"org.jboss.ironjacamar.api\">");
+      result.add("  <resources>");
+      result.add("    <resource-root path=\"ironjacamar-common-api-" + version + ".jar\"/>");
+      result.add("    <resource-root path=\"ironjacamar-common-spi-" + version + ".jar\"/>");
+      result.add("    <resource-root path=\"ironjacamar-core-api-" + version + ".jar\"/>");
+      result.add("  </resources>");
+
+      result.add("");
+  
+      result.add("  <dependencies>");
+      result.add("    <module name=\"javax.api\"/>");
+      result.add("    <module name=\"javax.resource.api\"/>");
+      result.add("    <module name=\"org.jboss.common-core\"/>");
+      result.add("    <module name=\"org.jboss.logging\"/>");
+      result.add("    <module name=\"org.jboss.threads\"/>");
+      result.add("  </dependencies>");
+      result.add("</module>");
+
+      return result;
+   }
+
+   /**
+    * Get the implementation definiton
+    * @param version The version
+    * @return The value
+    */
+   public static List<String> getImplementation(String version)
+   {
+      List<String> result = new ArrayList<String>();
+
+      for (String s : HEADER)
+      {
+         result.add(s);
+      }
+
+      result.add("");
+
+      result.add("<module xmlns=\"urn:jboss:module:1.0\" name=\"org.jboss.ironjacamar.impl\">");
+      result.add("  <resources>");
+      result.add("    <resource-root path=\"ironjacamar-common-impl-" + version + ".jar\"/>");
+      result.add("    <resource-root path=\"ironjacamar-core-impl-" + version + ".jar\"/>");
+      result.add("    <resource-root path=\"ironjacamar-deployers-common-" + version + ".jar\"/>");
+      result.add("    <resource-root path=\"ironjacamar-validator-" + version + ".jar\"/>");
+      result.add("  </resources>");
+
+      result.add("");
+  
+      result.add("  <dependencies>");
+      result.add("    <module name=\"javax.api\"/>");
+      result.add("    <module name=\"javax.resource.api\"/>");
+      result.add("    <module name=\"javax.security.auth.message.api\"/>");
+      result.add("    <module name=\"javax.validation.api\"/>");
+      result.add("    <module name=\"javax.xml.stream.api\"/>");
+      result.add("    <module name=\"org.hibernate.validator\"/>");
+      result.add("    <module name=\"org.jboss.as.naming\"/>");
+      result.add("    <module name=\"org.jboss.as.transactions\"/>");
+      result.add("    <module name=\"org.jboss.common-core\"/>");
+      result.add("    <module name=\"org.jboss.ironjacamar.api\"/>");
+      result.add("    <module name=\"org.jboss.jboss-transaction-spi\"/>");
+      result.add("    <module name=\"org.jboss.logging\"/>");
+      result.add("    <module name=\"org.jboss.threads\"/>");
+      result.add("    <module name=\"org.picketbox\"/>");
+      result.add("  </dependencies>");
+      result.add("</module>");
+
+      return result;
+   }
+
+   /**
+    * Get the JDBC definiton
+    * @param version The version
+    * @return The value
+    */
+   public static List<String> getJdbc(String version)
+   {
+      List<String> result = new ArrayList<String>();
+
+      for (String s : HEADER)
+      {
+         result.add(s);
+      }
+
+      result.add("");
+
+      result.add("<module xmlns=\"urn:jboss:module:1.0\" name=\"org.jboss.ironjacamar.jdbcadapters\">");
+      result.add("  <resources>");
+      result.add("    <resource-root path=\"ironjacamar-jdbc-" + version + ".jar\"/>");
+      result.add("  </resources>");
+
+      result.add("");
+  
+      result.add("  <dependencies>");
+      result.add("    <module name=\"javax.api\"/>");
+      result.add("    <module name=\"javax.resource.api\"/>");
+      result.add("    <module name=\"javax.validation.api\"/>");
+      result.add("    <module name=\"javax.xml.stream.api\"/>");
+      result.add("    <module name=\"org.hibernate.validator\"/>");
+      result.add("    <module name=\"org.jboss.as.naming\"/>");
+      result.add("    <module name=\"org.jboss.as.transactions\"/>");
+      result.add("    <module name=\"org.jboss.common-core\"/>");
+      result.add("    <module name=\"org.jboss.ironjacamar.api\"/>");
+      result.add("    <module name=\"org.jboss.jboss-transaction-spi\"/>");
+      result.add("    <module name=\"org.jboss.logging\"/>");
+      result.add("    <module name=\"org.jboss.threads\"/>");
+      result.add("    <module name=\"org.picketbox\"/>");
+      result.add("  </dependencies>");
+      result.add("</module>");
+
+      return result;
+   }
+}

Added: projects/jboss-jca/trunk/as/src/main/java/org/jboss/jca/as/upgrader/package.html
===================================================================
--- projects/jboss-jca/trunk/as/src/main/java/org/jboss/jca/as/upgrader/package.html	                        (rev 0)
+++ projects/jboss-jca/trunk/as/src/main/java/org/jboss/jca/as/upgrader/package.html	2011-06-28 12:27:24 UTC (rev 111682)
@@ -0,0 +1,3 @@
+<body>
+This package contains the IronJacamar upgrader for the JBoss Application Server.
+</body>

Added: projects/jboss-jca/trunk/as/src/main/resources/as-upgrader.bat
===================================================================
--- projects/jboss-jca/trunk/as/src/main/resources/as-upgrader.bat	                        (rev 0)
+++ projects/jboss-jca/trunk/as/src/main/resources/as-upgrader.bat	2011-06-28 12:27:24 UTC (rev 111682)
@@ -0,0 +1 @@
+java -jar ironjacamar-as.jar %*

Added: projects/jboss-jca/trunk/as/src/main/resources/as-upgrader.sh
===================================================================
--- projects/jboss-jca/trunk/as/src/main/resources/as-upgrader.sh	                        (rev 0)
+++ projects/jboss-jca/trunk/as/src/main/resources/as-upgrader.sh	2011-06-28 12:27:24 UTC (rev 111682)
@@ -0,0 +1,2 @@
+#!/bin/sh
+java -jar ironjacamar-as.jar $*


Property changes on: projects/jboss-jca/trunk/as/src/main/resources/as-upgrader.sh
___________________________________________________________________
Added: svn:executable
   + *

Modified: projects/jboss-jca/trunk/build.xml
===================================================================
--- projects/jboss-jca/trunk/build.xml	2011-06-28 08:50:34 UTC (rev 111681)
+++ projects/jboss-jca/trunk/build.xml	2011-06-28 12:27:24 UTC (rev 111682)
@@ -330,6 +330,7 @@
     <ant dir="codegenerator" inheritRefs="true" target="jars"/>
     <ant dir="adapters" inheritRefs="true" target="jars"/>
     <ant dir="rhq" inheritRefs="true" target="jars"/>
+    <ant dir="as" inheritRefs="true" target="jars"/>
   </target>
   
   <!-- ================================= 
@@ -347,6 +348,7 @@
     <ant dir="codegenerator" inheritRefs="true" target="docs"/>
     <ant dir="adapters" inheritRefs="true" target="docs"/>
     <ant dir="rhq" inheritRefs="true" target="docs"/>
+    <ant dir="as" inheritRefs="true" target="docs"/>
   </target>
   
   <!-- ================================= 
@@ -418,6 +420,7 @@
     <ant dir="embedded" inheritRefs="true" target="artifacts"/>
     <ant dir="codegenerator" inheritRefs="true" target="artifacts"/>
     <ant dir="adapters" inheritRefs="true" target="artifacts"/>
+    <ant dir="as" inheritRefs="true" target="artifacts"/>
   </target>
   
   <!-- ================================= 
@@ -553,6 +556,7 @@
           <include name="*.jar"/>
         </fileset>
       </auxClasspath>
+      <class location="${target.dir}/${name}-as.jar" />
       <class location="${target.dir}/${name}-codegenerator.jar" />
       <class location="${target.dir}/${name}-common-api.jar" />
       <class location="${target.dir}/${name}-common-impl.jar" />
@@ -612,6 +616,7 @@
           <include name="*.jar"/>
         </fileset>
       </auxClasspath>
+      <class location="${target.dir}/${name}-as.jar" />
       <class location="${target.dir}/${name}-codegenerator.jar" />
       <class location="${target.dir}/${name}-common-api.jar" />
       <class location="${target.dir}/${name}-common-impl.jar" />
@@ -1159,7 +1164,7 @@
     <fail message="IronJacamar doesn't support JDK 7+ artifacts" if="HAVE_JDK_1.7"/>
   
     <ivy:retrieve pattern="${lib.dir}/[conf]/[artifact].[ext]" 
-                  conf="${name}-codegenerator,${name}-common-api,${name}-common-impl,${name}-common-impl-papaki,${name}-common-spi,${name}-core-api,${name}-core-impl,${name}-deployers-common,${name}-deployers-fungal,${name}-embedded,${name}-embedded-arquillian,${name}-spec-api,${name}-validator,${name}-validator-ant,${name}-validator-cli,jdbc-local,jdbc-xa,mail"
+                  conf="${name}-as,${name}-codegenerator,${name}-common-api,${name}-common-impl,${name}-common-impl-papaki,${name}-common-spi,${name}-core-api,${name}-core-impl,${name}-deployers-common,${name}-deployers-fungal,${name}-embedded,${name}-embedded-arquillian,${name}-spec-api,${name}-validator,${name}-validator-ant,${name}-validator-cli,jdbc-local,jdbc-xa,mail"
                   sync="true"/>
 
     <delete file="${target.dir}/deploy.sh"/>
@@ -1176,6 +1181,21 @@
 VERSION=${version}
 </concat>
 
+    <!-- ironjacamar-as -->
+    <delete file="${target.dir}/${name}-as.xml"/>
+    <ivy:makepom artifactName="${name}-as" 
+                 conf="${name}-as"
+                 ivyfile="${basedir}/ivy.xml" 
+                 pomfile="${target.dir}/${name}-as.xml"
+                 headerFile="${tools.dir}/mvn/HEADER"
+                 templatefile="${tools.dir}/mvn/pom.template"
+                 printIvyInfo="false">
+      <mapping conf="${name}-as" scope="runtime"/>
+    </ivy:makepom>
+
+    <deploy-file file="deploy.sh" artifact="${name}-as" extension="jar"/>
+    <install-file file="install.sh" artifact="${name}-as" extension="jar"/>
+
     <!-- ironjacamar-codegenerator -->
     <delete file="${target.dir}/${name}-codegenerator.xml"/>
     <ivy:makepom artifactName="${name}-codegenerator" 

Modified: projects/jboss-jca/trunk/doc/userguide/en-US/modules/download.xml
===================================================================
--- projects/jboss-jca/trunk/doc/userguide/en-US/modules/download.xml	2011-06-28 08:50:34 UTC (rev 111681)
+++ projects/jboss-jca/trunk/doc/userguide/en-US/modules/download.xml	2011-06-28 12:27:24 UTC (rev 111682)
@@ -12,7 +12,7 @@
       <para>Each release is labelled with a version number and an identifier.</para>
 
       <programlisting>
-ironjacamar-&lt;major&gt;.&lt;minor&gt;.&lt;patch&gt;[.&lt;identifier&gt;]
+ironjacamar-&lt;major&gt;.&lt;minor&gt;.&lt;patch&gt;.&lt;identifier&gt;
       </programlisting>
 
       <para>where</para>
@@ -31,7 +31,7 @@
            Identifier: The identifier. Identifies the level of the quality of the release.
            <itemizedlist spacing="compact">
              <listitem>
-               None / Final: Stable release
+               Final: Stable release
              </listitem>
              <listitem>
                CR: Candidate for Release quality. The implementation is functional complete.
@@ -49,7 +49,7 @@
       <para>An example</para>
 
       <programlisting>
-ironjacamar-1.0.0.tar.gz
+ironjacamar-1.0.0.Final.tar.gz
       </programlisting>
 
       <para>which is the first stable release of the project.</para>
@@ -77,6 +77,12 @@
           </thead>
           <tbody>
             <row>
+              <entry><code>ironjacamar-as</code></entry>
+              <entry>
+                JBoss Application Server integration tools
+              </entry>
+            </row>
+            <row>
               <entry><code>ironjacamar-codegenerator</code></entry>
               <entry>
                 The code generator
@@ -119,6 +125,12 @@
               </entry>
             </row>
             <row>
+              <entry><code>ironjacamar-depchain</code></entry>
+              <entry>
+                The dependency chain for the IronJacamar container
+              </entry>
+            </row>
+            <row>
               <entry><code>ironjacamar-deployers-common</code></entry>
               <entry>
                 The common classes for the deployer chains
@@ -143,6 +155,12 @@
               </entry>
             </row>
             <row>
+              <entry><code>ironjacamar-jdbc</code></entry>
+              <entry>
+                The core library for the JDBC resource adapters
+              </entry>
+            </row>
+            <row>
               <entry><code>ironjacamar-spec-api</code></entry>
               <entry>
                 The Java EE Connector Architecture 1.6 API

Modified: projects/jboss-jca/trunk/doc/userguide/en-US/modules/installation.xml
===================================================================
--- projects/jboss-jca/trunk/doc/userguide/en-US/modules/installation.xml	2011-06-28 08:50:34 UTC (rev 111681)
+++ projects/jboss-jca/trunk/doc/userguide/en-US/modules/installation.xml	2011-06-28 12:27:24 UTC (rev 111682)
@@ -74,4 +74,43 @@
 
    </section>
 
+   <section id="installas">
+     <title>JBoss Application Server</title>
+
+     <para>
+       The IronJacamar provides the Java EE Connector Architecture (JCA) container
+       for JBoss Application Server 7 and future versions.
+     </para>
+
+     <para>
+       The container can be updated in the JBoss Application Server by using the 
+       <code>as-upgrader.sh</code> script in the <code>doc/as</code> directory.
+       This will allow an easy installation of IronJacamar patch releases to fix bugs
+       in the application server environment.
+     </para>
+
+     <para>
+       The script can be used, like:
+     </para>
+
+     <programlisting>
+./as-upgrader.sh 1.0.0.Final /path/to/as7/installation
+     </programlisting>
+
+     <para>
+       where <code>1.0.0.Final</code> is the version identifier of the IronJacamar container
+       and the path points to the top-level directory of the JBoss Application Server installation.
+     </para>
+
+     <para>
+       You can get an overview of all IronJacamar releases by browsing our
+       <ulink url="http://repository.jboss.org/nexus/content/groups/public/org/jboss/ironjacamar/">Nexus</ulink> repository.
+     </para>
+
+     <warning>
+       Make sure that you understand the version policies specified in the developer guide before upgrading
+     </warning>
+
+   </section>
+
 </chapter>

Modified: projects/jboss-jca/trunk/ivy.xml
===================================================================
--- projects/jboss-jca/trunk/ivy.xml	2011-06-28 08:50:34 UTC (rev 111681)
+++ projects/jboss-jca/trunk/ivy.xml	2011-06-28 12:27:24 UTC (rev 111682)
@@ -33,7 +33,7 @@
     </description>
   </info>
 
-  <configurations defaultconfmapping="common->default;sjc->default;embedded->default;arquillian->default;jetty->default;test->default;mail->default;;tools->default;ironjacamar-codegenerator->default;ironjacamar-common-api->default;ironjacamar-common-impl->default;ironjacamar-common-impl-papaki->default;ironjacamar-common-spi->default;ironjacamar-core-api->default;ironjacamar-core-impl->default;ironjacamar-depchain->default;ironjacamar-deployers-common->default;ironjacamar-deployers-fungal->default;ironjacamar-embedded->default;ironjacamar-embedded-arquillian->default;ironjacamar.jdbc->default;ironjacamar-spec-api->default;ironjacamar-validator->default;ironjacamar-validator-ant->default;ironjacamar-validator-cli->default;ironjacamar-validator-maven->default;jdbc-local->default;jdbc-xa->default;rhq->default;hornetq->default">
+  <configurations defaultconfmapping="common->default;sjc->default;embedded->default;arquillian->default;jetty->default;test->default;mail->default;;tools->default;ironjacamar-as->default;ironjacamar-codegenerator->default;ironjacamar-common-api->default;ironjacamar-common-impl->default;ironjacamar-common-impl-papaki->default;ironjacamar-common-spi->default;ironjacamar-core-api->default;ironjacamar-core-impl->default;ironjacamar-depchain->default;ironjacamar-deployers-common->default;ironjacamar-deployers-fungal->default;ironjacamar-embedded->default;ironjacamar-embedded-arquillian->default;ironjacamar.jdbc->default;ironjacamar-spec-api->default;ironjacamar-validator->default;ironjacamar-validator-ant->default;ironjacamar-validator-cli->default;ironjacamar-validator-maven->default;jdbc-local->default;jdbc-xa->default;rhq->default;hornetq->default">
     <conf name="arquillian" transitive="false"/>
     <conf name="common" transitive="false"/>
     <conf name="embedded" transitive="false"/>
@@ -45,6 +45,7 @@
     <conf name="tools" transitive="false"/>
     <conf name="rhq" transitive="false"/>
 
+    <conf name="ironjacamar-as" transitive="false"/>
     <conf name="ironjacamar-codegenerator" transitive="false"/>
     <conf name="ironjacamar-common-api" transitive="false"/>
     <conf name="ironjacamar-common-impl" transitive="false"/>
@@ -69,6 +70,7 @@
   </configurations>
 
   <publications>
+    <artifact name="ironjacamar-as" type="jar"/>
     <artifact name="ironjacamar-codegenerator" type="jar"/>
     <artifact name="ironjacamar-common-api" type="jar"/>
     <artifact name="ironjacamar-common-impl" type="jar"/>

Modified: projects/jboss-jca/trunk/sjc/build.xml
===================================================================
--- projects/jboss-jca/trunk/sjc/build.xml	2011-06-28 08:50:34 UTC (rev 111681)
+++ projects/jboss-jca/trunk/sjc/build.xml	2011-06-28 12:27:24 UTC (rev 111682)
@@ -106,6 +106,7 @@
     <mkdir dir="${target.dir}/sjc/config"/>
     <mkdir dir="${target.dir}/sjc/config/bootstrap"/>
     <mkdir dir="${target.dir}/sjc/doc"/>
+    <mkdir dir="${target.dir}/sjc/doc/as"/>
     <mkdir dir="${target.dir}/sjc/doc/codegenerator"/>
     <mkdir dir="${target.dir}/sjc/doc/datasources"/>
     <mkdir dir="${target.dir}/sjc/doc/validator"/>
@@ -173,13 +174,11 @@
     <copy todir="${target.dir}/sjc/lib">
       <fileset dir="${target.dir}">
         <include name="*.jar"/>
+        <exclude name="${name}-as.jar"/>
         <exclude name="${name}-codegenerator.jar"/>
-        <exclude name="${name}-deployers-main.jar"/>
-        <exclude name="${name}-deployers-rar.jar"/>
         <exclude name="${name}-embedded-arquillian.jar"/>
         <exclude name="${name}-embedded.jar"/>
         <exclude name="${name}-sjc.jar"/>
-        <exclude name="${name}-standalone.jar"/>
         <exclude name="${name}-web-console.jar"/>
       </fileset>
     </copy>
@@ -251,6 +250,18 @@
       </fileset>
     </copy>
 
+    <copy todir="${target.dir}/sjc/doc/as">
+      <fileset dir="${target.dir}">
+        <include name="${name}-as.jar"/>
+      </fileset>
+    </copy>
+    <copy todir="${target.dir}/sjc/doc/as">
+      <fileset dir="../as/src/main/resources/">
+        <include name="**/*.sh"/>
+        <include name="**/*.bat"/>
+      </fileset>
+    </copy>
+
     <copy todir="${target.dir}/sjc/doc/datasources" flatten="true">
       <fileset dir="../common/src/test/resources/ds/example">
         <include name="*.xml"/>
@@ -283,10 +294,10 @@
 
     <copy todir="${target.dir}/sjc/doc/samples">
       <fileset dir="../doc/samples"/>
-
     </copy>
 
     <chmod dir="${target.dir}/sjc/bin" perm="ugo+rx" includes="**/*.sh"/>
+    <chmod dir="${target.dir}/sjc/doc/as" perm="ugo+rx" includes="**/*.sh"/>
     <chmod dir="${target.dir}/sjc/doc/codegenerator" perm="ugo+rx" includes="**/*.sh"/>
     <chmod dir="${target.dir}/sjc/doc/validator" perm="ugo+rx" includes="**/*.sh"/>
 



More information about the jboss-cvs-commits mailing list