[jboss-cvs] JBossAS SVN: r68998 - in projects/ejb3/trunk/ejb3-installer/src/main: resources and 1 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Jan 15 17:13:47 EST 2008


Author: ALRubinger
Date: 2008-01-15 17:13:47 -0500 (Tue, 15 Jan 2008)
New Revision: 68998

Added:
   projects/ejb3/trunk/ejb3-installer/src/main/resources/conf/
   projects/ejb3/trunk/ejb3-installer/src/main/resources/conf/jbossas-ejb3-files-to-place-in-serverlib.txt
   projects/ejb3/trunk/ejb3-installer/src/main/resources/conf/jbossas-ejb3-files-to-remove.txt
Removed:
   projects/ejb3/trunk/ejb3-installer/src/main/resources/jbossas-ejb3-files-to-remove.txt
Modified:
   projects/ejb3/trunk/ejb3-installer/src/main/java/org/jboss/ejb3/installer/Installer.java
   projects/ejb3/trunk/ejb3-installer/src/main/resources/build-install-ejb3-plugin.xml
Log:
Patch AS with Server Libraries

Modified: projects/ejb3/trunk/ejb3-installer/src/main/java/org/jboss/ejb3/installer/Installer.java
===================================================================
--- projects/ejb3/trunk/ejb3-installer/src/main/java/org/jboss/ejb3/installer/Installer.java	2008-01-15 22:12:01 UTC (rev 68997)
+++ projects/ejb3/trunk/ejb3-installer/src/main/java/org/jboss/ejb3/installer/Installer.java	2008-01-15 22:13:47 UTC (rev 68998)
@@ -27,6 +27,7 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
+import java.io.PrintStream;
 import java.util.ArrayList;
 import java.util.Enumeration;
 import java.util.List;
@@ -73,23 +74,28 @@
     * Environment Property key for ANT_HOME 
     */
    private static final String ENV_PROPERTY_ANT_HOME = "ANT_HOME";
-   
+
    /*
     * Environment Property key for the Installation location
     */
    private static final String ENV_PROPERTY_INSTALL_LOCATION = "JBOSS_EJB3_PLUGIN_INSTALL_HOME";
-   
+
    /*
     * Namespace of the installer
     */
    private static final String NAMESPACE_DIRECTORY_INSTALLER = "jbossas-ejb3-plugin-installer";
 
    /*
-    * Location of the EJB3 Libraries
+    * Location of the Libraries
     */
    private static final String FILENAME_LIB_DIRECTORY = "lib";
 
    /*
+    * Location of the Configuration
+    */
+   private static final String FILENAME_CONF_DIRECTORY = "conf";
+
+   /*
     * Apache Ant executable
     */
    private static final String COMMAND_ANT = "ant";
@@ -109,11 +115,6 @@
     */
    private static final String FILENAME_BUILDFILE = "build-install-ejb3-plugin.xml";
 
