org.objectweb.speedo.generation.mivisitor
Class ORMappingGenerator

java.lang.Object
  extended by org.objectweb.speedo.generation.lib.AbstractGeneratorComponent
      extended by org.objectweb.speedo.generation.mivisitor.ORMappingGenerator
All Implemented Interfaces:
GeneratorComponent

public class ORMappingGenerator
extends AbstractGeneratorComponent

This Speedo Meta information visitor builds and fills the Speedo Meta information concerning the OR mapping information. It defines a SpeedoTable, SpeedoColumn, SpeedoJoin where it is required. This SMI visitor cannot be inclued with other SMI visitor. Indeed it requires that all meta information is complete (for all classes). In particular it needs the result of the Class analyser visitor. For this reason this SMI visitor is a simple GeneratorComponent to use when SMI is complete. In addition, due to dependency between classes (relation ship, inheritance) the visit of classes must be done in a particular order. For these reasons, this Visitor visits the SMI with a help of two internal classes ( VisitRequired and VisitRemeber).

Author:
S.Chassande-Barrioz

Nested Class Summary
static class ORMappingGenerator.VisitRemember
          This class represents the status of visited/treated elements of a persistent class.
static class ORMappingGenerator.VisitRequired
          This class represents required element to be visited in a persistent class.
 
Field Summary
static java.lang.String LOGGER_NAME
           
 
Fields inherited from class org.objectweb.speedo.generation.lib.AbstractGeneratorComponent
debug, logger, personality, scp
 
Constructor Summary
ORMappingGenerator(Personality p)
           
 
Method Summary
protected  java.lang.String getLoggerName()
           
 java.lang.String getTitle()
           
 boolean init()
          Initializes the component
 void process()
          Do the job of the component.
 void visitClassRefFieldExtension(SpeedoField sf)
          Visit extensions of field referencing a persistent class.
 void visitGenClassRefFieldExtension(SpeedoField sf)
          Visit extensions of field referencing a genclass.
 
Methods inherited from class org.objectweb.speedo.generation.lib.AbstractGeneratorComponent
getLogger, getSpeedoCompilerParameter, getSummary, setLogger, setSpeedoCompilerParameter
 
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
Constructor Detail

ORMappingGenerator

public ORMappingGenerator(Personality p)
Method Detail

getTitle

public java.lang.String getTitle()
Specified by:
getTitle in interface GeneratorComponent
Overrides:
getTitle in class AbstractGeneratorComponent
Returns:
a short string (less than 30 characters) representing the title of the component. This string must indicate job of the component.

getLoggerName

protected java.lang.String getLoggerName()

init

public boolean init()
             throws SpeedoException
Description copied from interface: GeneratorComponent
Initializes the component

Specified by:
init in interface GeneratorComponent
Specified by:
init in class AbstractGeneratorComponent
Returns:
boolean value indicating if the process method can be called.
Throws:
SpeedoException - if the component initialization fails

process

public void process()
             throws SpeedoException
Description copied from interface: GeneratorComponent
Do the job of the component.

Specified by:
process in interface GeneratorComponent
Specified by:
process in class AbstractGeneratorComponent
Throws:
SpeedoException - if the component initialization fails

visitClassRefFieldExtension

public void visitClassRefFieldExtension(SpeedoField sf)
                                 throws SpeedoException
Visit extensions of field referencing a persistent class. This method converts old Extensions 'source-foreign-keys' and 'target-foreign-keys' to mapping definition in the Speedo meta information.

Parameters:
sf - a persistent field referencing a persistent class.
Throws:
SpeedoException
See Also:
SpeedoProperties.SOURCE_FK, SpeedoProperties.TARGET_FK

visitGenClassRefFieldExtension

public void visitGenClassRefFieldExtension(SpeedoField sf)
                                    throws SpeedoException
Visit extensions of field referencing a genclass. This method converts old Extensions 'source-foreign-keys', 'target-foreign-keys' and 'join-table' to mapping definition in the Speedo meta information.

Parameters:
sf - a persistent field referencing a genclass.
Throws:
SpeedoException
See Also:
SpeedoProperties.SOURCE_FK, SpeedoProperties.TARGET_FK, SpeedoProperties.JOIN_TABLE