From 1ab855c3d4cd48b5015b4093303d578f8f6c1254 Mon Sep 17 00:00:00 2001 From: Conor MacNeill Date: Tue, 30 Apr 2002 07:00:51 +0000 Subject: [PATCH] Bring across more Ant1 tasks (ant structure) git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@272609 13f79535-47bb-0310-9956-ffa450edef68 --- proposal/mutant/build/ant1compat.xml | 31 +++++++-------- .../org/apache/tools/ant/Project.java | 39 +++++++++++++++++++ .../apache/ant/common/model/BuildElement.java | 2 +- 3 files changed, 55 insertions(+), 17 deletions(-) diff --git a/proposal/mutant/build/ant1compat.xml b/proposal/mutant/build/ant1compat.xml index 612be9d8e..77dc1c910 100644 --- a/proposal/mutant/build/ant1compat.xml +++ b/proposal/mutant/build/ant1compat.xml @@ -28,11 +28,7 @@ - - - - @@ -40,8 +36,21 @@ + + + + + + + + + + + + + @@ -53,21 +62,11 @@ - - - - - - - - - - - - + + 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 eb52b7308..37e00d568 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 @@ -340,6 +340,45 @@ public class Project implements org.apache.ant.common.event.BuildListener { } } + /** + * Returns a description of the type of the given element, with + * special handling for instances of tasks and data types. + *

+ * This is useful for logging purposes. + * + * @param element The element to describe. + * Must not be null. + * + * @return a description of the element type + * + * @since 1.95, Ant 1.5 + */ + public String getElementName(Object element) { + Hashtable elements = taskClassDefinitions; + Class elementClass = element.getClass(); + String typeName = "task"; + if (!elements.contains(elementClass)) { + elements = dataClassDefinitions; + typeName = "data type"; + if (!elements.contains(elementClass)) { + elements = null; + } + } + + if (elements != null) { + Enumeration e = elements.keys(); + while (e.hasMoreElements()) { + String name = (String) e.nextElement(); + Class clazz = (Class) elements.get(name); + if (elementClass.equals(clazz)) { + return "The <" + name + "> " + typeName; + } + } + } + + return "Class " + elementClass.getName(); + } + /** * Gets the Antlib factory of the Project * diff --git a/proposal/mutant/src/java/common/org/apache/ant/common/model/BuildElement.java b/proposal/mutant/src/java/common/org/apache/ant/common/model/BuildElement.java index b1fe83435..2a93a2947 100644 --- a/proposal/mutant/src/java/common/org/apache/ant/common/model/BuildElement.java +++ b/proposal/mutant/src/java/common/org/apache/ant/common/model/BuildElement.java @@ -61,7 +61,7 @@ import java.util.Map; import org.apache.ant.common.util.Location; /** - * A BuildElement is a holder configuration information for an element of + * A BuildElement is a holder of configuration information for an element of * the build. BuildElements may be grouped into a hierarchy to capture any * level of element nesting. *