org.objectweb.speedo.generation.jorm.rdb
Class OneTableRdbJormIMappingBuilder

java.lang.Object
  extended byorg.objectweb.speedo.generation.jorm.rdb.OneTableRdbJormIMappingBuilder
All Implemented Interfaces:
JormMIMappingBuilder, org.objectweb.jorm.util.api.Loggable, SpeedoProperties

public class OneTableRdbJormIMappingBuilder
extends java.lang.Object
implements JormMIMappingBuilder, SpeedoProperties, org.objectweb.jorm.util.api.Loggable

This class is an implementation of the JormMIMappingBuilder for the mapper rdb and its sub mappers. It defines a simple mapping where each persistent objects (generic class included) are mapped over one table.

Author:
S.Chassande-Barrioz

Field Summary
 
Fields inherited from interface org.objectweb.speedo.api.SpeedoProperties
CACHE_AUTO_CLEAN_SIZE, CACHE_AUTO_CLEAN_THRESHOLD, CACHE_CLASS_POLICY, CACHE_CLASS_POLICY_ALL, CACHE_CLASS_POLICY_CACHED, CACHE_CLASS_POLICY_FIXED, CACHE_CLASS_POLICY_NOCACHE, CACHE_REPLCAEMENT, CACHE_REPLCAEMENT_FIFO, CACHE_REPLCAEMENT_LRU, CACHE_REPLCAEMENT_MRU, CACHE_SIZE, CASCADE_DELETE, COMPILED_QUERY_CACHE_AUTO_CLEAN_SIZE, COMPILED_QUERY_CACHE_AUTO_CLEAN_THRESHOLD, COMPILED_QUERY_CACHE_POLICY, COMPILED_QUERY_CACHE_SIZE, CONNECTION_CHECK, CONNECTION_POOL_INACTIVETTL, CONNECTION_POOL_MAX, CONNECTION_POOL_MIN, CONNECTION_POOL_TIMEOUT, CONNECTION_POOL_TTL, DB_TRANSACTION_LOCKING, DEBUG, ELEMENT, ELEMENT_TYPE, EXTENSION_CLASS_IDX, EXTENSION_COLLECTION_IDX, EXTENSION_FIELD_IDX, EXTENSION_JDO_IDX, EXTENSION_MAP_IDX, EXTENSION_PACKAGE_IDX, FIELD_CONVERTER, ID, ID_LONG, ID_OLONG, ID_POLYMORPH_2L, ID_SEQUENCE, IMRICATED_PM_ALLOWED, INDEX, INDEX_TYPE, INHERITANCE_FILTER, INHERITANCE_FILTERED_MAPPING, INHERITANCE_HORIZONTAL_MAPPING, INHERITANCE_KEY, INHERITANCE_MAPPING, INHERITANCE_VERTICAL_MAPPING, JDO_OPTION_APPLICATION_IDENTITY, JDO_OPTION_ARRAY, JDO_OPTION_ARRAY_LIST, JDO_OPTION_CHANGE_APPLICATION_IDENTITY, JDO_OPTION_CONNECTION_DRIVER_NAME, JDO_OPTION_CONNECTION_DRIVER_NAME_old, JDO_OPTION_CONNECTION_DRIVER_NAME_old2, JDO_OPTION_CONNECTION_FACTORY_NAME, JDO_OPTION_CONNECTION_FACTORY2_NAME, JDO_OPTION_CONNECTION_PASSWORD, JDO_OPTION_CONNECTION_URL, JDO_OPTION_CONNECTION_USER_NAME, JDO_OPTION_DATASTORE_IDENTITY, JDO_OPTION_HASH_MAP, JDO_OPTION_HASH_TABLE, JDO_OPTION_IGNORE_CACHE, JDO_OPTION_LINKED_LIST, JDO_OPTION_LIST, JDO_OPTION_MAP, JDO_OPTION_MAPPING, JDO_OPTION_MULTITREADED, JDO_OPTION_NON_DURABLE_IDENTITY, JDO_OPTION_NON_TRANSACTIONAL_READ, JDO_OPTION_NON_TRANSACTIONAL_WRITE, JDO_OPTION_NULL_COLLECTION, JDO_OPTION_OPTIMISTIC, JDO_OPTION_RESTORE_VALUES, JDO_OPTION_RETAIN_VALUES, JDO_OPTION_TRANSIENT_TRANSACTIONAL, JDO_OPTION_TREE_MAP, JDO_OPTION_TREE_SET, JDO_OPTION_VECTOR, JDO_PERSISTENCE_MANAGER_FACTORY_CLASS, JDO_QUERY_JDOQL, JMX, JMX_HTTP_PORT, JOIN_TABLE, KEY_FIELD, LOGGER_NAME, MANAGED, MAPPER_NAME, MAPPING_STRUCTURE, MAPPING_STRUCTURE_CIR, MAPPING_STRUCTURE_DD, MAPPING_STRUCTURE_DN, MAPPING_STRUCTURE_FC, NO_LIMIT, PM_POOL_INACTIVETTL, PM_POOL_MAX, PM_POOL_MIN, PM_POOL_TIMEOUT, PM_POOL_TTL, PREFETCH, PREFETCH_ON_EXTENT, PREFETCH_ON_GENCLASS, PREFETCH_ON_QUERY, REVERSE_FIELD, SCALE, SIZE, SOURCE_FK, SPEEDO, SPEEDO_TRANSACTION_LOCKING, SQL_NAME, SQL_SEQ_ALLOCATOR, SQL_SEQ_CACHE, SQL_SEQ_INC, SQL_SEQ_NAME, SQL_SEQ_START, SQL_TYPE, SUPPORTED_EXTENSION, TARGET_FK, TM_NAME, TM_NAME_old, TRANSACTION_BMODE_NORMAL, TRANSACTION_BMODE_REQUIRED, TRANSACTION_BMODE_UT, TRANSACTION_LOCKING, TRANSACTION_LOCKING_LEVEL, TRANSACTION_LOCKING_LEVEL_ENABLETHIN, TRANSACTION_LOCKING_LEVEL_FIELD, TRANSACTION_LOCKING_LEVEL_INSTANCE, TRANSACTION_LOCKING_PESSIMISTIC_POLICY, TRANSACTION_LOCKING_PESSIMISTIC_POLICY_MUTEX, TRANSACTION_LOCKING_PESSIMISTIC_POLICY_RW_FIFO, TRANSACTION_MODE, TRANSACTION_MODE_NORMAL, TRANSACTION_MODE_REQUIRED, TRANSACTION_MODE_UT, TX_LISTENER, USER_CACHE, USER_CACHE_CLASS_POLICY, VENDOR_NAME
 
