net.spy.ant
Class SPGenTask

java.lang.Object
  extended by org.apache.tools.ant.ProjectComponent
      extended by org.apache.tools.ant.Task
          extended by org.apache.tools.ant.taskdefs.MatchingTask
              extended by net.spy.ant.SPGenTask
All Implemented Interfaces:
org.apache.tools.ant.types.selectors.SelectorContainer

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(java.io.File f)
          Checks if a parent directory exists and, if not, creates it.
 void execute()
          Performs the operation.
protected  void processFile(java.lang.String filename)
           
 void setDbcpSuperclass(java.lang.String sc)
          Set the DBCP superclass for the generated class.
 void setDbspSuperclass(java.lang.String sc)
          Set the DBSP superclass for the generated class.
 void setDestdir(java.io.File to)
          Sets the destination directory to place .java files.
 void setInterfaces(java.lang.String to)
          Add a space separated set of interfaces to have generated classes implement.
 void setSrcdir(java.io.File to)
          Sets the source directory to search for .spt files.
 void setSuperclass(java.lang.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(java.io.File to)
Sets the source directory to search for .spt files.


setDestdir

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


setSuperclass

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


setDbcpSuperclass

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


setDbspSuperclass

public void setDbspSuperclass(java.lang.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.

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

processFile

protected void processFile(java.lang.String filename)
Parameters:
filename -

checkParent

protected void checkParent(java.io.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

setInterfaces

public void setInterfaces(java.lang.String to)
Add a space separated set of interfaces to have generated classes implement.

Parameters:
to - a space separated list of fully qualified interface names.


Copyright © 1995-2007 SPY Internetworking. All Rights Reserved.