org.objectweb.jorm.generator.lib
Class JormGenerator

java.lang.Object
  extended byorg.objectweb.jorm.generator.lib.JormGenerator
All Implemented Interfaces:
Generator, Loggable

public class JormGenerator
extends java.lang.Object
implements Generator, Loggable

This class start the generations of the jorm objects and user object. The jorm objects are the mapping, the binding and the accessor. It is needed to specify a MOPFactory before start the generation.The generate method starts the generation. To generate user objects it is necessary to specify their GeneratorFactory by the addGeneratorFactory method.


Constructor Summary
JormGenerator()
           
 
Method Summary
 void addMappingGenerator(java.lang.String mappername, MOPFactory mappinggenerator)
          Adds a mapping generator which generates a specific mapping part.
 void generate(Class mo, TargetHolder holder, JormCompilerParameter cp, JormCompilerConfigurator jcc)
          This method generates the jorm objects by delegation to the AccessorGenerator, the BindingGenerator and the MappingGenerator.
 void generate(CompositeName mo, TargetHolder holder, JormCompilerParameter cp)
          This method generates the jorm objects by delegation to the PNameGenerator, BinderGenerator and CompositeNameGenerator.
 Logger getLogger()
          Returns a logger to an component that wants to log things.
 LoggerFactory getLoggerFactory()
          Returns a logger factory that allows the creation of new loggers.
 void init()
          Initializes the generator.
 void setCompilerConfigurator(JormCompilerConfigurator jcc)
          Assigns the compiler configurator to this generator.
 void setCompilerParameter(JormCompilerParameter jcp)
          Assigns the compiler parameter to this generator.
 void setLogger(Logger l)
          Assigns a logger to an component that wants to log things.
 void setLoggerFactory(LoggerFactory lf)
          Assigns a logger factory that allows the creation of new loggers.
 void setMetaInfoManager(Manager mim)
          Assigns the meta information manager to this generator.
 void setPathExplorer(PathExplorer pathexpl)
          Assigns a PathExplorer object for locating files that have to be parsed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JormGenerator

public JormGenerator()
Method Detail

init

public void init()
          throws PException
Initializes the generator. Should be called after setCompilerParameter and setCompilerConfigurator.

Specified by:
init in interface Generator
Throws:
PException

setCompilerParameter

public void setCompilerParameter(JormCompilerParameter jcp)
Assigns the compiler parameter to this generator.

Specified by:
setCompilerParameter in interface Generator
Parameters:
jcp - the compiler parameter.

setCompilerConfigurator

public void setCompilerConfigurator(JormCompilerConfigurator jcc)
Assigns the compiler configurator to this generator.

Specified by:
setCompilerConfigurator in interface Generator
Parameters:
jcc - the compiler configurator.

setMetaInfoManager

public void setMetaInfoManager(Manager mim)
Assigns the meta information manager to this generator.

Specified by:
setMetaInfoManager in interface Generator
Parameters:
mim - the meta information manager to use.

setPathExplorer

public void setPathExplorer(PathExplorer pathexpl)
Assigns a PathExplorer object for locating files that have to be parsed.

Specified by:
setPathExplorer in interface Generator
Parameters:
pathexpl - the PathExplorer to be used for file location

addMappingGenerator

public void addMappingGenerator(java.lang.String mappername,
                                MOPFactory mappinggenerator)
Adds a mapping generator which generates a specific mapping part.

Specified by:
addMappingGenerator in interface Generator
Parameters:
mappername - The name of the mapper.
mappinggenerator - The Mapping Verifier object.

generate

public void generate(Class mo,
                     TargetHolder holder,
                     JormCompilerParameter cp,
                     JormCompilerConfigurator jcc)
              throws PException
This method generates the jorm objects by delegation to the AccessorGenerator, the BindingGenerator and the MappingGenerator. Its second task is to launch the user objects generator.

Specified by:
generate in interface Generator
Parameters:
mo - This meta object is a Class.
holder - The target holder which allows to create files.
cp - The compiler parameter.
jcc - The actual configuration of the compiler.
Throws:
PException - if an error occurs during the generation.

generate

public void generate(CompositeName mo,
                     TargetHolder holder,
                     JormCompilerParameter cp)
              throws PException
This method generates the jorm objects by delegation to the PNameGenerator, BinderGenerator and CompositeNameGenerator.

Specified by:
generate in interface Generator
Parameters:
mo - This meta object is a CompositeName.
holder - The target holder which allows to create files.
cp - The compiler parameter.
Throws:
PException - if an error occurs during the generation.

setLogger

public void setLogger(Logger l)
Description copied from interface: Loggable
Assigns a logger to an component that wants to log things.

Specified by:
setLogger in interface Loggable
Parameters:
l - the logger object

getLogger

public Logger getLogger()
Description copied from interface: Loggable
Returns a logger to an component that wants to log things.

Specified by:
getLogger in interface Loggable

getLoggerFactory

public LoggerFactory getLoggerFactory()
Description copied from interface: Loggable
Returns a logger factory that allows the creation of new loggers.

Specified by:
getLoggerFactory in interface Loggable

setLoggerFactory

public void setLoggerFactory(LoggerFactory lf)
Description copied from interface: Loggable
Assigns a logger factory that allows the creation of new loggers.

Specified by:
setLoggerFactory in interface Loggable
Parameters:
lf - the LoggerFactory object to obtain new loggers