org.objectweb.speedo.genclass.merger
Class GenClassMerger

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 org.objectweb.speedo.genclass.merger.GenClassMerger
All Implemented Interfaces:
org.apache.tools.ant.types.selectors.SelectorContainer
Direct Known Subclasses:
EJBGenClassHomeMerger, EJBGenClassMerger, JDOGenClassHomeMerger, JDOGenClassMerger

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

Author:
S.Chassande-Barrioz

Field Summary
static java.lang.String GEN_CLASS_NAME
           
protected  org.objectweb.util.monolog.api.Logger logger
           
static java.lang.String LOGGER_NAME
           
protected  Personality personality
           
 
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
GenClassMerger()
           
GenClassMerger(Personality p)
           
 
Method Summary
protected  void checkAfter(GCInfo gc)
           
 void execute()
           
protected  java.lang.String getClassToWrite(java.lang.String gcn)
           
protected  java.lang.String getFirstClass(java.lang.String gcn)
           
protected  java.lang.String getLoggerName()
           
protected  java.lang.String getSecondClass(java.lang.String gcn)
           
 java.io.File getSrc()
           
protected  org.objectweb.asm.ClassReader loadJavaClass(java.lang.String fn, boolean remove)
          Loads a specified class.
 void mergeGenClass(GCInfo gc)
           
 GCInfo newGCInfo(java.lang.String gcn)
           
protected  boolean requireEnhancement(GCInfo gc)
           
 void setSrc(java.io.File src)
           
protected  void writeFirstClass(GCInfo gc, org.objectweb.asm.ClassVisitor current)
           
protected  void writeJavaClass(java.lang.String fn, org.objectweb.asm.ClassWriter jclass)
          Saves the new bytecode of the specified Java class under a specified base directory.
protected  void writeSecondClass(GCInfo gc, org.objectweb.asm.ClassVisitor current)
           
 
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
 

Field Detail

LOGGER_NAME

public static final java.lang.String LOGGER_NAME
See Also:
Constant Field Values

GEN_CLASS_NAME

public static final java.lang.String GEN_CLASS_NAME

logger

protected org.objectweb.util.monolog.api.Logger logger

personality

protected Personality personality
Constructor Detail

GenClassMerger

public GenClassMerger()

GenClassMerger

public GenClassMerger(Personality p)
Method Detail

getSrc

public java.io.File getSrc()

setSrc

public void setSrc(java.io.File src)

getLoggerName

protected java.lang.String getLoggerName()

execute

public void execute()
             throws org.apache.tools.ant.BuildException
Overrides:
execute in class org.apache.tools.ant.Task
Throws:
org.apache.tools.ant.BuildException

mergeGenClass

public void mergeGenClass(GCInfo gc)
                   throws SpeedoException
Throws:
SpeedoException

writeFirstClass

protected void writeFirstClass(GCInfo gc,
                               org.objectweb.asm.ClassVisitor current)
                        throws SpeedoException
Throws:
SpeedoException

writeSecondClass

protected void writeSecondClass(GCInfo gc,
                                org.objectweb.asm.ClassVisitor current)
                         throws SpeedoException
Throws:
SpeedoException

getClassToWrite

protected java.lang.String getClassToWrite(java.lang.String gcn)

getFirstClass

protected java.lang.String getFirstClass(java.lang.String gcn)

getSecondClass

protected java.lang.String getSecondClass(java.lang.String gcn)

requireEnhancement

protected boolean requireEnhancement(GCInfo gc)

checkAfter

protected void checkAfter(GCInfo gc)
                   throws SpeedoException
Throws:
SpeedoException

loadJavaClass

protected org.objectweb.asm.ClassReader loadJavaClass(java.lang.String fn,
                                                      boolean remove)
                                               throws SpeedoException
Loads a specified class.

Parameters:
fn - is the file name of the .class to load. the file name is a relative patht to the 'src' directory.
remove - indicates if the .class must be removed
Returns:
the JavaClass loaded
Throws:
SpeedoException - if the file cannot be loaded

newGCInfo

public GCInfo newGCInfo(java.lang.String gcn)

writeJavaClass

protected void writeJavaClass(java.lang.String fn,
                              org.objectweb.asm.ClassWriter jclass)
                       throws SpeedoException
Saves the new bytecode of the specified Java class under a specified base directory.

Parameters:
jclass - the Java class that has to be saved
Throws:
SpeedoException - if the file cannot be written