geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r439882 - in /geronimo/server/trunk/maven-plugins/geronimo-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/geronimo: InstallAssemblyMojo.java InstallerMojoSupport.java StartServerMojo.java
Date Mon, 04 Sep 2006 00:10:05 GMT
Author: jdillon
Date: Sun Sep  3 17:10:04 2006
New Revision: 439882

URL: http://svn.apache.org/viewvc?view=rev&rev=439882
Log:
Add intermediate abstract class for installer logic

Added:
    geronimo/server/trunk/maven-plugins/geronimo-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/geronimo/InstallerMojoSupport.java
  (with props)
Modified:
    geronimo/server/trunk/maven-plugins/geronimo-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/geronimo/InstallAssemblyMojo.java
    geronimo/server/trunk/maven-plugins/geronimo-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/geronimo/StartServerMojo.java

Modified: geronimo/server/trunk/maven-plugins/geronimo-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/geronimo/InstallAssemblyMojo.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/maven-plugins/geronimo-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/geronimo/InstallAssemblyMojo.java?view=diff&rev=439882&r1=439881&r2=439882
==============================================================================
--- geronimo/server/trunk/maven-plugins/geronimo-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/geronimo/InstallAssemblyMojo.java
(original)
+++ geronimo/server/trunk/maven-plugins/geronimo-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/geronimo/InstallAssemblyMojo.java
Sun Sep  3 17:10:04 2006
@@ -16,12 +16,6 @@
 
 package org.apache.geronimo.mavenplugins.geronimo;
 
-import java.io.File;
-
-import org.apache.tools.ant.taskdefs.Expand;
-
-import org.codehaus.plexus.util.FileUtils;
-
 /**
  * Install a Geronimo server assembly.
  *
@@ -30,57 +24,9 @@
  * @version $Rev$ $Date$
  */
 public class InstallAssemblyMojo
-    extends ServerMojoSupport
+    extends InstallerMojoSupport
 {
-    /**
-     * Enable forced install refresh.
-     *
-     * @parameter expression="${refresh}" default-value="false"
-     */
-    private boolean refresh = false;
-
-    //
-    // TODO: Allow this code to be used by this goal + start
-    //
-    
     protected void doExecute() throws Exception {
-        // Check if there is a newer archive or missing marker to trigger assembly install
-        File installMarker = new File(installDir, ".installed");
-        boolean refresh = this.refresh; // don't override config state with local state
-
-        if (!refresh) {
-            if (!installMarker.exists()) {
-                refresh = true;
-            }
-            else if (installArchive.lastModified() > installMarker.lastModified()) {
-                log.debug("Detected new assembly archive");
-                refresh = true;
-            }
-        }
-        else {
-            log.debug("User requested installation refresh");
-        }
-
-        if (refresh) {
-            if (installDir.exists()) {
-                log.debug("Removing: " + installDir);
-                FileUtils.forceDelete(installDir);
-            }
-        }
-
-        // Install the assembly
-        if (!installMarker.exists()) {
-            log.info("Installing assembly...");
-
-            Expand unzip = (Expand)createTask("unzip");
-            unzip.setSrc(installArchive);
-            unzip.setDest(outputDirectory);
-            unzip.execute();
-
-            installMarker.createNewFile();
-        }
-        else {
-            log.debug("Assembly already installed");
-        }
+        doInstall();
     }
 }

