org.ow2.jonas.generators.genbase.generator
Class AbsGenerator

java.lang.Object
  extended by org.ow2.jonas.generators.genbase.generator.AbsGenerator
Direct Known Subclasses:
Generator, Generator

public abstract class AbsGenerator
extends Object

Generators provide a structure to be extended for specific generation mechanisms.

Author:
Guillaume Sauthier

Constructor Summary
AbsGenerator(Config config)
          Creates a new Generator with the given Config.
 
Method Summary
abstract  void addFiles(Archive archive)
          Add generated files into an Archive
abstract  void compile()
          Compile generated java files into classes directory.
abstract  void generate()
          Generate files.
 File getClasses()
           
 Config getConfig()
           
protected  List<String> getJavaSources(File rootSrc, File src)
          Recursively walk a directory tree and return a List of all files found.
static org.objectweb.util.monolog.api.Logger getLogger()
           
 File getSources()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbsGenerator

public AbsGenerator(Config config)
             throws GenBaseException
Creates a new Generator with the given Config.

Parameters:
config - internal configuration object.
Throws:
GenBaseException - When sources and target temporary directory cannot be created
Method Detail

generate

public abstract void generate()
                       throws GenBaseException
Generate files.

Throws:
GenBaseException - When generation fails.

compile

public abstract void compile()
                      throws GenBaseException
Compile generated java files into classes directory.

Throws:
GenBaseException - When compilation fails

getJavaSources

protected List<String> getJavaSources(File rootSrc,
                                      File src)
Recursively walk a directory tree and return a List of all files found.

Parameters:
rootSrc - root directory
src - base directory
Returns:
the list containing all found files

addFiles

public abstract void addFiles(Archive archive)
                       throws GenBaseException
Add generated files into an Archive

Parameters:
archive - the archive destination of generated files.
Throws:
GenBaseException - When files cannot be added in the given Archive.

getConfig

public Config getConfig()
Returns:
the config.

getLogger

public static org.objectweb.util.monolog.api.Logger getLogger()
Returns:
the logger.

getClasses

public File getClasses()
Returns:
the classes.

getSources

public File getSources()
Returns:
the sources.


Copyright © 2010 OW2 Consortium. All Rights Reserved.