conor 2002/06/13 08:47:56
Modified: proposal/mutant/src/java/antcore/org/apache/ant/antcore/antlib
AntLibManager.java
proposal/mutant/src/java/antcore/org/apache/ant/antcore/config
AntConfigHandler.java
proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution
BuildEventSupport.java ComponentManager.java
Constants.java CoreExecService.java Frame.java
proposal/mutant/src/java/antcore/org/apache/ant/antcore/modelparser
BuildElementHandler.java ModelElementHandler.java
ProjectHandler.java TargetHandler.java
XMLProjectParser.java
proposal/mutant/src/java/antcore/org/apache/ant/antcore/xml
ElementHandler.java ParseContext.java
proposal/mutant/src/java/antlibs/ant1compat antlib.xml
proposal/mutant/src/java/antlibs/ant1compat/org/apache/tools/ant
Project.java
proposal/mutant/src/java/antlibs/monitor/org/apache/ant/antlib/monitor
MonitorAspect.java
proposal/mutant/src/java/antlibs/system/org/apache/ant/antlib/system
Ant.java AntAspect.java AntBase.java AntCall.java
proposal/mutant/src/java/common/org/apache/ant/common/antlib
AbstractAspect.java Aspect.java
proposal/mutant/src/java/common/org/apache/ant/common/model
ModelElement.java
proposal/mutant/src/java/common/org/apache/ant/common/service
ComponentService.java ExecService.java
proposal/mutant/src/java/frontend/org/apache/ant/cli
Commandline.java
proposal/mutant/src/java/start/org/apache/ant/start
Main.java
proposal/mutant/build ant1compat.xml
Added: proposal/mutant/src/java/common/org/apache/ant/common
Namespace.java
proposal/mutant/src/java/common/org/apache/ant/common/model
NamespaceValueCollection.java
proposal/mutant/src/java/common/org/apache/ant/common/util
AttributeCollection.java
proposal/mutant/src/java/init/org/apache/ant/init
AntEnvironment.java
Removed: proposal/mutant/src/java/common/org/apache/ant/common/model
AspectValueCollection.java
proposal/mutant/src/java/common/org/apache/ant/common/service
BuildKey.java
proposal/mutant/src/java/init/org/apache/ant/init
InitConfig.java
Log:
Improved XML Namespace Support
rename some methods
Revision Changes Path
1.14 +9 -9
jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/antlib/AntLibManager.java
Index: AntLibManager.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/antlib/AntLibManager.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -w -u -r1.13 -r1.14
--- AntLibManager.java 31 May 2002 15:15:46 -0000 1.13
+++ AntLibManager.java 13 Jun 2002 15:47:54 -0000 1.14
@@ -65,7 +65,7 @@
import org.apache.ant.antcore.xml.XMLParseException;
import org.apache.ant.common.util.CircularDependencyChecker;
import org.apache.ant.common.util.CircularDependencyException;
-import org.apache.ant.init.InitConfig;
+import org.apache.ant.init.AntEnvironment;
import org.apache.ant.init.LoaderUtils;
/**
@@ -90,7 +90,7 @@
private boolean remoteAllowed;
/** The Ant initialization config - location of vital components */
- private InitConfig initConfig;
+ private AntEnvironment antEnv;
/**
* This map stores a list of additional paths for each library indexed by
@@ -101,13 +101,13 @@
/**
* Constructor for the AntLibManager object
*
- * @param initConfig the init config of the system.
+ * @param antEnv the init config of the system.
* @param remoteAllowed true if remote libraries can be used and
* configured
*/
- public AntLibManager(InitConfig initConfig, boolean remoteAllowed) {
+ public AntLibManager(AntEnvironment antEnv, boolean remoteAllowed) {
this.remoteAllowed = remoteAllowed;
- this.initConfig = initConfig;
+ this.antEnv = antEnv;
}
/**
@@ -335,12 +335,12 @@
urlsList.add(librarySpec.getLibraryURL());
}
if (librarySpec.isToolsJarRequired()
- && initConfig.getToolsJarURL() != null) {
- urlsList.add(initConfig.getToolsJarURL());
+ && antEnv.getToolsJarURL() != null) {
+ urlsList.add(antEnv.getToolsJarURL());
}
if (librarySpec.usesAntXML()) {
- URL[] parserURLs = initConfig.getParserURLs();
+ URL[] parserURLs = antEnv.getParserURLs();
for (int i = 0; i < parserURLs.length; ++i) {
urlsList.add(parserURLs[i]);
}
@@ -357,7 +357,7 @@
antLibrary.setExtendsLibrary(extendsLibrary);
}
- antLibrary.setParentLoader(initConfig.getCommonLoader());
+ antLibrary.setParentLoader(antEnv.getCommonLoader());
newLibraries.put(libraryId, antLibrary);
if (libPathsMap != null) {
1.12 +1 -1
jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/config/AntConfigHandler.java
Index: AntConfigHandler.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/config/AntConfigHandler.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -w -u -r1.11 -r1.12
--- AntConfigHandler.java 27 May 2002 15:52:21 -0000 1.11
+++ AntConfigHandler.java 13 Jun 2002 15:47:54 -0000 1.12
@@ -78,7 +78,7 @@
public static final String GLOBAL_TASKS_ELEMENT = "global-tasks";
/** The per-frame tasks element */
- public static final String PERFRAME_TASKS_ELEMENT = "frame-tasks";
+ public static final String PERFRAME_TASKS_ELEMENT = "project-tasks";
/** The list of allowed Attributes */
public static final String[] ALLOWED_ATTRIBUTES
1.11 +10 -3
jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/BuildEventSupport.java
Index: BuildEventSupport.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/BuildEventSupport.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -w -u -r1.10 -r1.11
--- BuildEventSupport.java 27 May 2002 15:52:21 -0000 1.10
+++ BuildEventSupport.java 13 Jun 2002 15:47:54 -0000 1.11
@@ -77,7 +77,7 @@
* The listeners attached to the object which contains this support
* object
*/
- private List listeners = new ArrayList();
+ private ArrayList listeners = new ArrayList();
/** Records the latest task to be executed on a thread (Thread to Task).
*/
private Map threadTasks = new HashMap();
@@ -87,8 +87,8 @@
*
* @return the listeners value
*/
- public Iterator getListeners() {
- return listeners.iterator();
+ public List getListeners() {
+ return (List) listeners.clone();
}
/**
@@ -116,6 +116,7 @@
*/
public void fireBuildStarted(ModelElement element) {
BuildEvent event = new BuildEvent(element, BuildEvent.BUILD_STARTED);
+ List listeners = getListeners();
for (Iterator i = listeners.iterator(); i.hasNext();) {
BuildListener listener = (BuildListener) i.next();
listener.buildStarted(event);
@@ -132,6 +133,7 @@
Throwable cause) {
BuildEvent event = new BuildEvent(element, BuildEvent.BUILD_FINISHED,
cause);
+ List listeners = getListeners();
for (Iterator i = listeners.iterator(); i.hasNext();) {
BuildListener listener = (BuildListener) i.next();
listener.buildFinished(event);
@@ -145,6 +147,7 @@
*/
public void fireTargetStarted(ModelElement element) {
BuildEvent event = new BuildEvent(element,
BuildEvent.TARGET_STARTED);
+ List listeners = getListeners();
for (Iterator i = listeners.iterator(); i.hasNext();) {
BuildListener listener = (BuildListener) i.next();
listener.targetStarted(event);
@@ -161,6 +164,7 @@
Throwable cause) {
BuildEvent event = new BuildEvent(element,
BuildEvent.TARGET_FINISHED,
cause);
+ List listeners = getListeners();
for (Iterator i = listeners.iterator(); i.hasNext();) {
BuildListener listener = (BuildListener) i.next();
listener.targetFinished(event);
@@ -177,6 +181,7 @@
threadTasks.put(Thread.currentThread(), task);
}
BuildEvent event = new BuildEvent(task, BuildEvent.TASK_STARTED);
+ List listeners = getListeners();
for (Iterator i = listeners.iterator(); i.hasNext();) {
BuildListener listener = (BuildListener) i.next();
listener.taskStarted(event);
@@ -198,6 +203,7 @@
}
BuildEvent event = new BuildEvent(task, BuildEvent.TASK_FINISHED,
cause);
+ List listeners = getListeners();
for (Iterator i = listeners.iterator(); i.hasNext();) {
BuildListener listener = (BuildListener) i.next();
listener.taskFinished(event);
@@ -214,6 +220,7 @@
public void fireMessageLogged(Object source,
String message, int priority) {
BuildEvent event = new BuildEvent(source, message, priority);
+ List listeners = getListeners();
for (Iterator i = listeners.iterator(); i.hasNext();) {
BuildListener listener = (BuildListener) i.next();
listener.messageLogged(event);
1.21 +7 -4
jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/ComponentManager.java
Index: ComponentManager.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/ComponentManager.java,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -w -u -r1.20 -r1.21
--- ComponentManager.java 31 May 2002 15:15:46 -0000 1.20
+++ ComponentManager.java 13 Jun 2002 15:47:54 -0000 1.21
@@ -80,6 +80,8 @@
import org.apache.ant.common.util.AntException;
import org.apache.ant.common.util.Location;
import org.apache.ant.init.LoaderUtils;
+import org.apache.ant.common.util.AttributeCollection;
+import org.apache.ant.common.constants.Namespace;
/**
* The instance of the ComponentServices made available by the core to the
ant
@@ -684,7 +686,7 @@
// is there a polymorph indicator - look in Ant aspects
String typeName
- = model.getAspectAttributeValue(Constants.ANT_ASPECT, "type");
+ = model.getNamespaceAttributeValue(Namespace.ANT_META_URI,
"type");
Object typeInstance = null;
if (typeName != null) {
@@ -767,13 +769,14 @@
* @exception AntException if the object does not support an
* attribute in the map.
*/
- public void configureAttributes(Object object, Map attributeValues,
+ public void configureAttributes(Object object,
+ AttributeCollection attributeValues,
boolean ignoreUnsupported)
throws AntException {
Setter setter = getSetter(object.getClass());
- for (Iterator i = attributeValues.keySet().iterator(); i.hasNext();)
{
+ for (Iterator i = attributeValues.getAttributeNames(); i.hasNext();)
{
String attributeName = (String) i.next();
- String attributeValue = (String)
attributeValues.get(attributeName);
+ String attributeValue =
attributeValues.getAttribute(attributeName);
if (!setter.supportsAttribute(attributeName)) {
if (!ignoreUnsupported) {
throw new ExecutionException(object.getClass().getName()
1.4 +0 -3
jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/Constants.java
Index: Constants.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/Constants.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -w -u -r1.3 -r1.4
--- Constants.java 30 Apr 2002 14:57:02 -0000 1.3
+++ Constants.java 13 Jun 2002 15:47:54 -0000 1.4
@@ -62,8 +62,5 @@
public abstract class Constants {
/** The prefix for library ids that are automatically imported */
public static final String ANT_LIB_PREFIX = "ant.";
-
- /** The Ant aspect used to identify Ant metadata */
- public static final String ANT_ASPECT = "ant";
}
1.18 +18 -55
jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/CoreExecService.java
Index: CoreExecService.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/CoreExecService.java,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -w -u -r1.17 -r1.18
--- CoreExecService.java 27 May 2002 15:52:21 -0000 1.17
+++ CoreExecService.java 13 Jun 2002 15:47:54 -0000 1.18
@@ -54,7 +54,6 @@
package org.apache.ant.antcore.execution;
import java.io.File;
import java.net.MalformedURLException;
-import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.ant.antcore.modelparser.XMLProjectParser;
@@ -64,9 +63,8 @@
import org.apache.ant.common.model.Project;
import org.apache.ant.common.model.BuildElement;
import org.apache.ant.common.service.ExecService;
-import org.apache.ant.common.service.BuildKey;
import org.apache.ant.init.InitUtils;
-import org.apache.ant.common.model.AspectValueCollection;
+import org.apache.ant.common.model.NamespaceValueCollection;
import org.apache.ant.common.event.BuildListener;
import org.apache.ant.common.util.AntException;
@@ -81,10 +79,6 @@
/** The Frame this service instance is working for */
private Frame frame;
- /** A map of subbuild keys to the frame of the subbuild. */
- private Map subBuilds = new HashMap();
-
-
/**
* Constructor
*
@@ -106,11 +100,11 @@
ExecutionContext execContext = getTaskExecutionContext(task);
BuildElement model = execContext.getModel();
- AspectValueCollection aspectValues = null;
+ NamespaceValueCollection namespaceValues = null;
if (model != null) {
- aspectValues = model.getAspectAttributes();
+ namespaceValues = model.getNamespaceAttributes();
}
- frame.executeTask(task, aspectValues);
+ frame.executeTask(task, namespaceValues);
}
/**
@@ -144,7 +138,7 @@
* @param aspectValues the aspect attribute values.
* @exception AntException if there is an execution problem
*/
- public void executeTask(Task task, AspectValueCollection aspectValues)
+ public void executeTask(Task task, NamespaceValueCollection aspectValues)
throws AntException {
ExecutionContext execContext = getTaskExecutionContext(task);
@@ -185,24 +179,6 @@
/**
- * Gets the Frame for a subbuild based on the key
- *
- * @param key Description of the Parameter
- * @return the subbuild's Frame
- * @exception ExecutionException if the build cannot be found.
- */
- private Frame getSubbuildFrame(Object key) throws ExecutionException {
- Frame subFrame = (Frame) subBuilds.get(key);
-
- if (subFrame == null) {
- throw new ExecutionException("Could not find execution frame "
- + "for subbuild");
- }
- return subFrame;
- }
-
-
- /**
* Handle subbuild output.
*
* @param subbuildKey the core's key for managing the subbuild.
@@ -212,7 +188,8 @@
*/
public void handleBuildOutput(Object subbuildKey, String line,
boolean isErr) throws ExecutionException {
- getSubbuildFrame(subbuildKey).threadOutput(line, isErr);
+ Frame subFrame = (Frame) subbuildKey;
+ subFrame.threadOutput(line, isErr);
}
@@ -224,9 +201,9 @@
* @param libraryId the id of the library to be initialized.
* @exception AntException if the build cannot be run
*/
- public void initializeBuildLibrary(BuildKey key, String libraryId)
+ public void initializeBuildLibrary(Object key, String libraryId)
throws AntException {
- Frame subFrame = getSubbuildFrame(key);
+ Frame subFrame = (Frame) key;
subFrame.initializeLibrary(libraryId);
}
@@ -238,9 +215,10 @@
*
* @exception ExecutionException if the build cannot be found.
*/
- public void addBuildListener(BuildKey key, BuildListener listener)
+ public void addBuildListener(Object key, BuildListener listener)
throws ExecutionException {
- getSubbuildFrame(key).addBuildListener(listener);
+ Frame subFrame = (Frame) key;
+ subFrame.addBuildListener(listener);
}
@@ -251,20 +229,9 @@
* @param key Description of the Parameter
* @exception AntException if the build cannot be run
*/
- public void runBuild(BuildKey key, List targets) throws AntException {
- getSubbuildFrame(key).runBuild(targets);
- }
-
-
- /**
- * Release a subbuild that is no longer in use.
- *
- * @param key the BuildKey identifiying the subbuild.
- *
- * @exception ExecutionException if the build was not registered.
- */
- public void releaseBuild(BuildKey key) throws ExecutionException {
- subBuilds.remove(key);
+ public void runBuild(Object key, List targets) throws AntException {
+ Frame subFrame = (Frame) key;
+ subFrame.runBuild(targets);
}
@@ -316,7 +283,7 @@
* @return Description of the Return Value
* @exception AntException if the subbuild cannot be run
*/
- public BuildKey setupBuild(Project model, Map properties,
+ public Object setupBuild(Project model, Map properties,
boolean addListeners)
throws AntException {
Frame newFrame = frame.createFrame(model);
@@ -325,11 +292,7 @@
}
newFrame.initialize(properties);
- // create an anonymous inner class key.
- BuildKey key = new BuildKey() {};
-
- subBuilds.put(key, newFrame);
- return key;
+ return newFrame;
}
@@ -342,7 +305,7 @@
* @return Description of the Return Value
* @exception AntException if the subbuild cannot be run
*/
- public BuildKey setupBuild(Map properties, boolean addListeners)
+ public Object setupBuild(Map properties, boolean addListeners)
throws AntException {
return setupBuild(frame.getProject(), properties, addListeners);
}
1.29 +26 -20
jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/Frame.java
Index: Frame.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/Frame.java,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -w -u -r1.28 -r1.29
--- Frame.java 31 May 2002 15:15:47 -0000 1.28
+++ Frame.java 13 Jun 2002 15:47:54 -0000 1.29
@@ -72,7 +72,7 @@
import org.apache.ant.common.model.ModelException;
import org.apache.ant.common.model.Project;
import org.apache.ant.common.model.Target;
-import org.apache.ant.common.model.AspectValueCollection;
+import org.apache.ant.common.model.NamespaceValueCollection;
import org.apache.ant.common.service.ComponentService;
import org.apache.ant.common.service.DataService;
import org.apache.ant.common.service.EventService;
@@ -84,7 +84,7 @@
import org.apache.ant.common.util.FileUtils;
import org.apache.ant.common.util.Location;
import org.apache.ant.common.util.AntException;
-import org.apache.ant.init.InitConfig;
+import org.apache.ant.init.AntEnvironment;
import org.apache.ant.init.LoaderUtils;
/**
@@ -129,7 +129,7 @@
* Ant's initialization configuration with information on the location of
* Ant and its libraries.
*/
- private InitConfig initConfig;
+ private AntEnvironment antEnv;
/** BuildEvent support used to fire events and manage listeners */
private BuildEventSupport eventSupport = new BuildEventSupport();
@@ -176,26 +176,26 @@
* Create the main or root Execution Frame.
*
* @param config the user config to use for this execution of Ant
- * @param initConfig Ant's initialisation config
+ * @param antEnv Ant's initialisation config
*/
- public Frame(InitConfig initConfig, AntConfig config) {
+ public Frame(AntEnvironment antEnv, AntConfig config) {
this.config = config;
- this.initConfig = initConfig;
+ this.antEnv = antEnv;
this.parent = null;
this.libManager
- = new AntLibManager(initConfig, config.isRemoteLibAllowed());
+ = new AntLibManager(antEnv, config.isRemoteLibAllowed());
}
/**
* Create an Execution Frame.
*
* @param config the user config to use for this execution of Ant
- * @param initConfig Ant's initialisation config
+ * @param antEnv Ant's initialisation config
* @param parent the frame creating this frame.
*/
- private Frame(InitConfig initConfig, AntConfig config, Frame parent) {
+ private Frame(AntEnvironment antEnv, AntConfig config, Frame parent) {
this.config = config;
- this.initConfig = initConfig;
+ this.antEnv = antEnv;
this.parent = parent;
this.libManager = parent.libManager;
}
@@ -396,7 +396,7 @@
*/
protected void setMagicProperties() throws AntException {
// ant.home
- URL antHomeURL = initConfig.getAntHome();
+ URL antHomeURL = antEnv.getAntHome();
String antHomeString = null;
if (antHomeURL.getProtocol().equals("file")) {
@@ -500,8 +500,8 @@
*
* @return Ant's initialization configuration
*/
- protected InitConfig getInitConfig() {
- return initConfig;
+ protected AntEnvironment getAntEnvironment() {
+ return antEnv;
}
@@ -726,7 +726,7 @@
protected Frame createFrame(Project project)
throws ModelException {
Frame newFrame
- = new Frame(initConfig, config, this);
+ = new Frame(antEnv, config, this);
newFrame.setProject(project);
@@ -740,7 +740,8 @@
* will be added.
*/
protected void addListeners(Frame subFrame) {
- for (Iterator j = eventSupport.getListeners(); j.hasNext();) {
+ List listeners = eventSupport.getListeners();
+ for (Iterator j = listeners.iterator(); j.hasNext();) {
BuildListener listener = (BuildListener) j.next();
subFrame.addBuildListener(listener);
@@ -863,6 +864,10 @@
}
String fullProjectName = getFullProjectName(fullTargetName);
Frame frame = getContainingFrame(fullTargetName);
+ if (frame == null) {
+ throw new ExecutionException("No project available under the "
+ + "referenced name \"" + fullTargetName, targetRefLocation);
+ }
String localTargetName = getNameInFrame(fullTargetName);
Target target = frame.getProject().getTarget(localTargetName);
if (target == null) {
@@ -930,17 +935,18 @@
* Execute a task with the given aspect values.
*
* @param task the task to be executed.
- * @param aspectValues the collection of aspect attribute values.
+ * @param namespaceValues the collection of namespace attribute values.
* @exception AntException if the task has a problem.
*/
- protected void executeTask(Task task, AspectValueCollection aspectValues)
+ protected void executeTask(Task task,
+ NamespaceValueCollection namespaceValues)
throws AntException {
List aspects = componentManager.getAspects();
Map aspectContexts = new HashMap();
for (Iterator i = aspects.iterator(); i.hasNext();) {
Aspect aspect = (Aspect) i.next();
- Object aspectContext = aspect.preExecuteTask(task, aspectValues);
+ Object aspectContext = aspect.preExecuteTask(task,
namespaceValues);
if (aspectContext != null) {
aspectContexts.put(aspect, aspectContext);
}
@@ -1156,14 +1162,14 @@
try {
// load system ant lib
URL systemLibs
- = new URL(initConfig.getLibraryURL(), "syslibs/");
+ = new URL(antEnv.getLibraryURL(), "syslibs/");
componentManager.loadLib(systemLibs, false);
importStandardComponents();
executeTasks(config.getGlobalTasks());
// now load other system libraries
- URL antLibs = new URL(initConfig.getLibraryURL(), "antlibs/");
+ URL antLibs = new URL(antEnv.getLibraryURL(), "antlibs/");
componentManager.loadLib(antLibs, false);
runBuild(targets);
1.7 +3 -2
jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/modelparser/BuildElementHandler.java
Index: BuildElementHandler.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/modelparser/BuildElementHandler.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -w -u -r1.6 -r1.7
--- BuildElementHandler.java 16 May 2002 13:31:46 -0000 1.6
+++ BuildElementHandler.java 13 Jun 2002 15:47:54 -0000 1.7
@@ -93,7 +93,7 @@
buildElement.addAttribute(attributeName,
getAttribute(attributeName));
}
- buildElement.addAspectAttributes(getAspectAttributes());
+ addNamespaceAttributes();
}
@@ -110,6 +110,7 @@
public void startElement(String uri, String localName, String
qualifiedName,
Attributes attributes)
throws SAXParseException {
+
// everything within a task element is also a task element
BuildElementHandler nestedHandler
= new BuildElementHandler();
1.3 +15 -0
jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/modelparser/ModelElementHandler.java
Index: ModelElementHandler.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/modelparser/ModelElementHandler.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -w -u -r1.2 -r1.3
--- ModelElementHandler.java 12 Apr 2002 14:59:56 -0000 1.2
+++ ModelElementHandler.java 13 Jun 2002 15:47:54 -0000 1.3
@@ -55,6 +55,8 @@
import org.apache.ant.antcore.xml.ElementHandler;
import org.apache.ant.common.model.ModelElement;
+import java.util.Iterator;
+import org.apache.ant.common.util.AttributeCollection;
/**
* A BuildElementHandler parses the task elements of a build. Task elements
@@ -84,5 +86,18 @@
modelElement.setEndLocation(getLocation());
}
}
+
+ /**
+ * Add all attributes which belong to namespaces rather than the default
+ * namespace for the build files.
+ */
+ protected void addNamespaceAttributes() {
+ for (Iterator i = getNamespaces(); i.hasNext();) {
+ String uri = (String) i.next();
+ AttributeCollection namespaceValues =
getNamespaceAttributes(uri);
+ modelElement.addNamespaceAttributes(uri, namespaceValues);
+ }
+ }
+
}
1.9 +4 -4
jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/modelparser/ProjectHandler.java
Index: ProjectHandler.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/modelparser/ProjectHandler.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -w -u -r1.8 -r1.9
--- ProjectHandler.java 16 May 2002 13:31:46 -0000 1.8
+++ ProjectHandler.java 13 Jun 2002 15:47:54 -0000 1.9
@@ -133,7 +133,7 @@
project.setDefaultTarget(getAttribute(DEFAULT_ATTR));
project.setBase(getAttribute(BASEDIR_ATTR));
project.setName(getAttribute(NAME_ATTR));
- project.addAspectAttributes(getAspectAttributes());
+ addNamespaceAttributes();
}
}
1.7 +5 -5
jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/modelparser/TargetHandler.java
Index: TargetHandler.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/modelparser/TargetHandler.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -w -u -r1.6 -r1.7
--- TargetHandler.java 16 May 2002 13:31:46 -0000 1.6
+++ TargetHandler.java 13 Jun 2002 15:47:54 -0000 1.7
@@ -105,7 +105,7 @@
target = new Target(getLocation(), getAttribute(NAME_ATTR));
setModelElement(target);
target.setDescription(getAttribute(DESC_ATTR));
- target.addAspectAttributes(getAspectAttributes());
+ addNamespaceAttributes();
String depends = getAttribute(DEPENDS_ATTR);
if (depends != null) {
1.3 +1 -0
jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/modelparser/XMLProjectParser.java
Index: XMLProjectParser.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/modelparser/XMLProjectParser.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -w -u -r1.2 -r1.3
--- XMLProjectParser.java 18 Mar 2002 02:44:25 -0000 1.2
+++ XMLProjectParser.java 13 Jun 2002 15:47:54 -0000 1.3
@@ -78,6 +78,7 @@
throws XMLParseException {
try {
ParseContext context = new ParseContext();
+ context.declareNamespace("ant", "http://jakarta.apache.org/ant");
ProjectHandler projectHandler = new ProjectHandler();
context.parse(buildSource, "project", projectHandler);
1.7 +59 -23
jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/xml/ElementHandler.java
Index: ElementHandler.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/xml/ElementHandler.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -w -u -r1.6 -r1.7
--- ElementHandler.java 16 May 2002 13:31:46 -0000 1.6
+++ ElementHandler.java 13 Jun 2002 15:47:55 -0000 1.7
@@ -58,6 +58,7 @@
import java.util.Map;
import org.apache.ant.common.util.Location;
+import org.apache.ant.common.util.AttributeCollection;
import org.xml.sax.Attributes;
import org.xml.sax.ContentHandler;
import org.xml.sax.Locator;
@@ -98,10 +99,13 @@
private String elementName;
/** The attributes read from this element */
- private Map elementAttributes;
+ private AttributeCollection elementAttributes;
- /** The aspect attributes read from the element definition */
- private Map aspectAttributes;
+ /**
+ * This map contains a set of attribute collections for each namespace
+ * encountered.
+ */
+ private Map namespaces;
/** The content of this element */
private String content;
@@ -116,6 +120,29 @@
}
/**
+ * Get an interator over the namespace URIs encountered in the processing
+ * of the element
+ *
+ * @return an iterator over the namespace URIs.
+ */
+ public Iterator getNamespaces() {
+ return namespaces.keySet().iterator();
+ }
+
+ /**
+ * Get the collection of namespace attributes for a given namespace.
+ *
+ * @param uri the URI of the namespace from which the attribute
collection
+ * is required.
+ *
+ * @return an attribute collection if any attributes of the requested
+ * namespace have beebn encountered - otherwise null.
+ */
+ public AttributeCollection getNamespaceAttributes(String uri) {
+ return (AttributeCollection) namespaces.get(uri);
+ }
+
+ /**
* Gets the attributeValue attribute of the ElementHandler object
*
* @param attributeName th name of the attribute
@@ -123,7 +150,7 @@
* snot defined.
*/
public String getAttribute(String attributeName) {
- return (String) elementAttributes.get(attributeName);
+ return elementAttributes.getAttribute(attributeName);
}
/**
@@ -142,16 +169,7 @@
* @return an iterator over the attribute names
*/
public Iterator getAttributes() {
- return elementAttributes.keySet().iterator();
- }
-
- /**
- * Get the aspect attributes of this element.
- *
- * @return The aspect attributes.
- */
- public Map getAspectAttributes() {
- return aspectAttributes;
+ return elementAttributes.getAttributeNames();
}
/**
@@ -313,17 +331,35 @@
*/
protected final void processAttributes(Attributes attributes)
throws SAXParseException {
- aspectAttributes = new HashMap();
- elementAttributes = new HashMap();
+ namespaces = new HashMap();
+ elementAttributes = new AttributeCollection();
int length = attributes.getLength();
for (int i = 0; i < length; ++i) {
- String attributeName = attributes.getQName(i);
+ String uri = attributes.getURI(i);
+ if (uri != null && uri.trim().length() == 0) {
+ uri = null;
+ }
+ String localName = attributes.getLocalName(i);
+ String qName = attributes.getQName(i);
+ if (uri == null && qName.indexOf(":") != -1) {
+ // try to resolve through known namespaces
+ uri = context.resolveNamespace(qName);
+ localName = qName.substring(qName.indexOf(":") + 1);
+ }
+
String attributeValue = attributes.getValue(i);
- if (attributeName.indexOf(":") != -1) {
- aspectAttributes.put(attributeName, attributeValue);
+ if (uri != null) {
+ AttributeCollection namespaceAttributes
+ = (AttributeCollection) namespaces.get(uri);
+ if (namespaceAttributes == null) {
+ namespaceAttributes = new AttributeCollection();
+ namespaces.put(uri, namespaceAttributes);
+ }
+
+ namespaceAttributes.putAttribute(localName, attributeValue);
} else {
- validateAttribute(attributeName, attributeValue);
- elementAttributes.put(attributeName, attributeValue);
+ validateAttribute(localName, attributeValue);
+ elementAttributes.putAttribute(localName, attributeValue);
}
}
}
1.7 +29 -0
jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/xml/ParseContext.java
Index: ParseContext.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/xml/ParseContext.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -w -u -r1.6 -r1.7
--- ParseContext.java 7 Apr 2002 14:38:06 -0000 1.6
+++ ParseContext.java 13 Jun 2002 15:47:55 -0000 1.7
@@ -54,6 +54,8 @@
package org.apache.ant.antcore.xml;
import java.io.IOException;
+import java.util.Map;
+import java.util.HashMap;
import java.net.URL;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;
@@ -73,6 +75,9 @@
* @created 9 January 2002
*/
public class ParseContext {
+ /** These are namespace to URIs which need not be declared in the XML */
+ private Map knownNamespaces = new HashMap();
+
/**
* Used to check if we are trying to parse a build file within its own
* context.
@@ -144,6 +149,30 @@
} catch (CircularDependencyException e) {
throw new XMLParseException(e);
}
+ }
+
+ /**
+ * Given an XML qName, this method tries to resolve a name into a URI
+ * using the map of well known namespaces.
+ *
+ * @param qName the XML qName
+ * @return the namespace URI for the given name. If the namespace
+ * prefix is unknown the prefix is returned.
+ */
+ public String resolveNamespace(String qName) {
+ String namespaceId = qName.substring(0, qName.indexOf(":"));
+ String namespaceURI = (String) knownNamespaces.get(namespaceId);
+ return namespaceURI == null ? namespaceId : namespaceURI;
+ }
+
+ /**
+ * Declare a namespace
+ *
+ * @param prefix the prefix that is used in the XML for the namespace.
+ * @param uri the namespace's unique URI.
+ */
+ public void declareNamespace(String prefix, String uri) {
+ knownNamespaces.put(prefix, uri);
}
}
1.7 +41 -16
jakarta-ant/proposal/mutant/src/java/antlibs/ant1compat/antlib.xml
Index: antlib.xml
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/mutant/src/java/antlibs/ant1compat/antlib.xml,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -w -u -r1.6 -r1.7
--- antlib.xml 30 Apr 2002 14:57:02 -0000 1.6
+++ antlib.xml 13 Jun 2002 15:47:55 -0000 1.7
@@ -7,12 +7,15 @@
<converter classname="org.apache.tools.ant.Ant1Converter"/>
- <!-- typedefs -->
+ <!-- taskdefs -->
+ <taskdef name="WsdlToDotnet"
classname="org.apache.tools.ant.taskdefs.optional.dotnet.WsdlToDotnet"/>
<taskdef name="antlr"
classname="org.apache.tools.ant.taskdefs.optional.ANTLR"/>
<taskdef name="antstructure"
classname="org.apache.tools.ant.taskdefs.AntStructure"/>
<taskdef name="apply" classname="org.apache.tools.ant.taskdefs.Transform"/>
<taskdef name="available"
classname="org.apache.tools.ant.taskdefs.Available"/>
+ <taskdef name="basename"
classname="org.apache.tools.ant.taskdefs.Basename"/>
<taskdef name="blgenclient"
classname="org.apache.tools.ant.taskdefs.optional.ejb.BorlandGenerateClient"/>
+ <taskdef name="buildnumber"
classname="org.apache.tools.ant.taskdefs.BuildNumber"/>
<taskdef name="bunzip2" classname="org.apache.tools.ant.taskdefs.BUnzip2"/>
<taskdef name="bzip2" classname="org.apache.tools.ant.taskdefs.BZip2"/>
<taskdef name="cab"
classname="org.apache.tools.ant.taskdefs.optional.Cab"/>
@@ -27,15 +30,19 @@
<taskdef name="ccupdate"
classname="org.apache.tools.ant.taskdefs.optional.clearcase.CCUpdate"/>
<taskdef name="checksum"
classname="org.apache.tools.ant.taskdefs.Checksum"/>
<taskdef name="chmod" classname="org.apache.tools.ant.taskdefs.Chmod"/>
+ <taskdef name="concat" classname="org.apache.tools.ant.taskdefs.Concat"/>
<taskdef name="condition"
classname="org.apache.tools.ant.taskdefs.ConditionTask"/>
<taskdef name="copy" classname="org.apache.tools.ant.taskdefs.Copy"/>
<taskdef name="csc"
classname="org.apache.tools.ant.taskdefs.optional.dotnet.CSharp"/>
<taskdef name="cvs" classname="org.apache.tools.ant.taskdefs.Cvs"/>
+ <taskdef name="cvschangelog"
classname="org.apache.tools.ant.taskdefs.cvslib.ChangeLogTask"/>
<taskdef name="cvspass" classname="org.apache.tools.ant.taskdefs.CVSPass"/>
+ <taskdef name="cvstagdiff"
classname="org.apache.tools.ant.taskdefs.cvslib.CvsTagDiff"/>
<taskdef name="ddcreator"
classname="org.apache.tools.ant.taskdefs.optional.ejb.DDCreator"/>
<taskdef name="delete" classname="org.apache.tools.ant.taskdefs.Delete"/>
<taskdef name="depend"
classname="org.apache.tools.ant.taskdefs.optional.depend.Depend"/>
<taskdef name="dependset"
classname="org.apache.tools.ant.taskdefs.DependSet"/>
+ <taskdef name="dirname" classname="org.apache.tools.ant.taskdefs.Dirname"/>
<taskdef name="ear" classname="org.apache.tools.ant.taskdefs.Ear"/>
<taskdef name="echo" classname="org.apache.tools.ant.taskdefs.Echo"/>
<taskdef name="echoproperties"
classname="org.apache.tools.ant.taskdefs.optional.EchoProperties"/>
@@ -56,6 +63,10 @@
<taskdef name="input" classname="org.apache.tools.ant.taskdefs.Input"/>
<taskdef name="iplanet-ejbc"
classname="org.apache.tools.ant.taskdefs.optional.ejb.IPlanetEjbcTask"/>
<taskdef name="jar" classname="org.apache.tools.ant.taskdefs.Jar"/>
+ <taskdef name="jarlib-available"
classname="org.apache.tools.ant.taskdefs.optional.extension.JarLibAvailableTask"/>
+ <taskdef name="jarlib-display"
classname="org.apache.tools.ant.taskdefs.optional.extension.JarLibDisplayTask"/>
+ <taskdef name="jarlib-manifest"
classname="org.apache.tools.ant.taskdefs.optional.extension.JarLibManifestTask"/>
+ <taskdef name="jarlib-resolve"
classname="org.apache.tools.ant.taskdefs.optional.extension.JarLibResolveTask"/>
<taskdef name="java" classname="org.apache.tools.ant.taskdefs.Java"/>
<taskdef name="javac" classname="org.apache.tools.ant.taskdefs.Javac"/>
<taskdef name="javacc"
classname="org.apache.tools.ant.taskdefs.optional.javacc.JavaCC"/>
@@ -65,13 +76,13 @@
<taskdef name="jjtree"
classname="org.apache.tools.ant.taskdefs.optional.javacc.JJTree"/>
<taskdef name="jlink"
classname="org.apache.tools.ant.taskdefs.optional.jlink.JlinkTask"/>
<taskdef name="jpcoverage"
classname="org.apache.tools.ant.taskdefs.optional.sitraka.Coverage"/>
- <taskdef name="jpcovmerge"
classname="org.apache.tools.ant.taskdefs.optional.sitraka.CovMerge"/>
<taskdef name="jpcovreport"
classname="org.apache.tools.ant.taskdefs.optional.sitraka.CovReport"/>
<taskdef name="jspc"
classname="org.apache.tools.ant.taskdefs.optional.jsp.JspC"/>
<taskdef name="junit"
classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask"/>
<taskdef name="junitreport"
classname="org.apache.tools.ant.taskdefs.optional.junit.XMLResultAggregator"/>
<taskdef name="loadfile"
classname="org.apache.tools.ant.taskdefs.LoadFile"/>
- <taskdef name="mail" classname="org.apache.tools.ant.taskdefs.SendEmail"/>
+ <taskdef name="loadproperties"
classname="org.apache.tools.ant.taskdefs.LoadProperties"/>
+ <taskdef name="mail"
classname="org.apache.tools.ant.taskdefs.email.EmailTask"/>
<taskdef name="manifest"
classname="org.apache.tools.ant.taskdefs.Manifest"/>
<taskdef name="maudit"
classname="org.apache.tools.ant.taskdefs.optional.metamata.MAudit"/>
<taskdef name="mimemail"
classname="org.apache.tools.ant.taskdefs.optional.net.MimeMail"/>
@@ -101,6 +112,8 @@
<taskdef name="rmic" classname="org.apache.tools.ant.taskdefs.Rmic"/>
<taskdef name="rpm"
classname="org.apache.tools.ant.taskdefs.optional.Rpm"/>
<taskdef name="script"
classname="org.apache.tools.ant.taskdefs.optional.Script"/>
+ <taskdef name="serverdeploy"
classname="org.apache.tools.ant.taskdefs.optional.j2ee.ServerDeploy"/>
+ <taskdef name="setproxy"
classname="org.apache.tools.ant.taskdefs.optional.net.SetProxy"/>
<taskdef name="signjar" classname="org.apache.tools.ant.taskdefs.SignJar"/>
<taskdef name="sleep" classname="org.apache.tools.ant.taskdefs.Sleep"/>
<taskdef name="soscheckin"
classname="org.apache.tools.ant.taskdefs.optional.sos.SOSCheckin"/>
@@ -119,6 +132,7 @@
<taskdef name="tar" classname="org.apache.tools.ant.taskdefs.Tar"/>
<taskdef name="taskdef" classname="org.apache.tools.ant.taskdefs.Taskdef"/>
<taskdef name="telnet"
classname="org.apache.tools.ant.taskdefs.optional.net.TelnetTask"/>
+ <taskdef name="tempfile"
classname="org.apache.tools.ant.taskdefs.TempFile"/>
<taskdef name="test"
classname="org.apache.tools.ant.taskdefs.optional.Test"/>
<taskdef name="touch" classname="org.apache.tools.ant.taskdefs.Touch"/>
<taskdef name="translate"
classname="org.apache.tools.ant.taskdefs.optional.i18n.Translate"/>
@@ -132,8 +146,11 @@
<taskdef name="vajexport"
classname="org.apache.tools.ant.taskdefs.optional.ide.VAJExport"/>
<taskdef name="vajimport"
classname="org.apache.tools.ant.taskdefs.optional.ide.VAJImport"/>
<taskdef name="vajload"
classname="org.apache.tools.ant.taskdefs.optional.ide.VAJLoadProjects"/>
+ <taskdef name="vssadd"
classname="org.apache.tools.ant.taskdefs.optional.vss.MSVSSADD"/>
<taskdef name="vsscheckin"
classname="org.apache.tools.ant.taskdefs.optional.vss.MSVSSCHECKIN"/>
<taskdef name="vsscheckout"
classname="org.apache.tools.ant.taskdefs.optional.vss.MSVSSCHECKOUT"/>
+ <taskdef name="vsscp"
classname="org.apache.tools.ant.taskdefs.optional.vss.MSVSSCP"/>
+ <taskdef name="vsscreate"
classname="org.apache.tools.ant.taskdefs.optional.vss.MSVSSCREATE"/>
<taskdef name="vssget"
classname="org.apache.tools.ant.taskdefs.optional.vss.MSVSSGET"/>
<taskdef name="vsshistory"
classname="org.apache.tools.ant.taskdefs.optional.vss.MSVSSHISTORY"/>
<taskdef name="vsslabel"
classname="org.apache.tools.ant.taskdefs.optional.vss.MSVSSLABEL"/>
@@ -142,7 +159,10 @@
<taskdef name="wljspc"
classname="org.apache.tools.ant.taskdefs.optional.jsp.WLJspc"/>
<taskdef name="wlrun"
classname="org.apache.tools.ant.taskdefs.optional.ejb.WLRun"/>
<taskdef name="wlstop"
classname="org.apache.tools.ant.taskdefs.optional.ejb.WLStop"/>
+ <taskdef name="wsdltodotnet"
classname="org.apache.tools.ant.taskdefs.optional.dotnet.WsdlToDotnet"/>
+ <taskdef name="xmlproperty"
classname="org.apache.tools.ant.taskdefs.XmlProperty"/>
<taskdef name="xmlvalidate"
classname="org.apache.tools.ant.taskdefs.optional.XMLValidateTask"/>
+ <taskdef name="xslt"
classname="org.apache.tools.ant.taskdefs.XSLTProcess"/>
<taskdef name="zip" classname="org.apache.tools.ant.taskdefs.Zip"/>
<!-- Deprecated tasks -->
@@ -150,20 +170,25 @@
<taskdef name="copyfile"
classname="org.apache.tools.ant.taskdefs.Copyfile"/>
<taskdef name="deltree" classname="org.apache.tools.ant.taskdefs.Deltree"/>
<taskdef name="rename" classname="org.apache.tools.ant.taskdefs.Rename"/>
+ <taskdef name="starteam"
classname="org.apache.tools.ant.taskdefs.optional.scm.AntStarTeamCheckOut"/>
<!-- typedefs -->
- <typedef name="path" classname="org.apache.tools.ant.types.Path"/>
- <typedef name="fileset" classname="org.apache.tools.ant.types.FileSet"/>
+ <typedef name="classfileset"
classname="org.apache.tools.ant.types.optional.depend.ClassfileSet"/>
+ <typedef name="description"
classname="org.apache.tools.ant.types.Description"/>
+ <typedef name="dirset" classname="org.apache.tools.ant.types.DirSet"/>
+ <typedef name="extension"
classname="org.apache.tools.ant.taskdefs.optional.extension.ExtensionAdapter"/>
+ <typedef name="extensionSet"
classname="org.apache.tools.ant.taskdefs.optional.extension.ExtensionSet"/>
<typedef name="filelist" classname="org.apache.tools.ant.types.FileList"/>
- <typedef name="patternset"
classname="org.apache.tools.ant.types.PatternSet"/>
- <typedef name="mapper" classname="org.apache.tools.ant.types.Mapper"/>
+ <typedef name="fileset" classname="org.apache.tools.ant.types.FileSet"/>
<typedef name="filterchain"
classname="org.apache.tools.ant.types.FilterChain"/>
<typedef name="filterreader"
classname="org.apache.tools.ant.types.AntFilterReader"/>
<typedef name="filterset"
classname="org.apache.tools.ant.types.FilterSet"/>
- <typedef name="description"
classname="org.apache.tools.ant.types.Description"/>
- <typedef name="classfileset"
classname="org.apache.tools.ant.types.optional.depend.ClassfileSet"/>
- <typedef name="substitution"
classname="org.apache.tools.ant.types.Substitution"/>
+ <typedef name="libfileset"
classname="org.apache.tools.ant.taskdefs.optional.extension.LibFileSet"/>
+ <typedef name="mapper" classname="org.apache.tools.ant.types.Mapper"/>
+ <typedef name="path" classname="org.apache.tools.ant.types.Path"/>
+ <typedef name="patternset"
classname="org.apache.tools.ant.types.PatternSet"/>
<typedef name="regexp"
classname="org.apache.tools.ant.types.RegularExpression"/>
- <typedef name="regularexpression"
classname="org.apache.tools.ant.types.RegularExpression"/>
+ <typedef name="selector"
classname="org.apache.tools.ant.types.selectors.SelectSelector"/>
+ <typedef name="substitution"
classname="org.apache.tools.ant.types.Substitution"/>
<typedef name="xmlcatalog"
classname="org.apache.tools.ant.types.XMLCatalog"/>
</antlib>
1.25 +1 -2
jakarta-ant/proposal/mutant/src/java/antlibs/ant1compat/org/apache/tools/ant/Project.java
Index: Project.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/mutant/src/java/antlibs/ant1compat/org/apache/tools/ant/Project.java,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -w -u -r1.24 -r1.25
--- Project.java 27 May 2002 15:52:22 -0000 1.24
+++ Project.java 13 Jun 2002 15:47:55 -0000 1.25
@@ -68,7 +68,6 @@
import org.apache.ant.common.antlib.AntContext;
import org.apache.ant.common.antlib.AntLibFactory;
import org.apache.ant.common.event.MessageLevel;
-import org.apache.ant.common.service.BuildKey;
import org.apache.ant.common.service.ComponentService;
import org.apache.ant.common.service.DataService;
import org.apache.ant.common.service.ExecService;
@@ -197,7 +196,7 @@
/**
* The build key used to control the proxied build.
*/
- private BuildKey proxyBuildKey;
+ private Object proxyBuildKey;
/**
* The subordinate project if proxying
1.3 +5 -4
jakarta-ant/proposal/mutant/src/java/antlibs/monitor/org/apache/ant/antlib/monitor/MonitorAspect.java
Index: MonitorAspect.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/mutant/src/java/antlibs/monitor/org/apache/ant/antlib/monitor/MonitorAspect.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -w -u -r1.2 -r1.3
--- MonitorAspect.java 31 May 2002 15:15:47 -0000 1.2
+++ MonitorAspect.java 13 Jun 2002 15:47:55 -0000 1.3
@@ -57,7 +57,7 @@
import org.apache.ant.common.antlib.Task;
import org.apache.ant.common.antlib.AntContext;
import org.apache.ant.common.model.BuildElement;
-import org.apache.ant.common.model.AspectValueCollection;
+import org.apache.ant.common.model.NamespaceValueCollection;
import org.apache.ant.common.util.AntException;
import org.apache.ant.common.event.MessageLevel;
import java.util.Date;
@@ -97,8 +97,8 @@
* This join point is activated just prior to task execution.
*
* @param task the task being executed.
- * @param aspectValues a collection of aspect attribute values for use
- * during the task execution - may be null if no aspect values are
+ * @param namespaceValues a collection of namesapce attribute values for
use
+ * during the task execution - may be null if no namespace values
are
* provided.
* @return an object which indicates that this aspect wishes to
* be notified after execution has been completed, in which case the
obkect
@@ -106,7 +106,8 @@
* the aspect's postExecuteTask method will not be invoked.
* @exception AntException if the aspect cannot process the task.
*/
- public Object preExecuteTask(Task task, AspectValueCollection
aspectValues)
+ public Object preExecuteTask(Task task,
+ NamespaceValueCollection namespaceValues)
throws AntException {
System.gc();
AntContext taskContext = task.getAntContext();
1.11 +2 -3
jakarta-ant/proposal/mutant/src/java/antlibs/system/org/apache/ant/antlib/system/Ant.java
Index: Ant.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/mutant/src/java/antlibs/system/org/apache/ant/antlib/system/Ant.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -w -u -r1.10 -r1.11
--- Ant.java 27 May 2002 15:52:24 -0000 1.10
+++ Ant.java 13 Jun 2002 15:47:55 -0000 1.11
@@ -57,7 +57,6 @@
import java.io.FileOutputStream;
import java.io.IOException;
import org.apache.ant.common.model.Project;
-import org.apache.ant.common.service.BuildKey;
import org.apache.ant.common.service.ExecService;
import org.apache.ant.common.service.FileService;
import org.apache.ant.common.service.MagicProperties;
@@ -137,7 +136,7 @@
ExecService execService = getExecService();
Project model = execService.parseXMLBuildFile(antFile);
- BuildKey key = execService.setupBuild(model, getProperties(), true);
+ Object key = execService.setupBuild(model, getProperties(), true);
setSubBuildKey(key);
@@ -166,7 +165,7 @@
}
execService.runBuild(key, getTargets());
- execService.releaseBuild(key);
+ setSubBuildKey(null);
}
}
1.5 +12 -10
jakarta-ant/proposal/mutant/src/java/antlibs/system/org/apache/ant/antlib/system/AntAspect.java
Index: AntAspect.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/mutant/src/java/antlibs/system/org/apache/ant/antlib/system/AntAspect.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -w -u -r1.4 -r1.5
--- AntAspect.java 27 May 2002 15:52:24 -0000 1.4
+++ AntAspect.java 13 Jun 2002 15:47:55 -0000 1.5
@@ -53,7 +53,6 @@
*/
package org.apache.ant.antlib.system;
-import java.util.Map;
import org.apache.ant.common.antlib.AbstractAspect;
import org.apache.ant.common.antlib.AntContext;
import org.apache.ant.common.antlib.Task;
@@ -62,7 +61,9 @@
import org.apache.ant.common.service.ComponentService;
import org.apache.ant.common.util.AntException;
import org.apache.ant.common.model.BuildElement;
-import org.apache.ant.common.model.AspectValueCollection;
+import org.apache.ant.common.model.NamespaceValueCollection;
+import org.apache.ant.common.util.AttributeCollection;
+import org.apache.ant.common.constants.Namespace;
/**
* The Ant aspect - handles all ant aspects
@@ -70,9 +71,6 @@
* @author Conor MacNeill
*/
public class AntAspect extends AbstractAspect {
- /** The Ant aspect used to identify Ant metadata */
- public static final String ANT_ASPECT = "ant";
-
/** The core's data service implementation */
private DataService dataService = null;
@@ -107,7 +105,8 @@
*/
public Object preCreateComponent(Object component, BuildElement model)
throws AntException {
- String refId = model.getAspectAttributeValue(ANT_ASPECT, "refid");
+ String refId
+ = model.getNamespaceAttributeValue(Namespace.ANT_META_URI,
"refid");
if (refId != null) {
if (model.getAttributeNames().hasNext() ||
model.getNestedElements().hasNext() ||
@@ -141,7 +140,8 @@
*/
public Object postCreateComponent(Object component, BuildElement model)
throws AntException {
- String typeId = model.getAspectAttributeValue(ANT_ASPECT, "id");
+ String typeId
+ = model.getNamespaceAttributeValue(Namespace.ANT_META_URI, "id");
if (typeId != null) {
dataService.setMutableDataValue(typeId, component);
@@ -154,7 +154,7 @@
* This join point is activated just prior to task execution.
*
* @param task the task being executed.
- * @param aspectValues a collection of aspect attribute values for use
+ * @param namespaceValues a collection of namespace attribute values for
use
* during the task execution.
*
* @return an objectwhich indicates that this aspect wishes to
@@ -163,10 +163,12 @@
* the aspect's postExecuteTask method will not be invoked.
* @exception AntException if the aspect cannot process the task.
*/
- public Object preExecuteTask(Task task, AspectValueCollection
aspectValues)
+ public Object preExecuteTask(Task task,
+ NamespaceValueCollection namespaceValues)
throws AntException {
AntAspectContext aspectContext = new AntAspectContext();
- Map antAspectValues = aspectValues.getAttributes(ANT_ASPECT);
+ AttributeCollection antAspectValues
+ = namespaceValues.getAttributes(Namespace.ANT_META_URI);
if (antAspectValues == null) {
return null;
}
1.10 +2 -3
jakarta-ant/proposal/mutant/src/java/antlibs/system/org/apache/ant/antlib/system/AntBase.java
Index: AntBase.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/mutant/src/java/antlibs/system/org/apache/ant/antlib/system/AntBase.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -w -u -r1.9 -r1.10
--- AntBase.java 27 May 2002 15:52:24 -0000 1.9
+++ AntBase.java 13 Jun 2002 15:47:55 -0000 1.10
@@ -56,7 +56,6 @@
import java.util.List;
import java.util.Map;
import org.apache.ant.common.util.AntException;
-import org.apache.ant.common.service.BuildKey;
/**
* Common Base class for the Ant and AntCall tasks
@@ -81,7 +80,7 @@
/**
* The key to the subbuild with which the Ant task can manage the
subbuild
*/
- private BuildKey subbuildKey;
+ private Object subbuildKey;
/** The name of the target to be evaluated in the sub-build */
private String targetName;
@@ -181,7 +180,7 @@
*
* @param key the key returned by the Ant core for managing the subbuild
*/
- protected void setSubBuildKey(BuildKey key) {
+ protected void setSubBuildKey(Object key) {
this.subbuildKey = key;
}
1.9 +2 -3
jakarta-ant/proposal/mutant/src/java/antlibs/system/org/apache/ant/antlib/system/AntCall.java
Index: AntCall.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/mutant/src/java/antlibs/system/org/apache/ant/antlib/system/AntCall.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -w -u -r1.8 -r1.9
--- AntCall.java 27 May 2002 15:52:24 -0000 1.8
+++ AntCall.java 13 Jun 2002 15:47:55 -0000 1.9
@@ -54,7 +54,6 @@
package org.apache.ant.antlib.system;
import org.apache.ant.common.util.AntException;
import org.apache.ant.common.service.MagicProperties;
-import org.apache.ant.common.service.BuildKey;
/**
* The Ant task - used to execute a different build file
@@ -72,10 +71,10 @@
setProperty(MagicProperties.BASEDIR,
getExecService().getBaseDir().getAbsolutePath());
- BuildKey key = getExecService().setupBuild(getProperties(), true);
+ Object key = getExecService().setupBuild(getProperties(), true);
setSubBuildKey(key);
getExecService().runBuild(key, getTargets());
- getExecService().releaseBuild(key);
+ setSubBuildKey(null);
}
/**
1.1
jakarta-ant/proposal/mutant/src/java/common/org/apache/ant/common/Namespace.java
Index: Namespace.java
===================================================================
/*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Ant", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
package org.apache.ant.common.constants;
/**
* Namespace constants
*
* @author Conor MacNeill
* @created 14 June 2002
*/
public class Namespace {
/** The Ant namespace used to identify Ant metadata */
public static final String ANT_META_URI
= "http://jakarta.apache.org/ant/meta";
/** The namespace id that is predeclared for the Ant metadata namespace */
public static final String ANT_META_PREFIX = "ant";
/** The XML Schema namespace */
public static final String XSI_URI
= "http://www.w3.org/2001/XMLSchema-instance";
/** The namespace id that is predeclared for the Ant metadata namespace */
public static final String XSI_PREFIX = "xsi";
}
1.5 +5 -4
jakarta-ant/proposal/mutant/src/java/common/org/apache/ant/common/antlib/AbstractAspect.java
Index: AbstractAspect.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/mutant/src/java/common/org/apache/ant/common/antlib/AbstractAspect.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -w -u -r1.4 -r1.5
--- AbstractAspect.java 27 May 2002 15:52:25 -0000 1.4
+++ AbstractAspect.java 13 Jun 2002 15:47:55 -0000 1.5
@@ -55,7 +55,7 @@
import org.apache.ant.common.util.AntException;
import org.apache.ant.common.model.BuildElement;
-import org.apache.ant.common.model.AspectValueCollection;
+import org.apache.ant.common.model.NamespaceValueCollection;
/**
* An implementation of the Aspect interface providing default behaviour.
@@ -126,8 +126,8 @@
* This join point is activated just prior to task execution.
*
* @param task the task being executed.
- * @param aspectValues a collection of aspect attribute values for use
- * during the task execution - may be null if no aspect values are
+ * @param namespaceValues a collection of namespace attribute values for
use
+ * during the task execution - may be null if no namespace values
are
* provided.
* @return an object which indicates that this aspect wishes to
* be notified after execution has been completed, in which case the
obkect
@@ -135,7 +135,8 @@
* the aspect's postExecuteTask method will not be invoked.
* @exception AntException if the aspect cannot process the task.
*/
- public Object preExecuteTask(Task task, AspectValueCollection
aspectValues)
+ public Object preExecuteTask(Task task,
+ NamespaceValueCollection namespaceValues)
throws AntException {
return null;
}
1.5 +4 -4
jakarta-ant/proposal/mutant/src/java/common/org/apache/ant/common/antlib/Aspect.java
Index: Aspect.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/mutant/src/java/common/org/apache/ant/common/antlib/Aspect.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -w -u -r1.4 -r1.5
--- Aspect.java 27 May 2002 15:52:25 -0000 1.4
+++ Aspect.java 13 Jun 2002 15:47:55 -0000 1.5
@@ -55,7 +55,7 @@
import org.apache.ant.common.util.AntException;
import org.apache.ant.common.model.BuildElement;
-import org.apache.ant.common.model.AspectValueCollection;
+import org.apache.ant.common.model.NamespaceValueCollection;
/**
* An aspect is a component which is activated across all task and
@@ -108,8 +108,8 @@
* This join point is activated just prior to task execution.
*
* @param task the task being executed.
- * @param aspectValues a collection of aspect attribute values for use
- * during the task execution - may be null if no aspect values are
+ * @param namespaceValues a collection of namespace attribute values for
use
+ * during the task execution - may be null if no namespace values
are
* provided.
* @return an object which indicates that this aspect wishes to
* be notified after execution has been completed, in which case the
obkect
@@ -117,7 +117,7 @@
* the aspect's postExecuteTask method will not be invoked.
* @exception AntException if the aspect cannot process the task.
*/
- Object preExecuteTask(Task task, AspectValueCollection aspectValues)
+ Object preExecuteTask(Task task, NamespaceValueCollection
namespaceValues)
throws AntException;
/**
1.7 +32 -28
jakarta-ant/proposal/mutant/src/java/common/org/apache/ant/common/model/ModelElement.java
Index: ModelElement.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/mutant/src/java/common/org/apache/ant/common/model/ModelElement.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -w -u -r1.6 -r1.7
--- ModelElement.java 16 May 2002 13:31:46 -0000 1.6
+++ ModelElement.java 13 Jun 2002 15:47:55 -0000 1.7
@@ -54,9 +54,9 @@
package org.apache.ant.common.model;
import java.util.Iterator;
-import java.util.Map;
import org.apache.ant.common.util.Location;
+import org.apache.ant.common.util.AttributeCollection;
/**
* A ModelElement is an element of a build model. A location may be
@@ -68,7 +68,8 @@
*/
public abstract class ModelElement {
/** The aspectValues defined for this element. */
- private AspectValueCollection aspectValues = new AspectValueCollection();
+ private NamespaceValueCollection namespaceValues
+ = new NamespaceValueCollection();
/** The starting location of this element */
private Location location = Location.UNKNOWN_LOCATION;
@@ -107,13 +108,15 @@
}
/**
- * Adds aspect related attributes of this element
+ * Adds attributes of a given namespace detected for this element.
*
- * @param aspectAttributes a Map of aspect realted attributes that
pertain
- * to this model element.
- */
- public void addAspectAttributes(Map aspectAttributes) {
- aspectValues.addAttributes(aspectAttributes);
+ * @param uri the namespace's URI.
+ * @param attributes the attribute collection of the namespace's
attribute
+ * values.
+ */
+ public void addNamespaceAttributes(String uri,
+ AttributeCollection attributes) {
+ namespaceValues.addAttributes(uri, attributes);
}
/**
@@ -144,44 +147,45 @@
}
/**
- * Get an iterator on the aspectValues which have been given values on
this
+ * Get an iterator on the namespaces which have been given values on this
* element
*
- * @return an iterator of Strings , being the aspectValues which have
been
+ * @return an iterator of Strings, being the namespaces which have been
* given values on this element.
*/
- public Iterator getAspectNames() {
- return aspectValues.getNames();
+ public Iterator getNamespaceURIs() {
+ return namespaceValues.getNames();
}
/**
- * Get the set of attribute values related to the given aspect
+ * Get the set of attribute values related to the given namespace
*
- * @param aspectName the aspect identifier
- * @return a map of the attribute values for the given aspect.
+ * @param namespaceURI the namesace URI.
+ * @return a map of the attribute values for the given namespace.
*/
- public Map getAspectAttributes(String aspectName) {
- return aspectValues.getAttributes(aspectName);
+ public AttributeCollection getNamespaceAttributes(String namespaceURI) {
+ return namespaceValues.getAttributes(namespaceURI);
}
/**
- * Get the value of a single aspect attribute
+ * Get the value of a single namespace attribute
*
- * @param aspectName the aspect name
+ * @param namepaceURI the aspect name
* @param keyName the attribute name
* @return the aspect value
*/
- public String getAspectAttributeValue(String aspectName, String keyName)
{
- return aspectValues.getAttributeValue(aspectName, keyName);
+ public String getNamespaceAttributeValue(String namepaceURI,
+ String keyName) {
+ return namespaceValues.getAttributeValue(namepaceURI, keyName);
}
/**
- * Get the complete collection of aspect attribute values.
+ * Get the complete collection of namespace attribute values.
*
- * @return an AspectValueCollection instance.
+ * @return an NamespaceValueCollection instance.
*/
- public AspectValueCollection getAspectAttributes() {
- return aspectValues;
+ public NamespaceValueCollection getNamespaceAttributes() {
+ return namespaceValues;
}
}
1.1
jakarta-ant/proposal/mutant/src/java/common/org/apache/ant/common/model/NamespaceValueCollection.java
Index: NamespaceValueCollection.java
===================================================================
/*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Ant", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
package org.apache.ant.common.model;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import org.apache.ant.common.util.AttributeCollection;
/**
* The NamespaceValueCollection holds namespace values for a range of
* namespaces. Values can be retrieved for a particular namespace attribute
* or all attributes of a given namespace.
*
* @author Conor MacNeill
* @created 11 January 2002
*/
public class NamespaceValueCollection {
/**
* The namespaces defined for this collection. Each entry is an attribute
* collection keyed by the namespace URI.
*/
private Map namespaces = new HashMap();
/**
* Add the attributes of a given namespace to this collection.
*
* @param uri the namespace's URI.
* @param attributes the collection of attributes for the given namespace.
*/
public void addAttributes(String uri, AttributeCollection attributes) {
AttributeCollection currentCollection
= (AttributeCollection) namespaces.get(uri);
if (currentCollection == null) {
currentCollection = new AttributeCollection();
namespaces.put(uri, currentCollection);
}
for (Iterator i = attributes.getAttributeNames(); i.hasNext();) {
String attributeName = (String) i.next();
currentCollection.putAttribute(attributeName,
attributes.getAttribute(attributeName));
}
}
/**
* Get an iterator on the namespaces which have been given values on this
* collection
*
* @return an iterator of Strings, being the namespaces which have been
* given values on this element.
*/
public Iterator getNames() {
return namespaces.keySet().iterator();
}
/**
* Get the set of attribute values related to the given namespace
*
* @param namespaceURI the namespace URI
* @return an attribute collection
*/
public AttributeCollection getAttributes(String namespaceURI) {
return (AttributeCollection) namespaces.get(namespaceURI);
}
/**
* Get the value of a single namespace attribute
*
* @param namespaceURI the namespace URI
* @param keyName the attribute name
* @return the namespace attribute value
*/
public String getAttributeValue(String namespaceURI, String keyName) {
AttributeCollection namespaceAttributes = getAttributes(namespaceURI);
if (namespaceAttributes == null) {
return null;
}
return namespaceAttributes.getAttribute(keyName);
}
}
1.17 +2 -2
jakarta-ant/proposal/mutant/src/java/common/org/apache/ant/common/service/ComponentService.java
Index: ComponentService.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/mutant/src/java/common/org/apache/ant/common/service/ComponentService.java,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -w -u -r1.16 -r1.17
--- ComponentService.java 27 May 2002 15:52:26 -0000 1.16
+++ ComponentService.java 13 Jun 2002 15:47:55 -0000 1.17
@@ -53,9 +53,9 @@
*/
package org.apache.ant.common.service;
import java.net.URL;
-import java.util.Map;
import org.apache.ant.common.antlib.AntLibFactory;
import org.apache.ant.common.util.AntException;
+import org.apache.ant.common.util.AttributeCollection;
/**
@@ -197,7 +197,7 @@
* @exception AntException if the object does not support an
* attribute in the map.
*/
- void configureAttributes(Object object, Map attributeValues,
+ void configureAttributes(Object object, AttributeCollection
attributeValues,
boolean ignoreUnsupported)
throws AntException;
}
1.12 +9 -19
jakarta-ant/proposal/mutant/src/java/common/org/apache/ant/common/service/ExecService.java
Index: ExecService.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/mutant/src/java/common/org/apache/ant/common/service/ExecService.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -w -u -r1.11 -r1.12
--- ExecService.java 27 May 2002 15:52:26 -0000 1.11
+++ ExecService.java 13 Jun 2002 15:47:55 -0000 1.12
@@ -58,7 +58,7 @@
import org.apache.ant.common.antlib.Task;
import org.apache.ant.common.model.Project;
import org.apache.ant.common.util.AntException;
-import org.apache.ant.common.model.AspectValueCollection;
+import org.apache.ant.common.model.NamespaceValueCollection;
import org.apache.ant.common.event.BuildListener;
/**
@@ -101,7 +101,7 @@
* @return a key to the build allowing it to be executed and managed
* @exception AntException if the subbuild cannot be setup
*/
- BuildKey setupBuild(Project model, Map properties, boolean addListeners)
+ Object setupBuild(Project model, Map properties, boolean addListeners)
throws AntException;
@@ -114,7 +114,7 @@
* @return a key to the build allowing it to be executed and managed
* @exception AntException if the subbuild cannot be setup
*/
- BuildKey setupBuild(Map properties, boolean addListeners)
+ Object setupBuild(Map properties, boolean addListeners)
throws AntException;
@@ -126,7 +126,7 @@
* @param libraryId the id of the library to be initialized.
* @exception AntException if the build cannot be run
*/
- void initializeBuildLibrary(BuildKey key, String libraryId)
+ void initializeBuildLibrary(Object key, String libraryId)
throws AntException;
/**
@@ -137,31 +137,21 @@
*
* @exception AntException if the build cannot be found.
*/
- public void addBuildListener(BuildKey key, BuildListener listener)
+ void addBuildListener(Object key, BuildListener listener)
throws AntException;
/**
* Run a build which have been previously setup
*
- * @param buildKey the buildKey returned previously when the build was
+ * @param key the key returned previously when the build was
* setup
* @param targets A list of targets to be run
* @exception AntException if the build cannot be run
*/
- void runBuild(BuildKey buildKey, List targets)
+ void runBuild(Object key, List targets)
throws AntException;
-
- /**
- * Release a subbuild that is no longer in use.
- *
- * @param key the BuildKey identifiying the subbuild.
- *
- * @exception AntException if the build was not registered.
- */
- void releaseBuild(BuildKey key) throws AntException;
-
/**
* execute a task. The task should have already been initialised by the
* core
@@ -180,10 +170,10 @@
* by their nature, aspect values are not part of the task configuration.
*
* @param task the task to be executed
- * @param aspectValues the aspect attribute values.
+ * @param namespaceValues the namespace attribute values.
* @exception AntException if there is an execution problem
*/
- void executeTask(Task task, AspectValueCollection aspectValues)
+ void executeTask(Task task, NamespaceValueCollection namespaceValues)
throws AntException;
1.1
jakarta-ant/proposal/mutant/src/java/common/org/apache/ant/common/util/AttributeCollection.java
Index: AttributeCollection.java
===================================================================
/*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Ant", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
package org.apache.ant.common.util;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
/**
* An Attribute collection is a simple collection of named values
*
* @author Conor MacNeill
* @created 14 June 2002
*/
public class AttributeCollection {
/** The attribute values */
private Map attributes = new HashMap();
/**
* Get the value of an attribute given its name
*
* @param attributeName the attribute name
* @return the attribute value or null if there is no such attribute.
*/
public String getAttribute(String attributeName) {
return (String) attributes.get(attributeName);
}
/**
* Set the value of an attribute.
*
* @param attributeName the name of the attribute.
* @param attributeValue the value of the attribute.
*/
public void putAttribute(String attributeName, String attributeValue) {
attributes.put(attributeName, attributeValue);
}
/**
* Get an iterator over the names of all the attributes in the collection.
*
* @return an iterator of attribute names.
*/
public Iterator getAttributeNames() {
return attributes.keySet().iterator();
}
}
1.4 +9 -9
jakarta-ant/proposal/mutant/src/java/frontend/org/apache/ant/cli/Commandline.java
Index: Commandline.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/mutant/src/java/frontend/org/apache/ant/cli/Commandline.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -w -u -r1.3 -r1.4
--- Commandline.java 27 May 2002 15:52:27 -0000 1.3
+++ Commandline.java 13 Jun 2002 15:47:55 -0000 1.4
@@ -75,7 +75,7 @@
import org.apache.ant.common.util.DemuxOutputStream;
import org.apache.ant.common.logger.DefaultLogger;
import org.apache.ant.common.logger.BuildLogger;
-import org.apache.ant.init.InitConfig;
+import org.apache.ant.init.AntEnvironment;
import org.apache.ant.init.InitUtils;
import org.apache.ant.frontend.FrontendUtils;
import org.apache.ant.frontend.FrontendException;
@@ -88,7 +88,7 @@
*/
public class Commandline {
/** The initialisation configuration for Ant */
- private InitConfig initConfig;
+ private AntEnvironment antEnv;
/** Stream that we are using for logging */
private PrintStream out = System.out;
@@ -133,7 +133,7 @@
* @param args the commandline arguments
* @param config the initialisation configuration
*/
- public static void start(String[] args, InitConfig config) {
+ public static void start(String[] args, AntEnvironment config) {
// create a command line and use it to run ant
Commandline commandline = new Commandline();
commandline.process(args, config);
@@ -203,10 +203,10 @@
* Start the command line front end for mutant.
*
* @param args the commandline arguments
- * @param initConfig Ant's initialization configuration
+ * @param antEnv Ant's initialization configuration
*/
- private void process(String[] args, InitConfig initConfig) {
- this.initConfig = initConfig;
+ private void process(String[] args, AntEnvironment antEnv) {
+ this.antEnv = antEnv;
Frame mainFrame = null;
Project project = null;
try {
@@ -216,9 +216,9 @@
AntConfig config = new AntConfig();
AntConfig userConfig =
- FrontendUtils.getAntConfig(initConfig.getUserConfigArea());
+ FrontendUtils.getAntConfig(antEnv.getUserConfigArea());
AntConfig systemConfig
- =
FrontendUtils.getAntConfig(initConfig.getSystemConfigArea());
+ = FrontendUtils.getAntConfig(antEnv.getSystemConfigArea());
if (systemConfig != null) {
config.merge(systemConfig);
@@ -243,7 +243,7 @@
project = parseProject();
// create the execution manager to execute the build
- mainFrame = new Frame(initConfig, config);
+ mainFrame = new Frame(antEnv, config);
OutputStream demuxOut
= new DemuxOutputStream(mainFrame, false);
OutputStream demuxErr
1.1
jakarta-ant/proposal/mutant/src/java/init/org/apache/ant/init/AntEnvironment.java
Index: AntEnvironment.java
===================================================================
/*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Ant", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
package org.apache.ant.init;
import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
/**
* AntEnvironment describes the environment in which Ant is operating.
* It provides the locations of a number of key Ant components.
*
* @author Conor MacNeill
* @created 9 January 2002
*/
public class AntEnvironment {
/** The default name of the jar containing the XML parser */
public static final String DEFAULT_PARSER_JAR = "crimson.jar";
/** The system classloader */
private ClassLoader systemLoader;
/**
* The common class loader loads components which are common to tasks
* and the core
*/
private ClassLoader commonLoader;
/**
* The core loader is the loader which loads classes which are
* exclusively used by the Ant core
*/
private ClassLoader coreLoader;
/**
* The tools.jar URL is available for things which require the Sun tools
* jar
*/
private URL toolsJarURL;
/**
* The URLs to the Ant XML parser. These are available to allow tasks
* which require XML support to use the standard parser rather than
* having to supply their own
*/
private URL[] parserURLs;
/**
* The location of the Ant library directory from which tasks may be
* loaded
*/
private URL libraryURL;
/** The location of the system configuration file */
private File systemConfigArea;
/** The location of ANT_HOME */
private URL antHome;
/** The location of the user config file */
private File userConfigArea;
/**
* Create an unconfigured AntEnvironment which will be configured manually
* by the user
*/
public AntEnvironment() {
}
/**
* Create and automatically configure the Ant Environment
*
* @param libraryClass - a class loaded from the Ant library area.
* @exception InitException if the configuration cannot be initialized
*/
public AntEnvironment(Class libraryClass) throws InitException {
try {
URL antLibURL = getAntLibURL(libraryClass);
setLibraryURL(antLibURL);
URL antHome = new URL(antLibURL, "..");
setAntHome(antHome);
if (antHome.getProtocol().equals("file")) {
File systemConfigArea = new File(antHome.getFile(), "conf");
setSystemConfigArea(systemConfigArea);
}
File userConfigArea
= new File(System.getProperty("user.home"), ".ant/conf");
setUserConfigArea(userConfigArea);
// set up the class loaders that will be used when running Ant
ClassLoader systemLoader = getClass().getClassLoader();
setSystemLoader(systemLoader);
URL toolsJarURL = ClassLocator.getToolsJarURL();
setToolsJarURL(toolsJarURL);
URL commonJarLib = new URL(libraryURL, "common/");
ClassLoader commonLoader
= new
URLClassLoader(LoaderUtils.getLocationURLs(commonJarLib,
"common.jar"), systemLoader);
setCommonLoader(commonLoader);
// core needs XML parser for parsing various XML components.
URL parserBase = new URL(libraryURL, "parser/");
URL[] parserURLs
= LoaderUtils.getLocationURLs(parserBase,
DEFAULT_PARSER_JAR);
setParserURLs(parserURLs);
URL[] coreURLs
= LoaderUtils.getLocationURLs(new URL(libraryURL,
"antcore/"),
"antcore.jar");
URL[] combinedURLs = new URL[parserURLs.length + coreURLs.length];
System.arraycopy(coreURLs, 0, combinedURLs, 0, coreURLs.length);
System.arraycopy(parserURLs, 0, combinedURLs, coreURLs.length,
parserURLs.length);
ClassLoader coreLoader = new URLClassLoader(combinedURLs,
commonLoader);
setCoreLoader(coreLoader);
} catch (MalformedURLException e) {
throw new InitException(e);
}
}
/**
* Sets the location of the user configuration files
*
* @param userConfigArea the new user config area
*/
public void setUserConfigArea(File userConfigArea) {
this.userConfigArea = userConfigArea;
}
/**
* Set the location of ANT_HOME
*
* @param antHome the new value of ANT_HOME
*/
public void setAntHome(URL antHome) {
this.antHome = antHome;
}
/**
* Sets the location of the system configuration files
*
* @param systemConfigArea the new system config area
*/
public void setSystemConfigArea(File systemConfigArea) {
this.systemConfigArea = systemConfigArea;
}
/**
* Sets the systemLoader of the AntEnvironment
*
* @param systemLoader the new systemLoader value
*/
public void setSystemLoader(ClassLoader systemLoader) {
this.systemLoader = systemLoader;
}
/**
* Sets the commonLoader of the AntEnvironment
*
* @param commonLoader the new commonLoader value
*/
public void setCommonLoader(ClassLoader commonLoader) {
this.commonLoader = commonLoader;
}
/**
* Sets the coreLoader of the AntEnvironment
*
* @param coreLoader the new coreLoader value
*/
public void setCoreLoader(ClassLoader coreLoader) {
this.coreLoader = coreLoader;
}
/**
* Sets the toolsJarURL of the AntEnvironment
*
* @param toolsJarURL the new toolsJarURL value
*/
public void setToolsJarURL(URL toolsJarURL) {
this.toolsJarURL = toolsJarURL;
}
/**
* Sets the parserURLs of the AntEnvironment
*
* @param parserURLs the new parserURLs value
*/
public void setParserURLs(URL[] parserURLs) {
this.parserURLs = parserURLs;
}
/**
* Sets the libraryURL of the AntEnvironment
*
* @param libraryURL the new libraryURL value
*/
public void setLibraryURL(URL libraryURL) {
this.libraryURL = libraryURL;
}
/**
* Get the location of the user's config files
*
* @return the location of the user's Ant config files
*/
public File getUserConfigArea() {
return userConfigArea;
}
/**
* Get the location of Ant's home area
*
* @return the location of ANT_HOME
*/
public URL getAntHome() {
return antHome;
}
/**
* Get the location of the system config files
*
* @return the location of the system Ant config files
*/
public File getSystemConfigArea() {
return systemConfigArea;
}
/**
* Gets the systemLoader of the AntEnvironment
*
* @return the systemLoader value
*/
public ClassLoader getSystemLoader() {
return systemLoader;
}
/**
* Gets the commonLoader of the AntEnvironment
*
* @return the commonLoader value
*/
public ClassLoader getCommonLoader() {
return commonLoader;
}
/**
* Gets the coreLoader of the AntEnvironment
*
* @return the coreLoader value
*/
public ClassLoader getCoreLoader() {
return coreLoader;
}
/**
* Gets the toolsJarURL of the AntEnvironment
*
* @return the toolsJarURL value
*/
public URL getToolsJarURL() {
return toolsJarURL;
}
/**
* Gets the parserURLs of the AntEnvironment
*
* @return the parserURLs value
*/
public URL[] getParserURLs() {
return parserURLs;
}
/**
* Gets the libraryURL of the AntEnvironment
*
* @return the libraryURL value
*/
public URL getLibraryURL() {
return libraryURL;
}
/**
* Get a URL to the Ant Library directory.
*
* @param libraryClass - a class loaded from the Ant library area.
* @return the URL for the Ant library directory
* @throws MalformedURLException if there is a problem constructing the
* library URL
*/
private URL getAntLibURL(Class libraryClass) throws MalformedURLException
{
URL initClassURL = ClassLocator.getClassLocationURL(libraryClass);
String initURLString = initClassURL.toString();
int index = initURLString.lastIndexOf("/");
if (index != -1) {
initURLString = initURLString.substring(0, index + 1);
}
return new URL(initURLString);
}
}
1.13 +12 -12
jakarta-ant/proposal/mutant/src/java/start/org/apache/ant/start/Main.java
Index: Main.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/mutant/src/java/start/org/apache/ant/start/Main.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -w -u -r1.12 -r1.13
--- Main.java 4 May 2002 10:30:44 -0000 1.12
+++ Main.java 13 Jun 2002 15:47:56 -0000 1.13
@@ -60,7 +60,7 @@
import java.util.jar.Attributes;
import java.util.jar.JarInputStream;
import java.util.jar.Manifest;
-import org.apache.ant.init.InitConfig;
+import org.apache.ant.init.AntEnvironment;
import org.apache.ant.init.InitException;
import java.io.File;
@@ -135,7 +135,7 @@
public void start(String frontend, String defaultClass, String[] args)
throws InitException {
try {
- InitConfig config = new InitConfig(getClass());
+ AntEnvironment config = new AntEnvironment(getClass());
URL frontendJar = new URL(config.getLibraryURL(),
"frontend/" + frontend + ".jar");
@@ -169,7 +169,7 @@
frontEndLoader);
final Class[] param = {Class.forName("[Ljava.lang.String;"),
- InitConfig.class};
+ AntEnvironment.class};
final Method startMethod
= frontendClass.getMethod("start", param);
final Object[] argument = {args, config};
1.22 +1 -0 jakarta-ant/proposal/mutant/build/ant1compat.xml
Index: ant1compat.xml
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/mutant/build/ant1compat.xml,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -w -u -r1.21 -r1.22
--- ant1compat.xml 31 May 2002 15:15:46 -0000 1.21
+++ ant1compat.xml 13 Jun 2002 15:47:56 -0000 1.22
@@ -98,6 +98,7 @@
<exclude name="org/apache/tools/ant/taskdefs/TStampTest.java"/>
<exclude name="org/apache/tools/ant/taskdefs/TaskdefTest.java"/>
<exclude name="org/apache/tools/ant/taskdefs/TypedefTest.java"/>
+ <exclude
name="org/apache/tools/ant/taskdefs/optional/sitraka/XMLReportTest.java"/>
</patternset>
<fileset id="ant1src_tocopy" dir="${ant1java.dir}">
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>