You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by co...@apache.org on 2002/05/27 17:52:28 UTC
cvs commit: jakarta-ant/proposal/mutant/src/java/frontend/org/apache/ant/frontend FrontendException.java FrontendUtils.java
conor 02/05/27 08:52:27
Modified: proposal/mutant build.xml
proposal/mutant/build ant1compat.xml
proposal/mutant/src/java/antcore/org/apache/ant/antcore/antlib
AntLibHandler.java AntLibManager.java
AntLibrary.java AntLibrarySpec.java
ComponentLibrary.java
proposal/mutant/src/java/antcore/org/apache/ant/antcore/config
AntConfig.java AntConfigHandler.java
proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution
AttributeSetter.java BuildEventSupport.java
ComponentManager.java CoreDataService.java
CoreEventService.java CoreExecService.java
CoreFileService.java CoreInputService.java
DeferredSetter.java ExecutionContext.java
Frame.java Reflector.java Setter.java
TaskAdapter.java
proposal/mutant/src/java/antlibs/ant1compat/org/apache/tools/ant
Ant1Converter.java Ant1Factory.java
Ant1InputHandler.java Project.java
ProjectComponent.java ProjectHelper.java Task.java
proposal/mutant/src/java/antlibs/ant1compat/org/apache/tools/ant/taskdefs
Ant.java CallTarget.java
proposal/mutant/src/java/antlibs/script/org/apache/ant/antlib/script
ScriptBase.java ScriptDef.java ScriptFactory.java
proposal/mutant/src/java/antlibs/system/org/apache/ant/antlib/system
Ant.java AntAspect.java AntBase.java AntCall.java
FileConverter.java Import.java LibPath.java
LoadLib.java Parallel.java PrimitiveConverter.java
Ref.java Sequential.java SubBuild.java
URLConverter.java
proposal/mutant/src/java/common/org/apache/ant/common/antlib
AbstractAspect.java AbstractComponent.java
AbstractTask.java AntContext.java
AntLibFactory.java Aspect.java Converter.java
ExecutionComponent.java StandardLibFactory.java
Task.java TaskContainer.java
proposal/mutant/src/java/common/org/apache/ant/common/service
ComponentService.java DataService.java
EventService.java ExecService.java FileService.java
InputService.java MagicProperties.java
proposal/mutant/src/java/common/org/apache/ant/common/util
FileUtils.java PropertyUtils.java
proposal/mutant/src/java/frontend/org/apache/ant/cli
Commandline.java
proposal/mutant/src/java/frontend/org/apache/ant/frontend
FrontendUtils.java
Added: proposal/mutant/src/java/antcore/org/apache/ant/antcore/antlib
AntLibException.java
proposal/mutant/src/java/antlibs/ant1compat/org/apache/tools/ant
Ant1CompatException.java
proposal/mutant/src/java/antlibs/monitor antlib.xml
proposal/mutant/src/java/antlibs/monitor/org/apache/ant/antlib/monitor
MonitorAspect.java MonitorRecord.java
proposal/mutant/src/java/antlibs/script/org/apache/ant/antlib/script
ScriptException.java
proposal/mutant/src/java/antlibs/system/org/apache/ant/antlib/system
SystemException.java
proposal/mutant/src/java/common/org/apache/ant/common/antlib
AspectException.java ConverterException.java
ValidationException.java
proposal/mutant/src/java/common/org/apache/ant/common/logger
BuildLogger.java DefaultLogger.java
proposal/mutant/src/java/common/org/apache/ant/common/service
BuildKey.java
proposal/mutant/src/java/common/org/apache/ant/common/util
GeneralException.java
proposal/mutant/src/java/frontend/org/apache/ant/frontend
FrontendException.java
Removed: proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution
ExecutionManager.java
proposal/mutant/src/java/common/org/apache/ant/common/util
ConfigException.java ExecutionException.java
proposal/mutant/src/java/frontend/org/apache/ant/cli
BuildLogger.java DefaultLogger.java
Log:
Change Exception hierarchy
Much better Ant1 compatability
New monitoring aspect
Revision Changes Path
1.27 +38 -22 jakarta-ant/proposal/mutant/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/mutant/build.xml,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -w -u -r1.26 -r1.27
--- build.xml 20 May 2002 14:34:41 -0000 1.26
+++ build.xml 27 May 2002 15:52:20 -0000 1.27
@@ -144,32 +144,40 @@
<delete dir="${dist.dir}"/>
</target>
- <target name="antlibs" depends="common, systemlib">
+ <target name="antlibs" depends="common">
<ant antfile="build/script.xml"/>
+ <antcall target="buildlib">
+ <param name="libid" value="system"/>
+ <param name="libarea" value="syslibs"/>
+ </antcall>
+ <antcall target="buildlib">
+ <param name="libid" value="monitor"/>
+ <param name="libarea" value="syslibs"/>
+ </antcall>
</target>
- <target name="systemlib" depends="common">
- <mkdir dir="${bin.dir}/antlibs/system"/>
- <mkdir dir="${distlib.dir}/syslibs"/>
+ <target name="buildlib">
+ <mkdir dir="${bin.dir}/${libarea}/${libid}"/>
+ <mkdir dir="${distlib.dir}/${libarea}"/>
<path id="classpath.antlibs">
<path refid="classpath.common"/>
<pathelement location="${distlib.dir}/common/common.jar"/>
</path>
- <depend destdir="${bin.dir}/antlibs/system" srcdir="${java.dir}/antlibs/system" closure="yes">
+ <depend destdir="${bin.dir}/${libarea}/${libid}" srcdir="${java.dir}/antlibs/${libid}" closure="yes">
<classpath refid="classpath.antlibs"/>
</depend>
- <javac destdir="${bin.dir}/antlibs/system" srcdir="${java.dir}/antlibs/system" debug="${debug}">
+ <javac destdir="${bin.dir}/${libarea}/${libid}" srcdir="${java.dir}/antlibs/${libid}" debug="${debug}">
<classpath refid="classpath.antlibs"/>
</javac>
- <jar basedir="${bin.dir}/antlibs/system" jarfile="${distlib.dir}/syslibs/system.jar">
- <metainf dir="${java.dir}/antlibs/system"
+ <jar basedir="${bin.dir}/${libarea}/${libid}" jarfile="${distlib.dir}/${libarea}/${libid}.jar">
+ <metainf dir="${java.dir}/antlibs/${libid}"
includes="antlib.xml"/>
</jar>
</target>
<target name="main" depends="frontend, antlibs, ant1compat, remote, checkstyle"/>
- <target name="checkstyle" if="xxxcheckstyle.available">
+ <target name="checkstyle" if="xxcheckstyle.available">
<taskdef name="checkstyle"
classname="com.puppycrawl.tools.checkstyle.CheckStyleTask"/>
<mkdir dir="${bin.dir}/check"/>
@@ -216,4 +224,12 @@
<tag name="created" description="Date Created:" scope="types"/>
</javadoc>
</target>
+
+
+ <target name="test">
+ <ant antfile="build/ant1compat.xml" target="test"/>
+ </target>
+
+
+
</project>
1.20 +342 -46 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.19
retrieving revision 1.20
diff -u -w -u -r1.19 -r1.20
--- ant1compat.xml 16 May 2002 13:31:45 -0000 1.19
+++ ant1compat.xml 27 May 2002 15:52:20 -0000 1.20
@@ -1,20 +1,29 @@
<project default="ant1compat" name="Ant1Compat" basedir="..">
- <property name="src.dir" value="src"/>
- <property name="lib.dir" value="lib"/>
- <property name="java.dir" value="${src.dir}/java"/>
-
- <property name="bin.dir" value="bin"/>
- <property name="dist.dir" value="dist"/>
- <property name="javadocs.dir" value="${dist.dir}/javadocs"/>
- <property name="distlib.dir" value="${dist.dir}/lib"/>
+ <property name="debug" value="true" />
+ <property name="chmod.fail" value="true" />
+ <property name="deprecation" value="false" />
+ <property name="optimize" value="true" />
+ <property name="junit.fork" value="false" />
+ <property name="junit.filtertrace" value="off"/>
+ <property name="junit.summary" value="no"/>
<property name="ant1base.dir" value="../.."/>
<property name="ant1src.dir" value="${ant1base.dir}/src"/>
<property name="ant1java.dir" value="${ant1src.dir}/main"/>
<property name="ant1etc.dir" value="${ant1src.dir}/etc"/>
+ <property name="ant1.tests.dir" value="${ant1src.dir}/etc/testcases"/>
- <property name="debug" value="true"/>
+ <property name="src.dir" value="src"/>
+ <property name="java.dir" value="${src.dir}/java"/>
+ <property name="script.dir" value="${src.dir}/script"/>
+ <property name="lib.dir" value="lib"/>
+ <property name="tests.dir" value="${ant1src.dir}/testcases"/>
+ <property name="tests.etc.dir" value="${src.dir}/etc/testcases"/>
+
+ <property name="bin.dir" value="bin"/>
+ <property name="dist.dir" value="dist"/>
+ <property name="distlib.dir" value="${dist.dir}/lib"/>
<property name="ant.package" value="org/apache/tools/ant"/>
<property name="optional.package" value="${ant.package}/taskdefs/optional"/>
@@ -22,13 +31,40 @@
<property name="util.package" value="${ant.package}/util"/>
<property name="regexp.package" value="${util.package}/regexp"/>
+ <!--
+ ===================================================================
+ Set the properties for the build area
+ ===================================================================
+ -->
+ <property name="build.tests" value="${bin.dir}/testcases"/>
+
+
+ <path id="classpath">
+ <pathelement location="${distlib.dir}/init.jar"/>
+ <fileset dir="${lib.dir}/parser" includes="*.jar"/>
+ <fileset dir="${lib.dir}/ant1compat" includes="*.jar"/>
+ <pathelement location="${distlib.dir}/common/common.jar"/>
+ <pathelement location="${distlib.dir}/syslibs/system.jar"/>
+ </path>
+
+ <path id="tests-classpath">
+ <pathelement location="${build.classes}" />
+ <pathelement location="${build.tests}" />
+ <!--
+ include the test source and test data dirs
+ so that we can pick resources via getResource(AsStream)
+ -->
+ <pathelement location="${tests.dir}"/>
+ <pathelement location="${tests.etc.dir}"/>
+ <path refid="classpath" />
+ </path>
+
<patternset id="deprecated">
<exclude name="org/apache/tools/ant/taskdefs/Copydir.java"/>
<exclude name="org/apache/tools/ant/taskdefs/Copyfile.java"/>
</patternset>
<patternset id="toohard">
- <exclude name="org/apache/tools/ant/taskdefs/Do.java"/>
</patternset>
<patternset id="converted">
@@ -52,6 +88,16 @@
<exclude name="org/apache/tools/ant/UnknownElement.java"/>
</patternset>
+ <patternset id="unsupportedTests">
+ <exclude name="org/apache/tools/ant/taskdefs/ParallelTest.java"/>
+ <exclude name="org/apache/tools/ant/taskdefs/AntTest.java"/>
+ <exclude name="org/apache/tools/ant/taskdefs/InitializeClassTest.java"/>
+ <exclude name="org/apache/tools/ant/taskdefs/InputTest.java"/>
+ <exclude name="org/apache/tools/ant/taskdefs/JavaTest.java"/>
+ <exclude name="org/apache/tools/ant/taskdefs/JavacTest.java"/>
+ <exclude name="org/apache/tools/ant/taskdefs/TStampTest.java"/>
+ </patternset>
+
<fileset id="ant1src_tocopy" dir="${ant1java.dir}">
<include name="**/*.properties"/>
<include name="**/*.mf"/>
@@ -71,13 +117,8 @@
<patternset refid="notrequired"/>
</fileset>
- <path id="classpath">
- <pathelement location="${distlib.dir}/init.jar"/>
- <fileset dir="${lib.dir}/parser" includes="*.jar"/>
- <fileset dir="${lib.dir}/ant1compat" includes="*.jar"/>
- <pathelement location="${distlib.dir}/common/common.jar"/>
- <pathelement location="${distlib.dir}/syslibs/system.jar"/>
- </path>
+ <fileset id="ant1testcases_tocopy" dir="${ant1.tests.dir}">
+ </fileset>
<!--
===================================================================
@@ -109,6 +150,8 @@
<patternset id="needs.jdk1.3+">
<exclude name="${ant.package}/taskdefs/TestProcess.java"
unless="jdk1.3+" />
+ <exclude name="${optional.package}/extension/**/*.java"
+ unless="jdk1.3+" />
</patternset>
<patternset id="needs.jdk1.4+">
<exclude name="${regexp.package}/Jdk14Regexp*.java"
@@ -142,6 +185,8 @@
unless="trax.present"/>
<exclude name="${optional.package}/metamata/MMetrics*"
unless="trax.present"/>
+ <exclude name="${optional.package}/XsltTest.java"
+ unless="trax.present"/>
</patternset>
<patternset id="needs.xalan1">
<exclude name="${optional.package}/XalanLiaison*.java"
@@ -184,6 +229,10 @@
<exclude name="${ant.package}/listener/Log4jListener.java"
unless="log4j.present" />
</patternset>
+ <patternset id="needs.commons.logging">
+ <exclude name="${ant.package}/listener/CommonsLoggingListener.java"
+ unless="commons.logging.present" />
+ </patternset>
<patternset id="needs.bsf">
<exclude name="${optional.package}/Script.java"
unless="bsf.present" />
@@ -253,6 +302,8 @@
<patternset id="needs.swing">
<exclude name="${optional.package}/splash/*.java" unless="swing.present" />
</patternset>
+ <patternset id="teststhatfail">
+ </patternset>
<!--
===================================================================
@@ -334,6 +385,9 @@
<available property="log4j.present"
classname="org.apache.log4j.Category"
classpathref="classpath"/>
+ <available property="commons.logging.present"
+ classname="org.apache.commons.logging.LogFactory"
+ classpathref="classpath"/>
<!-- this is just a way to check for a TraX implementation -->
<available property="trax.impl.present"
resource="META-INF/services/javax.xml.transform.TransformerFactory"
@@ -380,6 +434,13 @@
</or>
</condition>
+ <condition property="tests.and.ant.share.classloader">
+ <or>
+ <equals arg1="${junit.fork}" arg2="true" />
+ <equals arg1="${build.sysclasspath}" arg2="only" />
+ </or>
+ </condition>
+
<condition property="sun.tools.present">
<and>
<available classname="sun.tools.native2ascii.Main" />
@@ -389,6 +450,18 @@
<available property="base64.present" classname="sun.misc.BASE64Encoder" />
+ <property name="build.tests.resolved" location="${build.tests}" />
+ <condition property="tests.are.on.system.classpath">
+ <or>
+ <!-- relative paths in CLASSPATH -->
+ <contains string="${java.class.path}"
+ substring="${build.tests}" />
+ <!-- absolute paths in CLASSPATH -->
+ <contains string="${java.class.path}"
+ substring="${build.tests.resolved}" />
+ </or>
+ </condition>
+
<condition property="jasper.present">
<and>
<available classname="org.apache.jasper.compiler.Compiler" />
@@ -441,11 +514,13 @@
<classpath refid="classpath" />
<patternset refid="needs.jdk1.2+" />
+ <patternset refid="needs.jdk1.3+" />
<patternset refid="needs.jdk1.4+" />
<patternset refid="needs.jakarta.regexp" />
<patternset refid="needs.jakarta.oro" />
<patternset refid="needs.jakarta.log4j" />
+ <patternset refid="needs.commons.logging" />
<patternset refid="needs.sun.uue" />
<patternset refid="needs.javamail" />
<patternset refid="needs.icontract" />
@@ -490,9 +565,230 @@
</jar>
</target>
+ <!--
+ ===================================================================
+ Compile testcases
+ ===================================================================
+ -->
+ <target name="compile-tests" depends="check_for_optional_packages" if="junit.present">
+ <mkdir dir="${build.tests}"/>
+
+ <javac srcdir="${tests.dir}"
+ destdir="${build.tests}"
+ debug="${debug}"
+ deprecation="${deprecation}" >
+ <classpath refid="tests-classpath" />
+
+ <patternset refid="needs.antlr" />
+
+ <patternset refid="needs.jdk1.2+" />
+ <patternset refid="needs.jdk1.3+" />
+ <patternset refid="needs.jdk1.4+" />
+
+ <patternset refid="needs.jakarta.regexp" />
+ <patternset refid="needs.jakarta.oro" />
+
+ <patternset refid="needs.trax" />
+ <patternset refid="needs.xslp" />
+ <patternset refid="needs.xalan1" />
+ <patternset refid="needs.jakarta.bcel" />
+ <patternset refid="unsupportedTests" />
+ </javac>
+ <copy todir="${tests.etc.dir}">
+ <fileset refid="ant1testcases_tocopy"/>
+ </copy>
+ </target>
+
+ <target name="dump-info" depends="dump-sys-properties,run-which" />
+
+ <target name="dump-sys-properties" unless="which.present"
+ depends="xml-check">
+ <echo message="java.vm.info=${java.vm.info}" />
+ <echo message="java.vm.name=${java.vm.name}" />
+ <echo message="java.vm.vendor=${java.vm.vendor}" />
+ <echo message="java.vm.version=${java.vm.version}" />
+ <echo message="os.arch=${os.arch}" />
+ <echo message="os.name=${os.name}" />
+ <echo message="os.version=${os.version}" />
+ <echo message="file.encoding=${file.encoding}" />
+ <echo message="user.language=${user.language}" />
+ </target>
+
+ <!-- helper class from Xalan2 to check for jar versioning of xml/xsl processors -->
+ <target name="xml-check" depends="check_for_optional_packages"
+ if="xalan.envcheck" unless="which.present">
+ <java classname="org.apache.xalan.xslt.EnvironmentCheck"/>
+ </target>
+
+ <target name="run-which" depends="check_for_optional_packages"
+ if="which.present">
+ <java classname="org.apache.env.Which" taskname="which"/>
+ </target>
+
+ <!-- test to see if we are online or not. can take a while when we are off line, so
+ setting the property is a good shortcut-->
+ <target name="probe-offline">
+ <condition property="offline">
+ <or>
+ <isset property="offline"/>
+ <not>
+ <http url="http://www.apache.org/"/>
+ </not>
+ </or>
+ </condition>
+ <echo level="verbose" > offline=${offline}</echo>
+ </target>
+
+ <!--
+ ===================================================================
+ Run testcase
+ ===================================================================
+ -->
+ <target name="test" depends="run-tests" description="--> run JUnit tests"/>
+
+ <target name="run-tests" depends="dump-info,compile-tests,probe-offline" if="junit.present">
+
+ <junit printsummary="${junit.summary}" haltonfailure="yes"
+ filtertrace="${junit.filtertrace}"
+ fork="${junit.fork}">
+ <classpath refid="tests-classpath"/>
+
+ <sysproperty key="ant.home" value="${ant.home}" />
+ <sysproperty key="build.tests" value="${build.tests}"/>
+ <sysproperty key="tests-classpath.value"
+ value="${tests-classpath.value}" />
+
+ <formatter type="brief" usefile="false" />
+
+ <batchtest>
+ <fileset dir="${tests.dir}">
+ <include name="**/*Test*" />
+
+ <!-- abstract classes, not testcases -->
+ <exclude name="${ant.package}/taskdefs/TaskdefsTest.java" />
+ <exclude name="${ant.package}/BuildFileTest.java" />
+ <exclude name="${regexp.package}/RegexpMatcherTest.java" />
+ <exclude name="${regexp.package}/RegexpTest.java" />
+ <exclude name="${optional.package}/AbstractXSLTLiaisonTest.java" />
+ <exclude name="${ant.package}/types/AbstractFileSetTest.java" />
+
+ <!-- helper classes, not testcases -->
+ <exclude name="org/example/**" />
+ <exclude name="${ant.package}/taskdefs/TaskdefTest*Task.java" />
+
+ <!-- interactive test -->
+ <exclude name="${ant.package}/taskdefs/TestProcess.java" />
+
+ <!-- only run these tests if their required libraries are
+ installed -->
+ <patternset refid="needs.jdk1.2+" />
+ <patternset refid="needs.jdk1.4+" />
+ <patternset refid="needs.jakarta.regexp" />
+ <patternset refid="needs.jakarta.oro" />
+ <patternset refid="needs.vaj" />
+ <patternset refid="needs.antlr" />
+ <patternset refid="needs.xalan1" />
+ <patternset refid="needs.xslp" />
+ <patternset refid="needs.jakarta.bcel" />
+ <patternset refid="needs.trax" />
+ <patternset refid="unsupportedTests" />
+ <!-- fails under 1.1 -->
+ <exclude name="${optional.package}/perforce/P4ChangeTest.java"
+ unless="jdk1.2+"/>
+
+ <!-- tests excluded if the test is run in offline mode -->
+ <patternset refid="onlinetests"/>
+
+ <!-- failing tests excluded unless run.failing.tests is set -->
+ <patternset refid="teststhatfail" />
+
+ <!-- runtime dependencies that are different from compile
+ time dependencies -->
+ <exclude name="${optional.package}/ReplaceRegExpTest.java"
+ unless="some.regexp.support" />
+ <exclude name="${optional.package}/sitraka/*.java"
+ unless="some.regexp.support" />
+
+ <!-- fail if testcases can be loaded from the system classloader -->
+ <exclude name="${optional.package}/junit/JUnitClassLoaderTest.java"
+ if="tests.are.on.system.classpath"/>
+ <exclude name="${optional.package}/sitraka/XMLReportTest.java"
+ if="tests.are.on.system.classpath"/>
+
+ <!-- these tests need to be localised before being ran???? -->
+ <exclude name="${optional.package}/PvcsTest.java" />
+
+ <!-- ehm, this is not really a TraX test but rather a xalan2 test..-->
+ <exclude name="${optional.package}/TraXLiaisonTest.java"
+ unless="xalan2.present"/>
+
+ <!-- needs BSF to work -->
+ <exclude name="${optional.package}/XalanLiaisonTest.java"
+ unless="bsf.present" />
+
+ <!--
+ XXX need to figure out what's causing this InvocationTargetException
+ -->
+ <exclude name="${optional.package}/junit/JUnitTestRunnerTest.java"
+ unless="jdk1.2+" />
+ <!-- DateTime handling seems to be broken in JDK 1.1 -->
+ <exclude name="${util.package}/DateUtilsTest.java"
+ unless="jdk1.2+" />
+
+ <!-- misc oneoff tests -->
+ <exclude name="${optional.package}/JspcTest.java"
+ unless="jasper.present" />
+ <exclude name="${optional.package}/WsdlToDotnetTest.java"
+ unless="dotnetapps.found" />
+
+ <!-- These tests only passes if testcases and Ant classes have
+ been loaded by the same classloader - will throw
+ IllegalAccessExceptions otherwise. -->
+ <exclude name="${ant.package}/taskdefs/SQLExecTest.java"
+ unless="tests.and.ant.share.classloader" />
+ <exclude name="${optional.package}/sos/SOSTest.java"
+ unless="tests.and.ant.share.classloader" />
+ <exclude name="${optional.package}/TraXLiaisonTest.java"
+ unless="tests.and.ant.share.classloader" />
+ <exclude name="${optional.package}/metamata/MAuditParserTest.java"
+ unless="tests.and.ant.share.classloader" />
+
+ <!-- can only run if cvs is installed on your machine
+ enable by setting the property have.cvs
+ -->
+ <exclude name="${ant.package}/taskdefs/AbstractCvsTaskTest.java"
+ unless="have.cvs" />
+
+ </fileset>
+ </batchtest>
+
+ </junit>
+ </target>
+
+ <target name="run-single-test" if="testcase" depends="compile-tests"
+ description="--> runs the single unit test defined in the testcase property">
+
+
+ <junit printsummary="${junit.summary}"
+ haltonfailure="yes"
+ fork="${junit.fork}"
+ filtertrace="${junit.filtertrace}">
+<!-- <jvmarg value="-classic"/> -->
+ <sysproperty key="ant.home" value="${ant.home}" />
+ <sysproperty key="build.tests" value="${build.tests}"/>
+ <sysproperty key="tests-classpath.value"
+ value="${tests-classpath.value}" />
+ <classpath refid="classes.zip" />
+ <classpath refid="tests-classpath"/>
+ <formatter type="plain" usefile="false" />
+ <test name="${testcase}" />
+ </junit>
+ </target>
+
<target name="clean">
<delete dir="${bin.dir}/ant1src_copy"/>
<delete dir="${bin.dir}/ant1compat"/>
+ <delete dir="${tests.etc.dir}"/>
</target>
</project>
1.9 +3 -4 jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/antlib/AntLibHandler.java
Index: AntLibHandler.java
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/antlib/AntLibHandler.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -w -u -r1.8 -r1.9
--- AntLibHandler.java 14 May 2002 15:11:09 -0000 1.8
+++ AntLibHandler.java 27 May 2002 15:52:21 -0000 1.9
@@ -52,7 +52,6 @@
* <http://www.apache.org/>.
*/
package org.apache.ant.antcore.antlib;
-import org.apache.ant.common.util.ConfigException;
import org.apache.ant.antcore.xml.ElementHandler;
import org.xml.sax.Attributes;
import org.xml.sax.SAXParseException;
@@ -166,8 +165,8 @@
} else {
super.startElement(uri, localName, qualifiedName, attributes);
}
- } catch (ConfigException e) {
- throw new SAXParseException(e.getMessage(), getLocator());
+ } catch (AntLibException e) {
+ throw new SAXParseException(e.getMessage(), getLocator(), e);
}
}
1.12 +140 -120 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.11
retrieving revision 1.12
diff -u -w -u -r1.11 -r1.12
--- AntLibManager.java 14 May 2002 15:11:09 -0000 1.11
+++ AntLibManager.java 27 May 2002 15:52:21 -0000 1.12
@@ -52,7 +52,6 @@
* <http://www.apache.org/>.
*/
package org.apache.ant.antcore.antlib;
-import java.io.File;
import java.io.FileNotFoundException;
import java.net.MalformedURLException;
import java.net.URL;
@@ -65,18 +64,22 @@
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.common.util.ExecutionException;
import org.apache.ant.init.InitConfig;
-import org.apache.ant.init.InitUtils;
import org.apache.ant.init.LoaderUtils;
/**
- * This class manages the configuration of Ant Libraries
+ * This class manages Ant Libraries. This class forms a global
+ * repository of loaded libraries so that only one copy of a library is
+ * used across all frames.
*
* @author Conor MacNeill
* @created 29 January 2002
*/
public class AntLibManager {
+ /**
+ * These are AntLibraries which have been loaded into the system
+ */
+ private Map antLibraries = new HashMap();
/** The list of extensions which are examined for ant libraries */
public static final String[] ANTLIB_EXTENSIONS
@@ -85,14 +88,25 @@
/** Flag which indicates whether non-file URLS are used */
private boolean remoteAllowed;
+ /** The Ant initialization config - location of vital components */
+ private InitConfig initConfig;
+
+ /**
+ * This map stores a list of additional paths for each library indexed by
+ * the libraryId
+ */
+ private Map libPathsMap = new HashMap();
+
/**
* Constructor for the AntLibManager object
*
+ * @param initConfig the init config of the system.
* @param remoteAllowed true if remote libraries can be used and
* configured
*/
- public AntLibManager(boolean remoteAllowed) {
+ public AntLibManager(InitConfig initConfig, boolean remoteAllowed) {
this.remoteAllowed = remoteAllowed;
+ this.initConfig = initConfig;
}
/**
@@ -101,14 +115,13 @@
* @param librarySpecs A map to which additional library specifications
* are added.
* @param libURL the URL from which Ant libraries are to be loaded
- * @exception MalformedURLException if the URL for the individual
- * library components cannot be formed
- * @exception ExecutionException if the library specs cannot be parsed
+ * @exception AntLibException if the library specs cannot be parsed
*/
public void addAntLibraries(Map librarySpecs, URL libURL)
- throws MalformedURLException, ExecutionException {
- URL[] libURLs = LoaderUtils.getLocationURLs(libURL, libURL.toString(),
- ANTLIB_EXTENSIONS);
+ throws AntLibException {
+ try {
+ URL[] libURLs = LoaderUtils.getLocationURLs(libURL,
+ libURL.toString(), ANTLIB_EXTENSIONS);
if (libURLs == null) {
return;
@@ -119,16 +132,17 @@
URL antLibraryURL = new URL("jar:" + libURLs[i]
+ "!/META-INF/antlib.xml");
try {
- AntLibrarySpec antLibrarySpec = parseLibraryDef(antLibraryURL);
+ AntLibrarySpec antLibrarySpec
+ = parseLibraryDef(antLibraryURL);
if (antLibrarySpec != null) {
String libraryId = antLibrarySpec.getLibraryId();
if (librarySpecs.containsKey(libraryId)) {
AntLibrarySpec currentSpec
= (AntLibrarySpec) librarySpecs.get(libraryId);
- throw new ExecutionException("Found more than one "
+ throw new AntLibException("Found more than one "
+ "copy of library with id = " + libraryId
- + " (" + libURLs[i] + ") + existing library at ("
- + currentSpec.getLibraryURL() + ")");
+ + " (" + libURLs[i] + ") + existing library "
+ + "at (" + currentSpec.getLibraryURL() + ")");
}
antLibrarySpec.setLibraryURL(libURLs[i]);
librarySpecs.put(libraryId, antLibrarySpec);
@@ -137,12 +151,18 @@
Throwable t = e.getCause();
// ignore file not found exceptions - means the
// jar does not provide META-INF/antlib.xml
- if (!(t instanceof FileNotFoundException)) {
- throw new ExecutionException("Unable to parse Ant library "
- + libURLs[i], e);
+ if (t instanceof AntLibException) {
+ throw (AntLibException) t;
+ } else if (!(t instanceof FileNotFoundException)) {
+ throw new AntLibException("Unable to parse Ant "
+ + "library " + libURLs[i], e);
}
}
}
+ } catch (MalformedURLException e) {
+ throw new AntLibException("Unable to load libraries from "
+ + libURL, e);
+ }
}
/**
@@ -151,29 +171,24 @@
* creating the class loaders for the library
*
* @param librarySpecs the loaded specifications of the Ant libraries
- * @param initConfig the Ant initialization configuration
- * @param libraries the collection of libraries already configured
- * @param libPathsMap a map of lists of library paths for each library
* @return A map of the newly configured libraries
- * @exception ExecutionException if a library cannot be configured from
+ * @exception AntLibException if a library cannot be configured from
* the given specification
*/
- public Map configLibraries(InitConfig initConfig, Map librarySpecs,
- Map libraries, Map libPathsMap)
- throws ExecutionException {
+ private Map configLibraries(Map librarySpecs)
+ throws AntLibException {
// check if any already defined
for (Iterator i = librarySpecs.keySet().iterator(); i.hasNext();) {
String libraryId = (String) i.next();
- if (libraries.containsKey(libraryId)) {
- AntLibrary currentVersion
- = (AntLibrary) libraries.get(libraryId);
+ if (antLibraries.containsKey(libraryId)) {
+ AntLibrary currentVersion = getLibrary(libraryId);
// same location?
AntLibrarySpec spec
= (AntLibrarySpec) librarySpecs.get(libraryId);
URL specURL = spec.getLibraryURL();
if (!specURL.equals(currentVersion.getDefinitionURL())) {
- throw new ExecutionException("Ant Library \"" + libraryId
+ throw new AntLibException("Ant Library \"" + libraryId
+ "\" is already loaded from "
+ currentVersion.getDefinitionURL()
+ " new version found at "
@@ -187,9 +202,9 @@
= new CircularDependencyChecker("configuring Ant libraries");
for (Iterator i = librarySpecs.keySet().iterator(); i.hasNext();) {
String libraryId = (String) i.next();
- if (!libraries.containsKey(libraryId)) {
- configLibrary(initConfig, librarySpecs, libraryId,
- configuring, libraries, newLibraries, libPathsMap);
+ if (!antLibraries.containsKey(libraryId)) {
+ configLibrary(librarySpecs, libraryId,
+ configuring, newLibraries);
}
}
@@ -200,87 +215,74 @@
* Load either a set of libraries or a single library.
*
* @param libLocationURL URL where libraries can be found
- * @param librarySpecs A collection of library specs which will be
- * populated with the libraries found
- * @exception ExecutionException if the libraries cannot be loaded
- * @exception MalformedURLException if the library's location cannot be
- * formed
+ * @exception AntLibException if the libraries cannot be loaded
+ *
+ * @return a map containing the newly loaded libraries indexed by their
+ * library ids.
*/
- public void loadLibs(Map librarySpecs, URL libLocationURL)
- throws ExecutionException, MalformedURLException {
+ public Map loadLibs(URL libLocationURL)
+ throws AntLibException {
if (!libLocationURL.getProtocol().equals("file")
&& !remoteAllowed) {
- throw new ExecutionException("The config library "
+ throw new AntLibException("The config library "
+ "location \"" + libLocationURL
+ "\" cannot be used because config does "
+ "not allow remote libraries");
}
- addAntLibraries(librarySpecs, libLocationURL);
- }
- /**
- * Load either a set of libraries or a single library.
- *
- * @param libLocationString URL or file where libraries can be found
- * @param librarySpecs A collection of library specs which will be
- * populated with the libraries found
- * @exception ExecutionException if the libraries cannot be loaded
- * @exception MalformedURLException if the library's location cannot be
- * formed
- */
- public void loadLibs(Map librarySpecs, String libLocationString)
- throws ExecutionException, MalformedURLException {
+ Map librarySpecs = new HashMap();
+ addAntLibraries(librarySpecs, libLocationURL);
+ Map newLibraries = configLibraries(librarySpecs);
- File libLocation = new File(libLocationString);
- if (!libLocation.exists()) {
- try {
- loadLibs(librarySpecs, new URL(libLocationString));
- } catch (MalformedURLException e) {
- // XXX
- }
- } else {
- addAntLibraries(librarySpecs, InitUtils.getFileURL(libLocation));
- }
+ antLibraries.putAll(newLibraries);
+ return newLibraries;
}
/**
* Add a library path to the given library
*
- * @param antLibrary the library to which the path is to be added
- * @param path the path to be added
- * @exception ExecutionException if remote paths are not allowed by
+ * @param libraryId the id of the library to which the path is to be added
+ * @param libPath the path to be added
+ * @exception AntLibException if remote paths are not allowed by
* configuration
*/
- public void addLibPath(AntLibrary antLibrary, URL path)
- throws ExecutionException {
- if (!path.getProtocol().equals("file")
+ public void addLibPath(String libraryId, URL libPath)
+ throws AntLibException {
+ System.out.println("Adding path " + libPath + " for " + libraryId);
+ if (!libPath.getProtocol().equals("file")
&& !remoteAllowed) {
- throw new ExecutionException("Remote libpaths are not"
- + " allowed: " + path);
+ throw new AntLibException("Remote libpaths are not"
+ + " allowed: " + libPath);
+ }
+
+ List libPaths = (List) libPathsMap.get(libraryId);
+ if (libPaths == null) {
+ libPaths = new ArrayList();
+ libPathsMap.put(libraryId, libPaths);
+ }
+ libPaths.add(libPath);
+
+ AntLibrary antLibrary = getLibrary(libraryId);
+ if (antLibrary != null) {
+ antLibrary.addLibraryURL(libPath);
}
- antLibrary.addLibraryURL(path);
}
/**
* Configure a library from a specification and the Ant init config.
*
- * @param initConfig Ant's init config passed in from the front end.
* @param librarySpecs the library specs from which this library is to
* be configured.
* @param libraryId the global identifier for the library
* @param configuring A circualr dependency chcker for library
* dependencies.
- * @param libraries the collection of libraries which have already been
- * configured
* @param newLibraries the new libraries being configured.
- * @param libPathsMap a map of lists of library patsh fro each library
- * @exception ExecutionException if the library cannot be configured.
+ * @exception AntLibException if the library cannot be configured.
*/
- private void configLibrary(InitConfig initConfig, Map librarySpecs,
- String libraryId,
+ private void configLibrary(Map librarySpecs, String libraryId,
CircularDependencyChecker configuring,
- Map libraries, Map newLibraries, Map libPathsMap)
- throws ExecutionException {
+ Map newLibraries)
+ throws AntLibException {
try {
configuring.visitNode(libraryId);
@@ -289,15 +291,15 @@
= (AntLibrarySpec) librarySpecs.get(libraryId);
String extendsId = librarySpec.getExtendsLibraryId();
if (extendsId != null) {
- if (!libraries.containsKey(extendsId) &&
+ if (!antLibraries.containsKey(extendsId) &&
!newLibraries.containsKey(extendsId)) {
if (!librarySpecs.containsKey(extendsId)) {
- throw new ExecutionException("Could not find library, "
+ throw new AntLibException("Could not find library, "
+ extendsId + ", upon which library "
+ libraryId + " depends");
}
- configLibrary(initConfig, librarySpecs, extendsId,
- configuring, libraries, newLibraries, libPathsMap);
+ configLibrary(librarySpecs, extendsId,
+ configuring, newLibraries);
}
}
@@ -328,8 +330,7 @@
antLibrary.addLibraryURL((URL) i.next());
}
if (extendsId != null) {
- AntLibrary extendsLibrary
- = (AntLibrary) libraries.get(extendsId);
+ AntLibrary extendsLibrary = getLibrary(extendsId);
if (extendsLibrary == null) {
extendsLibrary = (AntLibrary) newLibraries.get(extendsId);
}
@@ -344,14 +345,13 @@
if (libPaths != null) {
for (Iterator j = libPaths.iterator(); j.hasNext();) {
URL pathURL = (URL) j.next();
- addLibPath(antLibrary, pathURL);
+ antLibrary.addLibraryURL(pathURL);
}
}
}
-
configuring.leaveNode(libraryId);
} catch (CircularDependencyException e) {
- throw new ExecutionException(e);
+ throw new AntLibException(e);
}
}
@@ -374,5 +374,25 @@
return libHandler.getAntLibrarySpec();
}
+
+ /**
+ * Get a loaded library by its id.
+ *
+ * @param libraryId the library's global id
+ *
+ * @return the requested library or null if it has not been loaded
+ */
+ public AntLibrary getLibrary(String libraryId) {
+ return (AntLibrary) antLibraries.get(libraryId);
+ }
+
+ /**
+ * Get all the library ids of the currently loaded libraries.
+ *
+ * @return an iterator over the library identifier strings.
+ */
+ public Iterator getLibraryIds() {
+ return antLibraries.keySet().iterator();
+ }
}
1.10 +7 -7 jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/antlib/AntLibrary.java
Index: AntLibrary.java
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/antlib/AntLibrary.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -w -u -r1.9 -r1.10
--- AntLibrary.java 14 May 2002 15:11:09 -0000 1.9
+++ AntLibrary.java 27 May 2002 15:52:21 -0000 1.10
@@ -60,7 +60,7 @@
import java.util.Map;
import org.apache.ant.common.antlib.AntContext;
import org.apache.ant.common.antlib.AntLibFactory;
-import org.apache.ant.common.util.ExecutionException;
+import org.apache.ant.common.util.AntException;
/**
* This class represents the Ant library.
@@ -221,10 +221,10 @@
* required
* @return an instance of the factory, or null if this library does not
* support a factory
- * @exception ExecutionException if the factory cannot be created
+ * @exception AntException if the factory cannot be created
*/
public AntLibFactory getFactory(AntContext context)
- throws ExecutionException {
+ throws AntException {
try {
AntLibFactory libFactory = null;
if (factoryClassName != null) {
@@ -236,20 +236,20 @@
}
return libFactory;
} catch (ClassNotFoundException e) {
- throw new ExecutionException("Unable to create factory "
+ throw new AntLibException("Unable to create factory "
+ factoryClassName + " for the \"" + libraryId
+ "\" Ant library", e);
} catch (NoClassDefFoundError e) {
- throw new ExecutionException("Could not load a dependent class ("
+ throw new AntLibException("Could not load a dependent class ("
+ e.getMessage() + ") to create the factory "
+ factoryClassName + " for the \"" + libraryId
+ "\" Ant library", e);
} catch (InstantiationException e) {
- throw new ExecutionException("Unable to instantiate factory "
+ throw new AntLibException("Unable to instantiate factory "
+ factoryClassName + " for the \"" + libraryId
+ "\" Ant library", e);
} catch (IllegalAccessException e) {
- throw new ExecutionException("Unable to access factory "
+ throw new AntLibException("Unable to access factory "
+ factoryClassName + " for the \"" + libraryId
+ "\" Ant library", e);
}
1.8 +5 -6 jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/antlib/AntLibrarySpec.java
Index: AntLibrarySpec.java
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/antlib/AntLibrarySpec.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -w -u -r1.7 -r1.8
--- AntLibrarySpec.java 14 May 2002 15:11:09 -0000 1.7
+++ AntLibrarySpec.java 27 May 2002 15:52:21 -0000 1.8
@@ -57,7 +57,6 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import org.apache.ant.common.util.ConfigException;
/**
* This class represents the specification of an Ant library. It is merely
@@ -308,13 +307,13 @@
* @param classname the name of the class implementing the element
* @param definitionTypeName the name of the definition type. This is
* converted to its symbolic value
- * @exception ConfigException if the definition has already been defined
+ * @exception AntLibException if the definition has already been defined
*/
public void addDefinition(String definitionTypeName, String name,
String classname)
- throws ConfigException {
+ throws AntLibException {
if (definitions.containsKey(name)) {
- throw new ConfigException("More than one definition "
+ throw new AntLibException("More than one definition "
+ "in library for " + name);
}
int definitionType = 0;
@@ -324,7 +323,7 @@
} else if (definitionTypeName.equals("taskdef")) {
definitionType = AntLibrary.TASKDEF;
} else {
- throw new ConfigException("Unknown type of definition "
+ throw new AntLibException("Unknown type of definition "
+ definitionTypeName);
}
definitions.put(name,
1.4 +3 -3 jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/antlib/ComponentLibrary.java
Index: ComponentLibrary.java
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/antlib/ComponentLibrary.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -w -u -r1.3 -r1.4
--- ComponentLibrary.java 18 Mar 2002 02:44:24 -0000 1.3
+++ ComponentLibrary.java 27 May 2002 15:52:21 -0000 1.4
@@ -54,7 +54,7 @@
package org.apache.ant.antcore.antlib;
import org.apache.ant.common.antlib.AntContext;
import org.apache.ant.common.antlib.AntLibFactory;
-import org.apache.ant.common.util.ExecutionException;
+import org.apache.ant.common.util.AntException;
/**
* A Component Library supplies components to the Ant core.
@@ -83,9 +83,9 @@
* required
* @return an instance of the factory, or null if this library does not
* support a factory
- * @exception ExecutionException if the factory cannot be created
+ * @exception AntException if the factory cannot be created
*/
- AntLibFactory getFactory(AntContext context) throws ExecutionException;
+ AntLibFactory getFactory(AntContext context) throws AntException;
/**
* Gets the libraryId of the AntLibrary
1.1 jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/antlib/AntLibException.java
Index: AntLibException.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 apache@apache.org.
*
* 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.antcore.antlib;
import org.apache.ant.common.util.AntException;
import org.apache.ant.common.util.Location;
/**
* An AntLibException indicates a problem in an ant library
*
* @author Conor MacNeill
*/
public class AntLibException extends AntException {
/**
* Constructs an exception with the given descriptive message.
*
* @param msg Description of or information about the exception.
*/
public AntLibException(String msg) {
super(msg);
}
/**
* Constructs an exception with the given descriptive message and a
* location in a file.
*
* @param msg Description of or information about the exception.
* @param location Location in the project file where the error occured.
*/
public AntLibException(String msg, Location location) {
super(msg, location);
}
/**
* Constructs an exception with the given message and exception as a
* root cause.
*
* @param msg Description of or information about the exception.
* @param cause Throwable that might have cause this one.
*/
public AntLibException(String msg, Throwable cause) {
super(msg, cause);
}
/**
* Constructs an exception with the given message and exception as a
* root cause and a location in a file.
*
* @param msg Description of or information about the exception.
* @param cause Exception that might have cause this one.
* @param location Location in the project file where the error occured.
*/
public AntLibException(String msg, Throwable cause, Location location) {
super(msg, cause, location);
}
/**
* Constructs an exception with the given exception as a root cause.
*
* @param cause Exception that might have caused this one.
*/
public AntLibException(Throwable cause) {
super(cause);
}
/**
* Constructs an exception with the given exception as a root cause and
* a location in a file.
*
* @param cause Exception that might have cause this one.
* @param location Location in the project file where the error occured.
*/
public AntLibException(Throwable cause, Location location) {
super(cause, location);
}
}
1.11 +68 -14 jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/config/AntConfig.java
Index: AntConfig.java
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/config/AntConfig.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -w -u -r1.10 -r1.11
--- AntConfig.java 1 May 2002 07:19:30 -0000 1.10
+++ AntConfig.java 27 May 2002 15:52:21 -0000 1.11
@@ -52,9 +52,7 @@
* <http://www.apache.org/>.
*/
package org.apache.ant.antcore.config;
-import java.util.ArrayList;
import java.util.Iterator;
-import java.util.List;
import org.apache.ant.common.model.BuildElement;
/**
@@ -75,9 +73,14 @@
private boolean unsetProperties = true;
/**
- * Configuration tasks.
+ * Global Configuration tasks. These are run only once.
*/
- private List tasks = new ArrayList();
+ private BuildElement globalTasks;
+
+ /**
+ * Frame tasks - these are run in each new frame.
+ */
+ private BuildElement frameTasks;
/**
* Indicate if unset properties are OK.
@@ -107,21 +110,47 @@
}
/**
- * Get the configuration tasks
+ * Get the global configuration tasks
+ *
+ * @return an iterator over the set of config tasks.
+ */
+ public Iterator getGlobalTasks() {
+ if (globalTasks == null) {
+ return null;
+ }
+ return globalTasks.getNestedElements();
+ }
+
+ /**
+ * Get the per-frame configuration tasks
*
* @return an iterator over the set of config tasks.
*/
- public Iterator getTasks() {
- return tasks.iterator();
+ public Iterator getFrameTasks() {
+ if (frameTasks == null) {
+ return null;
+ }
+ return frameTasks.getNestedElements();
+ }
+
+ /**
+ * Add a global config task.
+ *
+ * @param globalTasks a collection of tasks to be executed as part of
+ * the configuration process.
+ */
+ public void addGlobalTasks(BuildElement globalTasks) {
+ this.globalTasks = globalTasks;
}
/**
- * Add a config task.
+ * Add a per-frame config task.
*
- * @param task a task to be executed as part of the configuration process.
+ * @param frameTasks a collection of tasks to be executed as part of the
+ * setup of each new frame.
*/
- public void addTask(BuildElement task) {
- tasks.add(task);
+ public void addFrameTasks(BuildElement frameTasks) {
+ this.frameTasks = frameTasks;
}
/**
@@ -162,7 +191,32 @@
remoteLibs = otherConfig.remoteLibs;
remoteProjects = otherConfig.remoteProjects;
unsetProperties = otherConfig.unsetProperties;
- tasks.addAll(otherConfig.tasks);
+ globalTasks = combineTasks(globalTasks, otherConfig.globalTasks);
+ frameTasks = combineTasks(frameTasks, otherConfig.frameTasks);
+ }
+
+ /**
+ * Combine two task collections
+ *
+ * @param lhs the lefthand collection
+ * @param rhs the right hand collection
+ *
+ * @return the combined collection of tasks
+ */
+ private BuildElement combineTasks(BuildElement lhs, BuildElement rhs) {
+ if (rhs == null) {
+ return lhs;
+ }
+
+ if (lhs == null) {
+ return rhs;
+ }
+
+ for (Iterator i = rhs.getNestedElements(); i.hasNext();) {
+ lhs.addNestedElement((BuildElement) i.next());
+ }
+
+ return lhs;
}
}
1.11 +20 -10 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.10
retrieving revision 1.11
diff -u -w -u -r1.10 -r1.11
--- AntConfigHandler.java 1 May 2002 07:19:30 -0000 1.10
+++ AntConfigHandler.java 27 May 2002 15:52:21 -0000 1.11
@@ -54,6 +54,7 @@
package org.apache.ant.antcore.config;
import org.apache.ant.antcore.xml.ElementHandler;
import org.apache.ant.antcore.modelparser.BuildElementHandler;
+import org.apache.ant.common.model.BuildElement;
import org.xml.sax.Attributes;
import org.xml.sax.SAXParseException;
@@ -73,6 +74,12 @@
/** The allowReportProject attribute name */
public static final String UNSET_PROPS_ATTR = "allow-unset-properties";
+ /** The global tasks element */
+ public static final String GLOBAL_TASKS_ELEMENT = "global-tasks";
+
+ /** The per-frame tasks element */
+ public static final String PERFRAME_TASKS_ELEMENT = "frame-tasks";
+
/** The list of allowed Attributes */
public static final String[] ALLOWED_ATTRIBUTES
= {REMOTE_PROJECT_ATTR, REMOTE_LIBRARY_ATTR, UNSET_PROPS_ATTR};
@@ -123,17 +130,20 @@
Attributes attributes)
throws SAXParseException {
- // everything else is a task
+ // configs support two task collections as elements
BuildElementHandler buildElementHandler = new BuildElementHandler();
buildElementHandler.start(getParseContext(), getXMLReader(),
this, getLocator(), attributes, getElementSource(),
qualifiedName);
- config.addTask(buildElementHandler.getBuildElement());
-// try {
-// } catch (ConfigException e) {
-// throw new SAXParseException("Unable to process config",
-// getLocator(), e);
-// }
+ BuildElement element = buildElementHandler.getBuildElement();
+ if (element.getType().equals(GLOBAL_TASKS_ELEMENT)) {
+ config.addGlobalTasks(element);
+ } else if (element.getType().equals(PERFRAME_TASKS_ELEMENT)) {
+ config.addFrameTasks(element);
+ } else {
+ throw new SAXParseException("<antconfig> does not support the <"
+ + element.getType() + "> element", getLocator());
+ }
}
/**
1.2 +26 -26 jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/AttributeSetter.java
Index: AttributeSetter.java
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/AttributeSetter.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -w -u -r1.1 -r1.2
--- AttributeSetter.java 25 Mar 2002 05:40:33 -0000 1.1
+++ AttributeSetter.java 27 May 2002 15:52:21 -0000 1.2
@@ -56,7 +56,7 @@
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import org.apache.ant.common.antlib.Converter;
-import org.apache.ant.common.util.ExecutionException;
+import org.apache.ant.common.util.AntException;
/**
* AttributeSetters are created at introspection time for each
@@ -131,12 +131,12 @@
* @exception InvocationTargetException if the method cannot be
* invoked
* @exception IllegalAccessException if the method cannot be invoked
- * @exception ExecutionException if the conversion of the value
+ * @exception AntException if the conversion of the value
* fails
*/
void set(Object obj, String stringValue)
throws InvocationTargetException, IllegalAccessException,
- ExecutionException {
+ AntException {
Object value = null;
if (converter != null) {
1.10 +4 -4 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.9
retrieving revision 1.10
diff -u -w -u -r1.9 -r1.10
--- BuildEventSupport.java 9 Apr 2002 12:23:53 -0000 1.9
+++ BuildEventSupport.java 27 May 2002 15:52:21 -0000 1.10
@@ -63,7 +63,7 @@
import org.apache.ant.common.model.ModelElement;
import org.apache.ant.common.util.DemuxOutputReceiver;
import org.apache.ant.common.event.MessageLevel;
-import org.apache.ant.common.util.ExecutionException;
+import org.apache.ant.common.util.AntException;
/**
* BuildEventSupport is used by classes which which to send build events to
@@ -239,8 +239,8 @@
task.handleSystemOut(line);
}
return;
- } catch (ExecutionException e) {
- // ignore just log normally
+ } catch (AntException e) {
+ // ignore just log as a non-task message
}
}
fireMessageLogged(this, line,
1.19 +120 -127 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.18
retrieving revision 1.19
diff -u -w -u -r1.18 -r1.19
--- ComponentManager.java 17 May 2002 12:20:38 -0000 1.18
+++ ComponentManager.java 27 May 2002 15:52:21 -0000 1.19
@@ -52,7 +52,6 @@
* <http://www.apache.org/>.
*/
package org.apache.ant.antcore.execution;
-import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
@@ -78,7 +77,7 @@
import org.apache.ant.common.event.MessageLevel;
import org.apache.ant.common.model.BuildElement;
import org.apache.ant.common.service.ComponentService;
-import org.apache.ant.common.util.ExecutionException;
+import org.apache.ant.common.util.AntException;
import org.apache.ant.common.util.Location;
import org.apache.ant.init.LoaderUtils;
@@ -92,11 +91,6 @@
public class ComponentManager implements ComponentService {
/**
- * These are AntLibraries which have been loaded into this component
- * manager
- */
- private static Map antLibraries = new HashMap();
- /**
* Type converters for this frame. Converters are used when configuring
* Tasks to handle special type conversions.
*/
@@ -129,12 +123,6 @@
/** The definitions which have been imported into this frame. */
private Map imports = new HashMap();
- /**
- * This map stores a list of additional paths for each library indexed by
- * the libraryId
- */
- private Map libPathsMap = new HashMap();
-
/** Reflector objects used to configure Tasks from the Task models. */
private Map setters = new HashMap();
@@ -143,16 +131,17 @@
* Constructor
*
* @param frame the frame containing this context
- *
+ * @param libManager the library manager with the library definitions
+ * which are shared across all component manager instances.
* @exception ExecutionException if the loaded libraries could not be
* imported.
*/
- protected ComponentManager(Frame frame) throws ExecutionException {
+ protected ComponentManager(Frame frame, AntLibManager libManager)
+ throws ExecutionException {
this.frame = frame;
AntConfig config = frame.getConfig();
- libManager = new AntLibManager(config.isRemoteLibAllowed());
+ this.libManager = libManager;
dynamicLibraries = new HashMap();
- libPathsMap = new HashMap();
}
/**
@@ -162,32 +151,32 @@
* @param libLocation the file or URL of the library location
* @param importAll if true all tasks are imported as the library is
* loaded
- * @param autoImport true if libraries in the Ant namespace should be
- * automatically imported.
- * @exception ExecutionException if the library cannot be loaded
+ * @exception AntException if the library cannot be loaded
*/
- public void loadLib(String libLocation, boolean importAll,
- boolean autoImport)
- throws ExecutionException {
- try {
- Map librarySpecs = new HashMap();
- libManager.loadLibs(librarySpecs, libLocation);
- Map newLibraries = libManager.configLibraries(frame.getInitConfig(),
- librarySpecs, antLibraries, libPathsMap);
-
- antLibraries.putAll(newLibraries);
- Iterator i = antLibraries.keySet().iterator();
+ public void loadLib(URL libLocation, boolean importAll)
+ throws AntException {
+ Map newLibraries = libManager.loadLibs(libLocation);
+ Iterator i = newLibraries.keySet().iterator();
while (i.hasNext()) {
String libraryId = (String) i.next();
- boolean doAuto = autoImport
- && libraryId.startsWith(Constants.ANT_LIB_PREFIX);
- if (importAll || doAuto) {
+ if (importAll) {
importLibrary(libraryId);
}
}
- } catch (MalformedURLException e) {
- throw new ExecutionException("Unable to load libraries from "
- + libLocation, e);
+ }
+
+ /**
+ * Examine all the libraries defined in the Library manager and import
+ * those which are in the ant library namespace.
+ *
+ * @exception AntException if the standard components cannot be imported.
+ */
+ protected void importStandardComponents() throws AntException {
+ for (Iterator i = libManager.getLibraryIds(); i.hasNext();) {
+ String libraryId = (String) i.next();
+ if (libraryId.startsWith(Constants.ANT_LIB_PREFIX)) {
+ importLibrary(libraryId);
+ }
}
}
@@ -229,32 +218,21 @@
* @param libraryId the unique id of the library for which an additional
* path is being defined
* @param libPath the library path (usually a jar)
- * @exception ExecutionException if the path cannot be specified
+ * @exception AntException if the path cannot be specified
*/
public void addLibPath(String libraryId, URL libPath)
- throws ExecutionException {
- List libPaths = (List) libPathsMap.get(libraryId);
- if (libPaths == null) {
- libPaths = new ArrayList();
- libPathsMap.put(libraryId, libPaths);
- }
- libPaths.add(libPath);
-
- // If this library already exists give it the new path now
- AntLibrary library = (AntLibrary) antLibraries.get(libraryId);
- if (library != null) {
- libManager.addLibPath(library, libPath);
- }
+ throws AntException {
+ libManager.addLibPath(libraryId, libPath);
}
/**
* Import a complete library into the current execution frame
*
* @param libraryId The id of the library to be imported
- * @exception ExecutionException if the library cannot be imported
+ * @exception AntException if the library cannot be imported
*/
- public void importLibrary(String libraryId) throws ExecutionException {
- AntLibrary library = (AntLibrary) antLibraries.get(libraryId);
+ public void importLibrary(String libraryId) throws AntException {
+ AntLibrary library = libManager.getLibrary(libraryId);
if (library == null) {
throw new ExecutionException("Unable to import library " + libraryId
+ " as it has not been loaded");
@@ -277,11 +255,11 @@
* @param alias the name under which this component will be used in the
* build scripts. If this is null, the components default name is
* used.
- * @exception ExecutionException if the component cannot be imported
+ * @exception AntException if the component cannot be imported
*/
public void importComponent(String libraryId, String defName,
- String alias) throws ExecutionException {
- AntLibrary library = (AntLibrary) antLibraries.get(libraryId);
+ String alias) throws AntException {
+ AntLibrary library = libManager.getLibrary(libraryId);
if (library == null) {
throw new ExecutionException("Unable to import component from "
+ "library \"" + libraryId + "\" as it has not been loaded");
@@ -331,10 +309,10 @@
* @param componentName the name of the component
* @return the created component. The return type of this method depends
* on the component type.
- * @exception ExecutionException if the component cannot be created
+ * @exception AntException if the component cannot be created
*/
public Object createComponent(String componentName)
- throws ExecutionException {
+ throws AntException {
return createComponent(componentName, (BuildElement) null);
}
@@ -347,12 +325,11 @@
* @param localName the name component within the library.
* @return the created component. The return type of this method depends
* on the component type.
- * @exception ExecutionException if the component cannot be created
+ * @exception AntException if the component cannot be created
*/
public Object createComponent(String libraryId, String localName)
- throws ExecutionException {
- AntLibrary library
- = (AntLibrary) antLibraries.get(libraryId);
+ throws AntException {
+ AntLibrary library = libManager.getLibrary(libraryId);
if (library == null) {
throw new ExecutionException("No library with libraryId \""
+ libraryId + "\" is available");
@@ -378,16 +355,31 @@
}
/**
+ * Initialize a library.
+ *
+ * @param libraryId the library's identifier.
+ *
+ * @exception AntException if the library cannot be initalized.
+ */
+ protected void initializeLibrary(String libraryId)
+ throws AntException {
+ AntLibrary library = libManager.getLibrary(libraryId);
+ if (library != null) {
+ getLibFactory(library);
+ }
+ }
+
+ /**
* Get the collection of Ant Libraries defined for this frame Gets the
* factory object for the given library
*
* @param componentLibrary the compnent library for which a factory objetc
* is required
* @return the library's factory object
- * @exception ExecutionException if the factory cannot be created
+ * @exception AntException if the factory cannot be created
*/
protected AntLibFactory getLibFactory(ComponentLibrary componentLibrary)
- throws ExecutionException {
+ throws AntException {
String libraryId = componentLibrary.getLibraryId();
if (libFactories.containsKey(libraryId)) {
return (AntLibFactory) libFactories.get(libraryId);
@@ -419,11 +411,11 @@
* @param model the build model representing the component and its
* configuration
* @return the configured component
- * @exception ExecutionException if there is a problem creating or
+ * @exception AntException if there is a problem creating or
* configuring the component
*/
protected Object createComponent(BuildElement model)
- throws ExecutionException {
+ throws AntException {
String componentName = model.getType();
return createComponent(componentName, model);
}
@@ -437,11 +429,11 @@
* @param model the build model of the component. If this is null, the
* component is created but not configured.
* @return the configured component
- * @exception ExecutionException if there is a problem creating or
+ * @exception AntException if there is a problem creating or
* configuring the component
*/
private Object createComponent(String componentName, BuildElement model)
- throws ExecutionException {
+ throws AntException {
Object component = null;
if (model != null) {
@@ -485,13 +477,13 @@
* @param libDefinition the component's definition
* @param model the BuildElement model of the component's configuration.
* @return the required component potentially wrapped in a wrapper object.
- * @exception ExecutionException if the component cannot be created
+ * @exception AntException if the component cannot be created
*/
private Object createComponentFromDef(String componentName,
ComponentLibrary componentLibrary,
AntLibDefinition libDefinition,
BuildElement model)
- throws ExecutionException {
+ throws AntException {
Location location = Location.UNKNOWN_LOCATION;
if (model != null) {
@@ -633,12 +625,12 @@
* @param libFactory the factory object of the typeClass's Ant library
* @param localName the name of the type within its Ant library
* @return an instance of the given class appropriately configured
- * @exception ExecutionException if there is a problem creating the type
+ * @exception AntException if there is a problem creating the type
* instance
*/
private Object createTypeInstance(Class typeClass, AntLibFactory libFactory,
BuildElement model, String localName)
- throws ExecutionException {
+ throws AntException {
try {
Object typeInstance
= libFactory.createComponent(typeClass, localName);
@@ -680,11 +672,11 @@
* @param model the model of the nested element
* @param factory Ant Library factory associated with the element to which
* the attribute is to be added.
- * @exception ExecutionException if the nested element cannot be created
+ * @exception AntException if the nested element cannot be created
*/
private void addNestedElement(AntLibFactory factory, Setter setter,
Object element, BuildElement model)
- throws ExecutionException {
+ throws AntException {
String nestedElementName = model.getType();
Class nestedType = setter.getType(nestedElementName);
@@ -734,11 +726,11 @@
* @param model the build model for the nestd element
* @param factory Ant Library factory associated with the element creating
* the nested element
- * @exception ExecutionException if the nested element cannot be created.
+ * @exception AntException if the nested element cannot be created.
*/
private void createNestedElement(AntLibFactory factory, Setter setter,
Object element, BuildElement model)
- throws ExecutionException {
+ throws AntException {
String nestedElementName = model.getType();
try {
Object nestedElement
@@ -770,12 +762,12 @@
* @param attributeValues a map containing named attribute values.
* @param ignoreUnsupported if this is true, attribute names for which no
* setter method exists are ignored.
- * @exception ExecutionException if the object does not support an
+ * @exception AntException if the object does not support an
* attribute in the map.
*/
public void configureAttributes(Object object, Map attributeValues,
boolean ignoreUnsupported)
- throws ExecutionException {
+ throws AntException {
Setter setter = getSetter(object.getClass());
for (Iterator i = attributeValues.keySet().iterator(); i.hasNext();) {
String attributeName = (String) i.next();
@@ -800,36 +792,13 @@
* @param model the BuildElement describing the object in the build file
* @param factory Ant Library factory associated with the element being
* configured
- * @exception ExecutionException if the element cannot be configured
+ * @exception AntException if the element cannot be configured
*/
private void configureElement(AntLibFactory factory, Object element,
BuildElement model)
- throws ExecutionException {
+ throws AntException {
Setter setter = getSetter(element.getClass());
- // start by setting the attributes of this element
- for (Iterator i = model.getAttributeNames(); i.hasNext();) {
- String attributeName = (String) i.next();
- String attributeValue = model.getAttributeValue(attributeName);
- if (!setter.supportsAttribute(attributeName)) {
- throw new ExecutionException(model.getType()
- + " does not support the \"" + attributeName
- + "\" attribute", model.getLocation());
- }
- setter.setAttribute(element, attributeName,
- frame.replacePropertyRefs(attributeValue));
- }
-
- String modelText = model.getText().trim();
- if (modelText.length() != 0) {
- if (!setter.supportsText()) {
- throw new ExecutionException(model.getType()
- + " does not support content", model.getLocation());
- }
- setter.addText(element,
- frame.replacePropertyRefs(modelText));
- }
-
- // now do the nested elements
+ // do the nested elements
for (Iterator i = model.getNestedElements(); i.hasNext();) {
BuildElement nestedElementModel = (BuildElement) i.next();
String nestedElementName = nestedElementModel.getType();
@@ -851,13 +820,37 @@
createNestedElement(factory, setter, element,
nestedElementModel);
} else {
- throw new ExecutionException(model.getType()
+ throw new ExecutionException("<" + model.getType() + ">"
+ " does not support the \"" + nestedElementName
+ "\" nested element",
nestedElementModel.getLocation());
}
}
}
+
+ // Set the attributes of this element
+ for (Iterator i = model.getAttributeNames(); i.hasNext();) {
+ String attributeName = (String) i.next();
+ String attributeValue = model.getAttributeValue(attributeName);
+ if (!setter.supportsAttribute(attributeName)) {
+ throw new ExecutionException("<" + model.getType() + ">"
+ + " does not support the \"" + attributeName
+ + "\" attribute", model.getLocation());
+ }
+ setter.setAttribute(element, attributeName,
+ frame.replacePropertyRefs(attributeValue));
+ }
+
+ String modelText = model.getText();
+ if (modelText.length() != 0) {
+ if (!setter.supportsText()) {
+ throw new ExecutionException("<" + model.getType() + ">"
+ + " does not support content", model.getLocation());
+ }
+ setter.addText(element,
+ frame.replacePropertyRefs(modelText));
+ }
+
}
/**
@@ -889,9 +882,9 @@
*
* @param library the library from which the aspects are to be loaded.
*
- * @exception ExecutionException if an aspect cannot be loaded.
+ * @exception AntException if an aspect cannot be loaded.
*/
- private void addAspects(AntLibrary library) throws ExecutionException {
+ private void addAspects(AntLibrary library) throws AntException {
if (!library.hasAspects()
|| loadedAspects.contains(library.getLibraryId())) {
return;
@@ -946,11 +939,11 @@
* frame.
*
* @param library the library from which the converters are required
- * @exception ExecutionException if a converter defined in the library
+ * @exception AntException if a converter defined in the library
* cannot be instantiated
*/
private void addConverters(AntLibrary library)
- throws ExecutionException {
+ throws AntException {
if (!library.hasConverters()
|| loadedConverters.contains(library.getLibraryId())) {
return;
1.5 +5 -5 jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/CoreDataService.java
Index: CoreDataService.java
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/CoreDataService.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -w -u -r1.4 -r1.5
--- CoreDataService.java 7 Apr 2002 14:38:06 -0000 1.4
+++ CoreDataService.java 27 May 2002 15:52:21 -0000 1.5
@@ -57,8 +57,8 @@
import java.util.List;
import java.util.Map;
import org.apache.ant.common.service.DataService;
-import org.apache.ant.common.util.ExecutionException;
import org.apache.ant.common.util.PropertyUtils;
+import org.apache.ant.common.util.AntException;
/**
* This is the core's implementation of the DataService service interface.
@@ -156,10 +156,10 @@
*
* @param value the string to be scanned for property references.
* @return the string with all property references replaced
- * @exception ExecutionException if any of the properties do not exist
+ * @exception AntException if any of the properties do not exist
*/
public String replacePropertyRefs(String value)
- throws ExecutionException {
+ throws AntException {
if (value == null) {
return null;
}
@@ -199,10 +199,10 @@
* @param value the string to be scanned for property references.
* @param replacementValues the collection of replacement values
* @return the string with all property references replaced
- * @exception ExecutionException if any of the properties do not exist
+ * @exception AntException if any of the properties do not exist
*/
public String replacePropertyRefs(String value, Map replacementValues)
- throws ExecutionException {
+ throws AntException {
if (value == null) {
return null;
}
1.5 +0 -1 jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/CoreEventService.java
Index: CoreEventService.java
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/CoreEventService.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -w -u -r1.4 -r1.5
--- CoreEventService.java 18 Mar 2002 02:44:24 -0000 1.4
+++ CoreEventService.java 27 May 2002 15:52:21 -0000 1.5
@@ -54,7 +54,6 @@
package org.apache.ant.antcore.execution;
import org.apache.ant.common.event.BuildListener;
import org.apache.ant.common.service.EventService;
-import org.apache.ant.common.util.ExecutionException;
/**
* Core implementation of the event service
1.17 +88 -28 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.16
retrieving revision 1.17
diff -u -w -u -r1.16 -r1.17
--- CoreExecService.java 16 May 2002 13:31:46 -0000 1.16
+++ CoreExecService.java 27 May 2002 15:52:21 -0000 1.17
@@ -64,9 +64,11 @@
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.util.ExecutionException;
+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.event.BuildListener;
+import org.apache.ant.common.util.AntException;
/**
* This is the core's implementation of the Execution Service.
@@ -98,9 +100,9 @@
* core. This is checked
*
* @param task the task to be executed
- * @exception ExecutionException if there is an execution problem
+ * @exception AntException if there is an execution problem
*/
- public void executeTask(Task task) throws ExecutionException {
+ public void executeTask(Task task) throws AntException {
ExecutionContext execContext = getTaskExecutionContext(task);
BuildElement model = execContext.getModel();
@@ -140,10 +142,10 @@
*
* @param task the task to be executed
* @param aspectValues the aspect attribute values.
- * @exception ExecutionException if there is an execution problem
+ * @exception AntException if there is an execution problem
*/
public void executeTask(Task task, AspectValueCollection aspectValues)
- throws ExecutionException {
+ throws AntException {
ExecutionContext execContext = getTaskExecutionContext(task);
frame.executeTask(task, aspectValues);
@@ -160,6 +162,17 @@
return frame.getBaseDir();
}
+ /**
+ * Set the basedir for the current execution
+ *
+ * @param baseDir the new base directory for this execution of Ant
+ *
+ * @exception AntException if the baseDir cannot be set to the given value.
+ */
+ public void setBaseDir(File baseDir) throws AntException {
+ frame.setBaseDir(baseDir);
+ }
+
/**
* get the name of the project associated with this execution.
@@ -204,14 +217,53 @@
/**
+ * Force initialisation of a particular ant library in the context of the
+ * given subbuild.
+ *
+ * @param key the build key.
+ * @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)
+ throws AntException {
+ Frame subFrame = getSubbuildFrame(key);
+ subFrame.initializeLibrary(libraryId);
+ }
+
+ /**
+ * Add a listener to a subbuild
+ *
+ * @param key the key identifying the build previously setup
+ * @param listener the listener to add to the build.
+ *
+ * @exception ExecutionException if the build cannot be found.
+ */
+ public void addBuildListener(BuildKey key, BuildListener listener)
+ throws ExecutionException {
+ getSubbuildFrame(key).addBuildListener(listener);
+ }
+
+
+ /**
* Run a build which have been previously setup
*
* @param targets A list of targets to be run
* @param key Description of the Parameter
- * @exception ExecutionException if the build cannot be run
+ * @exception AntException if the build cannot be run
*/
- public void runBuild(Object key, List targets) throws ExecutionException {
+ 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);
}
@@ -245,11 +297,11 @@
* referenced.
* @param model the project model.
* @param initialData the project's initial data load.
- * @exception ExecutionException if the project cannot be referenced.
+ * @exception AntException if the project cannot be referenced.
*/
public void createProjectReference(String referenceName, Project model,
Map initialData)
- throws ExecutionException {
+ throws AntException {
frame.createProjectReference(referenceName, model, initialData);
}
@@ -259,16 +311,22 @@
*
* @param model the project model to be used for the build
* @param properties the initiali properties to be used in the build
+ * @param addListeners true if the current frame's listeners should be
+ * added to the created Frame
* @return Description of the Return Value
- * @exception ExecutionException if the subbuild cannot be run
+ * @exception AntException if the subbuild cannot be run
*/
- public Object setupBuild(Project model, Map properties)
- throws ExecutionException {
+ public BuildKey setupBuild(Project model, Map properties,
+ boolean addListeners)
+ throws AntException {
Frame newFrame = frame.createFrame(model);
+ if (addListeners) {
+ frame.addListeners(newFrame);
+ }
+ newFrame.initialize(properties);
- newFrame.setInitialProperties(properties);
-
- Object key = new Object();
+ // create an anonymous inner class key.
+ BuildKey key = new BuildKey() {};
subBuilds.put(key, newFrame);
return key;
@@ -279,12 +337,14 @@
* Setup a sub-build using the current frame's project model
*
* @param properties the initiali properties to be used in the build
+ * @param addListeners true if the current frame's listeners should be
+ * added to the created Frame
* @return Description of the Return Value
- * @exception ExecutionException if the subbuild cannot be run
+ * @exception AntException if the subbuild cannot be run
*/
- public Object setupBuild(Map properties)
- throws ExecutionException {
- return setupBuild(frame.getProject(), properties);
+ public BuildKey setupBuild(Map properties, boolean addListeners)
+ throws AntException {
+ return setupBuild(frame.getProject(), properties, addListeners);
}
}
1.5 +3 -3 jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/CoreFileService.java
Index: CoreFileService.java
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/CoreFileService.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -w -u -r1.4 -r1.5
--- CoreFileService.java 18 Mar 2002 02:44:24 -0000 1.4
+++ CoreFileService.java 27 May 2002 15:52:21 -0000 1.5
@@ -54,8 +54,8 @@
package org.apache.ant.antcore.execution;
import java.io.File;
import org.apache.ant.common.service.FileService;
-import org.apache.ant.common.util.ExecutionException;
import org.apache.ant.common.util.FileUtils;
+import org.apache.ant.common.util.AntException;
/**
* The core's implementation of the File Service. The File Service is used
@@ -86,9 +86,9 @@
*
* @param fileName the file name to be resolved.
* @return the file resolved to the project's base dir
- * @exception ExecutionException if the file cannot be resolved.
+ * @exception AntException if the file cannot be resolved.
*/
- public File resolveFile(String fileName) throws ExecutionException {
+ public File resolveFile(String fileName) throws AntException {
File base = frame.getBaseDir();
return fileUtils.resolveFile(fileUtils.normalize(base.getPath()),
fileName);
1.2 +0 -1 jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/CoreInputService.java
Index: CoreInputService.java
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/CoreInputService.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -w -u -r1.1 -r1.2
--- CoreInputService.java 29 Apr 2002 15:29:11 -0000 1.1
+++ CoreInputService.java 27 May 2002 15:52:21 -0000 1.2
@@ -53,7 +53,6 @@
*/
package org.apache.ant.antcore.execution;
import org.apache.ant.common.service.InputService;
-import org.apache.ant.common.util.ExecutionException;
import org.apache.ant.common.input.InputRequest;
/**
1.4 +0 -1 jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/DeferredSetter.java
Index: DeferredSetter.java
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/DeferredSetter.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -w -u -r1.3 -r1.4
--- DeferredSetter.java 7 Apr 2002 14:38:06 -0000 1.3
+++ DeferredSetter.java 27 May 2002 15:52:21 -0000 1.4
@@ -53,7 +53,6 @@
*/
package org.apache.ant.antcore.execution;
import org.apache.ant.common.antlib.DeferredTask;
-import org.apache.ant.common.util.ExecutionException;
/**
* An implementation of the Setter interface for configuring instances of
1.14 +2 -3 jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/ExecutionContext.java
Index: ExecutionContext.java
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/ExecutionContext.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -w -u -r1.13 -r1.14
--- ExecutionContext.java 16 May 2002 13:31:46 -0000 1.13
+++ ExecutionContext.java 27 May 2002 15:52:21 -0000 1.14
@@ -54,7 +54,6 @@
package org.apache.ant.antcore.execution;
import org.apache.ant.common.antlib.AntContext;
import org.apache.ant.common.antlib.ExecutionComponent;
-import org.apache.ant.common.util.ExecutionException;
import org.apache.ant.common.util.Location;
import org.apache.ant.common.model.BuildElement;
1.27 +315 -132 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.26
retrieving revision 1.27
diff -u -w -u -r1.26 -r1.27
--- Frame.java 17 May 2002 12:20:38 -0000 1.26
+++ Frame.java 27 May 2002 15:52:21 -0000 1.27
@@ -63,11 +63,13 @@
import java.util.ArrayList;
import java.util.Set;
import org.apache.ant.antcore.config.AntConfig;
+import org.apache.ant.antcore.antlib.AntLibManager;
import org.apache.ant.common.antlib.Task;
import org.apache.ant.common.antlib.Aspect;
import org.apache.ant.common.event.BuildListener;
import org.apache.ant.common.event.MessageLevel;
import org.apache.ant.common.model.BuildElement;
+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;
@@ -79,8 +81,9 @@
import org.apache.ant.common.service.InputService;
import org.apache.ant.common.service.MagicProperties;
import org.apache.ant.common.util.DemuxOutputReceiver;
-import org.apache.ant.common.util.ExecutionException;
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.LoaderUtils;
@@ -146,10 +149,10 @@
/**
* The Data Service instance used by the frame for data management
*/
- private DataService dataService;
+ private CoreDataService dataService;
/** The execution file service instance */
- private FileService fileService;
+ private CoreFileService fileService;
/**
* the Component Manager used to manage the importing of library
@@ -160,19 +163,41 @@
/** The core's execution Service */
private CoreExecService execService;
+ /** The parent frame of this frame - may be null. */
+ private Frame parent = null;
+
+ /** The currently executing target in this frame */
+ private String currentTarget = null;
+
+ /** The global library manager */
+ private AntLibManager libManager;
+
+ /**
+ * 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
+ */
+ public Frame(InitConfig initConfig, AntConfig config) {
+ this.config = config;
+ this.initConfig = initConfig;
+ this.parent = null;
+ this.libManager
+ = new AntLibManager(initConfig, config.isRemoteLibAllowed());
+ }
/**
- * Create an Execution Frame for the given project
+ * Create an Execution Frame.
*
* @param config the user config to use for this execution of Ant
* @param initConfig Ant's initialisation config
- * @exception ExecutionException if a component of the library cannot be
- * imported
+ * @param parent the frame creating this frame.
*/
- protected Frame(InitConfig initConfig,
- AntConfig config) throws ExecutionException {
+ private Frame(InitConfig initConfig, AntConfig config, Frame parent) {
this.config = config;
this.initConfig = initConfig;
+ this.parent = parent;
+ this.libManager = parent.libManager;
}
@@ -182,10 +207,10 @@
*
* @param value the string to be scanned for property references.
* @return the string with all property references replaced
- * @exception ExecutionException if any of the properties do not exist
+ * @exception AntException if any of the properties do not exist
*/
protected String replacePropertyRefs(String value)
- throws ExecutionException {
+ throws AntException {
return dataService.replacePropertyRefs(value);
}
@@ -194,12 +219,12 @@
* Sets the Project of the Frame
*
* @param project The new Project value
- * @exception ExecutionException if any required sub-frames cannot be
- * created and configured
+ * @exception ModelException if the project is not valid.
*/
- protected void setProject(Project project) throws ExecutionException {
+ public void setProject(Project project) throws ModelException {
this.project = project;
referencedFrames.clear();
+ project.validate();
}
@@ -235,7 +260,7 @@
if (frame == this) {
if (dataValues.containsKey(name) && !mutable) {
- log("Ignoring oveeride for data value " + name,
+ log("Ignoring override for data value " + name,
MessageLevel.MSG_VERBOSE);
} else {
dataValues.put(name, value);
@@ -345,29 +370,32 @@
/**
- * Set the initial properties to be used when the frame starts execution
+ * Initialize the frame setting any initial properties.
*
* @param properties a Map of named properties which may in fact be any
* object
- * @exception ExecutionException if the properties cannot be set
+ * @exception AntException if the properties cannot be set
*/
- protected void setInitialProperties(Map properties)
- throws ExecutionException {
+ public void initialize(Map properties)
+ throws AntException {
+ configureServices();
if (properties != null) {
addProperties(properties);
}
// add in system properties
addProperties(System.getProperties());
+ setMagicProperties();
}
/**
* Set the values of various magic properties
*
- * @exception ExecutionException if the properties cannot be set
+ * @exception AntException if the properties cannot be set
*/
- protected void setMagicProperties() throws ExecutionException {
+ protected void setMagicProperties() throws AntException {
+ // ant.home
URL antHomeURL = initConfig.getAntHome();
String antHomeString = null;
@@ -378,7 +406,25 @@
} else {
antHomeString = antHomeURL.toString();
}
- setDataValue(MagicProperties.ANT_HOME, antHomeString, true);
+ setDataValue(MagicProperties.ANT_HOME, antHomeString, false);
+
+ // ant.file
+ URL projectSource = project.getSourceURL();
+ if (projectSource != null
+ && projectSource.getProtocol().equals("file")) {
+ setDataValue(MagicProperties.ANT_FILE, projectSource.getFile(),
+ true);
+ }
+
+ // basedir
+ determineBaseDir();
+
+ // ant.project.name
+ String projectName = project.getName();
+ if (projectName != null) {
+ setDataValue(MagicProperties.ANT_PROJECT_NAME, projectName, true);
+ }
+
}
@@ -650,26 +696,24 @@
* referenced.
* @param project the project model.
* @param initialData the project's initial data load.
- * @exception ExecutionException if the project cannot be referenced.
+ * @exception AntException if the project cannot be referenced.
*/
protected void createProjectReference(String name, Project project,
Map initialData)
- throws ExecutionException {
+ throws AntException {
Frame referencedFrame = createFrame(project);
+ addListeners(referencedFrame);
- if (initialData != null) {
- referencedFrame.setInitialProperties(initialData);
- }
+ referencedFrame.initialize(initialData);
// does the frame have any overrides?
Map initialProperties = (Map) overrides.get(name);
- if (initialProperties != null) {
- referencedFrame.setInitialProperties(initialProperties);
+ referencedFrame.initialize(initialProperties);
overrides.remove(name);
- }
referencedFrames.put(name, referencedFrame);
- referencedFrame.initialize();
+ referencedFrame.importStandardComponents();
+ referencedFrame.runGlobalTasks();
}
/**
@@ -677,21 +721,30 @@
*
* @param project the project model the frame will deal with
* @return an Frame ready to build the project
- * @exception ExecutionException if the frame cannot be created.
+ * @exception ModelException if the given project is not valid.
*/
protected Frame createFrame(Project project)
- throws ExecutionException {
+ throws ModelException {
Frame newFrame
- = new Frame(initConfig, config);
+ = new Frame(initConfig, config, this);
newFrame.setProject(project);
+
+ return newFrame;
+ }
+
+ /**
+ * Add all build listeners from this frame to the given sub frame.
+ *
+ * @param subFrame the subFrame to which all the listeners of this frame
+ * will be added.
+ */
+ protected void addListeners(Frame subFrame) {
for (Iterator j = eventSupport.getListeners(); j.hasNext();) {
BuildListener listener = (BuildListener) j.next();
- newFrame.addBuildListener(listener);
+ subFrame.addBuildListener(listener);
}
-
- return newFrame;
}
@@ -711,7 +764,7 @@
*
* @param listener the listener to be added to the frame
*/
- protected void addBuildListener(BuildListener listener) {
+ public void addBuildListener(BuildListener listener) {
for (Iterator i = getReferencedFrames(); i.hasNext();) {
Frame referencedFrame = (Frame) i.next();
@@ -735,15 +788,26 @@
eventSupport.removeBuildListener(listener);
}
+ /**
+ * Import any standard components from the libraries which have been loaded.
+ * A standard component is a component provided by a library in the ant
+ * namespace.
+ *
+ * @exception AntException if the standard components cannot be imported.
+ */
+ private void importStandardComponents() throws AntException {
+ componentManager.importStandardComponents();
+ }
/**
* Run the given list of targets
*
* @param targets a list of target names which are to be evaluated
- * @exception ExecutionException if there is a problem in the build
+ * @exception AntException if there is a problem in the build
*/
- protected void runBuild(List targets) throws ExecutionException {
- initialize();
+ protected void runBuild(List targets) throws AntException {
+ importStandardComponents();
+ runGlobalTasks();
if (targets.isEmpty()) {
// we just execute the default target if any
String defaultTarget = project.getDefaultTarget();
@@ -787,10 +851,12 @@
* @param flattenedList the List of targets that must be executed before
* the given target
* @param fullTargetName the fully qualified name of the target
+ * @param targetRefLocation the location requesting this dependency.
* @exception ExecutionException if the given target does not exist in the
* project hierarchy
*/
- private void flattenDependency(List flattenedList, String fullTargetName)
+ private void flattenDependency(List flattenedList, String fullTargetName,
+ Location targetRefLocation)
throws ExecutionException {
if (flattenedList.contains(fullTargetName)) {
return;
@@ -800,8 +866,8 @@
String localTargetName = getNameInFrame(fullTargetName);
Target target = frame.getProject().getTarget(localTargetName);
if (target == null) {
- throw new ExecutionException("Target " + fullTargetName
- + " does not exist");
+ throw new ExecutionException("Target \"" + fullTargetName
+ + "\" does not exist", targetRefLocation);
}
for (Iterator i = target.getDependencies(); i.hasNext();) {
String localDependencyName = (String) i.next();
@@ -810,7 +876,8 @@
fullDependencyName = fullProjectName + Project.REF_DELIMITER
+ localDependencyName;
}
- flattenDependency(flattenedList, fullDependencyName);
+ flattenDependency(flattenedList, fullDependencyName,
+ target.getLocation());
if (!flattenedList.contains(fullDependencyName)) {
flattenedList.add(fullDependencyName);
}
@@ -829,7 +896,7 @@
protected List getTargetDependencies(String fullTargetName)
throws ExecutionException {
List flattenedList = new ArrayList();
- flattenDependency(flattenedList, fullTargetName);
+ flattenDependency(flattenedList, fullTargetName, null);
flattenedList.add(fullTargetName);
return flattenedList;
}
@@ -839,10 +906,10 @@
* Execute the tasks of a target in this frame with the given name
*
* @param targetName the name of the target whose tasks will be evaluated
- * @exception ExecutionException if there is a problem executing the tasks
+ * @exception AntException if there is a problem executing the tasks
* of the target
*/
- protected void executeTarget(String targetName) throws ExecutionException {
+ protected void executeTarget(String targetName) throws AntException {
// to execute a target we must determine its dependencies and
// execute them in order.
@@ -864,10 +931,10 @@
*
* @param task the task to be executed.
* @param aspectValues the collection of aspect attribute values.
- * @exception ExecutionException if the task has a problem.
+ * @exception AntException if the task has a problem.
*/
protected void executeTask(Task task, AspectValueCollection aspectValues)
- throws ExecutionException {
+ throws AntException {
List aspects = componentManager.getAspects();
Map aspectContexts = new HashMap();
@@ -924,11 +991,15 @@
* Run the tasks returned by the given iterator
*
* @param taskIterator the iterator giving the tasks to execute
- * @exception ExecutionException if there is execution problem while
+ * @exception AntException if there is execution problem while
* executing tasks
*/
protected void executeTasks(Iterator taskIterator)
- throws ExecutionException {
+ throws AntException {
+
+ if (taskIterator == null) {
+ return;
+ }
while (taskIterator.hasNext()) {
BuildElement model = (BuildElement) taskIterator.next();
@@ -952,6 +1023,63 @@
}
+ /**
+ * Get the parent frame of this frame.
+ *
+ * @return the parent frame - may be null if this frame has no parent.
+ */
+ private Frame getParent() {
+ return parent;
+ }
+
+ /**
+ * Get the currently executing target of this frame
+ *
+ * @return the name of the current target.
+ */
+ private String getCurrentTarget() {
+ return currentTarget;
+ }
+
+ /**
+ * Check for recursion - executing the same target in the same buildfile
+ * with the same base directory
+ *
+ * @param targetName the target to check
+ *
+ * @exception ExecutionException if the target is already being evaluated
+ * in a parent frame.
+ */
+ private void checkRecursion(String targetName) throws ExecutionException {
+ Frame checkFrame = getParent();
+ while (checkFrame != null) {
+ File checkDir = checkFrame.getBaseDir();
+ String checkTarget = checkFrame.getCurrentTarget();
+ URL checkURL = checkFrame.getProject().getSourceURL();
+ if (targetName.equals(checkTarget)
+ && checkDir.equals(getBaseDir())
+ && checkURL != null
+ && checkURL.equals(getProject().getSourceURL())) {
+ throw new ExecutionException("Recursive execution of "
+ + "target \"" + targetName + "\" in "
+ + "project \"" + checkURL + "\"");
+ }
+ checkFrame = checkFrame.getParent();
+ }
+ }
+
+ /**
+ * Initialize a library in this frame.
+ *
+ * @param libraryId the library's global identifier.
+ *
+ * @exception AntException if the library cannot be initialized.
+ */
+ protected void initializeLibrary(String libraryId)
+ throws AntException {
+ componentManager.initializeLibrary(libraryId);
+ }
+
/**
* Execute the given target's tasks. The target must be local to this
@@ -959,10 +1087,13 @@
*
* @param targetName the name of the target within this frame that is to
* be executed.
- * @exception ExecutionException if there is a problem executing tasks
+ * @exception AntException if there is a problem executing tasks
*/
protected void executeTargetTasks(String targetName)
- throws ExecutionException {
+ throws AntException {
+ checkRecursion(targetName);
+ currentTarget = targetName;
+
Throwable failureCause = null;
Target target = project.getTarget(targetName);
String ifCondition = target.getIfCondition();
@@ -1000,51 +1131,104 @@
throw ee;
} finally {
eventSupport.fireTargetFinished(target, failureCause);
- }
+ currentTarget = null;
}
+ }
/**
- * Initialize the frame by executing the project level tasks if any
+ * Start the build. This is only called on the
+ * main frame of the build. All subordinate frames use runBuild to
+ * process sub builds.
*
- * @exception ExecutionException if the top level tasks of the frame
- * failed
+ * This method performs all global config tasks and then starts the
+ * build
+ *
+ * @param targets the targets to be evaluated in this build
+ *
+ * @exception AntException if there is a problem running the build.
*/
- protected void initialize() throws ExecutionException {
- configureServices();
- setMagicProperties();
- determineBaseDir();
+ public void startBuild(List targets) throws AntException {
+ eventSupport.fireBuildStarted(project);
+ Throwable buildFailureCause = null;
try {
// load system ant lib
URL systemLibs
= new URL(initConfig.getLibraryURL(), "syslibs/");
- componentManager.loadLib(systemLibs.toString(), true, true);
+ componentManager.loadLib(systemLibs, true);
- // execute any config tasks
- executeTasks(config.getTasks());
+ executeTasks(config.getGlobalTasks());
// now load other system libraries
URL antLibs = new URL(initConfig.getLibraryURL(), "antlibs/");
- componentManager.loadLib(antLibs.toString(), false, true);
+ componentManager.loadLib(antLibs, false);
- executeTasks(project.getTasks());
} catch (MalformedURLException e) {
throw new ExecutionException("Unable to initialize antlibs", e);
}
+
+ try {
+ runBuild(targets);
+ } catch (RuntimeException e) {
+ buildFailureCause = e;
+ throw e;
+ } catch (AntException e) {
+ buildFailureCause = e;
+ throw e;
+ } finally {
+ eventSupport.fireBuildFinished(project, buildFailureCause);
+ }
+ }
+
+ /**
+ * Execute any config and project level tasks
+ *
+ * @exception AntException if the top level tasks of the frame
+ * failed
+ */
+ private void runGlobalTasks() throws AntException {
+ executeTasks(config.getFrameTasks());
+ executeTasks(project.getTasks());
+ }
+
+ /**
+ * Set the base director for this frame's execution.
+ *
+ * @param baseDir the new base directory
+ *
+ * @exception AntException if the base directory cannot be set.
+ */
+ protected void setBaseDir(File baseDir) throws AntException {
+ FileUtils fileUtils = FileUtils.newFileUtils();
+
+ baseDir = fileUtils.normalize(baseDir.getAbsolutePath());
+ if (!baseDir.exists()) {
+ throw new ExecutionException("Basedir " + baseDir.getAbsolutePath()
+ + " does not exist");
+ }
+ if (!baseDir.isDirectory()) {
+ throw new ExecutionException("Basedir " + baseDir.getAbsolutePath()
+ + " is not a directory");
+ }
+ this.baseDir = baseDir;
+ setDataValue(MagicProperties.BASEDIR, baseDir.getPath(), false);
+ log("Project base dir set to: " + this.baseDir,
+ MessageLevel.MSG_VERBOSE);
}
/**
- * Determine the base directory for each frame in the frame hierarchy
+ * Determine the base directory.
*
- * @exception ExecutionException if the base directories cannot be
+ * @exception AntException if the base directories cannot be
* determined
*/
- private void determineBaseDir() throws ExecutionException {
+ private void determineBaseDir() throws AntException {
if (isDataValueSet(MagicProperties.BASEDIR)) {
- baseDir
- = new File(getDataValue(MagicProperties.BASEDIR).toString());
+ String baseDirString
+ = getDataValue(MagicProperties.BASEDIR).toString();
+ setBaseDir(new File(baseDirString));
} else {
URL projectURL = project.getSourceURL();
@@ -1054,17 +1238,16 @@
String base = project.getBase();
if (base == null) {
- baseDir = projectFileParent;
+ setBaseDir(projectFileParent);
} else {
FileUtils fileUtils = FileUtils.newFileUtils();
- baseDir = fileUtils.resolveFile(projectFileParent, base);
+ setBaseDir(fileUtils.resolveFile(projectFileParent, base));
}
} else {
- baseDir = new File(".");
+ setBaseDir(new File("."));
}
}
- setDataValue(MagicProperties.BASEDIR, baseDir.getAbsolutePath(), true);
}
@@ -1078,7 +1261,7 @@
private void configureServices() throws ExecutionException {
// create services and make them available in our services map
fileService = new CoreFileService(this);
- componentManager = new ComponentManager(this);
+ componentManager = new ComponentManager(this, libManager);
dataService = new CoreDataService(this,
config.isUnsetPropertiesAllowed());
execService = new CoreExecService(this);
1.9 +13 -13 jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/Reflector.java
Index: Reflector.java
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/Reflector.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -w -u -r1.8 -r1.9
--- Reflector.java 7 Apr 2002 14:38:06 -0000 1.8
+++ Reflector.java 27 May 2002 15:52:21 -0000 1.9
@@ -59,7 +59,7 @@
import java.util.Iterator;
import java.util.Map;
import org.apache.ant.common.antlib.Converter;
-import org.apache.ant.common.util.ExecutionException;
+import org.apache.ant.common.util.AntException;
/**
* A reflector is used to set attributes and add nested elements to an
@@ -145,12 +145,12 @@
* @param obj the object on which the value is being set
* @param attributeName the name of the attribute
* @param value the string represenation of the attribute's value
- * @exception ExecutionException if the object does not support the
+ * @exception AntException if the object does not support the
* attribute or the object has a problem setting the value
*/
public void setAttribute(Object obj, String attributeName,
String value)
- throws ExecutionException {
+ throws AntException {
String name = attributeName.toLowerCase();
AttributeSetter as
= (AttributeSetter) attributeSetters.get(name);
1.3 +3 -3 jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/Setter.java
Index: Setter.java
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/Setter.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -w -u -r1.2 -r1.3
--- Setter.java 18 Mar 2002 02:44:24 -0000 1.2
+++ Setter.java 27 May 2002 15:52:21 -0000 1.3
@@ -52,7 +52,7 @@
* <http://www.apache.org/>.
*/
package org.apache.ant.antcore.execution;
-import org.apache.ant.common.util.ExecutionException;
+import org.apache.ant.common.util.AntException;
/**
* The Setter interface is used by the Ant core to set values and nested
@@ -68,12 +68,12 @@
* @param obj the object on which the value is being set
* @param attributeName the name of the attribute
* @param value the string represenation of the attribute's value
- * @exception ExecutionException if the object does not support the
+ * @exception AntException if the object does not support the
* attribute or the object has a problem setting the value
*/
void setAttribute(Object obj, String attributeName,
String value)
- throws ExecutionException;
+ throws AntException;
/**
* Get the type of the given nested element
1.5 +11 -2 jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/TaskAdapter.java
Index: TaskAdapter.java
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/TaskAdapter.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -w -u -r1.4 -r1.5
--- TaskAdapter.java 18 Mar 2002 02:44:24 -0000 1.4
+++ TaskAdapter.java 27 May 2002 15:52:21 -0000 1.5
@@ -53,9 +53,9 @@
*/
package org.apache.ant.antcore.execution;
import java.lang.reflect.Method;
-
+import java.lang.reflect.InvocationTargetException;
import org.apache.ant.common.antlib.AbstractTask;
-import org.apache.ant.common.util.ExecutionException;
+import org.apache.ant.common.event.MessageLevel;
/**
* Use introspection to "adapt" an arbitrary Bean (not extending Task, but
@@ -105,7 +105,16 @@
public void execute() throws ExecutionException {
try {
executeMethod.invoke(worker, null);
+ } catch (InvocationTargetException e) {
+ log("Error in " + worker.getClass(), MessageLevel.MSG_ERR);
+ Throwable t = e.getTargetException();
+ if (t instanceof ExecutionException) {
+ throw (ExecutionException) t;
+ } else {
+ throw new ExecutionException(t);
+ }
} catch (Throwable t) {
+ log("Error in " + worker.getClass(), MessageLevel.MSG_ERR);
throw new ExecutionException(t);
}
}
1.4 +6 -6 jakarta-ant/proposal/mutant/src/java/antlibs/ant1compat/org/apache/tools/ant/Ant1Converter.java
Index: Ant1Converter.java
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/mutant/src/java/antlibs/ant1compat/org/apache/tools/ant/Ant1Converter.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -w -u -r1.3 -r1.4
--- Ant1Converter.java 7 Apr 2002 14:38:06 -0000 1.3
+++ Ant1Converter.java 27 May 2002 15:52:22 -0000 1.4
@@ -54,7 +54,7 @@
package org.apache.tools.ant;
import org.apache.ant.common.antlib.AbstractConverter;
-import org.apache.ant.common.util.ExecutionException;
+import org.apache.ant.common.antlib.ConverterException;
import org.apache.tools.ant.types.EnumeratedAttribute;
import org.apache.tools.ant.types.Path;
@@ -96,9 +96,9 @@
* @param value The value to be converted
* @param type the desired type of the converted object
* @return the value of the converted object
- * @exception ExecutionException if the conversion cannot be made
+ * @exception ConverterException if the conversion cannot be made
*/
- public Object convert(String value, Class type) throws ExecutionException {
+ public Object convert(String value, Class type) throws ConverterException {
if (type.equals(Path.class)) {
return new Path(project, value);
} else if (EnumeratedAttribute.class.isAssignableFrom(type)) {
@@ -108,13 +108,13 @@
ea.setValue(value);
return ea;
} catch (InstantiationException e) {
- throw new ExecutionException(e);
+ throw new ConverterException(e);
} catch (IllegalAccessException e) {
- throw new ExecutionException(e);
+ throw new ConverterException(e);
}
} else {
- throw new ExecutionException("This converter does not handle "
+ throw new ConverterException("This converter does not handle "
+ type.getName());
}
}
1.12 +14 -14 jakarta-ant/proposal/mutant/src/java/antlibs/ant1compat/org/apache/tools/ant/Ant1Factory.java
Index: Ant1Factory.java
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/mutant/src/java/antlibs/ant1compat/org/apache/tools/ant/Ant1Factory.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -w -u -r1.11 -r1.12
--- Ant1Factory.java 14 May 2002 15:11:09 -0000 1.11
+++ Ant1Factory.java 27 May 2002 15:52:22 -0000 1.12
@@ -55,7 +55,7 @@
import org.apache.ant.common.antlib.AntContext;
import org.apache.ant.common.antlib.StandardLibFactory;
import org.apache.ant.common.service.EventService;
-import org.apache.ant.common.util.ExecutionException;
+import org.apache.ant.common.util.AntException;
import org.apache.ant.init.LoaderUtils;
/**
@@ -78,9 +78,9 @@
*
* @param context the context for this factory to use to access core
* services.
- * @exception ExecutionException if the factory cannot be initialised.
+ * @exception AntException if the factory cannot be initialised.
*/
- public void init(AntContext context) throws ExecutionException {
+ public void init(AntContext context) throws AntException {
if (project != null) {
return;
}
@@ -109,11 +109,11 @@
* @return an instance of the required class
* @exception InstantiationException if the class cannot be instantiated
* @exception IllegalAccessException if the instance cannot be accessed
- * @exception ExecutionException if there is a problem creating the task
+ * @exception Ant1CompatException if there is a problem creating the task
*/
public Object createComponent(Class componentClass, String localName)
throws InstantiationException, IllegalAccessException,
- ExecutionException {
+ Ant1CompatException {
try {
java.lang.reflect.Constructor constructor = null;
// DataType can have a "no arg" constructor or take a single
@@ -136,9 +136,9 @@
Throwable t = ite.getTargetException();
String msg = "Could not create component of type: "
+ componentClass.getName() + " due to " + t;
- throw new ExecutionException(msg, t);
+ throw new Ant1CompatException(msg, t);
} catch (NoSuchMethodException e) {
- throw new ExecutionException("Unable to find an appropriate "
+ throw new Ant1CompatException("Unable to find an appropriate "
+ "constructor for component " + componentClass.getName(), e);
}
}
@@ -151,12 +151,12 @@
* @return a instance of the required class
* @exception InstantiationException if the class cannot be instantiated
* @exception IllegalAccessException if the instance cannot be accessed
- * @exception ExecutionException if there is a problem creating the
+ * @exception Ant1CompatException if there is a problem creating the
* converter
*/
public Object createInstance(Class requiredClass)
throws InstantiationException, IllegalAccessException,
- ExecutionException {
+ Ant1CompatException {
java.lang.reflect.Constructor c = null;
@@ -175,9 +175,9 @@
Throwable t = ite.getTargetException();
String msg = "Could not create instance of type: "
+ requiredClass.getName() + " due to " + t;
- throw new ExecutionException(msg, t);
+ throw new Ant1CompatException(msg, t);
} catch (NoSuchMethodException e) {
- throw new ExecutionException("Unable to find an appropriate "
+ throw new Ant1CompatException("Unable to find an appropriate "
+ "constructor for class " + requiredClass.getName(), e);
}
}
@@ -187,11 +187,11 @@
* create method.
*
* @param createdElement the element that the component created
- * @exception ExecutionException if there is a problem registering the
+ * @exception AntException if there is a problem registering the
* element
*/
public void registerCreatedElement(Object createdElement)
- throws ExecutionException {
+ throws AntException {
if (createdElement instanceof ProjectComponent) {
ProjectComponent component = (ProjectComponent) createdElement;
component.setProject(project);
1.2 +2 -2 jakarta-ant/proposal/mutant/src/java/antlibs/ant1compat/org/apache/tools/ant/Ant1InputHandler.java
Index: Ant1InputHandler.java
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/mutant/src/java/antlibs/ant1compat/org/apache/tools/ant/Ant1InputHandler.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -w -u -r1.1 -r1.2
--- Ant1InputHandler.java 29 Apr 2002 15:29:11 -0000 1.1
+++ Ant1InputHandler.java 27 May 2002 15:52:22 -0000 1.2
@@ -54,7 +54,7 @@
package org.apache.tools.ant;
import org.apache.ant.common.service.InputService;
-import org.apache.ant.common.util.ExecutionException;
+import org.apache.ant.common.util.AntException;
import org.apache.tools.ant.input.InputHandler;
import org.apache.tools.ant.input.InputRequest;
@@ -87,7 +87,7 @@
public void handleInput(InputRequest request) throws BuildException {
try {
inputService.handleInput(request);
- } catch (ExecutionException e) {
+ } catch (AntException e) {
throw new BuildException(e);
}
}
1.24 +362 -106 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.23
retrieving revision 1.24
diff -u -w -u -r1.23 -r1.24
--- Project.java 14 May 2002 15:11:09 -0000 1.23
+++ Project.java 27 May 2002 15:52:22 -0000 1.24
@@ -55,22 +55,26 @@
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
+import java.util.ArrayList;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Iterator;
+import java.util.List;
import java.util.Map;
+import java.util.HashMap;
import java.util.Properties;
import java.util.Stack;
import java.util.Vector;
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;
import org.apache.ant.common.service.FileService;
import org.apache.ant.common.service.InputService;
-import org.apache.ant.common.util.ExecutionException;
+import org.apache.ant.common.util.AntException;
import org.apache.ant.common.util.PropertyUtils;
import org.apache.tools.ant.input.InputHandler;
import org.apache.tools.ant.types.FilterSet;
@@ -84,6 +88,11 @@
* @created 30 January 2002
*/
public class Project implements org.apache.ant.common.event.BuildListener {
+ /**
+ * A Property key which identifies the Project actiong as proxy for a
+ * a project.
+ */
+ private static final String PROXY_KEY = "_ant.proxy";
/** String which indicates Java version 1.0 */
public static final String JAVA_1_0 = "1.0";
@@ -155,6 +164,12 @@
/** The core's Component Service instance */
private ComponentService componentService;
+ /**
+ * A static copy of a context used fro Projects which have been created on
+ * the fly. It is used to access the required core services
+ */
+ private static AntContext sharedContext = null;
+
/** Ant1 FileUtils instance for manipulating files */
private FileUtils fileUtils;
/** The collection of global filters */
@@ -167,6 +182,33 @@
/** the target's we have seen */
private Stack targetStack = new Stack();
+ /**
+ * Flag which indicates if this project object is proxing for a subordinate
+ * project which has not yet been created.
+ */
+ private boolean proxying;
+
+ /**
+ * The properties which will be passed to the project instance for which we
+ * are proxing.
+ */
+ private Map proxyProperties = new HashMap();
+
+ /**
+ * The build key used to control the proxied build.
+ */
+ private BuildKey proxyBuildKey;
+
+ /**
+ * The subordinate project if proxying
+ */
+ private Project subordinate;
+
+ /**
+ * The requested base dir
+ */
+ private File baseDir = null;
+
static {
// Determine the Java version by looking at available classes
@@ -197,18 +239,44 @@
* @param factory the factory object creating this project
*/
public Project(AntLibFactory factory) {
+ proxying = false;
this.factory = factory;
fileUtils = FileUtils.newFileUtils();
}
/**
- * The old constructor fopr Project instances - not used now.
+ * The old constructor for Project instances - legacy support.
*
* @deprecated
*/
public Project() {
- throw new BuildException("Projects can not be constructed to "
- + "invoke Ant");
+ if (sharedContext == null) {
+ throw new BuildException("Project object can no longer be "
+ + "constructed outside Ant execution");
+ }
+ proxying = true;
+ }
+
+ /**
+ * Configure a new project
+ *
+ * @param buildFile the file containing the XML build definition.
+ */
+ protected void configure(File buildFile) {
+ try {
+ // we create an execution frame and link ourselves to the Project
+ // object created in that frame
+ ExecService sharedExec
+ = (ExecService) sharedContext.getCoreService(ExecService.class);
+ org.apache.ant.common.model.Project subProject
+ = sharedExec.parseXMLBuildFile(buildFile);
+ proxyProperties.put(PROXY_KEY, this);
+ proxyBuildKey
+ = sharedExec.setupBuild(subProject, proxyProperties, false);
+ sharedExec.initializeBuildLibrary(proxyBuildKey, "ant.ant1compat");
+ } catch (AntException e) {
+ throw new BuildException(e.getMessage(), e);
+ }
}
/**
@@ -270,8 +338,65 @@
* @deprecated
*/
public void init() throws BuildException {
- throw new BuildException("Projects can not be initialized in this "
- + "manner any longer.");
+ String defs = "/org/apache/tools/ant/taskdefs/defaults.properties";
+
+ try {
+ Properties props = new Properties();
+ InputStream in = this.getClass().getResourceAsStream(defs);
+ if (in == null) {
+ throw new BuildException("Can't load default task list");
+ }
+ props.load(in);
+ in.close();
+
+ Enumeration enum = props.propertyNames();
+ while (enum.hasMoreElements()) {
+ String key = (String) enum.nextElement();
+ String value = props.getProperty(key);
+ try {
+ Class taskClass = Class.forName(value);
+ taskClassDefinitions.put(key, taskClass);
+ } catch (NoClassDefFoundError ncdfe) {
+ log("Could not load a dependent class ("
+ + ncdfe.getMessage() + ") for task " + key, MSG_DEBUG);
+ } catch (ClassNotFoundException cnfe) {
+ log("Could not load class (" + value
+ + ") for task " + key, MSG_DEBUG);
+ }
+ }
+ } catch (IOException ioe) {
+ throw new BuildException("Can't load default task list");
+ }
+
+ String dataDefs = "/org/apache/tools/ant/types/defaults.properties";
+
+ try {
+ Properties props = new Properties();
+ InputStream in = this.getClass().getResourceAsStream(dataDefs);
+ if (in == null) {
+ throw new BuildException("Can't load default datatype list");
+ }
+ props.load(in);
+ in.close();
+
+ Enumeration enum = props.propertyNames();
+ while (enum.hasMoreElements()) {
+ String key = (String) enum.nextElement();
+ String value = props.getProperty(key);
+ try {
+ Class dataClass = Class.forName(value);
+ dataClassDefinitions.put(key, dataClass);
+ } catch (NoClassDefFoundError ncdfe) {
+ log("Could not load a dependent class ("
+ + ncdfe.getMessage() + ") for type " + key, MSG_DEBUG);
+ } catch (ClassNotFoundException cnfe) {
+ log("Could not load class (" + value
+ + ") for type " + key, MSG_DEBUG);
+ }
+ }
+ } catch (IOException ioe) {
+ throw new BuildException("Can't load default datatype list");
+ }
}
@@ -284,8 +409,56 @@
* @deprecated
*/
public void executeTargets(Vector targetNames) throws BuildException {
- throw new BuildException("Targets within the project cannot be "
- + "executed with this method.");
+ if (!proxying) {
+ throw new BuildException("This interface is no longer available.");
+ }
+
+ try {
+ List targets = new ArrayList();
+ for (Iterator i = targetNames.iterator(); i.hasNext();) {
+ targets.add(i.next());
+ }
+
+ ExecService execService
+ = (ExecService) sharedContext.getCoreService(ExecService.class);
+ execService.runBuild(proxyBuildKey, targets);
+ } catch (AntException e) {
+ throw new BuildException(e.getMessage(), e);
+ }
+ }
+
+ /**
+ * Executes the specified target and any targets it depends on.
+ *
+ * @param targetName The name of the target to execute.
+ * Must not be <code>null</code>.
+ *
+ * @exception BuildException if the build failed
+ */
+ public void executeTarget(String targetName) throws BuildException {
+
+ // sanity check ourselves, if we've been asked to build nothing
+ // then we should complain
+
+ if (targetName == null) {
+ String msg = "No target specified";
+ throw new BuildException(msg);
+ }
+
+ if (!proxying) {
+ throw new BuildException("This interface is no longer available.");
+ }
+
+ try {
+ List targets = new ArrayList();
+ targets.add(targetName);
+
+ ExecService execService
+ = (ExecService) sharedContext.getCoreService(ExecService.class);
+ execService.runBuild(proxyBuildKey, targets);
+ } catch (AntException e) {
+ throw new BuildException(e.getMessage(), e);
+ }
}
/**
@@ -306,8 +479,8 @@
public void setProperty(String name, String value) {
try {
dataService.setMutableDataValue(name, value);
- } catch (ExecutionException e) {
- throw new BuildException(e);
+ } catch (AntException e) {
+ throw new BuildException(e.getMessage(), e);
}
}
@@ -318,10 +491,16 @@
* @param value the property value
*/
public void setNewProperty(String name, String value) {
+ if (dataService == null) {
+ if (!proxyProperties.containsKey(name)) {
+ proxyProperties.put(name, value);
+ }
+ return;
+ }
try {
dataService.setDataValue(name, value);
- } catch (ExecutionException e) {
- throw new BuildException(e);
+ } catch (AntException e) {
+ throw new BuildException(e.getMessage(), e);
}
}
@@ -333,10 +512,15 @@
* @param value the property value
*/
public void setUserProperty(String name, String value) {
+ if (dataService == null) {
+ proxyProperties.put(name, value);
+ return;
+ }
+
try {
dataService.setMutableDataValue(name, value);
- } catch (ExecutionException e) {
- throw new BuildException(e);
+ } catch (AntException e) {
+ throw new BuildException(e.getMessage(), e);
}
}
@@ -467,8 +651,8 @@
try {
Object value = dataService.getDataValue(name);
return value == null ? null : value.toString();
- } catch (ExecutionException e) {
- throw new BuildException(e);
+ } catch (AntException e) {
+ throw new BuildException(e.getMessage(), e);
}
}
@@ -482,8 +666,8 @@
public String getUserProperty(String name) {
try {
return dataService.getDataValue(name).toString();
- } catch (ExecutionException e) {
- throw new BuildException(e);
+ } catch (AntException e) {
+ throw new BuildException(e.getMessage(), e);
}
}
@@ -497,8 +681,8 @@
public Object getReference(String refId) {
try {
return dataService.getDataValue(refId);
- } catch (ExecutionException e) {
- throw new BuildException(e);
+ } catch (AntException e) {
+ throw new BuildException(e.getMessage(), e);
}
}
@@ -585,6 +769,7 @@
* @since 1.102, Ant 1.5
*/
public void registerThreadTask(Thread thread, Task task) {
+// XXX
// if (task != null) {
// threadTasks.put(thread, task);
// } else {
@@ -601,7 +786,7 @@
*/
public Task getThreadTask(Thread thread) {
return null;
- // return (Task)threadTasks.get(thread);
+ // return (Task)threadTasks.get(thread); XXX
}
/**
@@ -655,6 +840,10 @@
* @param event task started event
*/
public void taskStarted(org.apache.ant.common.event.BuildEvent event) {
+ Object source = event.getSource();
+ if (source instanceof Task) {
+ fireTaskStarted((Task) source);
+ }
}
/**
@@ -663,6 +852,10 @@
* @param event task finished event
*/
public void taskFinished(org.apache.ant.common.event.BuildEvent event) {
+ Object source = event.getSource();
+ if (source instanceof Task) {
+ fireTaskFinished((Task) source, event.getCause());
+ }
}
/**
@@ -671,6 +864,14 @@
* @param event message logged event
*/
public void messageLogged(org.apache.ant.common.event.BuildEvent event) {
+ Object source = event.getSource();
+ if (source instanceof Task) {
+ fireMessageLogged((Task) source, event.getMessage(),
+ event.getPriority());
+ } else {
+ fireMessageLogged(this, event.getMessage(),
+ event.getPriority());
+ }
}
/**
@@ -679,8 +880,12 @@
* @param listener the listener to be added to the project
*/
public void addBuildListener(BuildListener listener) {
+ if (subordinate != null) {
+ subordinate.addBuildListener(listener);
+ } else {
listeners.addElement(listener);
}
+ }
/**
* remove a build listener from this project
@@ -701,8 +906,8 @@
public void addReference(String name, Object value) {
try {
dataService.setDataValue(name, value);
- } catch (ExecutionException e) {
- throw new BuildException(e);
+ } catch (AntException e) {
+ throw new BuildException(e.getMessage(), e);
}
}
@@ -849,83 +1054,104 @@
filtering ? globalFilters : null, overwrite, preserveLastModified);
}
+
+
/**
- * Initialise this porject
+ * Initialise this project
*
* @param context the context the project uses to access core services
- * @exception ExecutionException if the project cannot be initialised.
+ * @exception AntException if the project cannot be initialised.
*/
- public void init(AntContext context) throws ExecutionException {
- this.context = context;
- fileService = (FileService) context.getCoreService(FileService.class);
- dataService = (DataService) context.getCoreService(DataService.class);
- execService = (ExecService) context.getCoreService(ExecService.class);
- componentService = (ComponentService)
- context.getCoreService(ComponentService.class);
-
- InputService inputService
- = (InputService) context.getCoreService(InputService.class);
- setInputHandler(new Ant1InputHandler(inputService));
-
- String defs = "/org/apache/tools/ant/taskdefs/defaults.properties";
-
- try {
- Properties props = new Properties();
- InputStream in = this.getClass().getResourceAsStream(defs);
- if (in == null) {
- throw new BuildException("Can't load default task list");
+ public void init(AntContext context) throws AntException {
+ initContext(context);
+ Object proxy = dataService.getDataValue(PROXY_KEY);
+ if (proxy != null) {
+ Project proxyProject = (Project) proxy;
+ proxyProject.setSubordinate(this);
+ }
+ init();
}
- props.load(in);
- in.close();
- Enumeration enum = props.propertyNames();
- while (enum.hasMoreElements()) {
- String key = (String) enum.nextElement();
- String value = props.getProperty(key);
- try {
- Class taskClass = Class.forName(value);
- taskClassDefinitions.put(key, taskClass);
- } catch (NoClassDefFoundError ncdfe) {
- log("Could not load a dependent class ("
- + ncdfe.getMessage() + ") for task " + key, MSG_DEBUG);
- } catch (ClassNotFoundException cnfe) {
- log("Could not load class (" + value
- + ") for task " + key, MSG_DEBUG);
+ /**
+ * Connect this project to its subordinate.
+ *
+ * When the subordinate project is created it will call this method to
+ * inform this project. The core services are then initialised using the
+ * context of the subordinate project
+ *
+ * @param subordinate the subordinate project
+ *
+ * @exception AntException if there is a problem configuring this project to
+ * use the subordinate's context.
+ */
+ private void setSubordinate(Project subordinate) throws AntException {
+ initContext(subordinate.getContext());
+ // add our listeners to the subordinate
+ for (Iterator i = listeners.iterator(); i.hasNext();) {
+ BuildListener listener = (BuildListener) i.next();
+ subordinate.addBuildListener(listener);
}
+ if (baseDir != null) {
+ execService.setBaseDir(baseDir);
}
- } catch (IOException ioe) {
- throw new BuildException("Can't load default task list");
+ this.subordinate = subordinate;
}
- String dataDefs = "/org/apache/tools/ant/types/defaults.properties";
-
- try {
- Properties props = new Properties();
- InputStream in = this.getClass().getResourceAsStream(dataDefs);
- if (in == null) {
- throw new BuildException("Can't load default datatype list");
+ /**
+ * Sets the base directory for the project, checking that
+ * the given filename exists and is a directory.
+ *
+ * @param baseDir The project base directory.
+ * Must not be <code>null</code>.
+ *
+ * @exception BuildException if the directory if invalid
+ */
+ public void setBasedir(String baseDir) throws BuildException {
+ setBaseDir(new File(baseDir));
}
- props.load(in);
- in.close();
- Enumeration enum = props.propertyNames();
- while (enum.hasMoreElements()) {
- String key = (String) enum.nextElement();
- String value = props.getProperty(key);
+ /**
+ * Sets the base directory for the project, checking that
+ * the given file exists and is a directory.
+ *
+ * @param baseDir The project base directory.
+ * Must not be <code>null</code>.
+ * @exception BuildException if the specified file doesn't exist or
+ * isn't a directory
+ */
+ public void setBaseDir(File baseDir) throws BuildException {
try {
- Class dataClass = Class.forName(value);
- dataClassDefinitions.put(key, dataClass);
- } catch (NoClassDefFoundError ncdfe) {
- log("Could not load a dependent class ("
- + ncdfe.getMessage() + ") for type " + key, MSG_DEBUG);
- } catch (ClassNotFoundException cnfe) {
- log("Could not load class (" + value
- + ") for type " + key, MSG_DEBUG);
+ if (execService != null) {
+ execService.setBaseDir(baseDir);
}
+ this.baseDir = baseDir;
+ proxyProperties.put("basedir", baseDir.getPath());
+ } catch (AntException e) {
+ throw new BuildException(e.getMessage(), e);
}
- } catch (IOException ioe) {
- throw new BuildException("Can't load default datatype list");
}
+
+ /**
+ * Initialise the context related parts of this project
+ *
+ * @param context the context the project uses to access core services
+ * @exception AntException if the project cannot be initialised.
+ */
+ public void initContext(AntContext context) throws AntException {
+ this.context = context;
+ if (sharedContext == null) {
+ sharedContext = context;
+ }
+
+ fileService = (FileService) context.getCoreService(FileService.class);
+ dataService = (DataService) context.getCoreService(DataService.class);
+ execService = (ExecService) context.getCoreService(ExecService.class);
+ componentService = (ComponentService)
+ context.getCoreService(ComponentService.class);
+
+ InputService inputService
+ = (InputService) context.getCoreService(InputService.class);
+ setInputHandler(new Ant1InputHandler(inputService));
}
/**
@@ -946,7 +1172,11 @@
* @param msgLevel level to log at
*/
public void log(String msg, int msgLevel) {
+ if (context != null) {
context.log(msg, msgLevel);
+ } else {
+ sharedContext.log(msg, msgLevel);
+ }
}
/**
@@ -976,7 +1206,33 @@
* @param msgLevel level to log at
*/
public void log(Task task, String msg, int msgLevel) {
+ if (context != null) {
context.log(msg, msgLevel);
+ } else {
+ sharedContext.log(msg, msgLevel);
+ }
+ }
+
+
+ /**
+ * Returns the canonical form of a filename.
+ * <p>
+ * If the specified file name is relative it is resolved
+ * with respect to the given root directory.
+ *
+ * @param fileName The name of the file to resolve.
+ * Must not be <code>null</code>.
+ *
+ * @param rootDir The directory to resolve relative file names with
+ * respect to. May be <code>null</code>, in which case
+ * the current directory is used.
+ *
+ * @return the resolved File.
+ *
+ * @deprecated
+ */
+ public File resolveFile(String fileName, File rootDir) {
+ return fileUtils.resolveFile(rootDir, fileName);
}
/**
@@ -988,8 +1244,8 @@
public File resolveFile(String fileName) {
try {
return fileService.resolveFile(fileName);
- } catch (ExecutionException e) {
- throw new BuildException(e);
+ } catch (AntException e) {
+ throw new BuildException(e.getMessage(), e);
}
}
@@ -1002,8 +1258,8 @@
public String replaceProperties(String value) {
try {
return dataService.replacePropertyRefs(value);
- } catch (ExecutionException e) {
- throw new BuildException(e);
+ } catch (AntException e) {
+ throw new BuildException(e.getMessage(), e);
}
}
@@ -1020,8 +1276,8 @@
componentService.taskdef(factory, taskClass.getClassLoader(),
taskName, taskClass.getName());
taskClassDefinitions.put(taskName, taskClass);
- } catch (ExecutionException e) {
- throw new BuildException(e);
+ } catch (AntException e) {
+ throw new BuildException(e.getMessage(), e);
}
}
@@ -1036,8 +1292,8 @@
componentService.typedef(factory, typeClass.getClassLoader(),
typeName, typeClass.getName());
dataClassDefinitions.put(typeName, typeClass);
- } catch (ExecutionException e) {
- throw new BuildException(e);
+ } catch (AntException e) {
+ throw new BuildException(e.getMessage(), e);
}
}
@@ -1070,7 +1326,7 @@
task.setTaskName(taskType);
return task;
} catch (Throwable e) {
- throw new BuildException(e);
+ throw new BuildException(e.getMessage(), e);
}
}
@@ -1094,7 +1350,7 @@
try {
return componentService.createComponent(typeName);
} catch (Throwable e) {
- throw new BuildException(e);
+ throw new BuildException(e.getMessage(), e);
}
}
1.7 +4 -4 jakarta-ant/proposal/mutant/src/java/antlibs/ant1compat/org/apache/tools/ant/ProjectComponent.java
Index: ProjectComponent.java
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/mutant/src/java/antlibs/ant1compat/org/apache/tools/ant/ProjectComponent.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -w -u -r1.6 -r1.7
--- ProjectComponent.java 5 Apr 2002 14:31:16 -0000 1.6
+++ ProjectComponent.java 27 May 2002 15:52:22 -0000 1.7
@@ -54,7 +54,7 @@
package org.apache.tools.ant;
import org.apache.ant.common.antlib.AntContext;
-import org.apache.ant.common.util.ExecutionException;
+import org.apache.ant.common.util.AntException;
/**
* ProjectComponent facade
@@ -113,10 +113,10 @@
*
* @param context the core context for this component
* @param componentType the component type of this component
- * @exception ExecutionException if the component cannot be initialized
+ * @exception AntException if the component cannot be initialized
*/
public void init(AntContext context, String componentType)
- throws ExecutionException {
+ throws AntException {
this.context = context;
this.componentType = componentType;
1.5 +7 -9 jakarta-ant/proposal/mutant/src/java/antlibs/ant1compat/org/apache/tools/ant/ProjectHelper.java
Index: ProjectHelper.java
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/mutant/src/java/antlibs/ant1compat/org/apache/tools/ant/ProjectHelper.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -w -u -r1.4 -r1.5
--- ProjectHelper.java 7 Apr 2002 14:38:06 -0000 1.4
+++ ProjectHelper.java 27 May 2002 15:52:22 -0000 1.5
@@ -58,7 +58,6 @@
import org.apache.ant.common.antlib.AntContext;
import org.apache.ant.common.service.DataService;
import org.apache.ant.common.util.AntException;
-import org.apache.ant.common.util.ExecutionException;
import org.apache.ant.common.util.PropertyUtils;
/**
@@ -106,7 +105,7 @@
DataService dataService
= (DataService) context.getCoreService(DataService.class);
return dataService.replacePropertyRefs(value);
- } catch (ExecutionException e) {
+ } catch (AntException e) {
throw new BuildException(e);
}
}
@@ -128,7 +127,7 @@
DataService dataService
= (DataService) context.getCoreService(DataService.class);
return dataService.replacePropertyRefs(value, keys);
- } catch (ExecutionException e) {
+ } catch (AntException e) {
throw new BuildException(e);
}
}
@@ -145,8 +144,7 @@
*/
public static void configureProject(Project project, File buildFile)
throws BuildException {
- throw new BuildException("Project are not built by ProjectHelper "
- + "any longer.");
+ project.configure(buildFile);
}
}
1.15 +12 -12 jakarta-ant/proposal/mutant/src/java/antlibs/ant1compat/org/apache/tools/ant/Task.java
Index: Task.java
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/mutant/src/java/antlibs/ant1compat/org/apache/tools/ant/Task.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -w -u -r1.14 -r1.15
--- Task.java 7 Apr 2002 14:38:06 -0000 1.14
+++ Task.java 27 May 2002 15:52:22 -0000 1.15
@@ -55,7 +55,7 @@
import org.apache.ant.common.antlib.AntContext;
import org.apache.ant.common.service.ExecService;
-import org.apache.ant.common.util.ExecutionException;
+import org.apache.ant.common.util.AntException;
/**
* Ant1 Task facade
@@ -159,10 +159,10 @@
* Add a nested task to this Ant1 task.
*
* @param task The task to be added
- * @exception ExecutionException if the task cannot be added.
+ * @exception AntException if the task cannot be added.
*/
public void addNestedTask(org.apache.ant.common.antlib.Task task)
- throws ExecutionException {
+ throws AntException {
if (!(this instanceof TaskContainer)) {
throw new BuildException("Can't add tasks to this task");
@@ -185,10 +185,10 @@
*
* @param context the core context for this component
* @param componentType the component type of this component
- * @exception ExecutionException if the component cannot be initialized
+ * @exception AntException if the component cannot be initialized
*/
public void init(AntContext context, String componentType)
- throws ExecutionException {
+ throws AntException {
super.init(context, componentType);
taskType = componentType;
@@ -225,7 +225,7 @@
ExecService execService
= (ExecService) context.getCoreService(ExecService.class);
execService.executeTask(this);
- } catch (ExecutionException e) {
+ } catch (AntException e) {
throw new BuildException(e);
}
}
1.1 jakarta-ant/proposal/mutant/src/java/antlibs/ant1compat/org/apache/tools/ant/Ant1CompatException.java
Index: Ant1CompatException.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 apache@apache.org.
*
* 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.tools.ant;
import org.apache.ant.common.util.Location;
import org.apache.ant.common.util.AntException;
/**
* An exception in the Ant1 compatability layer.
*
* @author Conor MacNeill
*/
public class Ant1CompatException extends AntException {
/**
* Constructs an exception with the given descriptive message.
*
* @param msg Description of or information about the exception.
*/
public Ant1CompatException(String msg) {
super(msg);
}
/**
* Constructs an exception with the given descriptive message and a
* location in a file.
*
* @param msg Description of or information about the exception.
* @param location Location in the project file where the error occured.
*/
public Ant1CompatException(String msg, Location location) {
super(msg, location);
}
/**
* Constructs an exception with the given message and exception as a
* root cause.
*
* @param msg Description of or information about the exception.
* @param cause Throwable that might have cause this one.
*/
public Ant1CompatException(String msg, Throwable cause) {
super(msg, cause);
}
/**
* Constructs an exception with the given message and exception as a
* root cause and a location in a file.
*
* @param msg Description of or information about the exception.
* @param cause Exception that might have cause this one.
* @param location Location in the project file where the error occured.
*/
public Ant1CompatException(String msg, Throwable cause,
Location location) {
super(msg, cause, location);
}
/**
* Constructs an exception with the given exception as a root cause.
*
* @param cause Exception that might have caused this one.
*/
public Ant1CompatException(Throwable cause) {
super(cause);
}
/**
* Constructs an exception with the given exception as a root cause and
* a location in a file.
*
* @param cause Exception that might have cause this one.
* @param location Location in the project file where the error occured.
*/
public Ant1CompatException(Throwable cause, Location location) {
super(cause, location);
}
}
1.9 +8 -8 jakarta-ant/proposal/mutant/src/java/antlibs/ant1compat/org/apache/tools/ant/taskdefs/Ant.java
Index: Ant.java
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/mutant/src/java/antlibs/ant1compat/org/apache/tools/ant/taskdefs/Ant.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -w -u -r1.8 -r1.9
--- Ant.java 14 May 2002 15:11:09 -0000 1.8
+++ Ant.java 27 May 2002 15:52:24 -0000 1.9
@@ -60,7 +60,7 @@
import org.apache.ant.common.antlib.AntContext;
import org.apache.ant.common.antlib.AntLibFactory;
import org.apache.ant.common.service.ComponentService;
-import org.apache.ant.common.util.ExecutionException;
+import org.apache.ant.common.util.AntException;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Task;
@@ -147,7 +147,7 @@
AntLibFactory factory = getProject().getFactory();
realAnt = (org.apache.ant.antlib.system.Ant)
componentService.createComponent("ant.system", "ant");
- } catch (ExecutionException e) {
+ } catch (AntException e) {
throw new BuildException(e);
}
}
@@ -169,7 +169,7 @@
}
try {
realAnt.execute();
- } catch (ExecutionException e) {
+ } catch (AntException e) {
throw new BuildException(e);
}
}
@@ -194,7 +194,7 @@
public void addReference(AntBase.Reference r) {
try {
realAnt.addReference(r);
- } catch (ExecutionException e) {
+ } catch (AntException e) {
throw new BuildException(e);
}
}
@@ -203,9 +203,9 @@
* Gets the componentService
*
* @return the componentService instance provided by the core
- * @exception ExecutionException if the service is not available.
+ * @exception AntException if the service is not available.
*/
- private ComponentService getComponentService() throws ExecutionException {
+ private ComponentService getComponentService() throws AntException {
AntContext context = getAntContext();
return (ComponentService)
context.getCoreService(ComponentService.class);
1.8 +7 -7 jakarta-ant/proposal/mutant/src/java/antlibs/ant1compat/org/apache/tools/ant/taskdefs/CallTarget.java
Index: CallTarget.java
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/mutant/src/java/antlibs/ant1compat/org/apache/tools/ant/taskdefs/CallTarget.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -w -u -r1.7 -r1.8
--- CallTarget.java 14 May 2002 15:11:09 -0000 1.7
+++ CallTarget.java 27 May 2002 15:52:24 -0000 1.8
@@ -60,7 +60,7 @@
import org.apache.ant.common.antlib.AntContext;
import org.apache.ant.common.antlib.AntLibFactory;
import org.apache.ant.common.service.ComponentService;
-import org.apache.ant.common.util.ExecutionException;
+import org.apache.ant.common.util.AntException;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Task;
@@ -104,7 +104,7 @@
AntLibFactory factory = getProject().getFactory();
antCall = (AntCall) componentService.createComponent("ant.system",
"antcall");
- } catch (ExecutionException e) {
+ } catch (AntException e) {
throw new BuildException(e);
}
}
@@ -120,7 +120,7 @@
}
try {
antCall.execute();
- } catch (ExecutionException e) {
+ } catch (AntException e) {
throw new BuildException(e);
}
}
@@ -145,7 +145,7 @@
public void addReference(AntBase.Reference r) {
try {
antCall.addReference(r);
- } catch (ExecutionException e) {
+ } catch (AntException e) {
throw new BuildException(e);
}
}
@@ -154,9 +154,9 @@
* Gets the componentService
*
* @return the componentService instance provided by the core
- * @exception ExecutionException if the service is not available.
+ * @exception AntException if the service is not available.
*/
- private ComponentService getComponentService() throws ExecutionException {
+ private ComponentService getComponentService() throws AntException {
AntContext context = getAntContext();
return
(ComponentService) context.getCoreService(ComponentService.class);
1.1 jakarta-ant/proposal/mutant/src/java/antlibs/monitor/antlib.xml
Index: antlib.xml
===================================================================
<antlib libid="antopt.monitor"
home="http://jakarta.apache.org/ant">
<aspect classname="org.apache.ant.antlib.monitor.MonitorAspect"/>
</antlib>
1.1 jakarta-ant/proposal/mutant/src/java/antlibs/monitor/org/apache/ant/antlib/monitor/MonitorAspect.java
Index: MonitorAspect.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 apache@apache.org.
*
* 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.antlib.monitor;
import org.apache.ant.common.antlib.AbstractAspect;
import org.apache.ant.common.antlib.Task;
import org.apache.ant.common.model.BuildElement;
import org.apache.ant.common.model.AspectValueCollection;
import org.apache.ant.common.util.AntException;
import org.apache.ant.common.event.MessageLevel;
import java.util.Date;
import java.io.PrintStream;
import java.io.FileOutputStream;
import java.io.IOException;
/**
* A monitoring aspect to help understand memory and performance
* characteristics.
*
* @author Conor MacNeill
*/
public class MonitorAspect extends AbstractAspect {
private static PrintStream monitorLog;
private static long lastMessageTime;
public MonitorAspect() {
if (monitorLog == null) {
try {
monitorLog
= new PrintStream(new FileOutputStream("monitor.log"));
monitorLog.println("Logging started at " + new Date());
lastMessageTime = System.currentTimeMillis();
} catch (IOException e) {
log("Unable to open monitor log", MessageLevel.MSG_WARN);
}
}
}
private void monitor(String message) {
Runtime rt = Runtime.getRuntime();
synchronized (monitorLog) {
long now = System.currentTimeMillis();
long diff = now - lastMessageTime;
lastMessageTime = now;
long freeMem = rt.freeMemory();
long usedMem = rt.totalMemory() - freeMem;
monitorLog.println("+" + diff + " (" + usedMem + "/"
+ freeMem + "): " + message);
}
}
/**
* This join point is activated before a component is to be created.
* The aspect can return an object to be used rather than the core creating
* the object.
*
* @param component the component that has been created. This will be null
* unless another aspect has created the component
* @param model the Build model that applies to the component
*
* @return a component to use.
* @exception AntException if the aspect cannot process the component.
*/
public Object preCreateComponent(Object component, BuildElement model)
throws AntException {
monitor("Creating component " + "from <" + model.getType() + ">");
return component;
}
/**
* This join point is activated after a component has been created and
* configured. If the aspect wishes, an object can be returned in place
* of the one created by Ant.
*
* @param component the component that has been created.
* @param model the Build model used to create the component.
*
* @return a replacement for the component if desired. If null is returned
* the current component is used.
* @exception AntException if the aspect cannot process the component.
*/
public Object postCreateComponent(Object component, BuildElement model)
throws AntException {
monitor("Created component "
+ component.getClass().getName()
+ " from <" + model.getType() + ">");
return component;
}
/**
* 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
* provided.
* @return an object which indicates that this aspect wishes to
* be notified after execution has been completed, in which case the obkect
* is returned to provide the aspect its context. If this returns null
* 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)
throws AntException {
String taskName = task.getClass().getName();
MonitorRecord record = new MonitorRecord(taskName);
return record;
}
/**
* This join point is activated after a task has executed. The aspect
* may override the task's failure cause by returning a new failure.
*
* @param context the context the aspect provided in preExecuteTask.
* @param failureCause the current failure reason for the task.
*
* @return a new failure reason or null if the task is not to fail.
*/
public Throwable postExecuteTask(Object context, Throwable failureCause) {
MonitorRecord record = (MonitorRecord)context;
record.print(monitorLog);
System.gc();
return failureCause;
}
}
1.1 jakarta-ant/proposal/mutant/src/java/antlibs/monitor/org/apache/ant/antlib/monitor/MonitorRecord.java
Index: MonitorRecord.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 apache@apache.org.
*
* 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.antlib.monitor;
import org.apache.ant.common.antlib.AbstractAspect;
import org.apache.ant.common.antlib.Task;
import org.apache.ant.common.model.BuildElement;
import org.apache.ant.common.model.AspectValueCollection;
import org.apache.ant.common.util.AntException;
import org.apache.ant.common.event.MessageLevel;
import java.util.Date;
import java.io.PrintStream;
import java.io.FileOutputStream;
import java.io.IOException;
/**
* A record of some performance values at a particular time
*
* @author Conor MacNeill
*/
public class MonitorRecord {
private String recordName;
private long startMillis;
private long startMemory;
private long getMemoryUsage() {
Runtime rt = Runtime.getRuntime();
return rt.totalMemory() - rt.freeMemory();
}
public MonitorRecord(String recordName) {
this.recordName = recordName;
startMillis = System.currentTimeMillis();
startMemory = getMemoryUsage();
}
public void print(PrintStream stream) {
long timeDiff = System.currentTimeMillis() - startMillis;
long memDiff = getMemoryUsage() - startMemory;
stream.println(recordName + " took " + timeDiff
+ " milliseconds and memory used changed by " + memDiff);
}
}
1.8 +9 -10 jakarta-ant/proposal/mutant/src/java/antlibs/script/org/apache/ant/antlib/script/ScriptBase.java
Index: ScriptBase.java
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/mutant/src/java/antlibs/script/org/apache/ant/antlib/script/ScriptBase.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -w -u -r1.7 -r1.8
--- ScriptBase.java 7 Apr 2002 14:38:06 -0000 1.7
+++ ScriptBase.java 27 May 2002 15:52:24 -0000 1.8
@@ -62,7 +62,6 @@
import java.util.Map;
import org.apache.ant.common.antlib.AbstractTask;
import org.apache.ant.common.antlib.DeferredTask;
-import org.apache.ant.common.util.ExecutionException;
import org.apache.ant.common.antlib.AntContext;
/**
@@ -113,9 +112,9 @@
/**
* Execute the script
*
- * @exception ExecutionException if tghe script execution fails
+ * @exception ScriptException if tghe script execution fails
*/
- public void execute() throws ExecutionException {
+ public void execute() throws ScriptException {
String language = factory.getScriptLanguage(scriptName);
String script = factory.getScript(scriptName);
@@ -151,13 +150,13 @@
Throwable t = e;
Throwable te = e.getTargetException();
if (te != null) {
- if (te instanceof ExecutionException) {
- throw (ExecutionException) te;
+ if (te instanceof ScriptException) {
+ throw (ScriptException) te;
} else {
t = te;
}
}
- throw new ExecutionException(t);
+ throw new ScriptException(t);
}
}
1.3 +3 -3 jakarta-ant/proposal/mutant/src/java/antlibs/script/org/apache/ant/antlib/script/ScriptDef.java
Index: ScriptDef.java
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/mutant/src/java/antlibs/script/org/apache/ant/antlib/script/ScriptDef.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -w -u -r1.2 -r1.3
--- ScriptDef.java 18 Mar 2002 02:44:26 -0000 1.2
+++ ScriptDef.java 27 May 2002 15:52:24 -0000 1.3
@@ -54,7 +54,7 @@
package org.apache.ant.antlib.script;
import org.apache.ant.common.antlib.AbstractTask;
-import org.apache.ant.common.util.ExecutionException;
+import org.apache.ant.common.util.AntException;
/**
* Define a task using a script
@@ -98,9 +98,9 @@
* Define the script. The script itself is stored in the factory where
* it is retried by the ScriptBase instance
*
- * @exception ExecutionException if the script cannot be defined
+ * @exception AntException if the script cannot be defined
*/
- public void execute() throws ExecutionException {
+ public void execute() throws AntException {
// tell the factory about this script, under this name.
factory.defineScript(name, language, script);
}
1.5 +10 -11 jakarta-ant/proposal/mutant/src/java/antlibs/script/org/apache/ant/antlib/script/ScriptFactory.java
Index: ScriptFactory.java
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/mutant/src/java/antlibs/script/org/apache/ant/antlib/script/ScriptFactory.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -w -u -r1.4 -r1.5
--- ScriptFactory.java 7 Apr 2002 14:38:06 -0000 1.4
+++ ScriptFactory.java 27 May 2002 15:52:24 -0000 1.5
@@ -58,7 +58,7 @@
import org.apache.ant.common.antlib.AntContext;
import org.apache.ant.common.antlib.StandardLibFactory;
import org.apache.ant.common.service.ComponentService;
-import org.apache.ant.common.util.ExecutionException;
+import org.apache.ant.common.util.AntException;
/**
* The ScriptFactory class is a factory for the Scripting tasks. It stores
@@ -120,19 +120,19 @@
* Initialise the factory
*
* @param context the factory's context
- * @exception ExecutionException if the factory cannot be initialized
+ * @exception AntException if the factory cannot be initialized
*/
- public void init(AntContext context) throws ExecutionException {
+ public void init(AntContext context) throws AntException {
super.init(context);
componentService = (ComponentService)
context.getCoreService(ComponentService.class);
try {
Class.forName("com.ibm.bsf.BSFManager");
} catch (ClassNotFoundException e) {
- throw new ExecutionException("The script Ant library requires "
+ throw new ScriptException("The script Ant library requires "
+ "bsf.jar to be available");
} catch (NoClassDefFoundError e) {
- throw new ExecutionException("The script Ant library requires "
+ throw new ScriptException("The script Ant library requires "
+ "bsf.jar to be available. The class " + e.getMessage()
+ "appears to be missing");
}
@@ -147,11 +147,10 @@
* @return an instance of the required class
* @exception InstantiationException if the class cannot be instantiated
* @exception IllegalAccessException if the instance cannot be accessed
- * @exception ExecutionException if there is a problem creating the task
+ * @exception AntException if there is a problem creating the task
*/
public Object createComponent(Class componentClass, String localName)
- throws InstantiationException, IllegalAccessException,
- ExecutionException {
+ throws InstantiationException, IllegalAccessException, AntException {
Object component = super.createComponent(componentClass, localName);
if (component instanceof ScriptDef) {
@@ -193,10 +192,10 @@
* @param name the name the script is to be defined under
* @param language the language of the scripr
* @param script the script text
- * @exception ExecutionException if the script cannot be defined
+ * @exception AntException if the script cannot be defined
*/
protected void defineScript(String name, String language, String script)
- throws ExecutionException {
+ throws AntException {
ScriptInfo scriptDefinition = new ScriptInfo(language, script);
scripts.put(name, scriptDefinition);
componentService.taskdef(this, ScriptBase.class.getClassLoader(),
1.1 jakarta-ant/proposal/mutant/src/java/antlibs/script/org/apache/ant/antlib/script/ScriptException.java
Index: ScriptException.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 apache@apache.org.
*
* 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.antlib.script;
import org.apache.ant.common.util.Location;
import org.apache.ant.common.util.AntException;
/**
* A Script related exception
*
* @author Conor MacNeill
*/
public class ScriptException extends AntException {
/**
* Constructs an exception with the given descriptive message.
*
* @param msg Description of or information about the exception.
*/
public ScriptException(String msg) {
super(msg);
}
/**
* Constructs an exception with the given descriptive message and a
* location in a file.
*
* @param msg Description of or information about the exception.
* @param location Location in the project file where the error occured.
*/
public ScriptException(String msg, Location location) {
super(msg, location);
}
/**
* Constructs an exception with the given message and exception as a
* root cause.
*
* @param msg Description of or information about the exception.
* @param cause Throwable that might have cause this one.
*/
public ScriptException(String msg, Throwable cause) {
super(msg, cause);
}
/**
* Constructs an exception with the given message and exception as a
* root cause and a location in a file.
*
* @param msg Description of or information about the exception.
* @param cause Exception that might have cause this one.
* @param location Location in the project file where the error occured.
*/
public ScriptException(String msg, Throwable cause,
Location location) {
super(msg, cause, location);
}
/**
* Constructs an exception with the given exception as a root cause.
*
* @param cause Exception that might have caused this one.
*/
public ScriptException(Throwable cause) {
super(cause);
}
/**
* Constructs an exception with the given exception as a root cause and
* a location in a file.
*
* @param cause Exception that might have cause this one.
* @param location Location in the project file where the error occured.
*/
public ScriptException(Throwable cause, Location location) {
super(cause, location);
}
}
1.10 +41 -8 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.9
retrieving revision 1.10
diff -u -w -u -r1.9 -r1.10
--- Ant.java 17 Apr 2002 15:51:06 -0000 1.9
+++ Ant.java 27 May 2002 15:52:24 -0000 1.10
@@ -53,11 +53,18 @@
*/
package org.apache.ant.antlib.system;
import java.io.File;
+import java.io.PrintStream;
+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;
-import org.apache.ant.common.util.ExecutionException;
+import org.apache.ant.common.util.AntException;
import org.apache.ant.common.util.FileUtils;
+import org.apache.ant.common.logger.DefaultLogger;
+import org.apache.ant.common.event.MessageLevel;
/**
* The Ant task - used to execute a different build file
@@ -71,7 +78,7 @@
/** the base directory to use for the run */
private File baseDir;
/** File to capture any output */
- private File outputFile;
+ private String output;
/**
@@ -97,19 +104,19 @@
/**
* The output file for capturing the build output
*
- * @param outputFile the output file for capturing the build output
+ * @param output the output file for capturing the build output
*/
- public void setOutput(File outputFile) {
- this.outputFile = outputFile;
+ public void setOutput(String output) {
+ this.output = output;
}
/**
* Run the sub-build
*
- * @exception ExecutionException if the build can't be run
+ * @exception AntException if the build can't be run
*/
- public void execute() throws ExecutionException {
+ public void execute() throws AntException {
if (baseDir == null) {
baseDir = getExecService().getBaseDir();
}
@@ -130,10 +137,36 @@
ExecService execService = getExecService();
Project model = execService.parseXMLBuildFile(antFile);
- Object key = execService.setupBuild(model, getProperties());
+ BuildKey key = execService.setupBuild(model, getProperties(), true);
setSubBuildKey(key);
+
+ if (output != null) {
+ FileService fileService
+ = (FileService) getCoreService(FileService.class);
+
+ File outfile = null;
+ if (baseDir != null) {
+ outfile = FileUtils.newFileUtils().resolveFile(baseDir, output);
+ } else {
+ outfile = fileService.resolveFile(output);
+ }
+ try {
+ PrintStream out
+ = new PrintStream(new FileOutputStream(outfile));
+ DefaultLogger logger = new DefaultLogger();
+ logger.setMessageOutputLevel(MessageLevel.MSG_INFO);
+ logger.setOutputPrintStream(out);
+ logger.setErrorPrintStream(out);
+ execService.addBuildListener(key, logger);
+ } catch (IOException ex) {
+ log("Ant: Can't set output to " + output,
+ MessageLevel.MSG_INFO);
+ }
+ }
+
execService.runBuild(key, getTargets());
+ execService.releaseBuild(key);
}
}
1.4 +33 -32 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.3
retrieving revision 1.4
diff -u -w -u -r1.3 -r1.4
--- AntAspect.java 17 May 2002 12:20:38 -0000 1.3
+++ AntAspect.java 27 May 2002 15:52:24 -0000 1.4
@@ -57,9 +57,10 @@
import org.apache.ant.common.antlib.AbstractAspect;
import org.apache.ant.common.antlib.AntContext;
import org.apache.ant.common.antlib.Task;
+import org.apache.ant.common.antlib.AspectException;
import org.apache.ant.common.service.DataService;
import org.apache.ant.common.service.ComponentService;
-import org.apache.ant.common.util.ExecutionException;
+import org.apache.ant.common.util.AntException;
import org.apache.ant.common.model.BuildElement;
import org.apache.ant.common.model.AspectValueCollection;
@@ -82,9 +83,9 @@
* Initialise the aspect with a context.
*
* @param context the aspect's context
- * @exception ExecutionException if the aspect cannot be initialised
+ * @exception AntException if the aspect cannot be initialised
*/
- public void init(AntContext context) throws ExecutionException {
+ public void init(AntContext context) throws AntException {
super.init(context);
dataService = (DataService) context.getCoreService(DataService.class);
componentService
@@ -102,23 +103,23 @@
* @param model the Build model that applies to the component
*
* @return a component to use.
- * @exception ExecutionException if the aspect cannot process the component.
+ * @exception AntException if the aspect cannot process the component.
*/
public Object preCreateComponent(Object component, BuildElement model)
- throws ExecutionException {
+ throws AntException {
String refId = model.getAspectAttributeValue(ANT_ASPECT, "refid");
if (refId != null) {
if (model.getAttributeNames().hasNext() ||
model.getNestedElements().hasNext() ||
model.getText().length() != 0) {
- throw new ExecutionException("Element <" + model.getType()
+ throw new AspectException("Element <" + model.getType()
+ "> is defined by reference and hence may not specify "
+ "any attributes, nested elements or content",
model.getLocation());
}
Object referredComponent = dataService.getDataValue(refId);
if (referredComponent == null) {
- throw new ExecutionException("The given ant:refid value '"
+ throw new AspectException("The given ant:refid value '"
+ refId + "' is not defined", model.getLocation());
}
return referredComponent;
@@ -136,10 +137,10 @@
*
* @return a replacement for the component if desired. If null is returned
* the current component is used.
- * @exception ExecutionException if the component cannot be processed.
+ * @exception AntException if the component cannot be processed.
*/
public Object postCreateComponent(Object component, BuildElement model)
- throws ExecutionException {
+ throws AntException {
String typeId = model.getAspectAttributeValue(ANT_ASPECT, "id");
if (typeId != null) {
@@ -160,10 +161,10 @@
* be notified after execution has been completed, in which case the obkect
* is returned to provide the aspect its context. If this returns null
* the aspect's postExecuteTask method will not be invoked.
- * @exception ExecutionException if the aspect cannot process the task.
+ * @exception AntException if the aspect cannot process the task.
*/
public Object preExecuteTask(Task task, AspectValueCollection aspectValues)
- throws ExecutionException {
+ throws AntException {
AntAspectContext aspectContext = new AntAspectContext();
Map antAspectValues = aspectValues.getAttributes(ANT_ASPECT);
if (antAspectValues == null) {
1.9 +8 -7 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.8
retrieving revision 1.9
diff -u -w -u -r1.8 -r1.9
--- AntBase.java 30 Apr 2002 14:57:02 -0000 1.8
+++ AntBase.java 27 May 2002 15:52:24 -0000 1.9
@@ -55,7 +55,8 @@
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
-import org.apache.ant.common.util.ExecutionException;
+import org.apache.ant.common.util.AntException;
+import org.apache.ant.common.service.BuildKey;
/**
* Common Base class for the Ant and AntCall tasks
@@ -80,7 +81,7 @@
/**
* The key to the subbuild with which the Ant task can manage the subbuild
*/
- private Object subbuildKey;
+ private BuildKey subbuildKey;
/** The name of the target to be evaluated in the sub-build */
private String targetName;
@@ -125,9 +126,9 @@
* System.err, directly or indirectly.
*
* @param line The line of error info produce by the task
- * @exception ExecutionException if the output cannot be handled.
+ * @exception AntException if the output cannot be handled.
*/
- public void handleSystemErr(String line) throws ExecutionException {
+ public void handleSystemErr(String line) throws AntException {
if (subbuildKey == null) {
super.handleSystemErr(line);
} else {
@@ -143,9 +144,9 @@
* or indirectly.
*
* @param line The line of content produce by the task
- * @exception ExecutionException if the output cannot be handled.
+ * @exception AntException if the output cannot be handled.
*/
- public void handleSystemOut(String line) throws ExecutionException {
+ public void handleSystemOut(String line) throws AntException {
if (subbuildKey == null) {
super.handleSystemOut(line);
} else {
@@ -180,7 +181,7 @@
*
* @param key the key returned by the Ant core for managing the subbuild
*/
- protected void setSubBuildKey(Object key) {
+ protected void setSubBuildKey(BuildKey key) {
this.subbuildKey = key;
}
1.8 +7 -5 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.7
retrieving revision 1.8
diff -u -w -u -r1.7 -r1.8
--- AntCall.java 9 Apr 2002 12:23:53 -0000 1.7
+++ AntCall.java 27 May 2002 15:52:24 -0000 1.8
@@ -52,8 +52,9 @@
* <http://www.apache.org/>.
*/
package org.apache.ant.antlib.system;
-import org.apache.ant.common.util.ExecutionException;
+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
@@ -65,15 +66,16 @@
/**
* Execute the sub-build
*
- * @exception ExecutionException if the build fails
+ * @exception AntException if the build fails
*/
- public void execute() throws ExecutionException {
+ public void execute() throws AntException {
setProperty(MagicProperties.BASEDIR,
getExecService().getBaseDir().getAbsolutePath());
- Object key = getExecService().setupBuild(getProperties());
+ BuildKey key = getExecService().setupBuild(getProperties(), true);
setSubBuildKey(key);
getExecService().runBuild(key, getTargets());
+ getExecService().releaseBuild(key);
}
/**
1.5 +5 -5 jakarta-ant/proposal/mutant/src/java/antlibs/system/org/apache/ant/antlib/system/FileConverter.java
Index: FileConverter.java
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/mutant/src/java/antlibs/system/org/apache/ant/antlib/system/FileConverter.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -w -u -r1.4 -r1.5
--- FileConverter.java 7 Apr 2002 14:38:07 -0000 1.4
+++ FileConverter.java 27 May 2002 15:52:24 -0000 1.5
@@ -55,7 +55,7 @@
import java.io.File;
import org.apache.ant.common.antlib.AbstractConverter;
-import org.apache.ant.common.util.ExecutionException;
+import org.apache.ant.common.antlib.ConverterException;
import org.apache.ant.common.util.AntException;
import org.apache.ant.common.service.FileService;
@@ -85,15 +85,15 @@
* @param value The value to be converted
* @param type the desired type of the converted object
* @return the value of the converted object
- * @exception ExecutionException if the conversion cannot be made
+ * @exception ConverterException if the conversion cannot be made
*/
- public Object convert(String value, Class type) throws ExecutionException {
+ public Object convert(String value, Class type) throws ConverterException {
try {
FileService fileService
= (FileService) getContext().getCoreService(FileService.class);
return fileService.resolveFile(value);
} catch (AntException e) {
- throw new ExecutionException("Unable to resolve file: "
+ throw new ConverterException("Unable to resolve file: "
+ value, e);
}
}
1.5 +9 -8 jakarta-ant/proposal/mutant/src/java/antlibs/system/org/apache/ant/antlib/system/Import.java
Index: Import.java
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/mutant/src/java/antlibs/system/org/apache/ant/antlib/system/Import.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -w -u -r1.4 -r1.5
--- Import.java 18 Mar 2002 02:44:26 -0000 1.4
+++ Import.java 27 May 2002 15:52:24 -0000 1.5
@@ -55,8 +55,9 @@
import org.apache.ant.common.antlib.AbstractTask;
import org.apache.ant.common.antlib.AntContext;
+import org.apache.ant.common.antlib.ValidationException;
import org.apache.ant.common.service.ComponentService;
-import org.apache.ant.common.util.ExecutionException;
+import org.apache.ant.common.util.AntException;
/**
* Task to import a component or components from a library
@@ -116,22 +117,22 @@
/**
* Validate this task is properly configured
*
- * @exception ExecutionException if the task is not configured correctly
+ * @exception ValidationException if the task is not configured correctly
*/
- public void validateComponent() throws ExecutionException {
+ public void validateComponent() throws ValidationException {
if (ref != null) {
if (libraryId != null || name != null) {
- throw new ExecutionException("The \"ref\" attribute can only "
+ throw new ValidationException("The \"ref\" attribute can only "
+ "be used when \"libraryId\" and \"name\" attributes are "
+ "not present");
}
} else {
if (libraryId == null) {
- throw new ExecutionException("You must specify a library "
+ throw new ValidationException("You must specify a library "
+ "identifier with the \"libraryid\" attribute");
}
if (alias != null && name == null) {
- throw new ExecutionException("You may only specify an alias"
+ throw new ValidationException("You may only specify an alias"
+ " when you specify the \"name\" or \"ref\" attributes");
}
}
@@ -140,9 +141,9 @@
/**
* Do the work and import the component or components
*
- * @exception ExecutionException if the components cannot be imported
+ * @exception AntException if the components cannot be imported
*/
- public void execute() throws ExecutionException {
+ public void execute() throws AntException {
AntContext context = getAntContext();
ComponentService componentService = (ComponentService)
context.getCoreService(ComponentService.class);
1.5 +23 -21 jakarta-ant/proposal/mutant/src/java/antlibs/system/org/apache/ant/antlib/system/LibPath.java
Index: LibPath.java
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/mutant/src/java/antlibs/system/org/apache/ant/antlib/system/LibPath.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -w -u -r1.4 -r1.5
--- LibPath.java 30 Apr 2002 14:57:02 -0000 1.4
+++ LibPath.java 27 May 2002 15:52:24 -0000 1.5
@@ -58,8 +58,9 @@
import org.apache.ant.common.antlib.AbstractTask;
import org.apache.ant.common.antlib.AntContext;
+import org.apache.ant.common.antlib.ValidationException;
import org.apache.ant.common.service.ComponentService;
-import org.apache.ant.common.util.ExecutionException;
+import org.apache.ant.common.util.AntException;
import org.apache.ant.common.event.MessageLevel;
import org.apache.ant.init.InitUtils;
@@ -91,9 +92,9 @@
* Sets the URL of the library to be loaded
*
* @param url the URL from which the library is to be loaded
- * @exception ExecutionException if the URL cannot be set
+ * @exception ValidationException if the URL cannot be set
*/
- public void setURL(URL url) throws ExecutionException {
+ public void setURL(URL url) throws ValidationException {
checkNullURL();
this.url = url;
}
@@ -102,14 +103,14 @@
* Set the file from which the library should be loaded.
*
* @param file the file from which the library should be loaded
- * @exception ExecutionException if the file attribute cannot be set
+ * @exception ValidationException if the file attribute cannot be set
*/
- public void setFile(File file) throws ExecutionException {
+ public void setFile(File file) throws ValidationException {
checkNullURL();
try {
this.url = InitUtils.getFileURL(file);
} catch (MalformedURLException e) {
- throw new ExecutionException(e);
+ throw new ValidationException(e);
}
}
@@ -117,29 +118,29 @@
* Set the dir in which to search for AntLibraries.
*
* @param dir the dir from which all Ant Libraries found will be loaded.
- * @exception ExecutionException if the dir attribute cannot be set
+ * @exception ValidationException if the dir attribute cannot be set
*/
- public void setDir(File dir) throws ExecutionException {
+ public void setDir(File dir) throws ValidationException {
checkNullURL();
try {
this.url = InitUtils.getFileURL(dir);
} catch (MalformedURLException e) {
- throw new ExecutionException(e);
+ throw new ValidationException(e);
}
}
/**
* Validate this task is configured correctly
*
- * @exception ExecutionException if the task is not configured correctly
+ * @exception ValidationException if the task is not configured correctly
*/
- public void validateComponent() throws ExecutionException {
+ public void validateComponent() throws ValidationException {
if (libraryId == null) {
- throw new ExecutionException("You must specify the id of the"
+ throw new ValidationException("You must specify the id of the"
+ "library for which you are providing additional classpaths");
}
if (url == null) {
- throw new ExecutionException("You must provide an additional "
+ throw new ValidationException("You must provide an additional "
+ "classpath using one of the file, dir or url attributes");
}
}
@@ -147,10 +148,10 @@
/**
* Add the libpath to the set of paths associated with the library
*
- * @exception ExecutionException if the library path cannot be addded to
+ * @exception AntException if the library path cannot be addded to
* the library
*/
- public void execute() throws ExecutionException {
+ public void execute() throws AntException {
AntContext context = getAntContext();
ComponentService componentService = (ComponentService)
context.getCoreService(ComponentService.class);
@@ -163,12 +164,13 @@
* Check if any of the location specifying attributes have already been
* set.
*
- * @exception ExecutionException if the search URL has already been set
+ * @exception ValidationException if the search URL has already been set
*/
- private void checkNullURL() throws ExecutionException {
+ private void checkNullURL() throws ValidationException {
if (url != null) {
- throw new ExecutionException("Location of library has already been "
- + "set. Please use only one of file, dir or url attributes");
+ throw new ValidationException("Location of library has already "
+ + "been set. Please use only one of file, dir or url "
+ + "attributes");
}
}
}
1.5 +21 -19 jakarta-ant/proposal/mutant/src/java/antlibs/system/org/apache/ant/antlib/system/LoadLib.java
Index: LoadLib.java
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/mutant/src/java/antlibs/system/org/apache/ant/antlib/system/LoadLib.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -w -u -r1.4 -r1.5
--- LoadLib.java 1 May 2002 07:19:30 -0000 1.4
+++ LoadLib.java 27 May 2002 15:52:24 -0000 1.5
@@ -58,7 +58,8 @@
import org.apache.ant.common.antlib.AbstractTask;
import org.apache.ant.common.antlib.AntContext;
import org.apache.ant.common.service.ComponentService;
-import org.apache.ant.common.util.ExecutionException;
+import org.apache.ant.common.antlib.ValidationException;
+import org.apache.ant.common.util.AntException;
import org.apache.ant.init.InitUtils;
/**
@@ -81,9 +82,9 @@
* Sets the URL of the library to be loaded
*
* @param url the URL from which the library is to be loaded
- * @exception ExecutionException if the URL cannot be set
+ * @exception ValidationException if the URL cannot be set
*/
- public void setURL(URL url) throws ExecutionException {
+ public void setURL(URL url) throws ValidationException {
checkNullURL();
this.url = url;
}
@@ -92,14 +93,14 @@
* Set the file from which the library should be loaded.
*
* @param file the file from which the library should be loaded
- * @exception ExecutionException if the file attribute cannot be set
+ * @exception ValidationException if the file attribute cannot be set
*/
- public void setFile(File file) throws ExecutionException {
+ public void setFile(File file) throws ValidationException {
checkNullURL();
try {
this.url = InitUtils.getFileURL(file);
} catch (MalformedURLException e) {
- throw new ExecutionException(e);
+ throw new ValidationException(e);
}
}
@@ -107,14 +108,14 @@
* Set the dir in which to search for AntLibraries.
*
* @param dir the dir from which all Ant Libraries found will be loaded.
- * @exception ExecutionException if the dir attribute cannot be set
+ * @exception ValidationException if the dir attribute cannot be set
*/
- public void setDir(File dir) throws ExecutionException {
+ public void setDir(File dir) throws ValidationException {
checkNullURL();
try {
this.url = InitUtils.getFileURL(dir);
} catch (MalformedURLException e) {
- throw new ExecutionException(e);
+ throw new ValidationException(e);
}
}
@@ -131,11 +132,11 @@
/**
* Validate this task is configured correctly
*
- * @exception ExecutionException if the task is not configured correctly
+ * @exception ValidationException if the task is not configured correctly
*/
- public void validateComponent() throws ExecutionException {
+ public void validateComponent() throws ValidationException {
if (url == null) {
- throw new ExecutionException("A location from which to load "
+ throw new ValidationException("A location from which to load "
+ "libraries must be provided");
}
}
@@ -144,26 +145,27 @@
/**
* Load the library or libraries and optiinally import their components
*
- * @exception ExecutionException if the library or libraries cannot be
+ * @exception AntException if the library or libraries cannot be
* loaded.
*/
- public void execute() throws ExecutionException {
+ public void execute() throws AntException {
AntContext context = getAntContext();
ComponentService componentService = (ComponentService)
context.getCoreService(ComponentService.class);
- componentService.loadLib(url.toString(), importAll, false);
+ componentService.loadLib(url, importAll);
}
/**
* Check if any of the location specifying attributes have already been
* set.
*
- * @exception ExecutionException if the search URL has already been set
+ * @exception ValidationException if the search URL has already been set
*/
- private void checkNullURL() throws ExecutionException {
+ private void checkNullURL() throws ValidationException {
if (url != null) {
- throw new ExecutionException("Location of library has already been "
- + "set. Please use only one of file, dir or url attributes");
+ throw new ValidationException("Location of library has already "
+ + "been set. Please use only one of file, dir or url "
+ + "attributes");
}
}
}
1.4 +9 -9 jakarta-ant/proposal/mutant/src/java/antlibs/system/org/apache/ant/antlib/system/Parallel.java
Index: Parallel.java
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/mutant/src/java/antlibs/system/org/apache/ant/antlib/system/Parallel.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -w -u -r1.3 -r1.4
--- Parallel.java 7 Apr 2002 14:38:07 -0000 1.3
+++ Parallel.java 27 May 2002 15:52:24 -0000 1.4
@@ -61,7 +61,7 @@
import org.apache.ant.common.antlib.Task;
import org.apache.ant.common.antlib.TaskContainer;
import org.apache.ant.common.service.ExecService;
-import org.apache.ant.common.util.ExecutionException;
+import org.apache.ant.common.util.AntException;
import org.apache.ant.common.util.Location;
/**
@@ -143,10 +143,10 @@
* Block execution until the specified time or for a specified amount of
* milliseconds and if defined, execute the wait status.
*
- * @exception ExecutionException if any of the nested tasks throws an
+ * @exception AntException if any of the nested tasks throws an
* exception
*/
- public void execute() throws ExecutionException {
+ public void execute() throws AntException {
TaskThread[] threads = new TaskThread[nestedTasks.size()];
int threadNumber = 0;
for (Iterator i = nestedTasks.iterator(); i.hasNext(); threadNumber++) {
@@ -181,9 +181,9 @@
if (firstException == null) {
firstException = t;
}
- if (t instanceof ExecutionException &&
+ if (t instanceof AntException &&
firstLocation == Location.UNKNOWN_LOCATION) {
- firstLocation = ((ExecutionException) t).getLocation();
+ firstLocation = ((AntException) t).getLocation();
}
exceptionMessage.append(lSep);
exceptionMessage.append(t.getMessage());
@@ -191,13 +191,13 @@
}
if (numExceptions == 1) {
- if (firstException instanceof ExecutionException) {
- throw (ExecutionException) firstException;
+ if (firstException instanceof AntException) {
+ throw (AntException) firstException;
} else {
- throw new ExecutionException(firstException);
+ throw new SystemException(firstException);
}
} else if (numExceptions > 1) {
- throw new ExecutionException(exceptionMessage.toString(),
+ throw new SystemException(exceptionMessage.toString(),
firstLocation);
}
}
1.3 +9 -9 jakarta-ant/proposal/mutant/src/java/antlibs/system/org/apache/ant/antlib/system/PrimitiveConverter.java
Index: PrimitiveConverter.java
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/mutant/src/java/antlibs/system/org/apache/ant/antlib/system/PrimitiveConverter.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -w -u -r1.2 -r1.3
--- PrimitiveConverter.java 18 Mar 2002 02:44:26 -0000 1.2
+++ PrimitiveConverter.java 27 May 2002 15:52:24 -0000 1.3
@@ -54,8 +54,8 @@
package org.apache.ant.antlib.system;
import org.apache.ant.common.antlib.AbstractConverter;
-import org.apache.ant.common.util.ExecutionException;
import org.apache.ant.common.util.PropertyUtils;
+import org.apache.ant.common.antlib.ConverterException;
/**
* A converter to convert to Java's primitie types
@@ -84,9 +84,9 @@
* @param value The value to be converted
* @param type the desired type of the converted object
* @return the value of the converted object
- * @exception ExecutionException if the conversion cannot be made
+ * @exception ConverterException if the conversion cannot be made
*/
- public Object convert(String value, Class type) throws ExecutionException {
+ public Object convert(String value, Class type) throws ConverterException {
if (type.equals(Character.class)
|| type.equals(Character.TYPE)) {
return new Character(value.charAt(0));
@@ -106,7 +106,7 @@
|| type.equals(Boolean.TYPE)) {
return new Boolean(PropertyUtils.toBoolean(value));
}
- throw new ExecutionException("This converter does not handle "
+ throw new ConverterException("This converter does not handle "
+ type.getName());
}
}
1.4 +5 -5 jakarta-ant/proposal/mutant/src/java/antlibs/system/org/apache/ant/antlib/system/Ref.java
Index: Ref.java
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/mutant/src/java/antlibs/system/org/apache/ant/antlib/system/Ref.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -w -u -r1.3 -r1.4
--- Ref.java 1 May 2002 10:03:38 -0000 1.3
+++ Ref.java 27 May 2002 15:52:24 -0000 1.4
@@ -55,7 +55,7 @@
import java.io.File;
import org.apache.ant.common.antlib.AntContext;
import org.apache.ant.common.model.Project;
-import org.apache.ant.common.util.ExecutionException;
+import org.apache.ant.common.util.AntException;
/**
* A Task to create a project reference.
@@ -77,10 +77,10 @@
* @param context core's context
* @param componentType the component type of this component (i.e its
* defined name in the build file)
- * @exception ExecutionException if we can't access the data service
+ * @exception AntException if we can't access the data service
*/
public void init(AntContext context, String componentType)
- throws ExecutionException {
+ throws AntException {
super.init(context, componentType);
}
@@ -109,9 +109,9 @@
/**
* Create the project reference
*
- * @exception ExecutionException if the project cannot be referenced.
+ * @exception AntException if the project cannot be referenced.
*/
- public void execute() throws ExecutionException {
+ public void execute() throws AntException {
Project model = getExecService().parseXMLBuildFile(projectFile);
getExecService().createProjectReference(name, model, getProperties());
1.4 +3 -3 jakarta-ant/proposal/mutant/src/java/antlibs/system/org/apache/ant/antlib/system/Sequential.java
Index: Sequential.java
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/mutant/src/java/antlibs/system/org/apache/ant/antlib/system/Sequential.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -w -u -r1.3 -r1.4
--- Sequential.java 7 Apr 2002 14:38:07 -0000 1.3
+++ Sequential.java 27 May 2002 15:52:24 -0000 1.4
@@ -61,7 +61,7 @@
import org.apache.ant.common.antlib.Task;
import org.apache.ant.common.antlib.TaskContainer;
import org.apache.ant.common.service.ExecService;
-import org.apache.ant.common.util.ExecutionException;
+import org.apache.ant.common.util.AntException;
/**
* Implements a single threaded task execution. <p>
@@ -94,10 +94,10 @@
/**
* Execute all nestedTasks.
*
- * @exception ExecutionException if any of the nested tasks throws an
+ * @exception AntException if any of the nested tasks throws an
* exception
*/
- public void execute() throws ExecutionException {
+ public void execute() throws AntException {
AntContext context = getAntContext();
ExecService execService
= (ExecService) context.getCoreService(ExecService.class);
1.2 +21 -20 jakarta-ant/proposal/mutant/src/java/antlibs/system/org/apache/ant/antlib/system/SubBuild.java
Index: SubBuild.java
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/mutant/src/java/antlibs/system/org/apache/ant/antlib/system/SubBuild.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -w -u -r1.1 -r1.2
--- SubBuild.java 30 Apr 2002 14:57:02 -0000 1.1
+++ SubBuild.java 27 May 2002 15:52:25 -0000 1.2
@@ -57,9 +57,10 @@
import org.apache.ant.common.antlib.AbstractComponent;
import org.apache.ant.common.antlib.AbstractTask;
import org.apache.ant.common.antlib.AntContext;
+import org.apache.ant.common.antlib.ValidationException;
import org.apache.ant.common.service.DataService;
import org.apache.ant.common.service.ExecService;
-import org.apache.ant.common.util.ExecutionException;
+import org.apache.ant.common.util.AntException;
/**
* Common Base class all tasks that can pass references and property overrides
@@ -127,15 +128,15 @@
/**
* Validate this data type instance
*
- * @exception ExecutionException if either attribute has not been set
+ * @exception ValidationException if either attribute has not been set
*/
- public void validateComponent() throws ExecutionException {
+ public void validateComponent() throws ValidationException {
if (name == null) {
- throw new ExecutionException("\"name\" attribute of "
+ throw new ValidationException("\"name\" attribute of "
+ "<property> must be supplied");
}
if (value == null) {
- throw new ExecutionException("\"value\" attribute of "
+ throw new ValidationException("\"value\" attribute of "
+ "<property> must be supplied");
}
}
@@ -152,7 +153,7 @@
/** The id of the reference to be passed */
private String refId;
/** The id to be used in the sub-build for this reference */
- private String toId;
+ private String toRefId;
/**
@@ -170,8 +171,8 @@
*
* @return the toId value
*/
- public String getToId() {
- return toId;
+ public String getToRefId() {
+ return toRefId;
}
@@ -188,22 +189,22 @@
/**
* Sets the toId of the Reference
*
- * @param toId the new toId value
+ * @param toRefId the new toId value
*/
- public void setToId(String toId) {
- this.toId = toId;
+ public void setToRefId(String toRefId) {
+ this.toRefId = toRefId;
}
/**
* Validate this data type instance
*
- * @exception ExecutionException if the refid attribute has not been
+ * @exception ValidationException if the refid attribute has not been
* set
*/
- public void validateComponent() throws ExecutionException {
+ public void validateComponent() throws ValidationException {
if (refId == null) {
- throw new ExecutionException("\"refid\" attribute of "
+ throw new ValidationException("\"refid\" attribute of "
+ "<reference> must be supplied");
}
}
@@ -234,17 +235,17 @@
* Add a reference to be passed
*
* @param reference the descriptor of the reference to be passed
- * @exception ExecutionException if the reference does not reference a
+ * @exception AntException if the reference does not reference a
* valid object
*/
- public void addReference(Reference reference) throws ExecutionException {
+ public void addReference(Reference reference) throws AntException {
String refId = reference.getRefId();
if (!dataService.isDataValueSet(refId)) {
- throw new ExecutionException("RefId \"" + refId + "\" is not set");
+ throw new ValidationException("RefId \"" + refId + "\" is not set");
}
Object value = dataService.getDataValue(refId);
- String toId = reference.getToId();
+ String toId = reference.getToRefId();
if (toId == null) {
toId = refId;
@@ -290,10 +291,10 @@
* @param context core's context
* @param componentType the component type of this component (i.e its
* defined name in the build file)
- * @exception ExecutionException if we can't access the data service
+ * @exception AntException if we can't access the data service
*/
public void init(AntContext context, String componentType)
- throws ExecutionException {
+ throws AntException {
super.init(context, componentType);
dataService = (DataService) getCoreService(DataService.class);
execService = (ExecService) getCoreService(ExecService.class);
1.4 +5 -5 jakarta-ant/proposal/mutant/src/java/antlibs/system/org/apache/ant/antlib/system/URLConverter.java
Index: URLConverter.java
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/mutant/src/java/antlibs/system/org/apache/ant/antlib/system/URLConverter.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -w -u -r1.3 -r1.4
--- URLConverter.java 18 Mar 2002 02:44:26 -0000 1.3
+++ URLConverter.java 27 May 2002 15:52:25 -0000 1.4
@@ -56,7 +56,7 @@
import java.net.URL;
import java.net.MalformedURLException;
import org.apache.ant.common.antlib.AbstractConverter;
-import org.apache.ant.common.util.ExecutionException;
+import org.apache.ant.common.antlib.ConverterException;
/**
* A converter to convert to URLs relative to the project base dir
@@ -82,13 +82,13 @@
* @param value The value to be converted
* @param type the desired type of the converted object
* @return the value of the converted object
- * @exception ExecutionException if the conversion cannot be made
+ * @exception ConverterException if the conversion cannot be made
*/
- public Object convert(String value, Class type) throws ExecutionException {
+ public Object convert(String value, Class type) throws ConverterException {
try {
return new URL(value);
} catch (MalformedURLException e) {
- throw new ExecutionException(e);
+ throw new ConverterException(e);
}
}
}
1.1 jakarta-ant/proposal/mutant/src/java/antlibs/system/org/apache/ant/antlib/system/SystemException.java
Index: SystemException.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 apache@apache.org.
*
* 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.antlib.system;
import org.apache.ant.common.util.Location;
import org.apache.ant.common.util.AntException;
/**
* A System task related exception
*
* @author Conor MacNeill
*/
public class SystemException extends AntException {
/**
* Constructs an exception with the given descriptive message.
*
* @param msg Description of or information about the exception.
*/
public SystemException(String msg) {
super(msg);
}
/**
* Constructs an exception with the given descriptive message and a
* location in a file.
*
* @param msg Description of or information about the exception.
* @param location Location in the project file where the error occured.
*/
public SystemException(String msg, Location location) {
super(msg, location);
}
/**
* Constructs an exception with the given message and exception as a
* root cause.
*
* @param msg Description of or information about the exception.
* @param cause Throwable that might have cause this one.
*/
public SystemException(String msg, Throwable cause) {
super(msg, cause);
}
/**
* Constructs an exception with the given message and exception as a
* root cause and a location in a file.
*
* @param msg Description of or information about the exception.
* @param cause Exception that might have cause this one.
* @param location Location in the project file where the error occured.
*/
public SystemException(String msg, Throwable cause,
Location location) {
super(msg, cause, location);
}
/**
* Constructs an exception with the given exception as a root cause.
*
* @param cause Exception that might have caused this one.
*/
public SystemException(Throwable cause) {
super(cause);
}
/**
* Constructs an exception with the given exception as a root cause and
* a location in a file.
*
* @param cause Exception that might have cause this one.
* @param location Location in the project file where the error occured.
*/
public SystemException(Throwable cause, Location location) {
super(cause, location);
}
}
1.4 +34 -24 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.3
retrieving revision 1.4
diff -u -w -u -r1.3 -r1.4
--- AbstractAspect.java 17 May 2002 12:20:38 -0000 1.3
+++ AbstractAspect.java 27 May 2002 15:52:25 -0000 1.4
@@ -53,7 +53,7 @@
*/
package org.apache.ant.common.antlib;
-import org.apache.ant.common.util.ExecutionException;
+import org.apache.ant.common.util.AntException;
import org.apache.ant.common.model.BuildElement;
import org.apache.ant.common.model.AspectValueCollection;
@@ -73,9 +73,9 @@
* Initialise the aspect with a context.
*
* @param context the aspect's context
- * @exception ExecutionException if the aspect cannot be initialised
+ * @exception AntException if the aspect cannot be initialised
*/
- public void init(AntContext context) throws ExecutionException {
+ public void init(AntContext context) throws AntException {
this.context = context;
}
@@ -98,10 +98,10 @@
* @param model the Build model that applies to the component
*
* @return a component to use.
- * @exception ExecutionException if the aspect cannot process the component.
+ * @exception AntException if the aspect cannot process the component.
*/
public Object preCreateComponent(Object component, BuildElement model)
- throws ExecutionException {
+ throws AntException {
return component;
}
@@ -115,10 +115,10 @@
*
* @return a replacement for the component if desired. If null is returned
* the current component is used.
- * @exception ExecutionException if the aspect cannot process the component.
+ * @exception AntException if the aspect cannot process the component.
*/
public Object postCreateComponent(Object component, BuildElement model)
- throws ExecutionException {
+ throws AntException {
return component;
}
@@ -133,10 +133,10 @@
* be notified after execution has been completed, in which case the obkect
* is returned to provide the aspect its context. If this returns null
* the aspect's postExecuteTask method will not be invoked.
- * @exception ExecutionException if the aspect cannot process the task.
+ * @exception AntException if the aspect cannot process the task.
*/
public Object preExecuteTask(Task task, AspectValueCollection aspectValues)
- throws ExecutionException {
+ throws AntException {
return null;
}
@@ -177,6 +177,16 @@
*/
public String taskError(Object context, String line) {
return line;
+ }
+
+ /**
+ * Log a message as a build event
+ *
+ * @param message the message to be logged
+ * @param level the priority level of the message
+ */
+ protected void log(String message, int level) {
+ context.log(message, level);
}
}
1.5 +7 -7 jakarta-ant/proposal/mutant/src/java/common/org/apache/ant/common/antlib/AbstractComponent.java
Index: AbstractComponent.java
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/mutant/src/java/common/org/apache/ant/common/antlib/AbstractComponent.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -w -u -r1.4 -r1.5
--- AbstractComponent.java 18 Mar 2002 02:44:27 -0000 1.4
+++ AbstractComponent.java 27 May 2002 15:52:25 -0000 1.5
@@ -53,7 +53,7 @@
*/
package org.apache.ant.common.antlib;
-import org.apache.ant.common.util.ExecutionException;
+import org.apache.ant.common.util.AntException;
/**
* Abstract implementation of the ExecutionComponent
@@ -96,10 +96,10 @@
*
* @param context the component's context
* @param componentType the type of the component
- * @exception ExecutionException if initialisation fails
+ * @exception AntException if initialisation fails
*/
public void init(AntContext context, String componentType)
- throws ExecutionException {
+ throws AntException {
this.context = context;
this.componentType = componentType;
}
@@ -109,9 +109,9 @@
* configured from its build model. The element may perform validation
* of its configuration
*
- * @exception ExecutionException if validation fails
+ * @exception ValidationException if validation fails
*/
- public void validateComponent() throws ExecutionException {
+ public void validateComponent() throws ValidationException {
// no validation by default
}
@@ -121,11 +121,11 @@
* @param serviceClass the required interface of which an instance is
* required
* @return the core's instance of the requested service
- * @exception ExecutionException if the core does not support the
+ * @exception AntException if the core does not support the
* requested service
*/
protected Object getCoreService(Class serviceClass)
- throws ExecutionException {
+ throws AntException {
return context.getCoreService(serviceClass);
}
1.7 +5 -5 jakarta-ant/proposal/mutant/src/java/common/org/apache/ant/common/antlib/AbstractTask.java
Index: AbstractTask.java
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/mutant/src/java/common/org/apache/ant/common/antlib/AbstractTask.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -w -u -r1.6 -r1.7
--- AbstractTask.java 9 Apr 2002 12:23:53 -0000 1.6
+++ AbstractTask.java 27 May 2002 15:52:25 -0000 1.7
@@ -53,7 +53,7 @@
*/
package org.apache.ant.common.antlib;
import org.apache.ant.common.event.MessageLevel;
-import org.apache.ant.common.util.ExecutionException;
+import org.apache.ant.common.util.AntException;
/**
* Abstract implementation of the Task interface
@@ -90,9 +90,9 @@
* directly or indirectly.
*
* @param line The line of content produce by the task
- * @exception ExecutionException if the output cannot be handled.
+ * @exception AntException if the output cannot be handled.
*/
- public void handleSystemOut(String line) throws ExecutionException {
+ public void handleSystemOut(String line) throws AntException {
// default behaviout is to log at INFO level
log(line, MessageLevel.MSG_INFO);
}
@@ -104,9 +104,9 @@
* System.err, directly or indirectly.
*
* @param line The line of error info produce by the task
- * @exception ExecutionException if the output cannot be handled.
+ * @exception AntException if the output cannot be handled.
*/
- public void handleSystemErr(String line) throws ExecutionException {
+ public void handleSystemErr(String line) throws AntException {
// default behaviout is to log at WARN level
log(line, MessageLevel.MSG_WARN);
}
1.9 +3 -3 jakarta-ant/proposal/mutant/src/java/common/org/apache/ant/common/antlib/AntContext.java
Index: AntContext.java
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/mutant/src/java/common/org/apache/ant/common/antlib/AntContext.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -w -u -r1.8 -r1.9
--- AntContext.java 16 May 2002 13:31:46 -0000 1.8
+++ AntContext.java 27 May 2002 15:52:25 -0000 1.9
@@ -52,7 +52,7 @@
* <http://www.apache.org/>.
*/
package org.apache.ant.common.antlib;
-import org.apache.ant.common.util.ExecutionException;
+import org.apache.ant.common.util.AntException;
import org.apache.ant.common.util.Location;
/**
@@ -80,10 +80,10 @@
* @param serviceInterfaceClass the class object for the required
* interface
* @return an instance of the requested interface
- * @exception ExecutionException if the core service is not supported
+ * @exception AntException if the core service is not supported
*/
Object getCoreService(Class serviceInterfaceClass)
- throws ExecutionException;
+ throws AntException;
/**
* Gets the location associated with the AntContext
1.8 +9 -9 jakarta-ant/proposal/mutant/src/java/common/org/apache/ant/common/antlib/AntLibFactory.java
Index: AntLibFactory.java
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/mutant/src/java/common/org/apache/ant/common/antlib/AntLibFactory.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -w -u -r1.7 -r1.8
--- AntLibFactory.java 14 May 2002 15:11:10 -0000 1.7
+++ AntLibFactory.java 27 May 2002 15:52:25 -0000 1.8
@@ -52,7 +52,7 @@
* <http://www.apache.org/>.
*/
package org.apache.ant.common.antlib;
-import org.apache.ant.common.util.ExecutionException;
+import org.apache.ant.common.util.AntException;
/**
* An Ant Library Factory is a class is used to create instances of the
@@ -68,9 +68,9 @@
* Initialise the factory
*
* @param context the factory's context
- * @exception ExecutionException if the factory cannot be initialized
+ * @exception AntException if the factory cannot be initialized
*/
- void init(AntContext context) throws ExecutionException;
+ void init(AntContext context) throws AntException;
/**
* Create an instance of the given component class
@@ -81,11 +81,11 @@
* @return an instance of the required class
* @exception InstantiationException if the class cannot be instantiated
* @exception IllegalAccessException if the instance cannot be accessed
- * @exception ExecutionException if there is a problem creating the task
+ * @exception AntException if there is a problem creating the task
*/
Object createComponent(Class componentClass, String localName)
throws InstantiationException, IllegalAccessException,
- ExecutionException;
+ AntException;
/**
* Create an instance of the given class
@@ -95,12 +95,12 @@
* @return a instance of the required class
* @exception InstantiationException if the class cannot be instantiated
* @exception IllegalAccessException if the instance cannot be accessed
- * @exception ExecutionException if there is a problem creating the
+ * @exception AntException if there is a problem creating the
* converter
*/
Object createInstance(Class requiredClass)
throws InstantiationException, IllegalAccessException,
- ExecutionException;
+ AntException;
/**
@@ -108,11 +108,11 @@
* create method.
*
* @param createdElement the element that the component created
- * @exception ExecutionException if there is a problem registering the
+ * @exception AntException if there is a problem registering the
* element
*/
void registerCreatedElement(Object createdElement)
- throws ExecutionException;
+ throws AntException;
}
1.4 +23 -23 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.3
retrieving revision 1.4
diff -u -w -u -r1.3 -r1.4
--- Aspect.java 17 May 2002 12:20:38 -0000 1.3
+++ Aspect.java 27 May 2002 15:52:25 -0000 1.4
@@ -53,7 +53,7 @@
*/
package org.apache.ant.common.antlib;
-import org.apache.ant.common.util.ExecutionException;
+import org.apache.ant.common.util.AntException;
import org.apache.ant.common.model.BuildElement;
import org.apache.ant.common.model.AspectValueCollection;
@@ -69,10 +69,10 @@
* Initialise the aspect with a context.
*
* @param context the aspect's context
- * @exception ExecutionException if the aspect cannot be initialised
+ * @exception AntException if the aspect cannot be initialised
*/
void init(AntContext context)
- throws ExecutionException;
+ throws AntException;
/**
@@ -85,10 +85,10 @@
* @param model the Build model that applies to the component
*
* @return a component to use.
- * @exception ExecutionException if the aspect cannot process the component.
+ * @exception AntException if the aspect cannot process the component.
*/
Object preCreateComponent(Object component, BuildElement model)
- throws ExecutionException;
+ throws AntException;
/**
* This join point is activated after a component has been created and
@@ -99,10 +99,10 @@
* @param model the Build model used to create the component.
*
* @return a component to use
- * @exception ExecutionException if the aspect cannot process the component.
+ * @exception AntException if the aspect cannot process the component.
*/
Object postCreateComponent(Object component, BuildElement model)
- throws ExecutionException;
+ throws AntException;
/**
* This join point is activated just prior to task execution.
@@ -115,10 +115,10 @@
* be notified after execution has been completed, in which case the obkect
* is returned to provide the aspect its context. If this returns null
* the aspect's postExecuteTask method will not be invoked.
- * @exception ExecutionException if the aspect cannot process the task.
+ * @exception AntException if the aspect cannot process the task.
*/
Object preExecuteTask(Task task, AspectValueCollection aspectValues)
- throws ExecutionException;
+ throws AntException;
/**
* This join point is activated after a task has executed. The aspect
1.3 +4 -6 jakarta-ant/proposal/mutant/src/java/common/org/apache/ant/common/antlib/Converter.java
Index: Converter.java
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/mutant/src/java/common/org/apache/ant/common/antlib/Converter.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -w -u -r1.2 -r1.3
--- Converter.java 18 Mar 2002 02:44:27 -0000 1.2
+++ Converter.java 27 May 2002 15:52:25 -0000 1.3
@@ -53,8 +53,6 @@
*/
package org.apache.ant.common.antlib;
-import org.apache.ant.common.util.ExecutionException;
-
/**
* Convert between a string and a data type
*
@@ -69,9 +67,9 @@
* @param value The value to be converted
* @param type the desired type of the converted object
* @return the value of the converted object
- * @exception ExecutionException if the conversion cannot be made
+ * @exception ConverterException if the conversion cannot be made
*/
- Object convert(String value, Class type) throws ExecutionException;
+ Object convert(String value, Class type) throws ConverterException;
/**
* Initialise the converter. The converter may use the AntContext to
1.6 +5 -5 jakarta-ant/proposal/mutant/src/java/common/org/apache/ant/common/antlib/ExecutionComponent.java
Index: ExecutionComponent.java
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/mutant/src/java/common/org/apache/ant/common/antlib/ExecutionComponent.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -w -u -r1.5 -r1.6
--- ExecutionComponent.java 14 May 2002 15:11:10 -0000 1.5
+++ ExecutionComponent.java 27 May 2002 15:52:25 -0000 1.6
@@ -52,7 +52,7 @@
* <http://www.apache.org/>.
*/
package org.apache.ant.common.antlib;
-import org.apache.ant.common.util.ExecutionException;
+import org.apache.ant.common.util.AntException;
/**
* An execution component is a component from an AntLibrary which is used in
@@ -68,20 +68,20 @@
*
* @param context the Component's context
* @param componentType the type of the component
- * @exception ExecutionException if the component cannot be initialised
+ * @exception AntException if the component cannot be initialised
*/
void init(AntContext context, String componentType)
- throws ExecutionException;
+ throws AntException;
/**
* Validate the component. This is called after the element has been
* configured from its build model. The element may perform validation
* of its configuration
*
- * @exception ExecutionException if the component is not validly
+ * @exception ValidationException if the component is not validly
* configured
*/
- void validateComponent() throws ExecutionException;
+ void validateComponent() throws ValidationException;
/**
* Get the AntContext associated with this component
1.9 +9 -9 jakarta-ant/proposal/mutant/src/java/common/org/apache/ant/common/antlib/StandardLibFactory.java
Index: StandardLibFactory.java
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/mutant/src/java/common/org/apache/ant/common/antlib/StandardLibFactory.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -w -u -r1.8 -r1.9
--- StandardLibFactory.java 14 May 2002 15:11:10 -0000 1.8
+++ StandardLibFactory.java 27 May 2002 15:52:25 -0000 1.9
@@ -52,7 +52,7 @@
* <http://www.apache.org/>.
*/
package org.apache.ant.common.antlib;
-import org.apache.ant.common.util.ExecutionException;
+import org.apache.ant.common.util.AntException;
/**
* Standard Ant Library Factory
@@ -74,11 +74,11 @@
* @return an instance of the required class
* @exception InstantiationException if the class cannot be instantiated
* @exception IllegalAccessException if the instance cannot be accessed
- * @exception ExecutionException if there is a problem creating the task
+ * @exception AntException if there is a problem creating the task
*/
public Object createComponent(Class componentClass, String localName)
throws InstantiationException, IllegalAccessException,
- ExecutionException {
+ AntException {
return componentClass.newInstance();
}
@@ -86,9 +86,9 @@
* Initilaise the factory
*
* @param context the factory's context
- * @exception ExecutionException if the factory cannot be initialized
+ * @exception AntException if the factory cannot be initialized
*/
- public void init(AntContext context) throws ExecutionException {
+ public void init(AntContext context) throws AntException {
this.context = context;
}
@@ -100,12 +100,12 @@
* @return a instance of the required class
* @exception InstantiationException if the class cannot be instantiated
* @exception IllegalAccessException if the instance cannot be accessed
- * @exception ExecutionException if there is a problem creating the
+ * @exception AntException if there is a problem creating the
* converter
*/
public Object createInstance(Class requiredClass)
throws InstantiationException, IllegalAccessException,
- ExecutionException {
+ AntException {
return requiredClass.newInstance();
}
@@ -114,11 +114,11 @@
* create method.
*
* @param createdElement the element that the component created
- * @exception ExecutionException if there is a problem registering the
+ * @exception AntException if there is a problem registering the
* element
*/
public void registerCreatedElement(Object createdElement)
- throws ExecutionException {
+ throws AntException {
// do nothing
}
1.6 +7 -7 jakarta-ant/proposal/mutant/src/java/common/org/apache/ant/common/antlib/Task.java
Index: Task.java
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/mutant/src/java/common/org/apache/ant/common/antlib/Task.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -w -u -r1.5 -r1.6
--- Task.java 9 Apr 2002 12:23:53 -0000 1.5
+++ Task.java 27 May 2002 15:52:25 -0000 1.6
@@ -52,7 +52,7 @@
* <http://www.apache.org/>.
*/
package org.apache.ant.common.antlib;
-import org.apache.ant.common.util.ExecutionException;
+import org.apache.ant.common.util.AntException;
/**
* The Task interface defines the methods that a Task must implement.
@@ -64,9 +64,9 @@
/**
* Execute the task.
*
- * @exception ExecutionException if the task has a problem executing.
+ * @exception AntException if the task has a problem executing.
*/
- void execute() throws ExecutionException;
+ void execute() throws AntException;
/**
* Sets the taskName of the Task
@@ -89,9 +89,9 @@
* directly or indirectly.
*
* @param line The line of content produce by the task
- * @exception ExecutionException if the output cannot be handled.
+ * @exception AntException if the output cannot be handled.
*/
- void handleSystemOut(String line) throws ExecutionException;
+ void handleSystemOut(String line) throws AntException;
/**
* Handle error information produced by the task. When a task prints to
@@ -100,8 +100,8 @@
* System.err, directly or indirectly.
*
* @param line The line of error info produce by the task
- * @exception ExecutionException if the output cannot be handled.
+ * @exception AntException if the output cannot be handled.
*/
- void handleSystemErr(String line) throws ExecutionException;
+ void handleSystemErr(String line) throws AntException;
}
1.4 +3 -3 jakarta-ant/proposal/mutant/src/java/common/org/apache/ant/common/antlib/TaskContainer.java
Index: TaskContainer.java
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/mutant/src/java/common/org/apache/ant/common/antlib/TaskContainer.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -w -u -r1.3 -r1.4
--- TaskContainer.java 18 Mar 2002 02:44:27 -0000 1.3
+++ TaskContainer.java 27 May 2002 15:52:25 -0000 1.4
@@ -52,7 +52,7 @@
* <http://www.apache.org/>.
*/
package org.apache.ant.common.antlib;
-import org.apache.ant.common.util.ExecutionException;
+import org.apache.ant.common.util.AntException;
/**
* A TaskContainer is an object which can contain and manage ExecutionTasks.
@@ -65,8 +65,8 @@
* Add a task to the container.
*
* @param task the task tobe added
- * @exception ExecutionException if the container cannot add the task
+ * @exception AntException if the container cannot add the task
*/
- void addNestedTask(Task task) throws ExecutionException;
+ void addNestedTask(Task task) throws AntException;
}
1.1 jakarta-ant/proposal/mutant/src/java/common/org/apache/ant/common/antlib/AspectException.java
Index: AspectException.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 apache@apache.org.
*
* 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.antlib;
import org.apache.ant.common.util.Location;
import org.apache.ant.common.util.AntException;
/**
* An Aspect Exception is used by Aspects to indicate problems
*
* @author Conor MacNeill
*/
public class AspectException extends AntException {
/**
* Constructs an exception with the given descriptive message.
*
* @param msg Description of or information about the exception.
*/
public AspectException(String msg) {
super(msg);
}
/**
* Constructs an exception with the given descriptive message and a
* location in a file.
*
* @param msg Description of or information about the exception.
* @param location Location in the project file where the error occured.
*/
public AspectException(String msg, Location location) {
super(msg, location);
}
/**
* Constructs an exception with the given message and exception as a
* root cause.
*
* @param msg Description of or information about the exception.
* @param cause Throwable that might have cause this one.
*/
public AspectException(String msg, Throwable cause) {
super(msg, cause);
}
/**
* Constructs an exception with the given message and exception as a
* root cause and a location in a file.
*
* @param msg Description of or information about the exception.
* @param cause Exception that might have cause this one.
* @param location Location in the project file where the error occured.
*/
public AspectException(String msg, Throwable cause,
Location location) {
super(msg, cause, location);
}
/**
* Constructs an exception with the given exception as a root cause.
*
* @param cause Exception that might have caused this one.
*/
public AspectException(Throwable cause) {
super(cause);
}
/**
* Constructs an exception with the given exception as a root cause and
* a location in a file.
*
* @param cause Exception that might have cause this one.
* @param location Location in the project file where the error occured.
*/
public AspectException(Throwable cause, Location location) {
super(cause, location);
}
}
1.1 jakarta-ant/proposal/mutant/src/java/common/org/apache/ant/common/antlib/ConverterException.java
Index: ConverterException.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 apache@apache.org.
*
* 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.antlib;
import org.apache.ant.common.util.Location;
import org.apache.ant.common.util.AntException;
/**
* A Converter Exception indicates a problem converting a value.
*
* @author Conor MacNeill
*/
public class ConverterException extends AntException {
/**
* Constructs an exception with the given descriptive message.
*
* @param msg Description of or information about the exception.
*/
public ConverterException(String msg) {
super(msg);
}
/**
* Constructs an exception with the given descriptive message and a
* location in a file.
*
* @param msg Description of or information about the exception.
* @param location Location in the project file where the error occured.
*/
public ConverterException(String msg, Location location) {
super(msg, location);
}
/**
* Constructs an exception with the given message and exception as a
* root cause.
*
* @param msg Description of or information about the exception.
* @param cause Throwable that might have cause this one.
*/
public ConverterException(String msg, Throwable cause) {
super(msg, cause);
}
/**
* Constructs an exception with the given message and exception as a
* root cause and a location in a file.
*
* @param msg Description of or information about the exception.
* @param cause Exception that might have cause this one.
* @param location Location in the project file where the error occured.
*/
public ConverterException(String msg, Throwable cause,
Location location) {
super(msg, cause, location);
}
/**
* Constructs an exception with the given exception as a root cause.
*
* @param cause Exception that might have caused this one.
*/
public ConverterException(Throwable cause) {
super(cause);
}
/**
* Constructs an exception with the given exception as a root cause and
* a location in a file.
*
* @param cause Exception that might have cause this one.
* @param location Location in the project file where the error occured.
*/
public ConverterException(Throwable cause, Location location) {
super(cause, location);
}
}
1.1 jakarta-ant/proposal/mutant/src/java/common/org/apache/ant/common/antlib/ValidationException.java
Index: ValidationException.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 apache@apache.org.
*
* 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.antlib;
import org.apache.ant.common.util.Location;
import org.apache.ant.common.util.AntException;
/**
* A validation exception is thrown by tasks when they are not configured
* correctly
*
* @author Conor MacNeill
*/
public class ValidationException extends AntException {
/**
* Constructs an exception with the given descriptive message.
*
* @param msg Description of or information about the exception.
*/
public ValidationException(String msg) {
super(msg);
}
/**
* Constructs an exception with the given descriptive message and a
* location in a file.
*
* @param msg Description of or information about the exception.
* @param location Location in the project file where the error occured.
*/
public ValidationException(String msg, Location location) {
super(msg, location);
}
/**
* Constructs an exception with the given message and exception as a
* root cause.
*
* @param msg Description of or information about the exception.
* @param cause Throwable that might have cause this one.
*/
public ValidationException(String msg, Throwable cause) {
super(msg, cause);
}
/**
* Constructs an exception with the given message and exception as a
* root cause and a location in a file.
*
* @param msg Description of or information about the exception.
* @param cause Exception that might have cause this one.
* @param location Location in the project file where the error occured.
*/
public ValidationException(String msg, Throwable cause,
Location location) {
super(msg, cause, location);
}
/**
* Constructs an exception with the given exception as a root cause.
*
* @param cause Exception that might have caused this one.
*/
public ValidationException(Throwable cause) {
super(cause);
}
/**
* Constructs an exception with the given exception as a root cause and
* a location in a file.
*
* @param cause Exception that might have cause this one.
* @param location Location in the project file where the error occured.
*/
public ValidationException(Throwable cause, Location location) {
super(cause, location);
}
}
1.1 jakarta-ant/proposal/mutant/src/java/common/org/apache/ant/common/logger/BuildLogger.java
Index: BuildLogger.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 apache@apache.org.
*
* 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.logger;
import java.io.PrintStream;
import org.apache.ant.common.event.BuildListener;
/**
* Interface used by Ant to log the build output. A build logger is a build
* listener which has the 'right' to send output to the ant log, which is
* usually System.out unles redirected by the -logfile option.
*
* @author Conor MacNeill
* @created 15 January 2002
*/
public interface BuildLogger extends BuildListener {
/**
* Set the msgOutputLevel this logger is to respond to. Only messages
* with a message level lower than or equal to the given level are
* output to the log.
*
* @param level the logging level for the logger.
*/
void setMessageOutputLevel(int level);
/**
* Set the output stream to which this logger is to send its output.
*
* @param output the output stream for the logger.
*/
void setOutputPrintStream(PrintStream output);
/**
* Set the output stream to which this logger is to send error messages.
*
* @param err the error stream for the logger.
*/
void setErrorPrintStream(PrintStream err);
}
1.1 jakarta-ant/proposal/mutant/src/java/common/org/apache/ant/common/logger/DefaultLogger.java
Index: DefaultLogger.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 apache@apache.org.
*
* 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.logger;
import java.io.PrintStream;
import org.apache.ant.common.antlib.ExecutionComponent;
import org.apache.ant.common.antlib.Task;
import org.apache.ant.common.event.BuildEvent;
import org.apache.ant.common.event.MessageLevel;
import org.apache.ant.common.model.Target;
import org.apache.ant.common.util.AntException;
import org.apache.ant.common.util.Location;
/**
* Writes build event to a PrintStream. Currently, it only writes which
* targets are being executed, and any messages that get logged.
*
* @author Conor MacNeill
* @created 15 January 2002
*/
public class DefaultLogger implements BuildLogger {
/** Standard field separator */
private static String lSep = System.getProperty("line.separator");
/** spacing to allow for task tags */
private static final int LEFT_COLUMN_SIZE = 12;
/** The stream where output should be written */
private PrintStream out;
/** The stream to where errors should be written */
private PrintStream err;
/** The level of messages which should be let through */
private int messageOutputLevel = MessageLevel.MSG_ERR;
/** Controls whether adornments are added */
private boolean emacsMode = false;
/** The time at which the build started */
private long startTime = System.currentTimeMillis();
/**
* Format the time into something readable
*
* @param millis Java millis value
* @return the formatted time
*/
protected static String formatTime(long millis) {
long seconds = millis / 1000;
long minutes = seconds / 60;
if (minutes > 0) {
return Long.toString(minutes) + " minute"
+ (minutes == 1 ? " " : "s ")
+ Long.toString(seconds % 60) + " second"
+ (seconds % 60 == 1 ? "" : "s");
} else {
return Long.toString(seconds) + " second"
+ (seconds % 60 == 1 ? "" : "s");
}
}
/**
* Set the messageOutputLevel this logger is to respond to. Only
* messages with a message level lower than or equal to the given level
* are output to the log. <P>
*
* Constants for the message levels are in Project.java. The order of
* the levels, from least to most verbose, is MSG_ERR, MSG_WARN,
* MSG_INFO, MSG_VERBOSE, MSG_DEBUG. The default message level for
* DefaultLogger is Project.MSG_ERR.
*
* @param level the logging level for the logger.
*/
public void setMessageOutputLevel(int level) {
this.messageOutputLevel = level;
}
/**
* Set the output stream to which this logger is to send its output.
*
* @param output the output stream for the logger.
*/
public void setOutputPrintStream(PrintStream output) {
this.out = output;
}
/**
* Set the output stream to which this logger is to send error messages.
*
* @param err the error stream for the logger.
*/
public void setErrorPrintStream(PrintStream err) {
this.err = err;
}
/**
* Set this logger to produce emacs (and other editor) friendly output.
*
* @param emacsMode true if output is to be unadorned so that emacs and
* other editors can parse files names, etc.
*/
public void setEmacsMode(boolean emacsMode) {
this.emacsMode = emacsMode;
}
/**
* Report an exception
*
* @param t The exception to be reported.
*/
public void reportException(Throwable t) {
if (t instanceof AntException) {
AntException e = (AntException) t;
Location location = e.getLocation();
Throwable cause = e.getCause();
if (location != null && location != Location.UNKNOWN_LOCATION) {
out.print(location);
}
out.println(e.getMessage());
if (messageOutputLevel >= MessageLevel.MSG_VERBOSE) {
t.printStackTrace(out);
}
if (!cause.getMessage().equals(t.getMessage())) {
out.println("Root cause: " + cause.toString());
}
} else {
t.printStackTrace(err);
}
}
/**
* Description of the Method
*
* @param event Description of Parameter
*/
public void buildStarted(BuildEvent event) {
startTime = System.currentTimeMillis();
}
/**
* Description of the Method
*
* @param event Description of Parameter
*/
public void buildFinished(BuildEvent event) {
Throwable cause = event.getCause();
if (cause == null) {
out.println(lSep + "BUILD SUCCESSFUL");
} else {
err.println(lSep + "BUILD FAILED" + lSep);
reportException(cause);
}
out.println(lSep + "Total time: "
+ formatTime(System.currentTimeMillis() - startTime));
}
/**
* Description of the Method
*
* @param event Description of Parameter
*/
public void targetStarted(BuildEvent event) {
if (MessageLevel.MSG_INFO <= messageOutputLevel) {
Target target = (Target) event.getSource();
out.println(lSep + target.getName() + ":");
}
}
/**
* Description of the Method
*
* @param event Description of Parameter
*/
public void targetFinished(BuildEvent event) {
}
/**
* Description of the Method
*
* @param event Description of Parameter
*/
public void taskStarted(BuildEvent event) {
}
/**
* Description of the Method
*
* @param event Description of Parameter
*/
public void taskFinished(BuildEvent event) {
}
/**
* Description of the Method
*
* @param event Description of Parameter
*/
public void messageLogged(BuildEvent event) {
PrintStream logTo
= event.getPriority() == MessageLevel.MSG_ERR ? err : out;
// Filter out messages based on priority
if (event.getPriority() <= messageOutputLevel) {
String name = null;
Object source = event.getSource();
if (source instanceof Task) {
name = ((Task) source).getTaskName();
}
if (name == null && source instanceof ExecutionComponent) {
name = ((ExecutionComponent) source).getComponentType();
}
if (name != null) {
// Print out the name of the task if we're in one
if (!emacsMode) {
String tag = "[" + name + "] ";
int indentSize = LEFT_COLUMN_SIZE - tag.length();
for (int i = 0; i < indentSize; i++) {
logTo.print(" ");
}
logTo.print(tag);
}
}
// Print the message
logTo.println(event.getMessage());
}
}
}
1.16 +24 -26 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.15
retrieving revision 1.16
diff -u -w -u -r1.15 -r1.16
--- ComponentService.java 17 May 2002 12:20:38 -0000 1.15
+++ ComponentService.java 27 May 2002 15:52:26 -0000 1.16
@@ -55,7 +55,7 @@
import java.net.URL;
import java.util.Map;
import org.apache.ant.common.antlib.AntLibFactory;
-import org.apache.ant.common.util.ExecutionException;
+import org.apache.ant.common.util.AntException;
/**
@@ -79,13 +79,11 @@
* @param libLocation the location of the library or the libraries
* @param importAll true if all components of the loaded libraries
* should be imported
- * @param autoImport true if libraries in the Ant namespace should be
- * automatically imported.
- * @exception ExecutionException if the library or libraries cannot be
+ * @exception AntException if the library or libraries cannot be
* imported.
*/
- void loadLib(String libLocation, boolean importAll, boolean autoImport)
- throws ExecutionException;
+ void loadLib(URL libLocation, boolean importAll)
+ throws AntException;
/**
* Add a library path to the given library. The library path is used in
@@ -94,9 +92,9 @@
* @param libraryId the library's unique identifier
* @param libPath the path to be added to the list of paths used by the
* library.
- * @exception ExecutionException if the path cannot be used.
+ * @exception AntException if the path cannot be used.
*/
- void addLibPath(String libraryId, URL libPath) throws ExecutionException;
+ void addLibPath(String libraryId, URL libPath) throws AntException;
/**
* Define a new type
@@ -106,11 +104,11 @@
* instances
* @param loader the class loader to use to create the particular types
* @param className the name of the class implementing the type
- * @exception ExecutionException if the type cannot be defined
+ * @exception AntException if the type cannot be defined
*/
void typedef(AntLibFactory factory, ClassLoader loader,
String typeName, String className)
- throws ExecutionException;
+ throws AntException;
/**
* Experimental - define a new task
@@ -120,11 +118,11 @@
* instances
* @param loader the class loader to use to create the particular tasks
* @param className the name of the class implementing the task
- * @exception ExecutionException if the task cannot be defined
+ * @exception AntException if the task cannot be defined
*/
void taskdef(AntLibFactory factory, ClassLoader loader,
String taskName, String className)
- throws ExecutionException;
+ throws AntException;
/**
@@ -137,18 +135,18 @@
* @param alias the name under which this component will be used in the
* build scripts. If this is null, the components default name is
* used.
- * @exception ExecutionException if the component cannot be imported
+ * @exception AntException if the component cannot be imported
*/
void importComponent(String libraryId, String defName,
- String alias) throws ExecutionException;
+ String alias) throws AntException;
/**
* Import a complete library into the current execution frame
*
* @param libraryId The id of the library to be imported
- * @exception ExecutionException if the library cannot be imported
+ * @exception AntException if the library cannot be imported
*/
- void importLibrary(String libraryId) throws ExecutionException;
+ void importLibrary(String libraryId) throws AntException;
/**
* Imports a component defined in another frame.
@@ -158,10 +156,10 @@
* @param alias the name under which this component will be used in the
* build scripts. If this is null, the components default name is
* used.
- * @exception ExecutionException if the component cannot be imported
+ * @exception AntException if the component cannot be imported
*/
void importFrameComponent(String relativeName, String alias)
- throws ExecutionException;
+ throws AntException;
/**
* Create a component. The component will have a context but will not be
@@ -171,9 +169,9 @@
* @param componentName the name of the component
* @return the created component. The return type of this method depends
* on the component type.
- * @exception ExecutionException if the component cannot be created
+ * @exception AntException if the component cannot be created
*/
- Object createComponent(String componentName) throws ExecutionException;
+ Object createComponent(String componentName) throws AntException;
/**
* Create a component given its libraryId and local name within the
@@ -184,10 +182,10 @@
* @param localName the name component within the library.
* @return the created component. The return type of this method depends
* on the component type.
- * @exception ExecutionException if the component cannot be created
+ * @exception AntException if the component cannot be created
*/
Object createComponent(String libraryId, String localName)
- throws ExecutionException;
+ throws AntException;
/**
* configure an object with attribtes from the given map
@@ -196,11 +194,11 @@
* @param attributeValues a map containing named attribute values.
* @param ignoreUnsupported if this is true, attribute names for which no
* setter method exists are ignored.
- * @exception ExecutionException if the object does not support an
+ * @exception AntException if the object does not support an
* attribute in the map.
*/
void configureAttributes(Object object, Map attributeValues,
boolean ignoreUnsupported)
- throws ExecutionException;
+ throws AntException;
}
1.6 +13 -13 jakarta-ant/proposal/mutant/src/java/common/org/apache/ant/common/service/DataService.java
Index: DataService.java
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/mutant/src/java/common/org/apache/ant/common/service/DataService.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -w -u -r1.5 -r1.6
--- DataService.java 24 Mar 2002 13:28:31 -0000 1.5
+++ DataService.java 27 May 2002 15:52:26 -0000 1.6
@@ -54,7 +54,7 @@
package org.apache.ant.common.service;
import java.util.Map;
-import org.apache.ant.common.util.ExecutionException;
+import org.apache.ant.common.util.AntException;
/**
* Service interface for Data value manipulation operations provided by the
@@ -70,9 +70,9 @@
* @param valueName the name of the data value
* @return the current object associated with the name or null if no
* value is currently associated with the name
- * @exception ExecutionException if the value cannot be retrieved.
+ * @exception AntException if the value cannot be retrieved.
*/
- Object getDataValue(String valueName) throws ExecutionException;
+ Object getDataValue(String valueName) throws AntException;
/**
* Indicate if a data value has been set
@@ -80,10 +80,10 @@
* @param name the name of the data value - may contain reference
* delimiters
* @return true if the value exists
- * @exception ExecutionException if the containing frame for the value
+ * @exception AntException if the containing frame for the value
* does not exist
*/
- boolean isDataValueSet(String name) throws ExecutionException;
+ boolean isDataValueSet(String name) throws AntException;
/**
* Set a data value. If an existing data value exists, associated with
@@ -91,19 +91,19 @@
*
* @param valueName the name of the data value
* @param value the value to be associated with the name
- * @exception ExecutionException if the value cannot be set
+ * @exception AntException if the value cannot be set
*/
- void setDataValue(String valueName, Object value) throws ExecutionException;
+ void setDataValue(String valueName, Object value) throws AntException;
/**
* Set a data value which can be overwritten
*
* @param valueName the name of the data value
* @param value the value to be associated with the name
- * @exception ExecutionException if the value cannot be set
+ * @exception AntException if the value cannot be set
*/
void setMutableDataValue(String valueName, Object value)
- throws ExecutionException;
+ throws AntException;
/**
* Replace ${} style constructions in the given value with the string
@@ -111,9 +111,9 @@
*
* @param value the string to be scanned for property references.
* @return the string with all property references replaced
- * @exception ExecutionException if any of the properties do not exist
+ * @exception AntException if any of the properties do not exist
*/
- String replacePropertyRefs(String value) throws ExecutionException;
+ String replacePropertyRefs(String value) throws AntException;
/**
* Replace ${} style constructions in the given value with the string
@@ -123,10 +123,10 @@
* @param value the string to be scanned for property references.
* @param replacementValues the collection of replacement values
* @return the string with all property references replaced
- * @exception ExecutionException if any of the properties do not exist
+ * @exception AntException if any of the properties do not exist
*/
String replacePropertyRefs(String value, Map replacementValues)
- throws ExecutionException;
+ throws AntException;
/**
* Get all the properties from the frame and any references frames. This
1.3 +5 -5 jakarta-ant/proposal/mutant/src/java/common/org/apache/ant/common/service/EventService.java
Index: EventService.java
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/mutant/src/java/common/org/apache/ant/common/service/EventService.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -w -u -r1.2 -r1.3
--- EventService.java 18 Mar 2002 02:44:27 -0000 1.2
+++ EventService.java 27 May 2002 15:52:26 -0000 1.3
@@ -53,7 +53,7 @@
*/
package org.apache.ant.common.service;
import org.apache.ant.common.event.BuildListener;
-import org.apache.ant.common.util.ExecutionException;
+import org.apache.ant.common.util.AntException;
/**
* Core service to manage receiving of events by components within Ant.
@@ -66,16 +66,16 @@
* Add a build listener to the current frame
*
* @param listener the lister which will receive build events
- * @exception ExecutionException if the listener cannot be added
+ * @exception AntException if the listener cannot be added
*/
- void addBuildListener(BuildListener listener) throws ExecutionException;
+ void addBuildListener(BuildListener listener) throws AntException;
/**
* Remove a listener from the current frame
*
* @param listener the listener to be removed
- * @exception ExecutionException if the listener could not be removed
+ * @exception AntException if the listener could not be removed
*/
- void removeBuildListener(BuildListener listener) throws ExecutionException;
+ void removeBuildListener(BuildListener listener) throws AntException;
}
1.11 +72 -25 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.10
retrieving revision 1.11
diff -u -w -u -r1.10 -r1.11
--- ExecService.java 16 May 2002 13:31:46 -0000 1.10
+++ ExecService.java 27 May 2002 15:52:26 -0000 1.11
@@ -57,8 +57,9 @@
import java.util.Map;
import org.apache.ant.common.antlib.Task;
import org.apache.ant.common.model.Project;
-import org.apache.ant.common.util.ExecutionException;
+import org.apache.ant.common.util.AntException;
import org.apache.ant.common.model.AspectValueCollection;
+import org.apache.ant.common.event.BuildListener;
/**
* The ExecService provides executiuon services to tasks
@@ -72,9 +73,9 @@
*
* @param xmlBuildFile The file containing the XML build description.
* @return A Project model for the build.
- * @exception ExecutionException if the build cannot be parsed
+ * @exception AntException if the build cannot be parsed
*/
- Project parseXMLBuildFile(File xmlBuildFile) throws ExecutionException;
+ Project parseXMLBuildFile(File xmlBuildFile) throws AntException;
/**
@@ -84,10 +85,10 @@
* referenced.
* @param model the project model.
* @param initialData the project's initial data load.
- * @exception ExecutionException if the project cannot be referenced.
+ * @exception AntException if the project cannot be referenced.
*/
void createProjectReference(String referenceName, Project model,
- Map initialData) throws ExecutionException;
+ Map initialData) throws AntException;
/**
@@ -95,22 +96,49 @@
*
* @param model the project model to be used for the build
* @param properties the initiali properties to be used in the build
+ * @param addListeners true if the current frame's listeners should be
+ * added to the created Frame
* @return a key to the build allowing it to be executed and managed
- * @exception ExecutionException if the subbuild cannot be setup
+ * @exception AntException if the subbuild cannot be setup
*/
- Object setupBuild(Project model, Map properties)
- throws ExecutionException;
+ BuildKey setupBuild(Project model, Map properties, boolean addListeners)
+ throws AntException;
/**
* Setup a sub-build using the current frame's project model
*
* @param properties the initiali properties to be used in the build
+ * @param addListeners true if the current frame's listeners should be
+ * added to the created Frame
* @return a key to the build allowing it to be executed and managed
- * @exception ExecutionException if the subbuild cannot be setup
+ * @exception AntException if the subbuild cannot be setup
*/
- Object setupBuild(Map properties)
- throws ExecutionException;
+ BuildKey setupBuild(Map properties, boolean addListeners)
+ throws AntException;
+
+
+ /**
+ * Force initialisation of a particular ant library in the context of the
+ * given subbuild.
+ *
+ * @param key the build key.
+ * @param libraryId the id of the library to be initialized.
+ * @exception AntException if the build cannot be run
+ */
+ void initializeBuildLibrary(BuildKey key, String libraryId)
+ throws AntException;
+
+ /**
+ * Add a listener to a subbuild
+ *
+ * @param key the key identifying the build previously setup
+ * @param listener the listener to add to the build.
+ *
+ * @exception AntException if the build cannot be found.
+ */
+ public void addBuildListener(BuildKey key, BuildListener listener)
+ throws AntException;
/**
@@ -119,19 +147,29 @@
* @param buildKey the buildKey returned previously when the build was
* setup
* @param targets A list of targets to be run
- * @exception ExecutionException if the build cannot be run
+ * @exception AntException if the build cannot be run
*/
- void runBuild(Object buildKey, List targets) throws ExecutionException;
+ void runBuild(BuildKey buildKey, 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
*
* @param task the task to be executed.
- * @exception ExecutionException if there is a problem in execution.
+ * @exception AntException if there is a problem in execution.
*/
- void executeTask(Task task) throws ExecutionException;
+ void executeTask(Task task) throws AntException;
/**
@@ -143,10 +181,10 @@
*
* @param task the task to be executed
* @param aspectValues the aspect attribute values.
- * @exception ExecutionException if there is an execution problem
+ * @exception AntException if there is an execution problem
*/
void executeTask(Task task, AspectValueCollection aspectValues)
- throws ExecutionException;
+ throws AntException;
/**
@@ -164,6 +202,15 @@
*/
File getBaseDir();
+ /**
+ * Set the basedir for the current execution
+ *
+ * @param baseDir the new base directory for this execution of Ant
+ * @exception AntException if the base directory cannot be set to the given
+ * value.
+ */
+ void setBaseDir(File baseDir) throws AntException ;
+
/**
* Handle subbuild output.
@@ -171,9 +218,9 @@
* @param subbuildKey the core's key for managing the subbuild.
* @param line the content produce by the current thread.
* @param isErr true if this content is from the thread's error stream.
- * @exception ExecutionException if the subbuild cannot be found.
+ * @exception AntException if the subbuild cannot be found.
*/
void handleBuildOutput(Object subbuildKey, String line, boolean isErr)
- throws ExecutionException;
+ throws AntException;
}
1.3 +3 -3 jakarta-ant/proposal/mutant/src/java/common/org/apache/ant/common/service/FileService.java
Index: FileService.java
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/mutant/src/java/common/org/apache/ant/common/service/FileService.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -w -u -r1.2 -r1.3
--- FileService.java 18 Mar 2002 02:44:27 -0000 1.2
+++ FileService.java 27 May 2002 15:52:26 -0000 1.3
@@ -54,7 +54,7 @@
package org.apache.ant.common.service;
import java.io.File;
-import org.apache.ant.common.util.ExecutionException;
+import org.apache.ant.common.util.AntException;
/**
* Service interface for File manipulation operations provided by the Ant
@@ -70,8 +70,8 @@
*
* @param fileName the file name to be resolved.
* @return the file resolved to the project's base dir
- * @exception ExecutionException if the file cannot be resolved
+ * @exception AntException if the file cannot be resolved
*/
- File resolveFile(String fileName) throws ExecutionException;
+ File resolveFile(String fileName) throws AntException;
}
1.2 +3 -3 jakarta-ant/proposal/mutant/src/java/common/org/apache/ant/common/service/InputService.java
Index: InputService.java
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/mutant/src/java/common/org/apache/ant/common/service/InputService.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -w -u -r1.1 -r1.2
--- InputService.java 29 Apr 2002 15:29:12 -0000 1.1
+++ InputService.java 27 May 2002 15:52:26 -0000 1.2
@@ -54,7 +54,7 @@
package org.apache.ant.common.service;
import org.apache.ant.common.input.InputRequest;
-import org.apache.ant.common.util.ExecutionException;
+import org.apache.ant.common.util.AntException;
/**
* Service interface for input management
@@ -67,8 +67,8 @@
* Handle an input request
*
* @param request an input request
- * @exception ExecutionException if the request cannot be handled
+ * @exception AntException if the request cannot be handled
*/
- void handleInput(InputRequest request) throws ExecutionException;
+ void handleInput(InputRequest request) throws AntException;
}
1.4 +12 -0 jakarta-ant/proposal/mutant/src/java/common/org/apache/ant/common/service/MagicProperties.java
Index: MagicProperties.java
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/mutant/src/java/common/org/apache/ant/common/service/MagicProperties.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -w -u -r1.3 -r1.4
--- MagicProperties.java 18 Mar 2002 02:44:27 -0000 1.3
+++ MagicProperties.java 27 May 2002 15:52:26 -0000 1.4
@@ -68,5 +68,17 @@
/** This property provides the location of Ant's home directory */
public static final String ANT_HOME = "ant.home";
+
+ /** The file containing the current project model, if any */
+ public static final String ANT_FILE = "ant.file";
+
+ /** The name of the project */
+ public static final String ANT_PROJECT_NAME = "ant.project.name";
+
+ /** The version of Ant */
+ public static final String ANT_VERSION = "ant.version";
+
+ /** The version of java detected by Ant. */
+ public static final String ANT_JAVA_VERSION = "ant.java.version";
}
1.1 jakarta-ant/proposal/mutant/src/java/common/org/apache/ant/common/service/BuildKey.java
Index: BuildKey.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 apache@apache.org.
*
* 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.service;
/**
* Opaque key used to refer to builds setup in the core.
*
* @author Conor MacNeill
*/
public interface BuildKey {
}
1.7 +8 -8 jakarta-ant/proposal/mutant/src/java/common/org/apache/ant/common/util/FileUtils.java
Index: FileUtils.java
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/mutant/src/java/common/org/apache/ant/common/util/FileUtils.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -w -u -r1.6 -r1.7
--- FileUtils.java 5 Apr 2002 14:31:16 -0000 1.6
+++ FileUtils.java 27 May 2002 15:52:26 -0000 1.7
@@ -96,10 +96,10 @@
* @return an absolute file that doesn't contain "./" or
* "../" sequences and uses the correct separator for the
* current platform.
- * @exception ExecutionException if the file cannot be resolved
+ * @exception GeneralException if the file cannot be resolved
*/
public File resolveFile(File file, String filename)
- throws ExecutionException {
+ throws GeneralException {
String platformFilename = filename.replace('/', File.separatorChar)
.replace('\\', File.separatorChar);
@@ -126,7 +126,7 @@
String msg = "The file or path you specified ("
+ filename + ") is invalid relative to "
+ file.getPath();
- throw new ExecutionException(msg);
+ throw new GeneralException(msg);
}
} else if (part.equals(".")) {
// Do nothing here
@@ -153,11 +153,11 @@
*
* @param path the path to be normalized
* @return the normalized path
- * @exception ExecutionException if there is a problem with the path
+ * @exception GeneralException if there is a problem with the path
* @throws NullPointerException if the file path is equal to null.
*/
public File normalize(String path)
- throws NullPointerException, ExecutionException {
+ throws NullPointerException, GeneralException {
String platformPath = path.replace('/', File.separatorChar)
.replace('\\', File.separatorChar);
@@ -168,7 +168,7 @@
Character.isLetter(platformPath.charAt(0)) &&
platformPath.charAt(1) == ':')) {
String msg = path + " is not an absolute path";
- throw new ExecutionException(msg);
+ throw new GeneralException(msg);
}
boolean dosWithDrive = false;
@@ -223,7 +223,7 @@
continue;
} else if ("..".equals(thisToken)) {
if (s.size() < 2) {
- throw new ExecutionException("Cannot resolve path "
+ throw new GeneralException("Cannot resolve path "
+ path);
} else {
s.pop();
1.3 +3 -3 jakarta-ant/proposal/mutant/src/java/common/org/apache/ant/common/util/PropertyUtils.java
Index: PropertyUtils.java
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/mutant/src/java/common/org/apache/ant/common/util/PropertyUtils.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -w -u -r1.2 -r1.3
--- PropertyUtils.java 18 Mar 2002 02:44:28 -0000 1.2
+++ PropertyUtils.java 27 May 2002 15:52:26 -0000 1.3
@@ -72,12 +72,12 @@
* @param value the string to be parsed
* @param fragments the fragments parsed out of the string
* @param propertyRefs the property refs to be replaced
- * @exception ExecutionException if there is a problem parsing out the
+ * @exception GeneralException if there is a problem parsing out the
* values
*/
public static void parsePropertyString(String value, List fragments,
List propertyRefs)
- throws ExecutionException {
+ throws GeneralException {
int prev = 0;
int pos;
while ((pos = value.indexOf("$", prev)) >= 0) {
@@ -94,7 +94,7 @@
} else {
int endName = value.indexOf('}', pos);
if (endName < 0) {
- throw new ExecutionException("Syntax error in property: "
+ throw new GeneralException("Syntax error in property: "
+ value);
}
String propertyName = value.substring(pos + 2, endName);
1.1 jakarta-ant/proposal/mutant/src/java/common/org/apache/ant/common/util/GeneralException.java
Index: GeneralException.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 apache@apache.org.
*
* 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;
/**
* A General Ant exception. This exception is usually thrown by utility classes.
*
* @author Conor MacNeill
*/
public class GeneralException extends AntException {
/**
* Constructs an exception with the given descriptive message.
*
* @param msg Description of or information about the exception.
*/
public GeneralException(String msg) {
super(msg);
}
/**
* Constructs an exception with the given descriptive message and a
* location in a file.
*
* @param msg Description of or information about the exception.
* @param location Location in the project file where the error occured.
*/
public GeneralException(String msg, Location location) {
super(msg, location);
}
/**
* Constructs an exception with the given message and exception as a
* root cause.
*
* @param msg Description of or information about the exception.
* @param cause Throwable that might have cause this one.
*/
public GeneralException(String msg, Throwable cause) {
super(msg, cause);
}
/**
* Constructs an exception with the given message and exception as a
* root cause and a location in a file.
*
* @param msg Description of or information about the exception.
* @param cause Exception that might have cause this one.
* @param location Location in the project file where the error occured.
*/
public GeneralException(String msg, Throwable cause,
Location location) {
super(msg, cause, location);
}
/**
* Constructs an exception with the given exception as a root cause.
*
* @param cause Exception that might have caused this one.
*/
public GeneralException(Throwable cause) {
super(cause);
}
/**
* Constructs an exception with the given exception as a root cause and
* a location in a file.
*
* @param cause Exception that might have cause this one.
* @param location Location in the project file where the error occured.
*/
public GeneralException(Throwable cause, Location location) {
super(cause, location);
}
}
1.3 +48 -43 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.2
retrieving revision 1.3
diff -u -w -u -r1.2 -r1.3
--- Commandline.java 17 Apr 2002 15:51:07 -0000 1.2
+++ Commandline.java 27 May 2002 15:52:27 -0000 1.3
@@ -65,18 +65,20 @@
import java.util.List;
import java.util.Map;
import org.apache.ant.antcore.config.AntConfig;
-import org.apache.ant.antcore.execution.ExecutionManager;
+import org.apache.ant.antcore.execution.Frame;
import org.apache.ant.antcore.modelparser.XMLProjectParser;
import org.apache.ant.antcore.xml.XMLParseException;
import org.apache.ant.common.event.BuildEvent;
import org.apache.ant.common.event.BuildListener;
import org.apache.ant.common.event.MessageLevel;
import org.apache.ant.common.model.Project;
-import org.apache.ant.common.util.ConfigException;
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.InitUtils;
import org.apache.ant.frontend.FrontendUtils;
+import org.apache.ant.frontend.FrontendException;
/**
* This is the command line front end. It drives the core.
@@ -141,34 +143,34 @@
* Adds a feature to the BuildListeners attribute of the Commandline
* object
*
- * @param execManager The feature to be added to the BuildListeners
- * attribute
- * @exception ConfigException if the necessary listener instances could
+ * @param eventSource the build event source to which listeners
+ * will be added.
+ * @exception FrontendException if the necessary listener instances could
* not be created
*/
- protected void addBuildListeners(ExecutionManager execManager)
- throws ConfigException {
+ protected void addBuildListeners(Frame eventSource)
+ throws FrontendException {
// Add the default listener
- execManager.addBuildListener(logger);
+ eventSource.addBuildListener(logger);
for (Iterator i = listeners.iterator(); i.hasNext();) {
String className = (String) i.next();
try {
BuildListener listener =
(BuildListener) Class.forName(className).newInstance();
- execManager.addBuildListener(listener);
+ eventSource.addBuildListener(listener);
} catch (ClassCastException e) {
System.err.println("The specified listener class "
+ className +
" does not implement the Listener interface");
- throw new ConfigException("Unable to instantiate listener "
+ throw new FrontendException("Unable to instantiate listener "
+ className, e);
} catch (Exception e) {
System.err.println("Unable to instantiate specified listener "
+ "class " + className + " : "
+ e.getClass().getName());
- throw new ConfigException("Unable to instantiate listener "
+ throw new FrontendException("Unable to instantiate listener "
+ className, e);
}
}
@@ -182,15 +184,15 @@
* be
* @param argType the option type
* @return the value of the option
- * @exception ConfigException if the option cannot be read
+ * @exception FrontendException if the option cannot be read
*/
private String getOption(String[] args, int position, String argType)
- throws ConfigException {
+ throws FrontendException {
String value = null;
try {
value = args[position];
} catch (IndexOutOfBoundsException e) {
- throw new ConfigException("You must specify a value for the "
+ throw new FrontendException("You must specify a value for the "
+ argType + " argument");
}
return value;
@@ -205,7 +207,7 @@
*/
private void process(String[] args, InitConfig initConfig) {
this.initConfig = initConfig;
- ExecutionManager executionManager = null;
+ Frame mainFrame = null;
Project project = null;
try {
parseArguments(args);
@@ -234,21 +236,21 @@
if (!buildFileURL.getProtocol().equals("file")
&& !config.isRemoteProjectAllowed()) {
- throw new ConfigException("Remote Projects are not allowed: "
+ throw new FrontendException("Remote Projects are not allowed: "
+ buildFileURL);
}
project = parseProject();
// create the execution manager to execute the build
- executionManager = new ExecutionManager(initConfig, config);
+ mainFrame = new Frame(initConfig, config);
OutputStream demuxOut
- = new DemuxOutputStream(executionManager, false);
+ = new DemuxOutputStream(mainFrame, false);
OutputStream demuxErr
- = new DemuxOutputStream(executionManager, true);
+ = new DemuxOutputStream(mainFrame, true);
System.setOut(new PrintStream(demuxOut));
System.setErr(new PrintStream(demuxErr));
- addBuildListeners(executionManager);
+ addBuildListeners(mainFrame);
} catch (Throwable e) {
if (logger != null) {
BuildEvent finishedEvent
@@ -261,7 +263,10 @@
}
try {
- executionManager.runBuild(project, targets, definedProperties);
+ mainFrame.setProject(project);
+ mainFrame.initialize(definedProperties);
+
+ mainFrame.startBuild(targets);
System.exit(0);
} catch (Throwable t) {
System.exit(1);
@@ -285,9 +290,9 @@
* Handle build file argument
*
* @param url the build file's URL
- * @exception ConfigException if the build file location is not valid
+ * @exception FrontendException if the build file location is not valid
*/
- private void argBuildFile(String url) throws ConfigException {
+ private void argBuildFile(String url) throws FrontendException {
try {
if (url.indexOf(":") == -1) {
// We convert any hash characters to their URL escape.
@@ -296,7 +301,7 @@
buildFileURL = new URL(url);
}
} catch (MalformedURLException e) {
- throw new ConfigException("Build file is not valid", e);
+ throw new FrontendException("Build file is not valid", e);
}
}
@@ -304,15 +309,15 @@
* Handle the log file option
*
* @param arg the value of the log file option
- * @exception ConfigException if the log file is not writeable
+ * @exception FrontendException if the log file is not writeable
*/
- private void argLogFile(String arg) throws ConfigException {
+ private void argLogFile(String arg) throws FrontendException {
try {
File logFile = new File(arg);
out = new PrintStream(new FileOutputStream(logFile));
err = out;
} catch (IOException ioe) {
- throw new ConfigException("Cannot write on the specified log " +
+ throw new FrontendException("Cannot write on the specified log " +
"file. Make sure the path exists and " +
"you have write permissions.", ioe);
}
@@ -322,11 +327,11 @@
* Handle the logger attribute
*
* @param arg the logger classname
- * @exception ConfigException if a logger has already been defined
+ * @exception FrontendException if a logger has already been defined
*/
- private void argLogger(String arg) throws ConfigException {
+ private void argLogger(String arg) throws FrontendException {
if (loggerClassname != null) {
- throw new ConfigException("Only one logger class may be " +
+ throw new FrontendException("Only one logger class may be " +
"specified.");
}
loggerClassname = arg;
@@ -336,9 +341,9 @@
/**
* Determine the build file to use
*
- * @exception ConfigException if the build file cannot be found
+ * @exception FrontendException if the build file cannot be found
*/
- private void determineBuildFile() throws ConfigException {
+ private void determineBuildFile() throws FrontendException {
if (buildFileURL == null) {
File defaultBuildFile
= new File(FrontendUtils.DEFAULT_BUILD_FILENAME);
@@ -352,7 +357,7 @@
try {
buildFileURL = InitUtils.getFileURL(defaultBuildFile);
} catch (MalformedURLException e) {
- throw new ConfigException("Build file is not valid", e);
+ throw new FrontendException("Build file is not valid", e);
}
}
}
@@ -361,11 +366,11 @@
* Parse the command line arguments.
*
* @param args the command line arguments
- * @exception ConfigException thrown when the command line contains some
+ * @exception FrontendException thrown when the command line contains some
* sort of error.
*/
private void parseArguments(String[] args)
- throws ConfigException {
+ throws FrontendException {
int i = 0;
while (i < args.length) {
@@ -417,9 +422,9 @@
* Creates the default build logger for sending build events to the ant
* log.
*
- * @exception ConfigException if the logger cannot be instantiatd
+ * @exception FrontendException if the logger cannot be instantiatd
*/
- private void createLogger() throws ConfigException {
+ private void createLogger() throws FrontendException {
if (loggerClassname != null) {
try {
Class loggerClass = Class.forName(loggerClassname);
@@ -428,13 +433,13 @@
System.err.println("The specified logger class "
+ loggerClassname +
" does not implement the BuildLogger interface");
- throw new ConfigException("Unable to instantiate logger "
+ throw new FrontendException("Unable to instantiate logger "
+ loggerClassname, e);
} catch (Exception e) {
System.err.println("Unable to instantiate specified logger "
+ "class " + loggerClassname + " : "
+ e.getClass().getName());
- throw new ConfigException("Unable to instantiate logger "
+ throw new FrontendException("Unable to instantiate logger "
+ loggerClassname, e);
}
} else {
1.2 +8 -9 jakarta-ant/proposal/mutant/src/java/frontend/org/apache/ant/frontend/FrontendUtils.java
Index: FrontendUtils.java
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/mutant/src/java/frontend/org/apache/ant/frontend/FrontendUtils.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -w -u -r1.1 -r1.2
--- FrontendUtils.java 16 Apr 2002 14:07:47 -0000 1.1
+++ FrontendUtils.java 27 May 2002 15:52:27 -0000 1.2
@@ -61,7 +61,6 @@
import org.apache.ant.antcore.config.AntConfigHandler;
import org.apache.ant.antcore.xml.ParseContext;
import org.apache.ant.antcore.xml.XMLParseException;
-import org.apache.ant.common.util.ConfigException;
import org.apache.ant.init.InitUtils;
/**
@@ -84,11 +83,11 @@
* @param configArea the config area from which the config may be read
* @return the AntConfig instance representing the config info read in
* from the config area. May be null if the AntConfig is not present
- * @exception ConfigException if the URL for the config file cannotbe
+ * @exception FrontendException if the URL for the config file cannotbe
* formed.
*/
public static AntConfig getAntConfig(File configArea)
- throws ConfigException {
+ throws FrontendException {
File configFile = new File(configArea, "antconfig.xml");
try {
@@ -105,11 +104,11 @@
*
* @param configFile the file containing the XML config
* @return the parsed config object
- * @exception ConfigException if the config cannot be parsed
+ * @exception FrontendException if the config cannot be parsed
* @exception FileNotFoundException if the file cannot be found.
*/
public static AntConfig getAntConfigFile(File configFile)
- throws ConfigException, FileNotFoundException {
+ throws FrontendException, FileNotFoundException {
try {
URL configFileURL = InitUtils.getFileURL(configFile);
@@ -120,15 +119,15 @@
return configHandler.getAntConfig();
} catch (MalformedURLException e) {
- throw new ConfigException("Unable to form URL to read config from "
- + configFile, e);
+ throw new FrontendException("Unable to form URL to read "
+ + "config from " + configFile, e);
} catch (XMLParseException e) {
if (e.getCause() instanceof FileNotFoundException) {
throw (FileNotFoundException) e.getCause();
}
- throw new ConfigException("Unable to parse config file from "
- + configFile, e);
+ throw new FrontendException("Unable to parse config file from "
+ + configFile, e, e.getLocation());
}
}
1.1 jakarta-ant/proposal/mutant/src/java/frontend/org/apache/ant/frontend/FrontendException.java
Index: FrontendException.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 apache@apache.org.
*
* 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.frontend;
import org.apache.ant.common.util.AntException;
import org.apache.ant.common.util.Location;
/**
* An exception in the frontend set up of an Ant run
*
* @author Conor MacNeill
*/
public class FrontendException extends AntException {
/**
* Constructs an exception with the given descriptive message.
*
* @param msg Description of or information about the exception.
*/
public FrontendException(String msg) {
super(msg);
}
/**
* Constructs an exception with the given descriptive message and a
* location in a file.
*
* @param msg Description of or information about the exception.
* @param location Location in the project file where the error occured.
*/
public FrontendException(String msg, Location location) {
super(msg, location);
}
/**
* Constructs an exception with the given message and exception as a
* root cause.
*
* @param msg Description of or information about the exception.
* @param cause Throwable that might have cause this one.
*/
public FrontendException(String msg, Throwable cause) {
super(msg, cause);
}
/**
* Constructs an exception with the given message and exception as a
* root cause and a location in a file.
*
* @param msg Description of or information about the exception.
* @param cause Exception that might have cause this one.
* @param location Location in the project file where the error occured.
*/
public FrontendException(String msg, Throwable cause,
Location location) {
super(msg, cause, location);
}
/**
* Constructs an exception with the given exception as a root cause.
*
* @param cause Exception that might have caused this one.
*/
public FrontendException(Throwable cause) {
super(cause);
}
/**
* Constructs an exception with the given exception as a root cause and
* a location in a file.
*
* @param cause Exception that might have cause this one.
* @param location Location in the project file where the error occured.
*/
public FrontendException(Throwable cause, Location location) {
super(cause, location);
}
}
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>