org.objectweb.speedo.generation.enhancer
Class EnhancerComponent

java.lang.Object
  extended byorg.objectweb.speedo.generation.lib.AbstractGeneratorComponent
      extended byorg.objectweb.speedo.generation.enhancer.EnhancerComponent
All Implemented Interfaces:
GeneratorComponent
Direct Known Subclasses:
AroundCompilation, DummyAccessorAdder, FieldModifier, PersistenceAwareEnhancer, PersistentClassEnhancer

public abstract class EnhancerComponent
extends AbstractGeneratorComponent

Abstract enhancer component. Provides methods to read and write classes to or from the file system. Adapted from loadXXX and writeXXX methods in EnhancerTool.


Field Summary
protected  boolean isSrcJar
          Indicates whether the .class files would be found in an archive.
 
Fields inherited from class org.objectweb.speedo.generation.lib.AbstractGeneratorComponent
debug, logger, scp
 
Constructor Summary
EnhancerComponent()
          Constructs an EnhancerComponent.
 
Method Summary
 org.objectweb.asm.ClassReader loadJavaClass(boolean isSrcJar, java.lang.String completeName, java.lang.String srcFiles, boolean remove)
          Loads a specified JDO Instance placed indifferently in a directory or in a .jar archive.
 org.objectweb.asm.ClassReader loadJavaClass(boolean isSrcJar, java.lang.String completeName, java.lang.String srcFiles, boolean remove, java.lang.String storeDir)
          Loads a specified JDO Instance placed indifferently in a directory or in a .jar archive and store it into a new directory.
 void writeJavaClass(java.lang.String name, org.objectweb.asm.ClassWriter jclass, java.lang.String srcFiles)
          Saves the new bytecode of the specified Java class under a specified base directory.
 
Methods inherited from class org.objectweb.speedo.generation.lib.AbstractGeneratorComponent
getLogger, getSpeedoCompilerParameter, init, process, setLogger, setSpeedoCompilerParameter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

isSrcJar

protected boolean isSrcJar
Indicates whether the .class files would be found in an archive.

Constructor Detail

EnhancerComponent

public EnhancerComponent()
Constructs an EnhancerComponent.

Method Detail

loadJavaClass

public org.objectweb.asm.ClassReader loadJavaClass(boolean isSrcJar,
                                                   java.lang.String completeName,
                                                   java.lang.String srcFiles,
                                                   boolean remove)
                                            throws SpeedoEnhancerException
Loads a specified JDO Instance placed indifferently in a directory or in a .jar archive.

Parameters:
isSrcJar - indicates whether the .class file would be found in an archive
completeName - the name of the Java class to be loaded
srcFiles - location of the .jar file or base directory of .class file
Returns:
the JavaClass loaded
Throws:
SpeedoEnhancerException - if the file cannot be loaded

loadJavaClass

public org.objectweb.asm.ClassReader loadJavaClass(boolean isSrcJar,
                                                   java.lang.String completeName,
                                                   java.lang.String srcFiles,
                                                   boolean remove,
                                                   java.lang.String storeDir)
                                            throws SpeedoEnhancerException
Loads a specified JDO Instance placed indifferently in a directory or in a .jar archive and store it into a new directory.

Parameters:
isSrcJar - indicates whether the .class file would be found in an archive
completeName - the name of the Java class to be loaded
srcFiles - location of the .jar file or base directory of .class file
storeDir - location of the base directory where the java class should be stored
Returns:
the JavaClass loaded
Throws:
SpeedoEnhancerException - if the file cannot be loaded

writeJavaClass

public void writeJavaClass(java.lang.String name,
                           org.objectweb.asm.ClassWriter jclass,
                           java.lang.String srcFiles)
                    throws SpeedoEnhancerException
Saves the new bytecode of the specified Java class under a specified base directory. The file's location is created if necessary.

Parameters:
jclass - the Java class that has to be saved
srcFiles - the base directory where it has to be saved
Throws:
SpeedoEnhancerException - if the file cannot be written