-   /*
-    * Filename of include patterns of files to be removed from AS 
-    */
-   private static final String FILENAME_REMOVE_INCLUDES = "jbossas-ejb3-files-to-remove.txt";
-
    // Instance Members
 
    /*
@@ -169,10 +170,10 @@
    public void install()
    {
       // Log
-      System.out.println("\n*****************************************");
-      System.out.println("|| JBossAS 5.0.x EJB3 Plugin Installer ||");
-      System.out.println("*****************************************\n");
-      System.out.println("Installing EJB3 Libraries to Temp Directory...");
+      this.getPrintStream().println("\n*****************************************");
+      this.getPrintStream().println("|| JBossAS 5.0.x EJB3 Plugin Installer ||");
+      this.getPrintStream().println("*****************************************\n");
+      this.getPrintStream().println("Installing EJB3 Libraries to Temp Directory...");
 
       // Add Shutdown Hook
       Runtime.getRuntime().addShutdownHook(new Shutdown());
@@ -183,21 +184,24 @@
       // Ensure JBOSS_HOME exists
       this.ensureJbossHomeExists();
 
-      // For each EJB3 Library
-      for (JarEntry library : this.getAllEjb3Libraries())
+      // For each Library
+      for (JarEntry library : this.getAllLibraries())
       {
          // Copy to the installer temp directory
          this.copyFileFromJarToDirectory(this.getInstallerJarFile(), library, this.getInstallationDirectory());
       }
 
+      // For Configuration File
+      for (JarEntry conf : this.getAllConfigurationFiles())
+      {
+         // Copy to the installer temp directory
+         this.copyFileFromJarToDirectory(this.getInstallerJarFile(), conf, this.getInstallationDirectory());
+      }
+
       // Copy the buildfile to the installer temp directory
       this.copyFileFromJarToDirectory(this.getInstallerJarFile(), this.getInstallerJarFile().getJarEntry(
             Installer.FILENAME_BUILDFILE), this.getInstallationDirectory());
 
-      // Copy the remove includes file to the installer temp directory
-      this.copyFileFromJarToDirectory(this.getInstallerJarFile(), this.getInstallerJarFile().getJarEntry(
-            Installer.FILENAME_REMOVE_INCLUDES), this.getInstallationDirectory());
-
       // Run Ant
       this.runAnt();
    }
@@ -226,7 +230,7 @@
          // Set as installation Directory
          this.setInstallationDirectory(installerDir);
          // Log
-         System.out.println("JBoss AS 5.0.x Installation Directory: " + this.installationDirectory);
+         this.getPrintStream().println("JBoss AS 5.0.x Installation Directory: " + this.installationDirectory);
       }
 
       // Return
@@ -267,10 +271,28 @@
    // Internal Helper Methods
 
    /**
-    * Returns all EJB3 Plugin libraries as references
+    * Returns all Libraries as references
     */
