- * - * name=value*name2=value
- * - * Names are case sensitive.
- *
- * Use the setSep() method to change the * to something else if you need to
- * use * as a name or value.
- *
- * @param keys The new Keys value
- */
- public void setKeys( String keys )
- {
- if( keys != null && keys.length() > 0 )
- {
- StringTokenizer tok =
- new StringTokenizer( keys, this.sep, false );
- while( tok.hasMoreTokens() )
- {
- String token = tok.nextToken().trim();
- StringTokenizer itok =
- new StringTokenizer( token, "=", false );
-
- String name = itok.nextToken();
- String value = itok.nextToken();
-// log ( "Name: " + name );
-// log ( "Value: " + value );
- replacements.put( name, value );
- }
- }
- }
-
- /**
- * Sets the seperator between name=value arguments in setKeys(). By default
- * it is "*".
- *
- * @param sep The new Sep value
- */
- public void setSep( String sep )
- {
- this.sep = sep;
- }
-
- /**
- * Set the source file.
- *
- * @param s The new Src value
- */
- public void setSrc( File s )
- {
- this.source = s;
- }
-
- /**
- * Do the execution.
- *
- * @exception BuildException Description of Exception
- */
- public void execute()
- throws BuildException
- {
- log( "!! KeySubst is deprecated. Use Filter + CopyDir instead. !!" );
- log( "Performing Substitions" );
- if( source == null || dest == null )
- {
- log( "Source and destinations must not be null" );
- return;
- }
- BufferedReader br = null;
- BufferedWriter bw = null;
- try
- {
- br = new BufferedReader( new FileReader( source ) );
- dest.delete();
- bw = new BufferedWriter( new FileWriter( dest ) );
-
- String line = null;
- String newline = null;
- int length;
- line = br.readLine();
- while( line != null )
- {
- if( line.length() == 0 )
- {
- bw.newLine();
- }
- else
- {
- newline = KeySubst.replace( line, replacements );
- bw.write( newline );
- bw.newLine();
- }
- line = br.readLine();
- }
- bw.flush();
- bw.close();
- br.close();
- }
- catch( IOException ioe )
- {
- ioe.printStackTrace();
- }
- }
-}
diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Rename.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Rename.java
deleted file mode 100644
index 7e1090049..000000000
--- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Rename.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright (C) The Apache Software Foundation. All rights reserved.
- *
- * This software is published under the terms of the Apache Software License
- * version 1.1, a copy of which has been included with this distribution in
- * the LICENSE file.
- */
-package org.apache.tools.ant.taskdefs;
-import java.io.File;
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Task;
-
-/**
- * Renames a file.
- *
- * @author haas@softwired.ch
- * @deprecated The rename task is deprecated. Use move instead.
- */
-public class Rename extends Task
-{
- private boolean replace = true;
- private File dest;
-
- private File src;
-
- /**
- * Sets the new name of the file.
- *
- * @param dest the new name of the file.
- */
- public void setDest( File dest )
- {
- this.dest = dest;
- }
-
- /**
- * Sets wheter an existing file should be replaced.
- *
- * @param replace on, if an existing file should be replaced.
- */
- public void setReplace( String replace )
- {
- this.replace = project.toBoolean( replace );
- }
-
-
- /**
- * Sets the file to be renamed.
- *
- * @param src the file to rename
- */
- public void setSrc( File src )
- {
- this.src = src;
- }
-
-
- /**
- * Renames the file src to dest
- *
- * @exception BuildException Description of Exception
- */
- public void execute()
- throws BuildException
- {
- log( "DEPRECATED - The rename task is deprecated. Use move instead." );
-
- if( dest == null )
- {
- throw new BuildException( "dest attribute is required", location );
- }
-
- if( src == null )
- {
- throw new BuildException( "src attribute is required", location );
- }
-
- if( replace && dest.exists() )
- {
- if( !dest.delete() )
- {
- throw new BuildException( "Unable to remove existing file " +
- dest );
- }
- }
- if( !src.renameTo( dest ) )
- {
- throw new BuildException( "Unable to rename " + src + " to " +
- dest );
- }
- }
-}
diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/TaskOutputStream.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/TaskOutputStream.java
deleted file mode 100644
index 5af5c9934..000000000
--- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/TaskOutputStream.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Copyright (C) The Apache Software Foundation. All rights reserved.
- *
- * This software is published under the terms of the Apache Software License
- * version 1.1, a copy of which has been included with this distribution in
- * the LICENSE file.
- */
-package org.apache.tools.ant.taskdefs;
-import java.io.IOException;
-import java.io.OutputStream;
-import org.apache.tools.ant.Task;
-
-/**
- * Redirects text written to a stream thru the standard ant logging mechanism.
- * This class is useful for integrating with tools that write to System.out and
- * System.err. For example, the following will cause all text written to
- * System.out to be logged with "info" priority:
System.setOut(new PrintStream(new TaskOutputStream(project, Project.MSG_INFO)));- * - * @author James Duncan Davidson (duncan@x180.com) - * @deprecated use LogOutputStream instead. - */ - -public class TaskOutputStream extends OutputStream -{ - private StringBuffer line; - private int msgOutputLevel; - - private Task task; - - /** - * Constructs a new JavacOutputStream with the given project as the output - * source for messages. - * - * @param task Description of Parameter - * @param msgOutputLevel Description of Parameter - */ - - TaskOutputStream( Task task, int msgOutputLevel ) - { - this.task = task; - this.msgOutputLevel = msgOutputLevel; - - line = new StringBuffer(); - } - - /** - * Write a character to the output stream. This method looks to make sure - * that there isn't an error being reported and will flush each line of - * input out to the project's log stream. - * - * @param c Description of Parameter - * @exception IOException Description of Exception - */ - - public void write( int c ) - throws IOException - { - char cc = ( char )c; - if( cc == '\r' || cc == '\n' ) - { - // line feed - if( line.length() > 0 ) - { - processLine(); - } - } - else - { - line.append( cc ); - } - } - - /** - * Processes a line of input and determines if an error occured. - */ - - private void processLine() - { - String s = line.toString(); - task.log( s, msgOutputLevel ); - line = new StringBuffer(); - } -} - diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/RenameExtensions.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/RenameExtensions.java deleted file mode 100644 index 1aa5ab674..000000000 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/RenameExtensions.java +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Copyright (C) The Apache Software Foundation. All rights reserved. - * - * This software is published under the terms of the Apache Software License - * version 1.1, a copy of which has been included with this distribution in - * the LICENSE file. - */ -package org.apache.tools.ant.taskdefs.optional; -import java.io.File; -import org.apache.tools.ant.BuildException; -import org.apache.tools.ant.Project; -import org.apache.tools.ant.taskdefs.MatchingTask; -import org.apache.tools.ant.taskdefs.Move; -import org.apache.tools.ant.types.Mapper; - -/** - * @author dIon Gillard - * dion@multitask.com.au - * @author Stefan Bodewig - * @version 1.2 - */ -public class RenameExtensions extends MatchingTask -{ - - private String fromExtension = ""; - private String toExtension = ""; - private boolean replace = false; - - private Mapper.MapperType globType; - private File srcDir; - - - /** - * Creates new RenameExtensions - */ - public RenameExtensions() - { - super(); - globType = new Mapper.MapperType(); - globType.setValue( "glob" ); - } - - /** - * store fromExtension * - * - * @param from The new FromExtension value - */ - public void setFromExtension( String from ) - { - fromExtension = from; - } - - /** - * store replace attribute - this determines whether the target file should - * be overwritten if present - * - * @param replace The new Replace value - */ - public void setReplace( boolean replace ) - { - this.replace = replace; - } - - /** - * Set the source dir to find the files to be renamed. - * - * @param srcDir The new SrcDir value - */ - public void setSrcDir( File srcDir ) - { - this.srcDir = srcDir; - } - - /** - * store toExtension * - * - * @param to The new ToExtension value - */ - public void setToExtension( String to ) - { - toExtension = to; - } - - /** - * Executes the task, i.e. does the actual compiler call - * - * @exception BuildException Description of Exception - */ - public void execute() - throws BuildException - { - - // first off, make sure that we've got a from and to extension - if( fromExtension == null || toExtension == null || srcDir == null ) - { - throw new BuildException( "srcDir, fromExtension and toExtension " + - "attributes must be set!" ); - } - - log( "DEPRECATED - The renameext task is deprecated. Use move instead.", - Project.MSG_WARN ); - log( "Replace this with:", Project.MSG_INFO ); - log( "
- * - * name=value*name2=value
- * - * Names are case sensitive.
- *
- * Use the setSep() method to change the * to something else if you need to
- * use * as a name or value.
- *
- * @param keys The new Keys value
- */
- public void setKeys( String keys )
- {
- if( keys != null && keys.length() > 0 )
- {
- StringTokenizer tok =
- new StringTokenizer( keys, this.sep, false );
- while( tok.hasMoreTokens() )
- {
- String token = tok.nextToken().trim();
- StringTokenizer itok =
- new StringTokenizer( token, "=", false );
-
- String name = itok.nextToken();
- String value = itok.nextToken();
-// log ( "Name: " + name );
-// log ( "Value: " + value );
- replacements.put( name, value );
- }
- }
- }
-
- /**
- * Sets the seperator between name=value arguments in setKeys(). By default
- * it is "*".
- *
- * @param sep The new Sep value
- */
- public void setSep( String sep )
- {
- this.sep = sep;
- }
-
- /**
- * Set the source file.
- *
- * @param s The new Src value
- */
- public void setSrc( File s )
- {
- this.source = s;
- }
-
- /**
- * Do the execution.
- *
- * @exception BuildException Description of Exception
- */
- public void execute()
- throws BuildException
- {
- log( "!! KeySubst is deprecated. Use Filter + CopyDir instead. !!" );
- log( "Performing Substitions" );
- if( source == null || dest == null )
- {
- log( "Source and destinations must not be null" );
- return;
- }
- BufferedReader br = null;
- BufferedWriter bw = null;
- try
- {
- br = new BufferedReader( new FileReader( source ) );
- dest.delete();
- bw = new BufferedWriter( new FileWriter( dest ) );
-
- String line = null;
- String newline = null;
- int length;
- line = br.readLine();
- while( line != null )
- {
- if( line.length() == 0 )
- {
- bw.newLine();
- }
- else
- {
- newline = KeySubst.replace( line, replacements );
- bw.write( newline );
- bw.newLine();
- }
- line = br.readLine();
- }
- bw.flush();
- bw.close();
- br.close();
- }
- catch( IOException ioe )
- {
- ioe.printStackTrace();
- }
- }
-}
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Rename.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Rename.java
deleted file mode 100644
index 7e1090049..000000000
--- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Rename.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright (C) The Apache Software Foundation. All rights reserved.
- *
- * This software is published under the terms of the Apache Software License
- * version 1.1, a copy of which has been included with this distribution in
- * the LICENSE file.
- */
-package org.apache.tools.ant.taskdefs;
-import java.io.File;
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Task;
-
-/**
- * Renames a file.
- *
- * @author haas@softwired.ch
- * @deprecated The rename task is deprecated. Use move instead.
- */
-public class Rename extends Task
-{
- private boolean replace = true;
- private File dest;
-
- private File src;
-
- /**
- * Sets the new name of the file.
- *
- * @param dest the new name of the file.
- */
- public void setDest( File dest )
- {
- this.dest = dest;
- }
-
- /**
- * Sets wheter an existing file should be replaced.
- *
- * @param replace on, if an existing file should be replaced.
- */
- public void setReplace( String replace )
- {
- this.replace = project.toBoolean( replace );
- }
-
-
- /**
- * Sets the file to be renamed.
- *
- * @param src the file to rename
- */
- public void setSrc( File src )
- {
- this.src = src;
- }
-
-
- /**
- * Renames the file src to dest
- *
- * @exception BuildException Description of Exception
- */
- public void execute()
- throws BuildException
- {
- log( "DEPRECATED - The rename task is deprecated. Use move instead." );
-
- if( dest == null )
- {
- throw new BuildException( "dest attribute is required", location );
- }
-
- if( src == null )
- {
- throw new BuildException( "src attribute is required", location );
- }
-
- if( replace && dest.exists() )
- {
- if( !dest.delete() )
- {
- throw new BuildException( "Unable to remove existing file " +
- dest );
- }
- }
- if( !src.renameTo( dest ) )
- {
- throw new BuildException( "Unable to rename " + src + " to " +
- dest );
- }
- }
-}
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/TaskOutputStream.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/TaskOutputStream.java
deleted file mode 100644
index 5af5c9934..000000000
--- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/TaskOutputStream.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Copyright (C) The Apache Software Foundation. All rights reserved.
- *
- * This software is published under the terms of the Apache Software License
- * version 1.1, a copy of which has been included with this distribution in
- * the LICENSE file.
- */
-package org.apache.tools.ant.taskdefs;
-import java.io.IOException;
-import java.io.OutputStream;
-import org.apache.tools.ant.Task;
-
-/**
- * Redirects text written to a stream thru the standard ant logging mechanism.
- * This class is useful for integrating with tools that write to System.out and
- * System.err. For example, the following will cause all text written to
- * System.out to be logged with "info" priority:
System.setOut(new PrintStream(new TaskOutputStream(project, Project.MSG_INFO)));- * - * @author James Duncan Davidson (duncan@x180.com) - * @deprecated use LogOutputStream instead. - */ - -public class TaskOutputStream extends OutputStream -{ - private StringBuffer line; - private int msgOutputLevel; - - private Task task; - - /** - * Constructs a new JavacOutputStream with the given project as the output - * source for messages. - * - * @param task Description of Parameter - * @param msgOutputLevel Description of Parameter - */ - - TaskOutputStream( Task task, int msgOutputLevel ) - { - this.task = task; - this.msgOutputLevel = msgOutputLevel; - - line = new StringBuffer(); - } - - /** - * Write a character to the output stream. This method looks to make sure - * that there isn't an error being reported and will flush each line of - * input out to the project's log stream. - * - * @param c Description of Parameter - * @exception IOException Description of Exception - */ - - public void write( int c ) - throws IOException - { - char cc = ( char )c; - if( cc == '\r' || cc == '\n' ) - { - // line feed - if( line.length() > 0 ) - { - processLine(); - } - } - else - { - line.append( cc ); - } - } - - /** - * Processes a line of input and determines if an error occured. - */ - - private void processLine() - { - String s = line.toString(); - task.log( s, msgOutputLevel ); - line = new StringBuffer(); - } -} - diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/RenameExtensions.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/RenameExtensions.java deleted file mode 100644 index 1aa5ab674..000000000 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/RenameExtensions.java +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Copyright (C) The Apache Software Foundation. All rights reserved. - * - * This software is published under the terms of the Apache Software License - * version 1.1, a copy of which has been included with this distribution in - * the LICENSE file. - */ -package org.apache.tools.ant.taskdefs.optional; -import java.io.File; -import org.apache.tools.ant.BuildException; -import org.apache.tools.ant.Project; -import org.apache.tools.ant.taskdefs.MatchingTask; -import org.apache.tools.ant.taskdefs.Move; -import org.apache.tools.ant.types.Mapper; - -/** - * @author dIon Gillard - * dion@multitask.com.au - * @author Stefan Bodewig - * @version 1.2 - */ -public class RenameExtensions extends MatchingTask -{ - - private String fromExtension = ""; - private String toExtension = ""; - private boolean replace = false; - - private Mapper.MapperType globType; - private File srcDir; - - - /** - * Creates new RenameExtensions - */ - public RenameExtensions() - { - super(); - globType = new Mapper.MapperType(); - globType.setValue( "glob" ); - } - - /** - * store fromExtension * - * - * @param from The new FromExtension value - */ - public void setFromExtension( String from ) - { - fromExtension = from; - } - - /** - * store replace attribute - this determines whether the target file should - * be overwritten if present - * - * @param replace The new Replace value - */ - public void setReplace( boolean replace ) - { - this.replace = replace; - } - - /** - * Set the source dir to find the files to be renamed. - * - * @param srcDir The new SrcDir value - */ - public void setSrcDir( File srcDir ) - { - this.srcDir = srcDir; - } - - /** - * store toExtension * - * - * @param to The new ToExtension value - */ - public void setToExtension( String to ) - { - toExtension = to; - } - - /** - * Executes the task, i.e. does the actual compiler call - * - * @exception BuildException Description of Exception - */ - public void execute() - throws BuildException - { - - // first off, make sure that we've got a from and to extension - if( fromExtension == null || toExtension == null || srcDir == null ) - { - throw new BuildException( "srcDir, fromExtension and toExtension " + - "attributes must be set!" ); - } - - log( "DEPRECATED - The renameext task is deprecated. Use move instead.", - Project.MSG_WARN ); - log( "Replace this with:", Project.MSG_INFO ); - log( "