net.spy.ant
Class SPGenTask

java.lang.Object
  extended byorg.apache.tools.ant.ProjectComponent
      extended byorg.apache.tools.ant.Task
          extended byorg.apache.tools.ant.taskdefs.MatchingTask
              extended bynet.spy.ant.SPGenTask
All Implemented Interfaces:
org.apache.tools.ant.types.selectors.SelectorContainer
Direct Known Subclasses:
SPGenTask

public class SPGenTask
extends org.apache.tools.ant.taskdefs.MatchingTask

Generates Java code from SPT files. This is an Ant task that recurses a directory and invokes net.spy.util.SPGen on .spt files to generate Java code. It does the usual stuff expected of a Make-style tool: leaving up-to-date .java files intact, creating output with a temporary file until it is finished so partial builds don't create problems, etc.

Example ant build entry:


	<target name="spfiles">
		<taskdef name="spgen" classname="net.spy.util.SPGenTask">
			<classpath refid="compile.classpath"/>
		</taskdef>
		<spgen srcdir="${spt.dir}" destdir="${spt.dir}"
			superclass="com.foo.MyDbsp"/>
	</target>
 

Version:
$Revision: 1.7 $ $Date: 2003/08/05 09:01:05 $
Author:
Scott Lamb

Field Summary
 
Fields inherited from class org.apache.tools.ant.taskdefs.MatchingTask
fileset
 
Fields inherited from class org.apache.tools.ant.Task
description, location, target, taskName, taskType, wrapper
 
Fields inherited from class org.apache.tools.ant.ProjectComponent
project
 
Constructor Summary
SPGenTask()
           
 
Method Summary
protected  void checkParent(File f)
          Checks if a parent directory exists and, if not, creates it.
 void execute()
          Performs the operation.
protected  void processFile(String filename)
          Processes an individual file.
 void setDbcpSuperclass(String sc)
          Set the DBCP superclass for the generated class.
 void setDbspSuperclass(String sc)
          Set the DBSP superclass for the generated class.
 void setDestdir(File destDir)
          Sets the destination directory to place .java files.
 void setSrcdir(File srcDir)
          Sets the source directory to search for .spt files.
 void setSuperclass(String sc)
          Set the superclass for the generated class.
 void setVerbose(boolean to)
          True if we want verbose transformations.
 
Methods inherited from class org.apache.tools.ant.taskdefs.MatchingTask
add, addAnd, addContains, addContainsRegexp, addCustom, addDate, addDepend, addDepth, addDifferent, addFilename, addMajority, addModified, addNone, addNot, addOr, addPresent, addSelector, addSize, addType, appendSelector, createExclude, createExcludesFile, createInclude, createIncludesFile, createPatternSet, getDirectoryScanner, getImplicitFileSet, getSelectors, hasSelectors, selectorCount, selectorElements, setCaseSensitive, setDefaultexcludes, setExcludes, setExcludesfile, setFollowSymlinks, setIncludes, setIncludesfile, setProject, XsetIgnore, XsetItems
 
Methods inherited from class org.apache.tools.ant.Task
getDescription, getLocation, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, maybeConfigure, perform, reconfigure, setDescription, setLocation, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType
 
Methods inherited from class org.apache.tools.ant.ProjectComponent
getProject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SPGenTask

public SPGenTask()
Method Detail

setSrcdir

public void setSrcdir(File srcDir)
Sets the source directory to search for .spt files.


setDestdir

public void setDestdir(File destDir)
Sets the destination directory to place .java files. If not specified, assumed to be the same as the source directory.


setSuperclass

public void setSuperclass(String sc)
Set the superclass for the generated class.


setDbcpSuperclass

public void setDbcpSuperclass(String sc)
Set the DBCP superclass for the generated class.


setDbspSuperclass

public void setDbspSuperclass(String sc)
Set the DBSP superclass for the generated class.


setVerbose

public void setVerbose(boolean to)
True if we want verbose transformations.


execute

public void execute()
             throws org.apache.tools.ant.BuildException
Performs the operation.

Throws:
org.apache.tools.ant.BuildException

processFile

protected void processFile(String filename)
Processes an individual file.

Parameters:
filename - The filename, relative to the source directory.

checkParent

protected void checkParent(File f)
                    throws org.apache.tools.ant.BuildException
Checks if a parent directory exists and, if not, creates it. Stops at the destination directory level.

Throws:
org.apache.tools.ant.BuildException