activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clebertsuco...@apache.org
Subject [2/2] activemq-artemis git commit: ARTEMIS-996 Simplify what was lookupHome(path) in artemis-maven-plugin and deduplicate it
Date Fri, 24 Feb 2017 16:00:24 GMT
ARTEMIS-996 Simplify what was lookupHome(path) in artemis-maven-plugin and deduplicate it


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/da06be19
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/da06be19
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/da06be19

Branch: refs/heads/master
Commit: da06be192b190c5c1792cac519e16ed1946a668b
Parents: 54a11f0
Author: Jiri Danek <jdanek@redhat.com>
Authored: Fri Feb 24 11:31:47 2017 +0100
Committer: Clebert Suconic <clebertsuconic@apache.org>
Committed: Fri Feb 24 11:00:14 2017 -0500

----------------------------------------------------------------------
 .../artemis/maven/ArtemisAbstractPlugin.java    | 12 ++++++++
 .../artemis/maven/ArtemisCLIPlugin.java         | 31 ++------------------
 .../artemis/maven/ArtemisCreatePlugin.java      | 29 ++----------------
 3 files changed, 16 insertions(+), 56 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/da06be19/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/ArtemisAbstractPlugin.java
----------------------------------------------------------------------
diff --git a/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/ArtemisAbstractPlugin.java
b/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/ArtemisAbstractPlugin.java
index ea6758b..304df89 100644
--- a/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/ArtemisAbstractPlugin.java
+++ b/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/ArtemisAbstractPlugin.java
@@ -19,6 +19,9 @@ package org.apache.activemq.artemis.maven;
 import java.io.File;
 import java.io.PrintWriter;
 import java.io.StringWriter;
+import java.nio.file.Files;
+import java.nio.file.LinkOption;
+import java.nio.file.Path;
 import java.util.HashSet;
 import java.util.LinkedList;
 import java.util.List;
@@ -76,6 +79,15 @@ public abstract class ArtemisAbstractPlugin extends AbstractMojo {
       }
    }
 
+   boolean isArtemisHome(Path path) {
+      if (path == null) {
+         return false;
+      }
+
+      Path artemisScript = path.resolve("bin").resolve("artemis");
+      return Files.exists(artemisScript, LinkOption.NOFOLLOW_LINKS);
+   }
+
    protected abstract boolean isIgnore();
 
    protected abstract void doExecute() throws MojoExecutionException, MojoFailureException;

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/da06be19/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/ArtemisCLIPlugin.java
----------------------------------------------------------------------
diff --git a/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/ArtemisCLIPlugin.java
b/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/ArtemisCLIPlugin.java
index 1402513..0e6d288 100644
--- a/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/ArtemisCLIPlugin.java
+++ b/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/ArtemisCLIPlugin.java
@@ -17,9 +17,6 @@
 package org.apache.activemq.artemis.maven;
 
 import java.io.File;
-import java.nio.file.Files;
-import java.nio.file.LinkOption;
-import java.nio.file.Path;
 
 import org.apache.activemq.artemis.boot.Artemis;
 import org.apache.activemq.artemis.cli.commands.Run;
@@ -70,30 +67,6 @@ public class ArtemisCLIPlugin extends ArtemisAbstractPlugin {
    @Parameter
    private String testPassword = null;
 
-   /**
-    * Validate if the directory is a artemis.home *
-    *
-    * @param path
-    * @return
-    */
-   private boolean lookupHome(Path path) {
-
-      if (path == null) {
-         return false;
-      }
-
-      Path binFolder = path.resolve("bin");
-
-      if (binFolder == null && Files.exists(binFolder, LinkOption.NOFOLLOW_LINKS))
{
-         return false;
-      }
-
-      Path artemisScript = binFolder.resolve("artemis");
-
-      return artemisScript != null && Files.exists(artemisScript, LinkOption.NOFOLLOW_LINKS);
-
-   }
-
    @Override
    protected boolean isIgnore() {
       return ignore;
@@ -106,8 +79,8 @@ public class ArtemisCLIPlugin extends ArtemisAbstractPlugin {
 
       MavenProject project = (MavenProject) getPluginContext().get("project");
 
-      if (!lookupHome(home.toPath())) {
-         if (lookupHome(alternateHome.toPath())) {
+      if (!isArtemisHome(home.toPath())) {
+         if (isArtemisHome(alternateHome.toPath())) {
             home = alternateHome;
          } else {
             getLog().error("********************************************************************************************");

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/da06be19/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/ArtemisCreatePlugin.java
----------------------------------------------------------------------
diff --git a/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/ArtemisCreatePlugin.java
b/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/ArtemisCreatePlugin.java
index fdc308a..86668da 100644
--- a/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/ArtemisCreatePlugin.java
+++ b/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/ArtemisCreatePlugin.java
@@ -21,7 +21,6 @@ import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.PrintStream;
 import java.nio.file.Files;
-import java.nio.file.LinkOption;
 import java.nio.file.Path;
 import java.nio.file.StandardCopyOption;
 import java.util.ArrayList;
@@ -134,30 +133,6 @@ public class ArtemisCreatePlugin extends ArtemisAbstractPlugin {
    @Parameter(defaultValue = "${noServer}")
    boolean ignore;
 
-   /**
-    * Validate if the directory is a artemis.home *
-    *
-    * @param path
-    * @return
-    */
-   private boolean lookupHome(Path path) {
-
-      if (path == null) {
-         return false;
-      }
-
-      Path binFolder = path.resolve("bin");
-
-      if (binFolder == null && Files.exists(binFolder, LinkOption.NOFOLLOW_LINKS))
{
-         return false;
-      }
-
-      Path artemisScript = binFolder.resolve("artemis");
-
-      return artemisScript != null && Files.exists(artemisScript, LinkOption.NOFOLLOW_LINKS);
-
-   }
-
    private void add(List<String> list, String... str) {
       for (String s : str) {
          list.add(s);
@@ -174,8 +149,8 @@ public class ArtemisCreatePlugin extends ArtemisAbstractPlugin {
       getLog().info("Local " + localRepository);
       MavenProject project = (MavenProject) getPluginContext().get("project");
 
-      if (!lookupHome(home.toPath())) {
-         if (lookupHome(alternateHome.toPath())) {
+      if (!isArtemisHome(home.toPath())) {
+         if (isArtemisHome(alternateHome.toPath())) {
             home = alternateHome;
          } else {
             getLog().error("********************************************************************************************");


Mime
View raw message