[jboss-cvs] JBossAS SVN: r68969 - in projects/ejb3/trunk: ejb3-installer and 2 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Jan 15 00:39:39 EST 2008


Author: ALRubinger
Date: 2008-01-15 00:39:39 -0500 (Tue, 15 Jan 2008)
New Revision: 68969

Added:
   projects/ejb3/trunk/ejb3-installer/src/main/resources/jbossas-ejb3-files-to-remove.txt
Modified:
   projects/ejb3/trunk/assembly/installer.xml
   projects/ejb3/trunk/ejb3-installer/pom.xml
   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:
Installer now cleans an existing JBossAS 5.0.x Installation of EJB3 files

Modified: projects/ejb3/trunk/assembly/installer.xml
===================================================================
--- projects/ejb3/trunk/assembly/installer.xml	2008-01-15 05:13:32 UTC (rev 68968)
+++ projects/ejb3/trunk/assembly/installer.xml	2008-01-15 05:39:39 UTC (rev 68969)
@@ -36,6 +36,16 @@
       <binaries>
         <unpack>true</unpack>
         <includeDependencies>false</includeDependencies>
+        <dependencySets>
+          <dependencySet>
+            <includes>
+              <include>ant-contrib:ant-contrib</include>
+            </includes>
+            <unpack>false</unpack>
+            <outputFileNameMapping>${artifactId}.${extension}</outputFileNameMapping>
+            <outputDirectory>lib</outputDirectory>
+          </dependencySet>
+        </dependencySets>
         <outputFileNameMapping></outputFileNameMapping>
         <outputDirectory></outputDirectory>
       </binaries>

Modified: projects/ejb3/trunk/ejb3-installer/pom.xml
===================================================================
--- projects/ejb3/trunk/ejb3-installer/pom.xml	2008-01-15 05:13:32 UTC (rev 68968)
+++ projects/ejb3/trunk/ejb3-installer/pom.xml	2008-01-15 05:39:39 UTC (rev 68969)
@@ -32,4 +32,18 @@
   <name>JBoss EJB 3.0 Installer</name>
   <description>Installer to patch existing JBoss AS 5.0.x Installation w/ EJB3 Plugin</description>
 
+  <!-- Properties -->
+  <properties>
+    <version.ant-contrib:ant-contrib>1.0b2</version.ant-contrib:ant-contrib>
+  </properties>
+
+  <!-- Dependencies -->
+  <dependencies>
+    <dependency>
+      <groupId>ant-contrib</groupId>
+      <artifactId>ant-contrib</artifactId>
+      <version>${version.ant-contrib:ant-contrib}</version>
+    </dependency>
+  </dependencies>
+
 </project>
\ No newline at end of file

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 05:13:32 UTC (rev 68968)
+++ projects/ejb3/trunk/ejb3-installer/src/main/java/org/jboss/ejb3/installer/Installer.java	2008-01-15 05:39:39 UTC (rev 68969)
@@ -63,19 +63,23 @@
     * System Property Key for OS 
     */
    private static final String SYSTEM_PROPERTY_OS = "os.name";
-   
+
    /*
     * Environment Property key for JBOSS_HOME
     */
    private static final String ENV_PROPERTY_JBOSS_HOME = "JBOSS_HOME";
-   
-   
+
    /*
     * Environment Property key for ANT_HOME 
     */
-   private static final String SYSTEM_PROPERTY_ANT_HOME = "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";
@@ -89,7 +93,7 @@
     * Apache Ant executable
     */
    private static final String COMMAND_ANT = "ant";
-   
+
    /*
     * Extension to append to Windows-based systems
     */
