ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject cvs commit: jakarta-ant/src/main/org/apache/tools/ant/taskdefs Replace.java
Date Thu, 04 Apr 2002 10:44:18 GMT
bodewig     02/04/04 02:44:18

  Modified:    src/main/org/apache/tools/ant/taskdefs Replace.java
  Log:
  New attribute for <replace> that allows all properties of a given
  property file to be used as replacefilter.
  
  PR: 7320
  Submitted by:	Wolfgang.Jakel@lutzwolf.de
  
  Revision  Changes    Path
  1.25      +21 -0     jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Replace.java
  
  Index: Replace.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Replace.java,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- Replace.java	3 Mar 2002 01:46:20 -0000	1.24
  +++ Replace.java	4 Apr 2002 10:44:18 -0000	1.25
  @@ -72,6 +72,7 @@
   import java.io.FileOutputStream;
   import java.io.BufferedReader;
   import java.io.BufferedWriter;
  +import java.util.Enumeration;
   import java.util.Properties;
   import java.util.Vector;
   
  @@ -92,6 +93,7 @@
       private NestedString value = new NestedString();
   
       private File propertyFile = null;
  +    private File replaceFilterFile = null;
       private Properties properties = null;
       private Vector replacefilters = new Vector();
   
  @@ -207,6 +209,18 @@
        * Do the execution.
        */
       public void execute() throws BuildException {
  +
  +        if (replaceFilterFile != null) {
  +            Properties properties = getProperties(replaceFilterFile);
  +            Enumeration enum = properties.keys();
  +            while(enum.hasMoreElements()){
  +               String token =  enum.nextElement().toString();
  +               Replacefilter replaceFilter = createReplacefilter();
  +               replaceFilter.setToken(token);
  +               replaceFilter.setValue(properties.getProperty(token));
  +            }
  +        }
  +
           validateAttributes();
   
           if (propertyFile != null) {
  @@ -434,6 +448,13 @@
       }
       
       
  +    /**
  +     * Sets a file used to define multiple ReplaceFilters from key-value pairs.
  +     */
  +    public void setReplaceFilterFile(File filename) {
  +        replaceFilterFile = filename;
  +    }
  +
       /**
        * Set the source files path when using matching tasks.
        */
  
  
  

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message