diff --git a/proposal/mutant/build.xml b/proposal/mutant/build.xml index fc20dc2e3..f0e03c32b 100644 --- a/proposal/mutant/build.xml +++ b/proposal/mutant/build.xml @@ -127,9 +127,6 @@ - - - @@ -171,7 +168,24 @@ parampattern="[a-z].*" staticpattern="[a-z].*" ignoreCastWhitespace="true"> - + + + + + + + + + + + + + diff --git a/proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/ExecutionDataService.java b/proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/ExecutionDataService.java index 9bd323952..727ea51f6 100644 --- a/proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/ExecutionDataService.java +++ b/proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/ExecutionDataService.java @@ -208,5 +208,15 @@ public class ExecutionDataService implements DataService { return sb.toString(); } + /** + * Get all the properties from the frame and any references frames. This + * is an expensive operation since it must clone all of the property + * stores in all frames + * + * @return a Map containing the frames properties indexed by their full name. + */ + public Map getAllProperties() { + return frame.getAllProperties(); + } } diff --git a/proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/ExecutionFrame.java b/proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/ExecutionFrame.java index 9bfc072a3..fd2e7e8a0 100755 --- a/proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/ExecutionFrame.java +++ b/proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/ExecutionFrame.java @@ -235,7 +235,7 @@ public class ExecutionFrame { this.initConfig = initConfig; configureServices(); - + antLibraries = new HashMap(standardLibs); try { @@ -276,6 +276,33 @@ public class ExecutionFrame { return project; } + + /** + * Get all the properties from the frame and any references frames. This + * is an expensive operation since it must clone all of the property + * stores in all frames + * + * @return a Map containing the frames properties indexed by their full name. + */ + public Map getAllProperties() { + Map allProperties = new HashMap(dataValues); + Iterator i = referencedFrames.keySet().iterator(); + while (i.hasNext()) { + String refName = (String)i.next(); + ExecutionFrame refFrame = getReferencedFrame(refName); + Map refProperties = refFrame.getAllProperties(); + Iterator j = refProperties.keySet().iterator(); + while (j.hasNext()) { + String name = (String)j.next(); + Object value = refProperties.get(name); + allProperties.put(refName + Project.REF_DELIMITER + name, + value); + } + } + + return allProperties; + } + /** * Log a message as a build event * diff --git a/proposal/mutant/src/java/antlibs/ant1compat/org/apache/tools/ant/Project.java b/proposal/mutant/src/java/antlibs/ant1compat/org/apache/tools/ant/Project.java index 41c99b91f..621df2769 100644 --- a/proposal/mutant/src/java/antlibs/ant1compat/org/apache/tools/ant/Project.java +++ b/proposal/mutant/src/java/antlibs/ant1compat/org/apache/tools/ant/Project.java @@ -54,6 +54,9 @@ package org.apache.tools.ant; import java.io.File; import java.io.IOException; +import java.util.Hashtable; +import java.util.Map; +import java.util.Iterator; import org.apache.ant.common.antlib.AntContext; import org.apache.ant.common.service.DataService; import org.apache.ant.common.service.FileService; @@ -618,5 +621,49 @@ public class Project { throw new BuildException(e); } } + + /** + * get a copy of the property hashtable + * @return the hashtable containing all properties, user included + */ + public Hashtable getProperties() { + Map properties = dataService.getAllProperties(); + Hashtable result = new Hashtable(); + for (Iterator i = properties.keySet().iterator(); i.hasNext();) { + String name = (String)i.next(); + Object value = properties.get(name); + if (value instanceof String) { + result.put(name, value); + } + } + + return result; + } + + /** + * get a copy of the property hashtable + * @return the hashtable containing all properties, user included + */ + public Hashtable getUserProperties() { + return getProperties(); + } + + /** + * Get all references in the project + * @return the hashtable containing all references + */ + public Hashtable getReferences() { + Map properties = dataService.getAllProperties(); + Hashtable result = new Hashtable(); + for (Iterator i = properties.keySet().iterator(); i.hasNext();) { + String name = (String)i.next(); + Object value = properties.get(name); + if (!(value instanceof String)) { + result.put(name, value); + } + } + + return result; + } } diff --git a/proposal/mutant/src/java/common/org/apache/ant/common/service/DataService.java b/proposal/mutant/src/java/common/org/apache/ant/common/service/DataService.java index 9f02cdb6e..681031702 100644 --- a/proposal/mutant/src/java/common/org/apache/ant/common/service/DataService.java +++ b/proposal/mutant/src/java/common/org/apache/ant/common/service/DataService.java @@ -128,5 +128,14 @@ public interface DataService { String replacePropertyRefs(String value, Map replacementValues) throws ExecutionException; + /** + * Get all the properties from the frame and any references frames. This + * is an expensive operation since it must clone all of the property + * stores in all frames + * + * @return a Map containing the frames properties indexed by their full name. + */ + Map getAllProperties(); + }