com.threerings.presents.tools
Class InstrumentStreamableTask

java.lang.Object
  extended by org.apache.tools.ant.ProjectComponent
      extended by org.apache.tools.ant.Task
          extended by com.threerings.presents.tools.InstrumentStreamableTask
All Implemented Interfaces:
Cloneable

public class InstrumentStreamableTask
extends Task

Instruments compiled Streamable classes with public methods that can be used to stream protected and private members when running in a sandboxed JVM.


Field Summary
protected  ArrayList<FileSet> _filesets
          A list of filesets that contain Streamable class files.
protected  File _outdir
          The directory to which we write our instrumented class files.
protected  ArrayList<Path> _paths
          A list of paths that make up our classpath.
protected  javassist.ClassPool _pool
          Used to instrument class files.
protected  javassist.CtClass _streamable
          Used to determine which classes implement Streamable.
protected static String BSNAME
           
 
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
InstrumentStreamableTask()
           
 
Method Summary
 void addFileset(FileSet set)
          Adds a nested <fileset> element which enumerates streamable class files.
 void addPath(Path path)
          Adds a <path> element which defines our classpath.
 void execute()
           
protected  String getFieldReader(javassist.CtField field)
           
protected  String getFieldWriter(javassist.CtField field)
           
protected  void processClass(File source)
          Processes a class file.
protected  void processStreamable(File source, javassist.CtClass clazz)
          Instruments the supplied Streamable implementing class.
protected  String readWrap(javassist.CtField field, String body)
           
 void setOutdir(File outdir)
          Configures the directory into which we write our instrumented class files.
protected  String writeWrap(javassist.CtField field, String body)
           
 
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

_filesets

protected ArrayList<FileSet> _filesets
A list of filesets that contain Streamable class files.


_paths

protected ArrayList<Path> _paths
A list of paths that make up our classpath.


_outdir

protected File _outdir
The directory to which we write our instrumented class files.


_pool

protected javassist.ClassPool _pool
Used to instrument class files.


_streamable

protected javassist.CtClass _streamable
Used to determine which classes implement Streamable.


BSNAME

protected static final String BSNAME
Constructor Detail

InstrumentStreamableTask

public InstrumentStreamableTask()
Method Detail

addFileset

public void addFileset(FileSet set)
Adds a nested <fileset> element which enumerates streamable class files.


addPath

public void addPath(Path path)
Adds a <path> element which defines our classpath.


setOutdir

public void setOutdir(File outdir)
Configures the directory into which we write our instrumented class files.


execute

public void execute()
Overrides:
execute in class Task

processClass

protected void processClass(File source)
Processes a class file.


processStreamable

protected void processStreamable(File source,
                                 javassist.CtClass clazz)
                          throws javassist.NotFoundException
Instruments the supplied Streamable implementing class.

Throws:
javassist.NotFoundException

getFieldReader

protected String getFieldReader(javassist.CtField field)
                         throws javassist.NotFoundException
Throws:
javassist.NotFoundException

getFieldWriter

protected String getFieldWriter(javassist.CtField field)
                         throws javassist.NotFoundException
Throws:
javassist.NotFoundException

readWrap

protected String readWrap(javassist.CtField field,
                          String body)
                   throws javassist.NotFoundException
Throws:
javassist.NotFoundException

writeWrap

protected String writeWrap(javassist.CtField field,
                           String body)
                    throws javassist.NotFoundException
Throws:
javassist.NotFoundException