-   private List<JarEntry> getAllEjb3Libraries()
+   private List<JarEntry> getAllLibraries()
    {
+      return this.getAllJarEntriesInDirectory(Installer.FILENAME_LIB_DIRECTORY);
+   }
+
+   /**
+    * Returns all configuration files as references
+    */
+   private List<JarEntry> getAllConfigurationFiles()
+   {
+      return this.getAllJarEntriesInDirectory(Installer.FILENAME_CONF_DIRECTORY);
+   }
+
+   /**
+    * Returns all references in the specified directory
+    * 
+    * @param directory The directory
+    */
+   private List<JarEntry> getAllJarEntriesInDirectory(String directory)
+   {
       // Initialize
       List<JarEntry> libraries = new ArrayList<JarEntry>();
 
@@ -283,7 +305,7 @@
       {
          JarEntry entry = entries.nextElement();
          // Ensure it's in "lib" directory
-         if (entry.getName().startsWith(Installer.FILENAME_LIB_DIRECTORY) && !entry.isDirectory())
+         if (entry.getName().startsWith(directory) && !entry.isDirectory())
          {
             libraries.add(entry);
          }
@@ -307,10 +329,9 @@
       String antHome = System.getenv(Installer.ENV_PROPERTY_ANT_HOME);
       if (antHome == null || "".equals(antHome))
       {
-         throw new RuntimeException("Environment Variable '" + Installer.ENV_PROPERTY_ANT_HOME
-               + "' must be specified.");
+         throw new RuntimeException("Environment Variable '" + Installer.ENV_PROPERTY_ANT_HOME + "' must be specified.");
       }
-      System.out.println("Using ANT_HOME: " + antHome);
+      this.getPrintStream().println("Using ANT_HOME: " + antHome);
 
       // Construct "ant" command
       String antCommand = antHome + File.separator + "bin" + File.separator + Installer.COMMAND_ANT;
@@ -326,12 +347,14 @@
       antProcessBuilder.redirectErrorStream(true);
       antProcessBuilder.environment().put(Installer.ENV_PROPERTY_JBOSS_HOME,
             this.getJbossAsInstallationDirectory().getAbsolutePath());
-      antProcessBuilder.environment().put(Installer.ENV_PROPERTY_INSTALL_LOCATION, this.getInstallationDirectory().getAbsolutePath());
+      antProcessBuilder.environment().put(Installer.ENV_PROPERTY_INSTALL_LOCATION,
+            this.getInstallationDirectory().getAbsolutePath());
 
       try
       {
          // Start the Process
-         System.out.println("Starting Ant> " + antCommand + " " + Installer.SWITCH_ANT_BUILDFILE + " " + buildfile);
+         this.getPrintStream().println(
+               "Starting Ant> " + antCommand + " " + Installer.SWITCH_ANT_BUILDFILE + " " + buildfile);
          antProcess = antProcessBuilder.start();
 
          // Capture the output
@@ -342,7 +365,7 @@
          int exitValue = antProcess.waitFor();
          if (exitValue == 0)
          {
-            System.out.println("Ant Build Completed");
+            this.getPrintStream().println("Ant Build Completed");
          }
          else
          {
@@ -374,13 +397,13 @@
    private void cleanup()
    {
       // Log
-      System.out.println("Starting Cleanup...");
+      this.getPrintStream().println("Starting Cleanup...");
 
       // Remove installation directory
       this.rmAndChildren(this.getInstallationDirectory());
 
       // Log
-      System.out.println("Cleanup Complete.");
+      this.getPrintStream().println("Cleanup Complete.");
    }
 
    /**
@@ -443,7 +466,7 @@
       }
 
       // Log
-      System.out.println("Copied " + fileToCopy.getName() + " to " + destinationFile.getAbsolutePath());
+      this.getPrintStream().println("Copied " + fileToCopy.getName() + " to " + destinationFile.getAbsolutePath());
    }
 
    /**
@@ -465,7 +488,7 @@
       {
          // Make the directory
          directory.mkdir();
-         System.out.println("Created Directory " + directory.getAbsolutePath());
+         this.getPrintStream().println("Created Directory " + directory.getAbsolutePath());
       }
    }
 
@@ -477,6 +500,12 @@
     */
    private void rmAndChildren(File file)
    {
+      // Only delete if exists
+      if (!file.exists())
+      {
+         return;
+      }
+
       // For all children
       File[] children = file.listFiles();
       if (children != null)
@@ -492,11 +521,11 @@
       boolean removed = file.delete();
       if (removed)
       {
-         System.out.println(file.getAbsolutePath() + " Removed.");
+         this.getPrintStream().println(file.getAbsolutePath() + " Removed.");
       }
       else
       {
-         System.out.println("Unable to remove " + file.getAbsolutePath());
+         this.getPrintStream().println("Unable to remove " + file.getAbsolutePath());
       }
 
    }
@@ -514,6 +543,15 @@
       }
    }
 
+   /**
+    * Return the Output Stream
+    * @return
+    */
+   private PrintStream getPrintStream()
+   {
+      return System.out;
+   }
+
    // Inner Classes
 
    /**
@@ -532,13 +570,13 @@
          super.run();
 
          // Log
-         System.out.println("Shutdown Hook called...");
+         getPrintStream().println("Shutdown Hook called...");
 
          // Cleanup
          cleanup();
 
          // Log
-         System.out.println("");
+         getPrintStream().println("");
       }
    }
 
@@ -571,12 +609,12 @@
          // Obtain InputStream of process
          InputStream in = this.process.getInputStream();
 
-         // Read in and direct to stdout
+         // Read in and direct PrintStream
          try
          {
             while ((bytesRead = in.read(buffer)) != -1)
             {
-               System.out.write(buffer, 0, bytesRead);
+               getPrintStream().write(buffer, 0, bytesRead);
             }
          }
          catch (IOException ioe)

Modified: projects/ejb3/trunk/ejb3-installer/src/main/resources/build-install-ejb3-plugin.xml
===================================================================
--- projects/ejb3/trunk/ejb3-installer/src/main/resources/build-install-ejb3-plugin.xml	2008-01-15 22:12:01 UTC (rev 68997)
+++ projects/ejb3/trunk/ejb3-installer/src/main/resources/build-install-ejb3-plugin.xml	2008-01-15 22:13:47 UTC (rev 68998)
@@ -9,18 +9,27 @@
 <!--                                                                        -->
 <!-- ====================================================================== -->
 
-<!-- $Id: build.xml 68707 2008-01-09 00:20:17Z andrew.rubinger at jboss.org $ -->
+<!-- $Id: build-install-ejb3-plugin.xml 68707 2008-01-09 00:20:17Z andrew.rubinger at jboss.org $ -->
 
 <project name="jboss-ejb3-plugin-installer" default="install" basedir=".">
 
   <!-- Project Properties ============================================================== -->
 
+  <!-- Environment -->
   <property environment="env" />
   <property name="jboss.home" value="${env.JBOSS_HOME}" />
   <property name="installer.home" value="${env.JBOSS_EJB3_PLUGIN_INSTALL_HOME}" />
+  
+  <!-- Configuration -->
+  <property name="installer.lib" value="${installer.home}/lib" />
 
-  <property name="file.jbossas.remove.includes" value="jbossas-ejb3-files-to-remove.txt" />
+  <!-- Includes file of patterns to remove from existing AS Installation -->
+  <property name="file.jbossas.remove.includes" value="conf/jbossas-ejb3-files-to-remove.txt" />
+  <property name="file.jbossas.serverlib.includes" value="conf/jbossas-ejb3-files-to-place-in-serverlib.txt" />
 
+  <!-- Servers to patch -->
+  <property name="servers" value="default;all" />
+
   <!-- Optional Tasks =================================================================== -->
 
   <taskdef resource="net/sf/antcontrib/antcontrib.properties">
@@ -68,7 +77,12 @@
   
   -->
   <target name="install" depends="clean">
-    <echo>IMPLEMENT</echo>
+
+    <echo>Installing EJB3 Plugin to ${jboss.home}</echo>
+
+    <!-- Copy all binaries to "lib" directory of each server -->
+    <foreach list="${servers}" delimiter=";" param="serverName" target="install-libs" inheritall="true" />
+
   </target>
 
   <!-- 
@@ -87,4 +101,20 @@
 
   </target>
 
+  <!-- 
+  
+  Installs binaries to the "lib" directory of the
+  specified "serverName"
+  
+  -->
+  <target name="install-libs">
+
+    <echo>Installing EJB3 Binaries to "lib" of Server "${serverName}"</echo>
+
+    <copy todir="${jboss.home}/server/${serverName}/lib">
+      <fileset dir="${installer.lib}" includesfile="${file.jbossas.serverlib.includes}" />
+    </copy>
+
+  </target>
+
 </project>
\ No newline at end of file

Added: projects/ejb3/trunk/ejb3-installer/src/main/resources/conf/jbossas-ejb3-files-to-place-in-serverlib.txt
===================================================================
--- projects/ejb3/trunk/ejb3-installer/src/main/resources/conf/jbossas-ejb3-files-to-place-in-serverlib.txt	                        (rev 0)
+++ projects/ejb3/trunk/ejb3-installer/src/main/resources/conf/jbossas-ejb3-files-to-place-in-serverlib.txt	2008-01-15 22:13:47 UTC (rev 68998)
@@ -0,0 +1,7 @@
+jboss-ejb3-cache.jar
+jboss-ejb3-core.jar
+jboss-ejb3-ext-api.jar
+jboss-ejb3-impl.jar
+jboss-ejb3-interceptors.jar
+jboss-ejb3-metadata.jar
+jboss-ejb3-pool.jar
\ No newline at end of file


Property changes on: projects/ejb3/trunk/ejb3-installer/src/main/resources/conf/jbossas-ejb3-files-to-place-in-serverlib.txt
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Copied: projects/ejb3/trunk/ejb3-installer/src/main/resources/conf/jbossas-ejb3-files-to-remove.txt (from rev 68988, projects/ejb3/trunk/ejb3-installer/src/main/resources/jbossas-ejb3-files-to-remove.txt)
===================================================================
--- projects/ejb3/trunk/ejb3-installer/src/main/resources/conf/jbossas-ejb3-files-to-remove.txt	                        (rev 0)
+++ projects/ejb3/trunk/ejb3-installer/src/main/resources/conf/jbossas-ejb3-files-to-remove.txt	2008-01-15 22:13:47 UTC (rev 68998)
@@ -0,0 +1,32 @@
+client/jboss-annotations-ejb3.jar
+client/jboss-ejb3-impl.jar
+client/jboss-ejb3-client.jar
+client/ejb3-persistence.jar
+client/jboss-ejb3-impl-javadoc.jar
+client/jboss-ejb3-ext-api.jar
+server/default/lib/jboss-ejb3-impl.jar
+server/default/lib/jboss-ejb3-cache.jar
+server/default/lib/jboss-ejb3-ext-api.jar
+server/default/deployers/ejb3.deployer/jboss-annotations-ejb3.jar
+server/default/deployers/ejb3.deployer/META-INF/ejb3-deployers-beans.xml
+server/default/deployers/ejb3.deployer/META-INF/persistence.properties
+server/default/deployers/ejb3.deployer/META-INF/
+server/default/deployers/ejb3.deployer/jboss-ejb3.jar
+server/default/deployers/ejb3.deployer
+server/default/deploy/ejb3-interceptors-aop.xml
+server/default/deploy/ejb3-connectors-service.xml
+server/default/deploy/ejb3-timer-service.xml
+server/all/lib/jboss-ejb3-impl.jar
+server/all/lib/jboss-ejb3-cache.jar
+server/all/lib/jboss-ejb3-ext-api.jar
+server/all/deployers/ejb3.deployer/jboss-annotations-ejb3.jar
+server/all/deployers/ejb3.deployer/META-INF/ejb3-deployers-beans.xml
+server/all/deployers/ejb3.deployer/META-INF/persistence.properties
+server/all/deployers/ejb3.deployer/META-INF
+server/all/deployers/ejb3.deployer/jboss-ejb3.jar
+server/all/deployers/ejb3.deployer
+server/all/deploy/ejb3-interceptors-aop.xml
+server/all/deploy/ejb3-connectors-service.xml
+server/all/deploy/ejb3-timer-service.xml
+server/all/deploy/cluster/ejb3-clustered-sfsbcache-beans.xml
+server/all/deploy/cluster/ejb3-entity-cache-beans.xml
\ No newline at end of file


Property changes on: projects/ejb3/trunk/ejb3-installer/src/main/resources/conf/jbossas-ejb3-files-to-remove.txt
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Deleted: projects/ejb3/trunk/ejb3-installer/src/main/resources/jbossas-ejb3-files-to-remove.txt
===================================================================
--- projects/ejb3/trunk/ejb3-installer/src/main/resources/jbossas-ejb3-files-to-remove.txt	2008-01-15 22:12:01 UTC (rev 68997)
+++ projects/ejb3/trunk/ejb3-installer/src/main/resources/jbossas-ejb3-files-to-remove.txt	2008-01-15 22:13:47 UTC (rev 68998)
@@ -1,34 +0,0 @@
-client/jboss-annotations-ejb3.jar
-client/jboss-ejb3-impl.jar
-client/jboss-ejb3-client.jar
-client/ejb3-persistence.jar
-client/jboss-ejb3-impl-javadoc.jar
-client/jboss-ejb3-ext-api.jar
-server/default/lib/jboss-ejb3-impl.jar
-server/default/lib/ejb3-persistence.jar
-server/default/lib/jboss-ejb3-cache.jar
-server/default/lib/jboss-ejb3-ext-api.jar
-server/default/deployers/ejb3.deployer/jboss-annotations-ejb3.jar
-server/default/deployers/ejb3.deployer/META-INF/ejb3-deployers-beans.xml
-server/default/deployers/ejb3.deployer/META-INF/persistence.properties
-server/default/deployers/ejb3.deployer/META-INF/
-server/default/deployers/ejb3.deployer/jboss-ejb3.jar
-server/default/deployers/ejb3.deployer
-server/default/deploy/ejb3-interceptors-aop.xml
-server/default/deploy/ejb3-connectors-service.xml
-server/default/deploy/ejb3-timer-service.xml
-server/all/lib/jboss-ejb3-impl.jar
-server/all/lib/ejb3-persistence.jar
-server/all/lib/jboss-ejb3-cache.jar
-server/all/lib/jboss-ejb3-ext-api.jar
-server/all/deployers/ejb3.deployer/jboss-annotations-ejb3.jar
-server/all/deployers/ejb3.deployer/META-INF/ejb3-deployers-beans.xml
-server/all/deployers/ejb3.deployer/META-INF/persistence.properties
-server/all/deployers/ejb3.deployer/META-INF
-server/all/deployers/ejb3.deployer/jboss-ejb3.jar
-server/all/deployers/ejb3.deployer
-server/all/deploy/ejb3-interceptors-aop.xml
-server/all/deploy/ejb3-connectors-service.xml
-server/all/deploy/ejb3-timer-service.xml
-server/all/deploy/cluster/ejb3-clustered-sfsbcache-beans.xml
-server/all/deploy/cluster/ejb3-entity-cache-beans.xml
\ No newline at end of file




More information about the jboss-cvs-commits mailing list