Constructor Summary
OneTableRdbJormIMappingBuilder()
           
 
Method Summary
 org.objectweb.jorm.metainfo.api.ClassMapping createClassMapping(org.objectweb.jorm.metainfo.api.Class clazz, SpeedoClass sc, org.objectweb.jorm.metainfo.api.Mapping mapping)
          It builds a RdbClassMultiMapping and creates the main table.
 org.objectweb.jorm.metainfo.api.PrimitiveElementMapping createFieldMapping(org.objectweb.jorm.metainfo.api.PrimitiveElement pe, SpeedoElement selem, org.objectweb.jorm.metainfo.api.CommonClassMapping cm)
          The column name is built with the field name.
 org.objectweb.jorm.metainfo.api.GenClassMapping createGenClassMapping(org.objectweb.jorm.metainfo.api.GenClassRef gcr, SpeedoField sf, org.objectweb.jorm.metainfo.api.Mapping mapping)
          It builds a RdbClassMultiMapping and creates the table.
 void createNameDefMapping(org.objectweb.jorm.metainfo.api.CommonClassMapping cm, org.objectweb.jorm.metainfo.api.NameDef nd, SpeedoClass sc, boolean isIdentifier, boolean isInGenClass)
          It creates the mapping of a name def (reference or identifier).
 void finalizeClassMapping(SpeedoClass sc, java.lang.String projectName, java.lang.String mapperName)
          It finishes the filling of a ClassMapping (Inheritance for example).
 org.objectweb.util.monolog.api.Logger getLogger()
           
 org.objectweb.util.monolog.api.LoggerFactory getLoggerFactory()
           
 void setLogger(org.objectweb.util.monolog.api.Logger logger)
           
 void setLoggerFactory(org.objectweb.util.monolog.api.LoggerFactory loggerFactory)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OneTableRdbJormIMappingBuilder

public OneTableRdbJormIMappingBuilder()
Method Detail

getLogger

public org.objectweb.util.monolog.api.Logger getLogger()
Specified by:
getLogger in interface org.objectweb.jorm.util.api.Loggable

getLoggerFactory

