[jbpm-commits] JBoss JBPM SVN: r5433 - in jbpm4/trunk/modules: pvm/src/main/java/org/jbpm/pvm/internal/ant and 1 other directory.

do-not-reply at jboss.org do-not-reply at jboss.org
Thu Aug 6 04:43:39 EDT 2009


Author: tom.baeyens at jboss.com
Date: 2009-08-06 04:43:39 -0400 (Thu, 06 Aug 2009)
New Revision: 5433

Added:
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/ant/StartTomcatTask.java
Modified:
   jbpm4/trunk/modules/distro/src/main/files/install/build.xml
Log:
JBPM-2409 JBPM-2411 started installer refactoring to support tomcat and ci script cleanup

Modified: jbpm4/trunk/modules/distro/src/main/files/install/build.xml
===================================================================
--- jbpm4/trunk/modules/distro/src/main/files/install/build.xml	2009-08-06 08:01:07 UTC (rev 5432)
+++ jbpm4/trunk/modules/distro/src/main/files/install/build.xml	2009-08-06 08:43:39 UTC (rev 5433)
@@ -66,6 +66,10 @@
           depends="delete.jboss, install.jboss" 
           description="Deletes the previous jboss installation and re-installs jboss" />
 
+  <target name="reinstall.jboss.and.jbpm" 
+          depends="delete.jboss, install.jboss, install.jbpm.into.jboss" 
+          description="Deletes the previous jboss installation and re-installs jboss and installs jbpm in it" />
+
   <!-- ### DELETE JBOSS ################################################### -->
   <target name="delete.jboss" 
           description="Deletes jboss installation">
@@ -92,111 +96,6 @@
     <get src="${jboss.distro.url}" dest="${jboss.distro.path}" />
   </target>
   
-  <!-- ### REINSTALL TOMCAT ################################################ -->
-  <target name="reinstall.tomcat" 
-          depends="delete.tomcat, install.tomcat" 
-          description="Deletes the previous tomcat installation and re-installs tomcat" />
-
-  <!-- ### DELETE TOMCAT ################################################### -->
-  <target name="delete.tomcat" 
-          description="Deletes tomcat installation">
-    <delete dir="${tomcat.home}" />
-  </target>
-
-  <!-- ### INSTALL TOMCAT ################################################## -->
-  <target name="install.tomcat" 
-          depends="get.tomcat"
-          description="Downloads tomcat to ${tomcat.distro.dir} if its not available and then unzips tomcat">
-    <unzip src="${tomcat.distro.path}" dest="${tomcat.parent.dir}" />
-    <chmod perm="a+x" file="${tomcat.home}/bin/startup.sh" os="Linux, Mac OS X" />
-    <chmod perm="a+x" file="${tomcat.home}/bin/shutdown.sh" os="Linux, Mac OS X" />
-  </target>
-  
-  <!-- ### GET TOMCAT ###################################################### -->
-  <condition property="is.tomcat.distro.available">
-    <available file="${tomcat.distro.path}" />
-  </condition>
-  <target name="get.tomcat" 
-          unless="is.tomcat.distro.available"
-          description="Downloads tomcat into ${tomcat.distro.dir} if it is not available">
-    <mkdir dir="${tomcat.distro.dir}" />
-    <get src="${tomcat.distro.url}" dest="${tomcat.distro.path}" />
-  </target>
-
-  <!-- ### INSTALL JBPM INTO TOMCAT ####################################### -->
-  <target name="install.jbpm.into.tomcat"
-  	      depends="generate.cfg"
-          description="Installs jBPM into tomcat">
-
-  	<!-- create the jbpm configuration jar file -->
-  	<jar destfile="${tomcat.home}/lib/jbpm.cfg.jar">
-  		<fileset dir="generated/cfg">
-  			<exclude name="logging.properties"/>
-  	  </fileset>
-    </jar>
-
-    <copy todir="${tomcat.home}/lib" overwrite="true">
-      <fileset dir="${jbpm.home}">
-        <include name="jbpm.jar" />
-      </fileset>
-      <fileset dir="${jbpm.home}/lib">
-        <include name="gwt-console-server-integration.jar" />
-        <include name="gwt-console-rpc.jar" />
-        <include name="jbpm-console-integration.jar" />
-        <include name="jbpm-console-form-plugin.jar" />
-        <include name="jbpm-console-graphView-plugin.jar"/>
-        <include name="freemarker.jar" />
-        <include name="livetribe-jsr223.jar" />
-        <include name="juel*.jar" />
-        <include name="hibernate-core.jar" />
-        <include name="hibernate-cglib-repack.jar" />
-      </fileset>
-    </copy>
-
-    <copy todir="${tomcat.home}/webapps" overwrite="true">
-      <fileset dir="${jbpm.home}/lib">
-        <include name="gwt-console.war" />
-        <include name="gwt-console-server.war" />
-      </fileset>
-    </copy>
-    
-    <!-- reporting -->
-    <property name="birt.dir" value="${jboss.server.data.dir}/birt"/>
-    <mkdir dir="${birt.dir}"/>
-    <unzip src="${jbpm.home}/lib/report-engine.zip" dest="${birt.dir}"/>
-    <unzip src="${jbpm.home}/lib/jbpm-console-reports.jar" dest="${birt.dir}"/>
-
-  	<!-- copy database driver -->
-    <property name="container.lib.dir" value="${tomcat.home}/" />
-    <antcall target="internal.copy.database.driver" />
-  </target>
-
-  <!-- ### START TOMCAT ################################################### -->
-  <target name="start.tomcat" 
-          description="Starts Tomcat and waits till it is booted, then lets Tomcat run in the background">
-    <taskdef name="start-tomcat"
-             classname="org.jbpm.pvm.internal.ant.StartTomcatTask">
-      <classpath>
-        <fileset dir="${jbpm.home}">
-          <include name="jbpm.jar" />
-        </fileset>
-      </classpath>
-    </taskdef>
-    <start-jboss tomcathome="${jboss.home}" />
-  </target>
-
-  <!-- ### STOP TOMCAT ################################################### -->
-  <target name="stop.tomcat" 
-          description="Signals Tomcat to stop, but doesn't wait till its finished">
-    <exec executable="${jboss.home}/bin/shutdown.bat" os="Windows Vista, Windows XP,Windows 2000,Windows 98">
-      <arg line="-S"/>
-    </exec>
-    <exec executable="${jboss.home}/bin/shutdown.sh" os="Linux, Unix, Mac">
-      <arg line="-S"/>
-    </exec>
-  </target>
-  
-	
   <!-- ### INSTALL JBPM INTO JBOSS ######################### -->
   <target name="install.jbpm.into.jboss" 
           description="Installs jBPM into JBoss">