Added: geronimo/server/trunk/maven-plugins/geronimo-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/geronimo/InstallerMojoSupport.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/maven-plugins/geronimo-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/geronimo/InstallerMojoSupport.java?view=auto&rev=439882
==============================================================================
--- geronimo/server/trunk/maven-plugins/geronimo-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/geronimo/InstallerMojoSupport.java
(added)
+++ geronimo/server/trunk/maven-plugins/geronimo-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/geronimo/InstallerMojoSupport.java
Sun Sep  3 17:10:04 2006
@@ -0,0 +1,80 @@
+/*
+ *  Copyright 2006 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.mavenplugins.geronimo;
+
+import java.io.File;
+
+import org.apache.tools.ant.taskdefs.Expand;
+
+import org.codehaus.plexus.util.FileUtils;
+
+/**
+ * Common assembly install support.
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class InstallerMojoSupport
+    extends ServerMojoSupport
+{
+    /**
+     * Enable forced install refresh.
+     *
+     * @parameter expression="${refresh}" default-value="false"
+     */
+    protected boolean refresh = false;
+
+    protected void doInstall() throws Exception {
+        // Check if there is a newer archive or missing marker to trigger assembly install
+        File installMarker = new File(installDir, ".installed");
+        boolean refresh = this.refresh; // don't override config state with local state
+
+        if (!refresh) {
+            if (!installMarker.exists()) {
+                refresh = true;
+            }
+            else if (installArchive.lastModified() > installMarker.lastModified()) {
+                log.debug("Detected new assembly archive");
+                refresh = true;
+            }
+        }
+        else {
+            log.debug("User requested installation refresh");
+        }
+
+        if (refresh) {
+            if (installDir.exists()) {
+                log.debug("Removing: " + installDir);
+                FileUtils.forceDelete(installDir);
+            }
+        }
+
+        // Install the assembly
+        if (!installMarker.exists()) {
+            log.info("Installing assembly...");
+
+            Expand unzip = (Expand)createTask("unzip");
+            unzip.setSrc(installArchive);
+            unzip.setDest(outputDirectory);
+            unzip.execute();
+
+            installMarker.createNewFile();
+        }
+        else {
+            log.debug("Assembly already installed");
+        }
+    }
+}

Propchange: geronimo/server/trunk/maven-plugins/geronimo-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/geronimo/InstallerMojoSupport.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/maven-plugins/geronimo-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/geronimo/InstallerMojoSupport.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/server/trunk/maven-plugins/geronimo-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/geronimo/InstallerMojoSupport.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/server/trunk/maven-plugins/geronimo-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/geronimo/StartServerMojo.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/maven-plugins/geronimo-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/geronimo/StartServerMojo.java?view=diff&rev=439882&r1=439881&r2=439882
==============================================================================
--- geronimo/server/trunk/maven-plugins/geronimo-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/geronimo/StartServerMojo.java
(original)
+++ geronimo/server/trunk/maven-plugins/geronimo-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/geronimo/StartServerMojo.java
Sun Sep  3 17:10:04 2006
@@ -22,11 +22,8 @@
 import java.util.Timer;
 import java.util.TimerTask;
 
-import org.apache.tools.ant.taskdefs.Expand;
 import org.apache.tools.ant.taskdefs.Java;
 
-import org.codehaus.plexus.util.FileUtils;
-
 /**
  * Start the Geronimo server.
  *
@@ -35,7 +32,7 @@
  * @version $Rev$ $Date$
  */
 public class StartServerMojo
-    extends ServerMojoSupport
+    extends InstallerMojoSupport
 {
     /**
      * Flag to control if we background the server or block Maven execution.
@@ -73,13 +70,6 @@
     private boolean veryverbose = false;
 
     /**
-     * Enable forced install refresh.
-     *
-     * @parameter expression="${refresh}" default-value="false"
-     */
-    private boolean refresh = false;
-
-    /**
      * Time in seconds to wait before terminating the forked JVM.
      *
      * @parameter expression="${timeout}" default-value="-1"
@@ -98,44 +88,7 @@
     protected void doExecute() throws Exception {
         log.info("Starting Geronimo server...");
 
-        // Check if there is a newer archive or missing marker to trigger assembly install
-        File installMarker = new File(installDir, ".installed");
-        boolean refresh = this.refresh; // don't override config state with local state
-
-        if (!refresh) {
-            if (!installMarker.exists()) {
-                refresh = true;
-            }
-            else if (installArchive.lastModified() > installMarker.lastModified()) {
-                log.debug("Detected new assembly archive");
-                refresh = true;
-            }
-        }
-        else {
-            log.debug("User requested installation refresh");
-        }
-
-        if (refresh) {
-            if (installDir.exists()) {
-                log.debug("Removing: " + installDir);
-                FileUtils.forceDelete(installDir);
-            }
-        }
-
-        // Install the assembly
-        if (!installMarker.exists()) {
-            log.info("Installing assembly...");
-
-            Expand unzip = (Expand)createTask("unzip");
-            unzip.setSrc(installArchive);
-            unzip.setDest(outputDirectory);
-            unzip.execute();
-
-            installMarker.createNewFile();
-        }
-        else {
-            log.debug("Assembly already installed... reusing");
-        }
+        doInstall();
 
         // Setup the JVM to start the server with
         final Java java = (Java)createTask("java");



Mime
View raw message