incubator-easyant-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jlboud...@apache.org
Subject svn commit: r1393793 - /incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/report/EasyAntReport.java
Date Wed, 03 Oct 2012 22:07:04 GMT
Author: jlboudart
Date: Wed Oct  3 22:07:04 2012
New Revision: 1393793

URL: http://svn.apache.org/viewvc?rev=1393793&view=rev
Log:
Enhance extensionpoints support in EasyantReport

Modified:
    incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/report/EasyAntReport.java

Modified: incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/report/EasyAntReport.java
URL: http://svn.apache.org/viewvc/incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/report/EasyAntReport.java?rev=1393793&r1=1393792&r2=1393793&view=diff
==============================================================================
--- incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/report/EasyAntReport.java
(original)
+++ incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/report/EasyAntReport.java
Wed Oct  3 22:07:04 2012
@@ -40,6 +40,7 @@ public class EasyAntReport {
     private Map<String, PropertyDescriptor> propertyReports;
     private ResolveReport resolveReport;
     private ModuleDescriptor moduleDescriptor;
+    private boolean extensionPointsConfigured;
 
     /**
      * Default Constructor
@@ -84,13 +85,6 @@ public class EasyAntReport {
         if (targetReport == null) {
             throw new IllegalArgumentException("targetReport cannot be null");
         }
-        if (targetReport.getExtensionPoint() != null) {
-            for (ExtensionPointReport extensionPoint : extensionPointReports) {
-                if (extensionPoint.getName().equals(targetReport.getExtensionPoint())) {
-                    extensionPoint.addTargetReport(targetReport);
-                }
-            }
-        }
         targetReports.add(targetReport);
     }
 
@@ -105,6 +99,7 @@ public class EasyAntReport {
         if (name == null || name.equals("")) {
             throw new IllegalArgumentException("extension point name cannot be null");
         }
+        maybeConfigureExtensionPoints();
         for (ExtensionPointReport extensionPointReport : extensionPointReports) {
             if (extensionPointReport.getName().equals(name)) {
                 return extensionPointReport;
@@ -119,9 +114,25 @@ public class EasyAntReport {
      * @return a list of extension points
      */
     public List<ExtensionPointReport> getExtensionPointReports() {
+        maybeConfigureExtensionPoints();
         return Collections.unmodifiableList(extensionPointReports);
     }
 
+    private void maybeConfigureExtensionPoints() {
+        if (!extensionPointsConfigured) {
+            for (TargetReport targetReport : targetReports) {
+                if (targetReport.getExtensionPoint() != null) {
+                    for (ExtensionPointReport extensionPointReport : extensionPointReports)
{
+                        if (extensionPointReport.getName().equals(targetReport.getExtensionPoint()))
{
+                            extensionPointReport.addTargetReport(targetReport);
+                        }
+                    }
+                }
+            }
+            extensionPointsConfigured = true;
+        }
+    }
+
     /**
      * Add a given extensionPointReport
      * 



Mime
View raw message