@@ -310,6 +209,114 @@
     </exec>
   </target>
 
+  <!-- ### REINSTALL TOMCAT ################################################ -->
+  <target name="reinstall.tomcat" 
+          depends="delete.tomcat, install.tomcat" 
+          description="Deletes the previous tomcat installation and re-installs tomcat" />
+
+  <target name="reinstall.tomcat.and.jbpm" 
+          depends="delete.tomcat, install.tomcat, install.jbpm.into.tomcat" 
+          description="Deletes the previous tomcat installation and re-installs tomcat and installs jbpm in it" />
+
+  <!-- ### DELETE TOMCAT ################################################### -->
+  <target name="delete.tomcat" 
+          description="Deletes tomcat installation">
+    <delete dir="${tomcat.home}" />
+  </target>
+
+  <!-- ### INSTALL TOMCAT ################################################## -->
+  <target name="install.tomcat" 
+          depends="get.tomcat"
+          description="Downloads tomcat to ${tomcat.distro.dir} if its not available and then unzips tomcat">
+    <unzip src="${tomcat.distro.path}" dest="${tomcat.parent.dir}" />
+    <chmod perm="a+x" file="${tomcat.home}/bin/startup.sh" os="Linux, Mac OS X" />
+    <chmod perm="a+x" file="${tomcat.home}/bin/shutdown.sh" os="Linux, Mac OS X" />
+  </target>
+  
+  <!-- ### GET TOMCAT ###################################################### -->
+  <condition property="is.tomcat.distro.available">
+    <available file="${tomcat.distro.path}" />
+  </condition>
+  <target name="get.tomcat" 
+          unless="is.tomcat.distro.available"
+          description="Downloads tomcat into ${tomcat.distro.dir} if it is not available">
+    <mkdir dir="${tomcat.distro.dir}" />
+    <get src="${tomcat.distro.url}" dest="${tomcat.distro.path}" />
+  </target>
+
+  <!-- ### INSTALL JBPM INTO TOMCAT ####################################### -->
+  <target name="install.jbpm.into.tomcat"
+          depends="generate.cfg"
+          description="Installs jBPM into tomcat">
+
+    <!-- create the jbpm configuration jar file -->
+    <jar destfile="${tomcat.home}/lib/jbpm.cfg.jar">
+      <fileset dir="generated/cfg">
+        <exclude name="logging.properties"/>
+      </fileset>
+    </jar>
+
+    <copy todir="${tomcat.home}/lib" overwrite="true">
+      <fileset dir="${jbpm.home}">
+        <include name="jbpm.jar" />
+      </fileset>
+      <fileset dir="${jbpm.home}/lib">
+        <include name="gwt-console-server-integration.jar" />
+        <include name="gwt-console-rpc.jar" />
+        <include name="jbpm-console-integration.jar" />
+        <include name="jbpm-console-form-plugin.jar" />
+        <include name="jbpm-console-graphView-plugin.jar"/>
+        <include name="freemarker.jar" />
+        <include name="livetribe-jsr223.jar" />
+        <include name="juel*.jar" />
+        <include name="hibernate-core.jar" />
+        <include name="hibernate-cglib-repack.jar" />
+      </fileset>
+    </copy>
+
+    <copy todir="${tomcat.home}/webapps" overwrite="true">
+      <fileset dir="${jbpm.home}/lib">
+        <include name="gwt-console.war" />
+        <include name="gwt-console-server.war" />
+      </fileset>
+    </copy>
+    
+    <!-- reporting -->
+    <property name="birt.dir" value="${jboss.server.data.dir}/birt"/>
+    <mkdir dir="${birt.dir}"/>
+    <unzip src="${jbpm.home}/lib/report-engine.zip" dest="${birt.dir}"/>
+    <unzip src="${jbpm.home}/lib/jbpm-console-reports.jar" dest="${birt.dir}"/>
+
+    <!-- copy database driver -->
+    <property name="container.lib.dir" value="${tomcat.home}/" />
+    <antcall target="internal.copy.database.driver" />
+  </target>
+
+  <!-- ### START TOMCAT ################################################### -->
+  <target name="start.tomcat" 
+          description="Starts Tomcat and waits till it is booted, then lets Tomcat run in the background">
+    <taskdef name="start-tomcat"
+             classname="org.jbpm.pvm.internal.ant.StartTomcatTask">
+      <classpath>
+        <fileset dir="${jbpm.home}">
+          <include name="jbpm.jar" />
+        </fileset>
+      </classpath>
+    </taskdef>
+    <start-tomcat tomcathome="${tomcat.home}" />
+  </target>
+
+  <!-- ### STOP TOMCAT ################################################### -->
+  <target name="stop.tomcat" 
+          description="Signals Tomcat to stop, but doesn't wait till its finished">
+    <exec executable="${jboss.home}/bin/shutdown.bat" os="Windows Vista, Windows XP,Windows 2000,Windows 98">
+      <arg line="-S"/>
+    </exec>
+    <exec executable="${jboss.home}/bin/shutdown.sh" os="Linux, Unix, Mac">
+      <arg line="-S"/>
+    </exec>
+  </target>
+  
   <!-- ### COPY DATABASE DRIVER ######################################### -->
   <target name="internal.copy.database.driver" if="database.driver">
     <condition property="database.driver" value="mysql-connector-java.jar">
