geronimo-scm mailing list archives

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

URL: http://svn.apache.org/viewvc?view=rev&rev=439879
Log:
Adding geronimo:install helper, pending how to allow geronimo:start to re-use this goal

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

Added: 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=auto&rev=439879
==============================================================================
--- geronimo/server/trunk/maven-plugins/geronimo-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/geronimo/InstallAssemblyMojo.java
(added)
+++ geronimo/server/trunk/maven-plugins/geronimo-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/geronimo/InstallAssemblyMojo.java
Sun Sep  3 17:01:25 2006
@@ -0,0 +1,86 @@
+/*
+ *  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;
+
+/**
+ * Install a Geronimo server assembly.
+ *
+ * @goal install
+ *
+ * @version $Rev$ $Date$
+ */
+public class InstallAssemblyMojo
+    extends ServerMojoSupport
+{
+    /**
+     * 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");
+        }
+    }
+}

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

Propchange: geronimo/server/trunk/maven-plugins/geronimo-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/geronimo/InstallAssemblyMojo.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/InstallAssemblyMojo.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message