@@ -105,6 +109,11 @@
     */
    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
 
    /*
@@ -164,7 +173,7 @@
       System.out.println("|| JBossAS 5.0.x EJB3 Plugin Installer ||");
       System.out.println("*****************************************\n");
       System.out.println("Installing EJB3 Libraries to Temp Directory...");
-      
+
       // Add Shutdown Hook
       Runtime.getRuntime().addShutdownHook(new Shutdown());
 
@@ -185,6 +194,10 @@
       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();
    }
@@ -288,39 +301,37 @@
    {
       // Initialize
       Process antProcess = null;
-      String buildfile = this.getInstallationDirectory() + File.separator
-            + Installer.FILENAME_BUILDFILE;
+      String buildfile = this.getInstallationDirectory() + File.separator + Installer.FILENAME_BUILDFILE;
 
       // Obtain ANT_HOME and ensure specified
-      String antHome = System.getenv(Installer.SYSTEM_PROPERTY_ANT_HOME);
-      if(antHome==null || "".equals(antHome))
+      String antHome = System.getenv(Installer.ENV_PROPERTY_ANT_HOME);
+      if (antHome == null || "".equals(antHome))
       {
-            throw new RuntimeException("Environment Variable '" + Installer.SYSTEM_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);
-      
+
       // Construct "ant" command
       String antCommand = antHome + File.separator + "bin" + File.separator + Installer.COMMAND_ANT;
-      
+
       // Windows Hack
-      if(System.getProperty(Installer.SYSTEM_PROPERTY_OS).trim().toLowerCase().contains("windows"))
+      if (System.getProperty(Installer.SYSTEM_PROPERTY_OS).trim().toLowerCase().contains("windows"))
       {
-          antCommand = antCommand + Installer.COMMAND_EXTENSION_WINDOWS;
+         antCommand = antCommand + Installer.COMMAND_EXTENSION_WINDOWS;
       }
-      
+
       // Construct the Process
-      ProcessBuilder antProcessBuilder = new ProcessBuilder(antCommand, Installer.SWITCH_ANT_BUILDFILE,
-            buildfile);
+      ProcessBuilder antProcessBuilder = new ProcessBuilder(antCommand, Installer.SWITCH_ANT_BUILDFILE, buildfile);
       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());
+
       try
       {
          // Start the Process
-         System.out.println("Starting Ant> " + antCommand + " "
-             + Installer.SWITCH_ANT_BUILDFILE + " " + buildfile);
+         System.out.println("Starting Ant> " + antCommand + " " + Installer.SWITCH_ANT_BUILDFILE + " " + buildfile);
          antProcess = antProcessBuilder.start();
 
          // Capture the output
@@ -343,8 +354,8 @@
          // The command could not be found
          if (antProcess == null)
          {
-            throw new RuntimeException("Ensure Apache Ant is properly installed and Environment Variable ANT_HOME is set",
-                  ioe);
+            throw new RuntimeException(
+                  "Ensure Apache Ant is properly installed and Environment Variable ANT_HOME is set", ioe);
          }
 
          // Other I/O Error
@@ -416,16 +427,16 @@
       catch (IOException ioe)
       {
          throw new RuntimeException(ioe);
-      } 
-      finally 
+      }
+      finally
       {
          // Close the Streams
-         try 
+         try
          {
             in.close();
             out.close();
-         } 
-         catch (IOException ioe) 
+         }
+         catch (IOException ioe)
          {
             // Ignore
          }
@@ -479,13 +490,13 @@
 
       // Remove
       boolean removed = file.delete();
-      if(removed)
+      if (removed)
       {
-           System.out.println(file.getAbsolutePath() + " Removed.");
+         System.out.println(file.getAbsolutePath() + " Removed.");
       }
       else
       {
-           System.out.println("Unable to remove " + file.getAbsolutePath());
+         System.out.println("Unable to remove " + file.getAbsolutePath());
       }
 
    }

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 05:13:32 UTC (rev 68968)
+++ projects/ejb3/trunk/ejb3-installer/src/main/resources/build-install-ejb3-plugin.xml	2008-01-15 05:39:39 UTC (rev 68969)
@@ -12,12 +12,23 @@
 <!-- $Id: build.xml 68707 2008-01-09 00:20:17Z andrew.rubinger at jboss.org $ -->
 
 <project name="jboss-ejb3-plugin-installer" default="install" basedir=".">
-  
+
   <!-- Project Properties ============================================================== -->
- 
+
   <property environment="env" />
   <property name="jboss.home" value="${env.JBOSS_HOME}" />
+  <property name="installer.home" value="${env.JBOSS_EJB3_PLUGIN_INSTALL_HOME}" />
 
+  <property name="file.jbossas.remove.includes" value="jbossas-ejb3-files-to-remove.txt" />
+
+  <!-- Optional Tasks =================================================================== -->
+
+  <taskdef resource="net/sf/antcontrib/antcontrib.properties">
+    <classpath>
+      <pathelement location="${installer.home}/lib/ant-contrib.jar" />
+    </classpath>
+  </taskdef>
+
   <!-- Targets ========================================================================= -->
 
   <!--
@@ -26,28 +37,54 @@
   
   -->
   <target name="init">
-  
-    <echo>JBoss AS Installation: ${jboss.home}</echo>
-  
+
+    <if>
+      <isset property="jboss.home" />
+      <then>
+        <echo>JBoss Home Directory is: ${jboss.home}</echo>
+      </then>
+      <else>
+        <echo>Ensure Environment Variable "JBOSS_HOME" is set before running.</echo>
+        <fail message="Ensure Environment Variable 'JBOSS_HOME' is set before running." />
+      </else>
+    </if>
+
+    <if>
+      <isset property="installer.home" />
+      <then>
+        <echo>EJB3 Plugin Installer Home Directory is: ${installer.home}</echo>
+      </then>
+      <else>
+        <echo>Ensure Environment Variable "JBOSS_EJB3_PLUGIN_INSTALL_HOME" is set before running.</echo>
+        <fail message="Ensure Environment Variable 'JBOSS_EJB3_PLUGIN_INSTALL_HOME' is set before running." />
+      </else>
+    </if>
+
   </target>
-  
+
   <!-- 
   
   Installs the EJB3 Plugin 
   
   -->
-  <target name="install" depends="init,clean">
+  <target name="install" depends="clean">
     <echo>IMPLEMENT</echo>
   </target>
-  
+
   <!-- 
   
   Cleans existing EJB3 Binaries from
   the AS Installation   
   
   -->
-  <target name="clean">
-    <echo>IMPLEMENT</echo>
+  <target name="clean" depends="init">
+
+    <echo>Cleaning ${jboss.home} of EJB3 Binaries and Descriptors...</echo>
+
+    <delete verbose="true" includeemptydirs="true">
+      <fileset dir="${jboss.home}" includesfile="${file.jbossas.remove.includes}" />
+    </delete>
+
   </target>
 
 </project>
\ No newline at end of file

Added: 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	                        (rev 0)
+++ projects/ejb3/trunk/ejb3-installer/src/main/resources/jbossas-ejb3-files-to-remove.txt	2008-01-15 05:39:39 UTC (rev 68969)
@@ -0,0 +1,34 @@
+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


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




More information about the jboss-cvs-commits mailing list