net.sweetohm.ant.xml
Class NestTask

java.lang.Object
  extended by org.apache.tools.ant.ProjectComponent
      extended by org.apache.tools.ant.Task
          extended by net.sweetohm.ant.util.FileTask
              extended by net.sweetohm.ant.xml.NestTask
All Implemented Interfaces:
java.lang.Cloneable

public class NestTask
extends FileTask

This task nest files within a given file to replace a processing instruction.

Version:
1.0
Author:
Michel CASABIANCA

Field Summary
(package private)  java.util.Vector files
          The list of files to process
(package private)  java.lang.String pattern
          Processing instruction to search
(package private)  java.lang.String pi
          Processing instruction to search for
(package private)  java.io.File source
          The file to insert
 
Fields inherited from class org.apache.tools.ant.Task
target, taskName, taskType, wrapper
 
Fields inherited from class org.apache.tools.ant.ProjectComponent
description, location, project
 
Constructor Summary
NestTask()
          Empty constructor (needed for reflexion).
 
Method Summary
 void execute()
          The method to launch the program as an Ant task.
(package private)  void insert(java.lang.String string, java.io.File file, java.lang.String content)
          Insert the PI with the content of the file
(package private)  void processFile(java.io.File file, java.lang.String content)
          Process a single file
 void setPattern(java.lang.String pattern)
          Pattern setter.
 void setSource(java.lang.String source)
          Source setter.
 
Methods inherited from class net.sweetohm.ant.util.FileTask
addFileset, getFiles, setDir, setFile
 
Methods inherited from class org.apache.tools.ant.Task
bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType
 
Methods inherited from class org.apache.tools.ant.ProjectComponent
clone, getDescription, getLocation, getProject, setDescription, setLocation, setProject
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

pattern

java.lang.String pattern
Processing instruction to search


pi

java.lang.String pi
Processing instruction to search for


files

java.util.Vector files
The list of files to process


source

java.io.File source
The file to insert

Constructor Detail

NestTask

public NestTask()
Empty constructor (needed for reflexion).

Method Detail

setPattern

public void setPattern(java.lang.String pattern)
Pattern setter.

Parameters:
pattern - The pattern to search.

setSource

public void setSource(java.lang.String source)
Source setter.

Parameters:
source - The source file to insert.

execute

public void execute()
The method to launch the program as an Ant task.

Overrides:
execute in class org.apache.tools.ant.Task

processFile

void processFile(java.io.File file,
                 java.lang.String content)
           throws java.io.IOException
Process a single file

Parameters:
file - The file to process
Throws:
java.io.IOException

insert

void insert(java.lang.String string,
            java.io.File file,
            java.lang.String content)
      throws java.io.IOException
Insert the PI with the content of the file

Parameters:
string - The content of the file
file - The file to insert
source - The content of the file to insert
Throws:
java.io.IOException