org.jboss.weaver
Class WeaveRunner

java.lang.Object
  extended by org.jboss.weaver.WeaveRunner

public class WeaveRunner
extends Object

Takes jar or class files and weaves the bytecode based on the given configuration. A weaver object should be created, and passed to the setWeaver() method. The weaver object is what does the actual byte code weaving.

Version:
$Revision: 166 $
Author:
Bill Burke, Adrian Brock, pgier

Field Summary
static URLClassLoader loader
           
 
Constructor Summary
WeaveRunner()
          Creates a weave runner with no Weaver (org.jboss.weaver.Weaver).
WeaveRunner(Weaver weaver)
           
 
Method Summary
 void addFilesFromSourcePathFile(String sourcePathFile)
           
 void addSourcePath(String path)
           
 void appendClassPath(javassist.ClassPool pool, String classpath)
           
static String argUsage()
          Create a string describing the available options for the parseArgs method.
 void clearSourcePaths()
           
 void compileFile(ClassFileInfo info)
           
 void copyFile(File source, File dest)
           
 void copyFile(File file, String sourcePath, String destPath)
          Copies the file from the source path into the destination.
 javassist.bytecode.ClassFile createClassFile(InputStream is)
           
 String getClassName(InputStream is)
          Get the name of a class from a given input stream
 String getOutputDir()
           
 String getOutputJar()
           
 ArrayList<String> getSourcePaths()
           
 Weaver getWeaver()
           
 boolean isCopyResourceFiles()
          Whether to copy files that are not translated to the output directory.
 boolean isSuppress()
           
 boolean isUsingSystemClasspath()
           
 boolean isVerbose()
           
 void parseArgs(String[] args)
          Parses command line arguments and calls setters.
 void setCopyResourceFiles(boolean copyResourceFiles)
          Determines whether to copy files that are not translated to the output directory.
 void setOutputDir(String outputPath)
           
 void setOutputJar(String outputJar)
           
 void setSourcePaths(ArrayList<String> sourcePaths)
           
 void setSuppress(boolean suppress)
           
 void setUsingSystemClasspath(boolean usingSystemClasspath)
           
 void setVerbose(boolean verbose)
           
 void setWeaver(String weaverClass)
           
 void setWeaver(Weaver weaver)
           
 void weave()
           
 void weave(String[] args)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

loader

public static URLClassLoader loader
Constructor Detail

WeaveRunner

public WeaveRunner()
Creates a weave runner with no Weaver (org.jboss.weaver.Weaver).


WeaveRunner

public WeaveRunner(Weaver weaver)
Method Detail

parseArgs

public void parseArgs(String[] args)
Parses command line arguments and calls setters.

Parameters:
args -

appendClassPath

public void appendClassPath(javassist.ClassPool pool,
                            String classpath)
                     throws javassist.NotFoundException
Throws:
javassist.NotFoundException

weave

public void weave(String[] args)
           throws javassist.NotFoundException,
                  IOException
Throws:
javassist.NotFoundException
IOException

weave

public void weave()
           throws javassist.NotFoundException,
                  IOException
Throws:
javassist.NotFoundException
IOException

getClassName

public String getClassName(InputStream is)
                    throws IOException
Get the name of a class from a given input stream

Parameters:
is - The stream with the class file data
Returns:
The name of the class
Throws:
IOException

createClassFile

public javassist.bytecode.ClassFile createClassFile(InputStream is)
                                             throws IOException
Throws:
IOException

addFilesFromSourcePathFile

public void addFilesFromSourcePathFile(String sourcePathFile)

copyFile

public void copyFile(File file,
                     String sourcePath,
                     String destPath)
              throws IOException
Copies the file from the source path into the destination.

Parameters:
file -
Throws:
IOException

copyFile

public void copyFile(File source,
                     File dest)
              throws IOException
Throws:
IOException

compileFile

public void compileFile(ClassFileInfo info)
                 throws javassist.bytecode.BadBytecode,
                        javassist.CannotCompileException
Throws:
javassist.bytecode.BadBytecode
javassist.CannotCompileException

getOutputDir

public String getOutputDir()

setOutputDir

public void setOutputDir(String outputPath)

getOutputJar

public String getOutputJar()

setOutputJar

public void setOutputJar(String outputJar)

addSourcePath

public void addSourcePath(String path)

getSourcePaths

public ArrayList<String> getSourcePaths()

setSourcePaths

public void setSourcePaths(ArrayList<String> sourcePaths)

clearSourcePaths

public void clearSourcePaths()

getWeaver

public Weaver getWeaver()

setWeaver

public void setWeaver(Weaver weaver)

setWeaver

public void setWeaver(String weaverClass)

isSuppress

public boolean isSuppress()

setSuppress

public void setSuppress(boolean suppress)

isVerbose

public boolean isVerbose()

setVerbose

public void setVerbose(boolean verbose)

isUsingSystemClasspath

public boolean isUsingSystemClasspath()

setUsingSystemClasspath

public void setUsingSystemClasspath(boolean usingSystemClasspath)

isCopyResourceFiles

public boolean isCopyResourceFiles()
Whether to copy files that are not translated to the output directory. Default is true.

Returns:

setCopyResourceFiles

public void setCopyResourceFiles(boolean copyResourceFiles)
Determines whether to copy files that are not translated to the output directory. For example .properties files.

Parameters:
copyResourceFiles -

argUsage

public static String argUsage()
Create a string describing the available options for the parseArgs method. Available options -verbose -suppress (-classpath | -cp) <classpath> -weaverClass <WeaverClass> -outputDir -outputJar -useSystemClasspath +

Returns:
The usage string


Copyright © 2005-2007 JBoss, a division of Red Hat, Inc. All Rights Reserved.