@@ -328,5 +335,5 @@
     <fail message="please download the ${database} driver jar and put it in the ${jbpm.home}/lib directory" unless="database.driver.jar.available" />
     <copy file="${jbpm.home}/lib/${database.driver}" todir="${container.lib.dir}" />
   </target>
-  
+
 </project>

Added: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/ant/StartTomcatTask.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/ant/StartTomcatTask.java	                        (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/ant/StartTomcatTask.java	2009-08-06 08:43:39 UTC (rev 5433)
@@ -0,0 +1,78 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.jbpm.pvm.internal.ant;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Task;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class StartTomcatTask extends Task {
+  
+  private static final String END_MESSAGE = " Server startup in ";
+  
+  String configuration = null;
+  String tomcathome = null;
+
+  public void execute() throws BuildException {
+    try {
+      // get some environment variableInstances
+      String fileSeparator = System.getProperty( "file.separator" );
+      String os = getProject().getProperty( "os.name" ).toLowerCase();
+      
+      // build the command string
+      String command = null; 
+      if ( os.indexOf( "windows" ) != -1 ) {
+        command = getTomcatHome() + fileSeparator + "bin" + fileSeparator + "startup.bat";          
+      } else if ( os.indexOf( "linux" ) != -1 || os.indexOf( "mac" ) != -1) {
+        command = getTomcatHome() + fileSeparator + "bin" + fileSeparator + "startup.sh";
+      } else {
+        throw new BuildException( "os '" + os + "' not supported in the starttomcat task." );
+      }
+
+      // launch the command and wait till the END_MESSAGE appears
+      Thread launcher = new Launcher(this, command, END_MESSAGE);
+      launcher.start();
+      launcher.join();
+      
+    } catch (Exception e) {
+      e.printStackTrace();
+    }
+  }
+  
+  String getTomcatHome() {
+    if (tomcathome!=null) {
+      return tomcathome;
+    }
+    String tomcatHomeSysProp = getProject().getProperty( "tomcat.home" );
+    if (tomcatHomeSysProp!=null) {
+      return tomcatHomeSysProp;
+    }
+    throw new BuildException("starttomcat couldn't figure out which tomcat to start: attribute tomcathome not specified and property tomcat.home was not set");
+  }
+
+  public void setTomcathome(String tomcathome) {
+    this.tomcathome = tomcathome;
+  }
+}


Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/ant/StartTomcatTask.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain



More information about the jbpm-commits mailing list