public org.objectweb.util.monolog.api.LoggerFactory getLoggerFactory()
Specified by:
getLoggerFactory in interface org.objectweb.jorm.util.api.Loggable

setLogger

public void setLogger(org.objectweb.util.monolog.api.Logger logger)
Specified by:
setLogger in interface org.objectweb.jorm.util.api.Loggable

setLoggerFactory

public void setLoggerFactory(org.objectweb.util.monolog.api.LoggerFactory loggerFactory)
Specified by:
setLoggerFactory in interface org.objectweb.jorm.util.api.Loggable

createClassMapping

public org.objectweb.jorm.metainfo.api.ClassMapping createClassMapping(org.objectweb.jorm.metainfo.api.Class clazz,
                                                                       SpeedoClass sc,
                                                                       org.objectweb.jorm.metainfo.api.Mapping mapping)
                                                                throws org.objectweb.jorm.api.PException,
                                                                       SpeedoException
It builds a RdbClassMultiMapping and creates the main table. The name of the table is built with the short class name.

Specified by:
createClassMapping in interface JormMIMappingBuilder
Parameters:
clazz - is the Jorm meta object representing the class which the ClassMapping must be built.
mapping - is the Mapping instance which will host the ClassMapping.
Returns:
the ClassMapping instance built by the method (never null).
Throws:
org.objectweb.jorm.api.PException - if it is not possible to build the ClassMapping
SpeedoException

finalizeClassMapping

public void finalizeClassMapping(SpeedoClass sc,
                                 java.lang.String projectName,
                                 java.lang.String mapperName)
                          throws org.objectweb.jorm.api.PException,
                                 SpeedoException
Description copied from interface: JormMIMappingBuilder
It finishes the filling of a ClassMapping (Inheritance for example).

Specified by:
finalizeClassMapping in interface JormMIMappingBuilder
Throws:
org.objectweb.jorm.api.PException - if it is not possible to build the ClassMapping
SpeedoException

createGenClassMapping

public org.objectweb.jorm.metainfo.api.GenClassMapping createGenClassMapping(org.objectweb.jorm.metainfo.api.GenClassRef gcr,
                                                                             SpeedoField sf,
                                                                             org.objectweb.jorm.metainfo.api.Mapping mapping)
                                                                      throws org.objectweb.jorm.api.PException,
                                                                             SpeedoException
It builds a RdbClassMultiMapping and creates the table. the table is build with the generic class identifier ("A/f1" ==> "A_f1")

Specified by:
createGenClassMapping in interface JormMIMappingBuilder
Parameters:
gcr - is the Jorm meta object representing the gen class which the GenClassMapping must be built.
mapping - is the Mapping instance which will host the GenClassMapping.
Returns:
the GenClassMapping instance built by the method (never null).
Throws:
org.objectweb.jorm.api.PException - if it is not possible to build the GenClassMapping
SpeedoException

createFieldMapping

public org.objectweb.jorm.metainfo.api.PrimitiveElementMapping createFieldMapping(org.objectweb.jorm.metainfo.api.PrimitiveElement pe,
                                                                                  SpeedoElement selem,
                                                                                  org.objectweb.jorm.metainfo.api.CommonClassMapping cm)
                                                                           throws org.objectweb.jorm.api.PException
The column name is built with the field name.

Specified by:
createFieldMapping in interface JormMIMappingBuilder
Parameters:
pe - is the Jorm meta object representing a primitive field
cm - is the MappingStructure which will host the mapping of the field
Returns:
a PrimitiveElementMapping corresponding to the given primitive field.
Throws:
org.objectweb.jorm.api.PException - if it is not possible to build the mapping of the primitive field.

createNameDefMapping

public void createNameDefMapping(org.objectweb.jorm.metainfo.api.CommonClassMapping cm,
                                 org.objectweb.jorm.metainfo.api.NameDef nd,
                                 SpeedoClass sc,
                                 boolean isIdentifier,
                                 boolean isInGenClass)
                          throws org.objectweb.jorm.api.PException,
                                 SpeedoException
It creates the mapping of a name def (reference or identifier).

Specified by:
createNameDefMapping in interface JormMIMappingBuilder
Parameters:
cm - is the MappingStructure which will host the mapping of the fields of the name def
nd - is the NameDef which must be mapped.
Throws:
org.objectweb.jorm.api.PException - if it is not possible to build the mapping of the field.
SpeedoException