From 500d69e18909fb9dc8dc537095aa352e951f61da Mon Sep 17 00:00:00 2001 From: Peter Donald Date: Fri, 4 Jan 2002 09:25:13 +0000 Subject: [PATCH] Removed cruft from tasks that manually worked with references rather than letting the container handle it. git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@270509 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/tools/ant/taskdefs/Available.java | 7 --- .../apache/tools/ant/taskdefs/DependSet.java | 8 +-- .../org/apache/tools/ant/taskdefs/Java.java | 12 ---- .../org/apache/tools/ant/taskdefs/Javac.java | 23 ------- .../tools/ant/taskdefs/PathConvert.java | 22 ------- .../apache/tools/ant/taskdefs/Property.java | 6 -- .../org/apache/tools/ant/taskdefs/Rmic.java | 12 ---- .../apache/tools/ant/taskdefs/SQLExec.java | 12 ---- .../ant/taskdefs/javadoc/DocletInfo.java | 12 ---- .../tools/ant/taskdefs/javadoc/Javadoc.java | 44 ------------- .../ant/taskdefs/optional/depend/Depend.java | 12 ---- .../optional/ejb/BorlandGenerateClient.java | 7 --- .../tools/ant/taskdefs/optional/jsp/JspC.java | 15 ----- .../ant/taskdefs/security/GenerateKey.java | 2 - .../ant/taskdefs/text/ReplaceRegExp.java | 8 +-- .../tools/ant/taskdefs/text/Substitution.java | 62 +++---------------- .../apache/tools/ant/taskdefs/Available.java | 7 --- .../apache/tools/ant/taskdefs/DependSet.java | 8 +-- .../org/apache/tools/ant/taskdefs/Java.java | 12 ---- .../org/apache/tools/ant/taskdefs/Javac.java | 23 ------- .../tools/ant/taskdefs/PathConvert.java | 22 ------- .../apache/tools/ant/taskdefs/Property.java | 6 -- .../org/apache/tools/ant/taskdefs/Rmic.java | 12 ---- .../apache/tools/ant/taskdefs/SQLExec.java | 12 ---- .../ant/taskdefs/javadoc/DocletInfo.java | 12 ---- .../tools/ant/taskdefs/javadoc/Javadoc.java | 44 ------------- .../ant/taskdefs/optional/depend/Depend.java | 12 ---- .../optional/ejb/BorlandGenerateClient.java | 7 --- .../tools/ant/taskdefs/optional/jsp/JspC.java | 15 ----- .../ant/taskdefs/security/GenerateKey.java | 2 - .../ant/taskdefs/text/ReplaceRegExp.java | 8 +-- .../tools/ant/taskdefs/text/Substitution.java | 62 +++---------------- 32 files changed, 30 insertions(+), 498 deletions(-) diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Available.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Available.java index bbb1f8b12..a1bfe8c10 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Available.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Available.java @@ -15,7 +15,6 @@ import org.apache.tools.ant.Task; import org.apache.tools.ant.taskdefs.condition.Condition; import org.apache.tools.ant.types.EnumeratedAttribute; import org.apache.tools.ant.types.Path; -import org.apache.tools.ant.types.Reference; /** * Will set the given property if the requested resource is available at @@ -55,12 +54,6 @@ public class Available createClasspath().append( classpath ); } - public void setClasspathRef( Reference r ) - throws TaskException - { - createClasspath().setRefid( r ); - } - public void setFile( String file ) { m_file = file; diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/DependSet.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/DependSet.java index 88fabac1a..0121d1683 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/DependSet.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/DependSet.java @@ -179,12 +179,12 @@ public class DependSet extends MatchingTask { FileList targetFL = (FileList)enumTargetLists.next(); - String[] targetFiles = targetFL.getFiles( getProject() ); + String[] targetFiles = targetFL.getFiles(); for( int i = 0; i < targetFiles.length; i++ ) { - File dest = new File( targetFL.getDir( getProject() ), targetFiles[ i ] ); + File dest = new File( targetFL.getDir(), targetFiles[ i ] ); if( !dest.exists() ) { getLogger().debug( targetFiles[ i ] + " does not exist." ); @@ -250,12 +250,12 @@ public class DependSet extends MatchingTask { FileList sourceFL = (FileList)enumSourceLists.next(); - String[] sourceFiles = sourceFL.getFiles( getProject() ); + String[] sourceFiles = sourceFL.getFiles(); int i = 0; do { - File src = new File( sourceFL.getDir( getProject() ), sourceFiles[ i ] ); + File src = new File( sourceFL.getDir(), sourceFiles[ i ] ); if( src.lastModified() > now ) { diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Java.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Java.java index 4645361e8..5da32e4e9 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Java.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Java.java @@ -20,7 +20,6 @@ import org.apache.tools.ant.types.Argument; import org.apache.tools.ant.types.CommandlineJava; import org.apache.tools.ant.types.EnvironmentVariable; import org.apache.tools.ant.types.Path; -import org.apache.tools.ant.types.Reference; /** * This task acts as a loader for java applications but allows to use the same @@ -67,17 +66,6 @@ public class Java extends Task createClasspath().append( s ); } - /** - * Adds a reference to a CLASSPATH defined elsewhere. - * - * @param r The new ClasspathRef value - */ - public void setClasspathRef( Reference r ) - throws TaskException - { - createClasspath().setRefid( r ); - } - /** * The working directory of the process * diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Javac.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Javac.java index 58fa18e68..7cfe1f027 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Javac.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Javac.java @@ -18,7 +18,6 @@ import org.apache.tools.ant.taskdefs.compilers.CompilerAdapter; import org.apache.tools.ant.taskdefs.compilers.CompilerAdapterFactory; import org.apache.tools.ant.types.Argument; import org.apache.tools.ant.types.Path; -import org.apache.tools.ant.types.Reference; import org.apache.tools.ant.util.GlobPatternMapper; import org.apache.tools.ant.util.SourceFileScanner; @@ -88,17 +87,6 @@ public class Javac extends MatchingTask private Path src; private String target; - /** - * Adds a reference to a CLASSPATH defined elsewhere. - * - * @param r The new BootClasspathRef value - */ - public void setBootClasspathRef( Reference r ) - throws TaskException - { - createBootclasspath().setRefid( r ); - } - /** * Sets the bootclasspath that will be used to compile the classes against. * @@ -135,17 +123,6 @@ public class Javac extends MatchingTask } } - /** - * Adds a reference to a CLASSPATH defined elsewhere. - * - * @param r The new ClasspathRef value - */ - public void setClasspathRef( Reference r ) - throws TaskException - { - createClasspath().setRefid( r ); - } - /** * Set the debug flag. * diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/PathConvert.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/PathConvert.java index 9f261d338..ce94a9633 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/PathConvert.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/PathConvert.java @@ -11,7 +11,6 @@ import java.io.File; import java.util.ArrayList; import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.Task; -import org.apache.tools.ant.types.FileSet; import org.apache.tools.ant.types.Path; import org.apache.tools.ant.types.Reference; @@ -160,27 +159,6 @@ public class PathConvert extends Task throws TaskException { // If we are a reference, the create a Path from the reference - if( isReference() ) - { - path = new Path().createPath(); - - Object obj = refid.getReferencedObject( getProject() ); - - if( obj instanceof Path ) - { - path.setRefid( refid ); - } - else if( obj instanceof FileSet ) - { - FileSet fs = (FileSet)obj; - path.addFileset( fs ); - } - else - { - throw new TaskException( "'refid' does not refer to a path or fileset" ); - } - } - validateSetup();// validate our setup // Currently, we deal with only two path formats: Unix and Windows diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Property.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Property.java index 51821b6ce..5b61807f6 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Property.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Property.java @@ -55,12 +55,6 @@ public class Property } } - public void setClasspathRef( Reference r ) - throws TaskException - { - createClasspath().setRefid( r ); - } - public void setEnvironment( String env ) { m_env = env; diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Rmic.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Rmic.java index 20e39e822..25a5319b9 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Rmic.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Rmic.java @@ -18,7 +18,6 @@ import org.apache.tools.ant.DirectoryScanner; import org.apache.tools.ant.taskdefs.rmic.RmicAdapter; import org.apache.tools.ant.taskdefs.rmic.RmicAdapterFactory; import org.apache.tools.ant.types.Path; -import org.apache.tools.ant.types.Reference; import org.apache.tools.ant.util.FileNameMapper; import org.apache.tools.ant.util.SourceFileScanner; @@ -120,17 +119,6 @@ public class Rmic extends MatchingTask } } - /** - * Adds a reference to a CLASSPATH defined elsewhere. - * - * @param r The new ClasspathRef value - */ - public void setClasspathRef( Reference r ) - throws TaskException - { - createClasspath().setRefid( r ); - } - /** * Sets the debug flag. * diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/SQLExec.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/SQLExec.java index 185047090..2df8e4a6d 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/SQLExec.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/SQLExec.java @@ -37,7 +37,6 @@ import org.apache.tools.ant.Task; import org.apache.tools.ant.types.EnumeratedAttribute; import org.apache.tools.ant.types.FileSet; import org.apache.tools.ant.types.Path; -import org.apache.tools.ant.types.Reference; /** * Reads in a text file containing SQL statements seperated with semicolons and @@ -180,17 +179,6 @@ public class SQLExec } } - /** - * Set the classpath for loading the driver using the classpath reference. - * - * @param r The new ClasspathRef value - */ - public void setClasspathRef( Reference r ) - throws TaskException - { - createClasspath().setRefid( r ); - } - /** * Set the statement delimiter.

* diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/javadoc/DocletInfo.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/javadoc/DocletInfo.java index ba4ce8246..ada5fca68 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/javadoc/DocletInfo.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/javadoc/DocletInfo.java @@ -11,7 +11,6 @@ import java.util.ArrayList; import java.util.Iterator; import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.types.Path; -import org.apache.tools.ant.types.Reference; public class DocletInfo { @@ -37,17 +36,6 @@ public class DocletInfo } } - /** - * Adds a reference to a CLASSPATH defined elsewhere. - * - * @param r The new PathRef value - */ - public void setPathRef( final Reference reference ) - throws TaskException - { - createPath().setRefid( reference ); - } - public String getName() { return m_name; diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/javadoc/Javadoc.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/javadoc/Javadoc.java index 5f6b7a730..c501a33f0 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/javadoc/Javadoc.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/javadoc/Javadoc.java @@ -23,7 +23,6 @@ import org.apache.tools.ant.taskdefs.exec.Execute; import org.apache.tools.ant.types.Commandline; import org.apache.tools.ant.types.FileSet; import org.apache.tools.ant.types.Path; -import org.apache.tools.ant.types.Reference; /** * This task makes it easy to generate Javadoc documentation for a collection of @@ -102,17 +101,6 @@ public class Javadoc m_author = src; } - /** - * Adds a reference to a CLASSPATH defined elsewhere. - * - * @param r The new BootClasspathRef value - */ - public void setBootClasspathRef( Reference r ) - throws TaskException - { - createBootclasspath().setRefid( r ); - } - public void setBootclasspath( Path src ) throws TaskException { @@ -151,17 +139,6 @@ public class Javadoc } } - /** - * Adds a reference to a CLASSPATH defined elsewhere. - * - * @param r The new ClasspathRef value - */ - public void setClasspathRef( Reference r ) - throws TaskException - { - createClasspath().setRefid( r ); - } - /** * Sets whether default exclusions should be used or not. * @@ -205,16 +182,6 @@ public class Javadoc m_doclet.setPath( src ); } - public void setDocletPathRef( Reference r ) - throws TaskException - { - if( m_doclet == null ) - { - m_doclet = new DocletInfo(); - } - m_doclet.createPath().setRefid( r ); - } - public void setDoctitle( String src ) { Html h = new Html(); @@ -417,17 +384,6 @@ public class Javadoc } } - /** - * Adds a reference to a CLASSPATH defined elsewhere. - * - * @param r The new SourcepathRef value - */ - public void setSourcepathRef( Reference r ) - throws TaskException - { - createSourcepath().setRefid( r ); - } - public void setSplitindex( boolean b ) { addArgIf( b, "-splitindex" ); diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/depend/Depend.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/depend/Depend.java index 47e8679d6..b7a483cdb 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/depend/Depend.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/depend/Depend.java @@ -24,7 +24,6 @@ import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.DirectoryScanner; import org.apache.tools.ant.taskdefs.MatchingTask; import org.apache.tools.ant.types.Path; -import org.apache.tools.ant.types.Reference; /** * Generate a dependency file for a given set of classes @@ -117,17 +116,6 @@ public class Depend extends MatchingTask } } - /** - * Adds a reference to a CLASSPATH defined elsewhere. - * - * @param r The new ClasspathRef value - */ - public void setClasspathRef( Reference r ) - throws TaskException - { - createClasspath().setRefid( r ); - } - public void setClosure( boolean closure ) { this.closure = closure; diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/BorlandGenerateClient.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/BorlandGenerateClient.java index 1f88f706a..d58aa1e01 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/BorlandGenerateClient.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/BorlandGenerateClient.java @@ -13,7 +13,6 @@ import org.apache.tools.ant.Task; import org.apache.tools.ant.taskdefs.Java; import org.apache.tools.ant.taskdefs.exec.ExecTask; import org.apache.tools.ant.types.Path; -import org.apache.tools.ant.types.Reference; /** * BorlandGenerateClient is dedicated to the Borland Application Server 4.5 This @@ -66,12 +65,6 @@ public class BorlandGenerateClient extends Task } } - public void setClasspathRef( Reference r ) - throws TaskException - { - createClasspath().setRefid( r ); - } - public void setClientjar( File clientjar ) { clientjarfile = clientjar; diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jsp/JspC.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jsp/JspC.java index 67445874b..97c60ca7e 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jsp/JspC.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jsp/JspC.java @@ -16,7 +16,6 @@ import org.apache.tools.ant.taskdefs.MatchingTask; import org.apache.tools.ant.taskdefs.optional.jsp.compilers.CompilerAdapter; import org.apache.tools.ant.taskdefs.optional.jsp.compilers.CompilerAdapterFactory; import org.apache.tools.ant.types.Path; -import org.apache.tools.ant.types.Reference; /** * Ant task to run the jsp compiler.

@@ -108,20 +107,6 @@ public class JspC extends MatchingTask classpath.append( cp ); } - /** - * Adds a reference to a CLASSPATH defined elsewhere - * - * @param r The new ClasspathRef value - */ - public void setClasspathRef( Reference r ) - throws TaskException - { - createClasspath().setRefid( r ); - } - - /* - * ------------------------------------------------------------ - */ /** * Set the destination directory into which the JSP source files should be * compiled. diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/security/GenerateKey.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/security/GenerateKey.java index a54b6d036..39fff4555 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/security/GenerateKey.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/security/GenerateKey.java @@ -7,8 +7,6 @@ */ package org.apache.tools.ant.taskdefs.security; -import java.util.ArrayList; -import java.util.Iterator; import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.Task; import org.apache.tools.ant.taskdefs.exec.ExecTask; diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/text/ReplaceRegExp.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/text/ReplaceRegExp.java index 0455b5462..28e084fc1 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/text/ReplaceRegExp.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/text/ReplaceRegExp.java @@ -240,11 +240,11 @@ public class ReplaceRegExp extends Task throws TaskException { String res = input; - Regexp regexp = r.getRegexp( getProject() ); + Regexp regexp = r.getRegexp(); if( regexp.matches( input, options ) ) { - res = regexp.substitute( input, s.getExpression( getProject() ), options ); + res = regexp.substitute( input, s.getExpression(), options ); } return res; @@ -277,8 +277,8 @@ public class ReplaceRegExp extends Task boolean changes = false; - final String message = "Replacing pattern '" + regex.getPattern( getProject() ) + - "' with '" + subs.getExpression( getProject() ) + + final String message = "Replacing pattern '" + regex.getPattern() + + "' with '" + subs.getExpression() + "' in '" + f.getPath() + "'" + ( byline ? " by line" : "" ) + ( flags.length() > 0 ? " with flags: '" + flags + "'" : "" ) + diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/text/Substitution.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/text/Substitution.java index 5b0b30a18..69ab81c70 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/text/Substitution.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/text/Substitution.java @@ -7,10 +7,7 @@ */ package org.apache.tools.ant.taskdefs.text; -import java.util.Stack; -import org.apache.myrmidon.api.TaskException; -import org.apache.tools.ant.Project; -import org.apache.tools.ant.types.DataType; +import org.apache.tools.ant.ProjectComponent; /** * A regular expression substitution datatype. It is an expression that is meant @@ -24,65 +21,20 @@ import org.apache.tools.ant.types.DataType; * @see org.apache.oro.text.regex.Perl5Substitition */ public class Substitution - extends DataType + extends ProjectComponent { - public final static String DATA_TYPE_NAME = "substitition"; + private String m_expression; - private String expression; - - public Substitution() - { - this.expression = null; - } - - public void setExpression( String expression ) + public void setExpression( final String expression ) { - this.expression = expression; + m_expression = expression; } /** * Gets the pattern string for this RegularExpression in the given project. - * - * @param p Description of Parameter - * @return The Expression value */ - public String getExpression( Project p ) - throws TaskException + public String getExpression() { - if( isReference() ) - { - return getRef( p ).getExpression( p ); - } - - return expression; - } - - /** - * Get the RegularExpression this reference refers to in the given project. - * Check for circular references too - * - * @param p Description of Parameter - * @return The Ref value - */ - public Substitution getRef( Project p ) - throws TaskException - { - if( !checked ) - { - Stack stk = new Stack(); - stk.push( this ); - dieOnCircularReference( stk, p ); - } - - Object o = ref.getReferencedObject( p ); - if( !( o instanceof Substitution ) ) - { - String msg = ref.getRefId() + " doesn\'t denote a substitution"; - throw new TaskException( msg ); - } - else - { - return (Substitution)o; - } + return m_expression; } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Available.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Available.java index bbb1f8b12..a1bfe8c10 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Available.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Available.java @@ -15,7 +15,6 @@ import org.apache.tools.ant.Task; import org.apache.tools.ant.taskdefs.condition.Condition; import org.apache.tools.ant.types.EnumeratedAttribute; import org.apache.tools.ant.types.Path; -import org.apache.tools.ant.types.Reference; /** * Will set the given property if the requested resource is available at @@ -55,12 +54,6 @@ public class Available createClasspath().append( classpath ); } - public void setClasspathRef( Reference r ) - throws TaskException - { - createClasspath().setRefid( r ); - } - public void setFile( String file ) { m_file = file; diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/DependSet.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/DependSet.java index 88fabac1a..0121d1683 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/DependSet.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/DependSet.java @@ -179,12 +179,12 @@ public class DependSet extends MatchingTask { FileList targetFL = (FileList)enumTargetLists.next(); - String[] targetFiles = targetFL.getFiles( getProject() ); + String[] targetFiles = targetFL.getFiles(); for( int i = 0; i < targetFiles.length; i++ ) { - File dest = new File( targetFL.getDir( getProject() ), targetFiles[ i ] ); + File dest = new File( targetFL.getDir(), targetFiles[ i ] ); if( !dest.exists() ) { getLogger().debug( targetFiles[ i ] + " does not exist." ); @@ -250,12 +250,12 @@ public class DependSet extends MatchingTask { FileList sourceFL = (FileList)enumSourceLists.next(); - String[] sourceFiles = sourceFL.getFiles( getProject() ); + String[] sourceFiles = sourceFL.getFiles(); int i = 0; do { - File src = new File( sourceFL.getDir( getProject() ), sourceFiles[ i ] ); + File src = new File( sourceFL.getDir(), sourceFiles[ i ] ); if( src.lastModified() > now ) { diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Java.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Java.java index 4645361e8..5da32e4e9 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Java.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Java.java @@ -20,7 +20,6 @@ import org.apache.tools.ant.types.Argument; import org.apache.tools.ant.types.CommandlineJava; import org.apache.tools.ant.types.EnvironmentVariable; import org.apache.tools.ant.types.Path; -import org.apache.tools.ant.types.Reference; /** * This task acts as a loader for java applications but allows to use the same @@ -67,17 +66,6 @@ public class Java extends Task createClasspath().append( s ); } - /** - * Adds a reference to a CLASSPATH defined elsewhere. - * - * @param r The new ClasspathRef value - */ - public void setClasspathRef( Reference r ) - throws TaskException - { - createClasspath().setRefid( r ); - } - /** * The working directory of the process * diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Javac.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Javac.java index 58fa18e68..7cfe1f027 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Javac.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Javac.java @@ -18,7 +18,6 @@ import org.apache.tools.ant.taskdefs.compilers.CompilerAdapter; import org.apache.tools.ant.taskdefs.compilers.CompilerAdapterFactory; import org.apache.tools.ant.types.Argument; import org.apache.tools.ant.types.Path; -import org.apache.tools.ant.types.Reference; import org.apache.tools.ant.util.GlobPatternMapper; import org.apache.tools.ant.util.SourceFileScanner; @@ -88,17 +87,6 @@ public class Javac extends MatchingTask private Path src; private String target; - /** - * Adds a reference to a CLASSPATH defined elsewhere. - * - * @param r The new BootClasspathRef value - */ - public void setBootClasspathRef( Reference r ) - throws TaskException - { - createBootclasspath().setRefid( r ); - } - /** * Sets the bootclasspath that will be used to compile the classes against. * @@ -135,17 +123,6 @@ public class Javac extends MatchingTask } } - /** - * Adds a reference to a CLASSPATH defined elsewhere. - * - * @param r The new ClasspathRef value - */ - public void setClasspathRef( Reference r ) - throws TaskException - { - createClasspath().setRefid( r ); - } - /** * Set the debug flag. * diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/PathConvert.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/PathConvert.java index 9f261d338..ce94a9633 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/PathConvert.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/PathConvert.java @@ -11,7 +11,6 @@ import java.io.File; import java.util.ArrayList; import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.Task; -import org.apache.tools.ant.types.FileSet; import org.apache.tools.ant.types.Path; import org.apache.tools.ant.types.Reference; @@ -160,27 +159,6 @@ public class PathConvert extends Task throws TaskException { // If we are a reference, the create a Path from the reference - if( isReference() ) - { - path = new Path().createPath(); - - Object obj = refid.getReferencedObject( getProject() ); - - if( obj instanceof Path ) - { - path.setRefid( refid ); - } - else if( obj instanceof FileSet ) - { - FileSet fs = (FileSet)obj; - path.addFileset( fs ); - } - else - { - throw new TaskException( "'refid' does not refer to a path or fileset" ); - } - } - validateSetup();// validate our setup // Currently, we deal with only two path formats: Unix and Windows diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Property.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Property.java index 51821b6ce..5b61807f6 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Property.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Property.java @@ -55,12 +55,6 @@ public class Property } } - public void setClasspathRef( Reference r ) - throws TaskException - { - createClasspath().setRefid( r ); - } - public void setEnvironment( String env ) { m_env = env; diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Rmic.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Rmic.java index 20e39e822..25a5319b9 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Rmic.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Rmic.java @@ -18,7 +18,6 @@ import org.apache.tools.ant.DirectoryScanner; import org.apache.tools.ant.taskdefs.rmic.RmicAdapter; import org.apache.tools.ant.taskdefs.rmic.RmicAdapterFactory; import org.apache.tools.ant.types.Path; -import org.apache.tools.ant.types.Reference; import org.apache.tools.ant.util.FileNameMapper; import org.apache.tools.ant.util.SourceFileScanner; @@ -120,17 +119,6 @@ public class Rmic extends MatchingTask } } - /** - * Adds a reference to a CLASSPATH defined elsewhere. - * - * @param r The new ClasspathRef value - */ - public void setClasspathRef( Reference r ) - throws TaskException - { - createClasspath().setRefid( r ); - } - /** * Sets the debug flag. * diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/SQLExec.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/SQLExec.java index 185047090..2df8e4a6d 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/SQLExec.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/SQLExec.java @@ -37,7 +37,6 @@ import org.apache.tools.ant.Task; import org.apache.tools.ant.types.EnumeratedAttribute; import org.apache.tools.ant.types.FileSet; import org.apache.tools.ant.types.Path; -import org.apache.tools.ant.types.Reference; /** * Reads in a text file containing SQL statements seperated with semicolons and @@ -180,17 +179,6 @@ public class SQLExec } } - /** - * Set the classpath for loading the driver using the classpath reference. - * - * @param r The new ClasspathRef value - */ - public void setClasspathRef( Reference r ) - throws TaskException - { - createClasspath().setRefid( r ); - } - /** * Set the statement delimiter.

* diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/javadoc/DocletInfo.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/javadoc/DocletInfo.java index ba4ce8246..ada5fca68 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/javadoc/DocletInfo.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/javadoc/DocletInfo.java @@ -11,7 +11,6 @@ import java.util.ArrayList; import java.util.Iterator; import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.types.Path; -import org.apache.tools.ant.types.Reference; public class DocletInfo { @@ -37,17 +36,6 @@ public class DocletInfo } } - /** - * Adds a reference to a CLASSPATH defined elsewhere. - * - * @param r The new PathRef value - */ - public void setPathRef( final Reference reference ) - throws TaskException - { - createPath().setRefid( reference ); - } - public String getName() { return m_name; diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/javadoc/Javadoc.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/javadoc/Javadoc.java index 5f6b7a730..c501a33f0 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/javadoc/Javadoc.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/javadoc/Javadoc.java @@ -23,7 +23,6 @@ import org.apache.tools.ant.taskdefs.exec.Execute; import org.apache.tools.ant.types.Commandline; import org.apache.tools.ant.types.FileSet; import org.apache.tools.ant.types.Path; -import org.apache.tools.ant.types.Reference; /** * This task makes it easy to generate Javadoc documentation for a collection of @@ -102,17 +101,6 @@ public class Javadoc m_author = src; } - /** - * Adds a reference to a CLASSPATH defined elsewhere. - * - * @param r The new BootClasspathRef value - */ - public void setBootClasspathRef( Reference r ) - throws TaskException - { - createBootclasspath().setRefid( r ); - } - public void setBootclasspath( Path src ) throws TaskException { @@ -151,17 +139,6 @@ public class Javadoc } } - /** - * Adds a reference to a CLASSPATH defined elsewhere. - * - * @param r The new ClasspathRef value - */ - public void setClasspathRef( Reference r ) - throws TaskException - { - createClasspath().setRefid( r ); - } - /** * Sets whether default exclusions should be used or not. * @@ -205,16 +182,6 @@ public class Javadoc m_doclet.setPath( src ); } - public void setDocletPathRef( Reference r ) - throws TaskException - { - if( m_doclet == null ) - { - m_doclet = new DocletInfo(); - } - m_doclet.createPath().setRefid( r ); - } - public void setDoctitle( String src ) { Html h = new Html(); @@ -417,17 +384,6 @@ public class Javadoc } } - /** - * Adds a reference to a CLASSPATH defined elsewhere. - * - * @param r The new SourcepathRef value - */ - public void setSourcepathRef( Reference r ) - throws TaskException - { - createSourcepath().setRefid( r ); - } - public void setSplitindex( boolean b ) { addArgIf( b, "-splitindex" ); diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/depend/Depend.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/depend/Depend.java index 47e8679d6..b7a483cdb 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/depend/Depend.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/depend/Depend.java @@ -24,7 +24,6 @@ import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.DirectoryScanner; import org.apache.tools.ant.taskdefs.MatchingTask; import org.apache.tools.ant.types.Path; -import org.apache.tools.ant.types.Reference; /** * Generate a dependency file for a given set of classes @@ -117,17 +116,6 @@ public class Depend extends MatchingTask } } - /** - * Adds a reference to a CLASSPATH defined elsewhere. - * - * @param r The new ClasspathRef value - */ - public void setClasspathRef( Reference r ) - throws TaskException - { - createClasspath().setRefid( r ); - } - public void setClosure( boolean closure ) { this.closure = closure; diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/BorlandGenerateClient.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/BorlandGenerateClient.java index 1f88f706a..d58aa1e01 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/BorlandGenerateClient.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/BorlandGenerateClient.java @@ -13,7 +13,6 @@ import org.apache.tools.ant.Task; import org.apache.tools.ant.taskdefs.Java; import org.apache.tools.ant.taskdefs.exec.ExecTask; import org.apache.tools.ant.types.Path; -import org.apache.tools.ant.types.Reference; /** * BorlandGenerateClient is dedicated to the Borland Application Server 4.5 This @@ -66,12 +65,6 @@ public class BorlandGenerateClient extends Task } } - public void setClasspathRef( Reference r ) - throws TaskException - { - createClasspath().setRefid( r ); - } - public void setClientjar( File clientjar ) { clientjarfile = clientjar; diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jsp/JspC.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jsp/JspC.java index 67445874b..97c60ca7e 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jsp/JspC.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jsp/JspC.java @@ -16,7 +16,6 @@ import org.apache.tools.ant.taskdefs.MatchingTask; import org.apache.tools.ant.taskdefs.optional.jsp.compilers.CompilerAdapter; import org.apache.tools.ant.taskdefs.optional.jsp.compilers.CompilerAdapterFactory; import org.apache.tools.ant.types.Path; -import org.apache.tools.ant.types.Reference; /** * Ant task to run the jsp compiler.

@@ -108,20 +107,6 @@ public class JspC extends MatchingTask classpath.append( cp ); } - /** - * Adds a reference to a CLASSPATH defined elsewhere - * - * @param r The new ClasspathRef value - */ - public void setClasspathRef( Reference r ) - throws TaskException - { - createClasspath().setRefid( r ); - } - - /* - * ------------------------------------------------------------ - */ /** * Set the destination directory into which the JSP source files should be * compiled. diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/security/GenerateKey.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/security/GenerateKey.java index a54b6d036..39fff4555 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/security/GenerateKey.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/security/GenerateKey.java @@ -7,8 +7,6 @@ */ package org.apache.tools.ant.taskdefs.security; -import java.util.ArrayList; -import java.util.Iterator; import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.Task; import org.apache.tools.ant.taskdefs.exec.ExecTask; diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/text/ReplaceRegExp.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/text/ReplaceRegExp.java index 0455b5462..28e084fc1 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/text/ReplaceRegExp.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/text/ReplaceRegExp.java @@ -240,11 +240,11 @@ public class ReplaceRegExp extends Task throws TaskException { String res = input; - Regexp regexp = r.getRegexp( getProject() ); + Regexp regexp = r.getRegexp(); if( regexp.matches( input, options ) ) { - res = regexp.substitute( input, s.getExpression( getProject() ), options ); + res = regexp.substitute( input, s.getExpression(), options ); } return res; @@ -277,8 +277,8 @@ public class ReplaceRegExp extends Task boolean changes = false; - final String message = "Replacing pattern '" + regex.getPattern( getProject() ) + - "' with '" + subs.getExpression( getProject() ) + + final String message = "Replacing pattern '" + regex.getPattern() + + "' with '" + subs.getExpression() + "' in '" + f.getPath() + "'" + ( byline ? " by line" : "" ) + ( flags.length() > 0 ? " with flags: '" + flags + "'" : "" ) + diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/text/Substitution.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/text/Substitution.java index 5b0b30a18..69ab81c70 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/text/Substitution.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/text/Substitution.java @@ -7,10 +7,7 @@ */ package org.apache.tools.ant.taskdefs.text; -import java.util.Stack; -import org.apache.myrmidon.api.TaskException; -import org.apache.tools.ant.Project; -import org.apache.tools.ant.types.DataType; +import org.apache.tools.ant.ProjectComponent; /** * A regular expression substitution datatype. It is an expression that is meant @@ -24,65 +21,20 @@ import org.apache.tools.ant.types.DataType; * @see org.apache.oro.text.regex.Perl5Substitition */ public class Substitution - extends DataType + extends ProjectComponent { - public final static String DATA_TYPE_NAME = "substitition"; + private String m_expression; - private String expression; - - public Substitution() - { - this.expression = null; - } - - public void setExpression( String expression ) + public void setExpression( final String expression ) { - this.expression = expression; + m_expression = expression; } /** * Gets the pattern string for this RegularExpression in the given project. - * - * @param p Description of Parameter - * @return The Expression value */ - public String getExpression( Project p ) - throws TaskException + public String getExpression() { - if( isReference() ) - { - return getRef( p ).getExpression( p ); - } - - return expression; - } - - /** - * Get the RegularExpression this reference refers to in the given project. - * Check for circular references too - * - * @param p Description of Parameter - * @return The Ref value - */ - public Substitution getRef( Project p ) - throws TaskException - { - if( !checked ) - { - Stack stk = new Stack(); - stk.push( this ); - dieOnCircularReference( stk, p ); - } - - Object o = ref.getReferencedObject( p ); - if( !( o instanceof Substitution ) ) - { - String msg = ref.getRefId() + " doesn\'t denote a substitution"; - throw new TaskException( msg ); - } - else - { - return (Substitution)o; - } + return m_expression; } }