incubator-easyant-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jlboud...@apache.org
Subject svn commit: r1417626 - in /incubator/easyant/core/trunk/src/main/java/org/apache/easyant/man: ListExtensionPoints.java ListTargets.java
Date Wed, 05 Dec 2012 20:23:38 GMT
Author: jlboudart
Date: Wed Dec  5 20:23:37 2012
New Revision: 1417626

URL: http://svn.apache.org/viewvc?rev=1417626&view=rev
Log:
Enhance listExtensionPoints option with more informations

Modified:
    incubator/easyant/core/trunk/src/main/java/org/apache/easyant/man/ListExtensionPoints.java
    incubator/easyant/core/trunk/src/main/java/org/apache/easyant/man/ListTargets.java

Modified: incubator/easyant/core/trunk/src/main/java/org/apache/easyant/man/ListExtensionPoints.java
URL: http://svn.apache.org/viewvc/incubator/easyant/core/trunk/src/main/java/org/apache/easyant/man/ListExtensionPoints.java?rev=1417626&r1=1417625&r2=1417626&view=diff
==============================================================================
--- incubator/easyant/core/trunk/src/main/java/org/apache/easyant/man/ListExtensionPoints.java
(original)
+++ incubator/easyant/core/trunk/src/main/java/org/apache/easyant/man/ListExtensionPoints.java
Wed Dec  5 20:23:37 2012
@@ -20,6 +20,7 @@ package org.apache.easyant.man;
 import java.util.List;
 
 import org.apache.easyant.core.report.ExtensionPointReport;
+import org.apache.easyant.core.report.ImportedModuleReport;
 
 /**
  * ManCommand implementation to list all extension points associated with specified build
module.
@@ -31,7 +32,8 @@ public class ListExtensionPoints extends
     private static final long serialVersionUID = 1L;
 
     public ListExtensionPoints() throws IllegalArgumentException {
-        super("listExtensionPoints", false, "List all extension-points available");
+        super("listExtensionPoints", true, "List all extension-points available");
+        setOptionalArg(true);
         setStopBuild(true);
     }
 
@@ -39,16 +41,34 @@ public class ListExtensionPoints extends
         getProject().log(
                 LINE_SEP + "--- Available ExtensionPoints for current project: " + getProject().getName()
+ " ---"
                         + LINE_SEP);
-
-        List<ExtensionPointReport> extensionPoints = getEareport().getExtensionPointReports();
-        for (ExtensionPointReport extensionPointReport : extensionPoints) {
-            getProject().log("\t" + extensionPointReport.getName());
+        String container = getValue();
+        if (container == null || container.trim().length() == 0) {
+            getProject().log(
+                    LINE_SEP + "No ExtensionPoint / Plugin specified. Listing all targets
available in the project.");
+
+            List<ExtensionPointReport> extensionPoints = getEareport().getExtensionPointReports();
+            printExtensionPoints(extensionPoints);
+        } else {
+            ImportedModuleReport importedModuleReport = getEareport().getImportedModuleReport(container);
+            if (importedModuleReport != null) {
+                getProject().log(LINE_SEP + "Extension-points for Module: " + container);
+                printExtensionPoints(importedModuleReport.getEasyantReport().getExtensionPointReports());
+            } else {
+                getProject().log(LINE_SEP + "\tNo Module / Plugin found by name: " + container);
+            }
         }
-
         getProject().log(
                 LINE_SEP + LINE_SEP + "For more information on an ExtensionPoint, run:" +
LINE_SEP
                         + "\t easyant -describe <EXTENSION POINT>");
         getProject().log(LINE_SEP + "--- End Of (ExtensionPoints Listing) ---");
     }
 
+    private void printExtensionPoints(List<ExtensionPointReport> extensionPoints) {
+        for (ExtensionPointReport extensionPointReport : extensionPoints) {
+            getProject().log("\tExtension-Point : " + extensionPointReport.getName());
+            getProject().log("\t\tDescription : " + extensionPointReport.getDescription());
+            getProject().log("\t\tDepends : " + extensionPointReport.getDepends());
+        }
+    }
+
 }

Modified: incubator/easyant/core/trunk/src/main/java/org/apache/easyant/man/ListTargets.java
URL: http://svn.apache.org/viewvc/incubator/easyant/core/trunk/src/main/java/org/apache/easyant/man/ListTargets.java?rev=1417626&r1=1417625&r2=1417626&view=diff
==============================================================================
--- incubator/easyant/core/trunk/src/main/java/org/apache/easyant/man/ListTargets.java (original)
+++ incubator/easyant/core/trunk/src/main/java/org/apache/easyant/man/ListTargets.java Wed
Dec  5 20:23:37 2012
@@ -77,25 +77,18 @@ public class ListTargets extends Easyant
                 getProject().log("\tNo ExtensionPoint found by name: " + container);
             }
 
-            List<ImportedModuleReport> modules = getEareport().getImportedModuleReports();
-            ImportedModuleReport selected = null;
-            for (int i = 0; i < modules.size(); i++) {
-                selected = modules.get(i);
-                if (container.equals(selected.getModuleMrid())) {
-                    break;
-                }
-            }
-            if (selected != null) {
+            ImportedModuleReport selectedModule = getEareport().getImportedModuleReport(container);
+            if (selectedModule != null) {
                 getProject().log(LINE_SEP + "Targets for Module: " + container);
-                List<TargetReport> targets = selected.getEasyantReport().getTargetReports();
+                List<TargetReport> targets = selectedModule.getEasyantReport().getTargetReports();
                 printTargets(targets, getProject());
             } else {
                 getProject().log(LINE_SEP + "\tNo Module / Plugin found by name: " + container);
             }
 
             getProject().log(
-                    LINE_SEP + LINE_SEP + "For more information on an ExtensionPoint, run:"
+ LINE_SEP
-                            + "\t easyant -describe <EXTENSION POINT>");
+                    LINE_SEP + LINE_SEP + "For more information on an target, run:" + LINE_SEP
+                            + "\t easyant -describe <TARGET>");
         }
         getProject().log(LINE_SEP + "--- End Of (Targets Listing) ---");
     }



Mime
View raw message