org.objectweb.speedo.generation.jorm.rdb
Class RdbJORMMapping
java.lang.Object
org.objectweb.speedo.generation.jorm.rdb.RdbJORMMapping
- All Implemented Interfaces:
- SpeedoProperties, JormMIMappingBuilder, org.objectweb.util.monolog.api.Loggable
public class RdbJORMMapping
- extends java.lang.Object
- implements JormMIMappingBuilder, SpeedoProperties, org.objectweb.util.monolog.api.Loggable
This class is an implementation of the JormMIMappingBuilder for the mapper
rdb and its sub mappers. It defines the O/R mapping of persistent classes.
It supports the mapping a of a class into several tables (multi table class
mapping).
- Author:
- S.Chassande-Barrioz
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, CONNECTION_CHECK, CONNECTION_DRIVER_NAME, CONNECTION_FACTORY, CONNECTION_FACTORY_NAME, CONNECTION_PASSWORD, CONNECTION_POOL_INACTIVETTL, CONNECTION_POOL_MAX, CONNECTION_POOL_MIN, CONNECTION_POOL_TIMEOUT, CONNECTION_POOL_TTL, CONNECTION_URL, CONNECTION_USER_NAME, CONNECTION2_FACTORY, CONNECTION2_FACTORY_NAME, 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_DEFAULT_HOST, JMX_HTTP_HOST, 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, SHAREABLE, 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_FILTERS, 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 |
Method Summary |
void |
createClassIdentifierNameDefMapping(org.objectweb.jorm.metainfo.api.ClassMapping cm,
org.objectweb.jorm.metainfo.api.NameDef nd,
SpeedoClass sc,
MIBuilderHelper mibh)
Maps the identifier fields. |
org.objectweb.jorm.metainfo.api.ClassMapping |
createClassMapping(org.objectweb.jorm.metainfo.api.Class clazz,
SpeedoClass sc,
org.objectweb.jorm.metainfo.api.Mapping mapping)
Defines the mapping the a class. |
void |
createClassRefNameDefMapping(org.objectweb.jorm.metainfo.api.ClassMapping cm,
org.objectweb.jorm.metainfo.api.NameDef nd,
SpeedoCommonField sf)
Creates the mapping of the name def (JORM meta object) corresponding to
a reference to a persistent class from a persistent class. |
void |
createClassRefNameDefMapping(org.objectweb.jorm.metainfo.api.GenClassMapping gcm,
org.objectweb.jorm.metainfo.api.NameDef nd,
SpeedoField sf)
Creates the mapping of the name def (JORM meta object) corresponding to
a reference to a persistent class from a generic persistent class. |
org.objectweb.jorm.metainfo.api.PrimitiveElementMapping |
createFieldMapping(org.objectweb.jorm.metainfo.api.PrimitiveElement pe,
SpeedoField sf,
org.objectweb.jorm.metainfo.api.ClassMapping cm)
Creates a PEM (PrimitiveElementMapping) for a PrimitiveElement. |
org.objectweb.jorm.metainfo.api.PrimitiveElementMapping |
createFieldMapping(org.objectweb.jorm.metainfo.api.PrimitiveElement pe,
SpeedoInheritedField sif,
org.objectweb.jorm.metainfo.api.ClassMapping cm)
Creates a PEM (PrimitiveElementMapping) for a PrimitiveElement. |
org.objectweb.jorm.metainfo.api.PrimitiveElementMapping |
createFieldMapping(org.objectweb.jorm.metainfo.api.PrimitiveElement pe,
SpeedoNoFieldColumn snfc,
org.objectweb.jorm.metainfo.api.ClassMapping cm)
Creates a PEM (PrimitiveElementMapping) for a PrimitiveElement. |
org.objectweb.jorm.metainfo.api.PrimitiveElementMapping |
createGenClassElementMapping(org.objectweb.jorm.metainfo.api.PrimitiveElement pe,
SpeedoField sf,
org.objectweb.jorm.metainfo.api.GenClassMapping gcm)
It creates the mapping of a primitive field (element of the generic
class). |
void |
createGenClassIdentifierNameDefMapping(org.objectweb.jorm.metainfo.api.GenClassMapping gcm,
org.objectweb.jorm.metainfo.api.NameDef nd,
SpeedoField sf,
MIBuilderHelper mibh)
Creates the mapping of the name def (JORM meta object) corresponding to
the identifier of a persistent generic class (collection, map, ...). |
org.objectweb.jorm.metainfo.api.PrimitiveElementMapping |
createGenClassIndexMapping(org.objectweb.jorm.metainfo.api.PrimitiveElement pe,
SpeedoField sf,
org.objectweb.jorm.metainfo.api.GenClassMapping gcm)
It creates the mapping of a primitive field used as index in the generic
class. |
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 GenClassMapping, assignes it to the mapping and builds
mapping structure for the class (RdbTable, directory name, ...). |
void |
createGenClassRefNameDefMapping(org.objectweb.jorm.metainfo.api.ClassMapping cm,
org.objectweb.jorm.metainfo.api.NameDef nd,
SpeedoCommonField sf)
Creates the mapping of the name def (JORM meta object) corresponding to
a reference to a persistent generic class. |
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 |
RdbJORMMapping
public RdbJORMMapping()
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
- Defines the mapping the a class. It creates the table(s) where the
class is stored. When there are several tables (multitable mapping) or
in case of vertical inheritance, this method bulds the join between
the main table and the secondary table.
- Specified by:
createClassMapping
in interface JormMIMappingBuilder
- Parameters:
clazz
- is the JORM meta object representing the persistent class.sc
- is the Speedo meta object representing the persistent class.mapping
- is the JORM Meta object associated to the persistent class
- Returns:
- the JORM meta object of mapping corresponding to the class.
- Throws:
org.objectweb.jorm.api.PException
- if it is not possible to build the ClassMapping
SpeedoException
createClassIdentifierNameDefMapping
public void createClassIdentifierNameDefMapping(org.objectweb.jorm.metainfo.api.ClassMapping cm,
org.objectweb.jorm.metainfo.api.NameDef nd,
SpeedoClass sc,
MIBuilderHelper mibh)
throws org.objectweb.jorm.api.PException,
SpeedoException
- Maps the identifier fields.
- Specified by:
createClassIdentifierNameDefMapping
in interface JormMIMappingBuilder
- Parameters:
cm
- is the JORM meta object representing the mapping of a
persistent class.nd
- is the JORM meta object representing the name definition of the
persistent class.sc
- is the Speedo meta object representing the persistent classmibh
- is a helper for the building of the JORM meta information.
- Throws:
org.objectweb.jorm.api.PException
SpeedoException
createFieldMapping
public org.objectweb.jorm.metainfo.api.PrimitiveElementMapping createFieldMapping(org.objectweb.jorm.metainfo.api.PrimitiveElement pe,
SpeedoField sf,
org.objectweb.jorm.metainfo.api.ClassMapping cm)
throws org.objectweb.jorm.api.PException,
SpeedoException
- Creates a PEM (PrimitiveElementMapping) for a PrimitiveElement. The PEM
is created only if the column does not already exist in the table
- Specified by:
createFieldMapping
in interface JormMIMappingBuilder
- Parameters:
pe
- is the primitive element to mapsf
- is the persistent field holding column definitioncm
- is the RdbClassMapping correponding to the persistent class
owning the field. It permits to find tha table where the field is mapped.
- Returns:
- the created or existing PEM corresponding to the specified
column name.
- Throws:
org.objectweb.jorm.api.PException
- if it is not possible to build the mapping of the
primitive field.
SpeedoException
createFieldMapping
public org.objectweb.jorm.metainfo.api.PrimitiveElementMapping createFieldMapping(org.objectweb.jorm.metainfo.api.PrimitiveElement pe,
SpeedoInheritedField sif,
org.objectweb.jorm.metainfo.api.ClassMapping cm)
throws org.objectweb.jorm.api.PException,
SpeedoException
- Creates a PEM (PrimitiveElementMapping) for a PrimitiveElement. The PEM
is created only if the column does not already exist in the table
- Specified by:
createFieldMapping
in interface JormMIMappingBuilder
- Parameters:
pe
- is the primitive element to mapsif
- is the persistent field holding column definitioncm
- is the RdbClassMapping correponding to the persistent class
owning the field. It permits to find tha table where the field is mapped.
- Returns:
- the created or existing PEM corresponding to the specified
column name.
- Throws:
org.objectweb.jorm.api.PException
SpeedoException
createFieldMapping
public org.objectweb.jorm.metainfo.api.PrimitiveElementMapping createFieldMapping(org.objectweb.jorm.metainfo.api.PrimitiveElement pe,
SpeedoNoFieldColumn snfc,
org.objectweb.jorm.metainfo.api.ClassMapping cm)
throws org.objectweb.jorm.api.PException,
SpeedoException
- Creates a PEM (PrimitiveElementMapping) for a PrimitiveElement. The PEM
is created only if the column does not already exist in the table
- Specified by:
createFieldMapping
in interface JormMIMappingBuilder
- Parameters:
pe
- is the primitive element to mapsif
- is the persistent field holding column definitioncm
- is the RdbClassMapping correponding to the persistent class
owning the field. It permits to find tha table where the field is mapped.
- Returns:
- the created or existing PEM corresponding to the specified
column name.
- Throws:
org.objectweb.jorm.api.PException
- if it is not possible to build the mapping of the
primitive field.
SpeedoException
createClassRefNameDefMapping
public void createClassRefNameDefMapping(org.objectweb.jorm.metainfo.api.ClassMapping cm,
org.objectweb.jorm.metainfo.api.NameDef nd,
SpeedoCommonField sf)
throws org.objectweb.jorm.api.PException,
SpeedoException
- Creates the mapping of the name def (JORM meta object) corresponding to
a reference to a persistent class from a persistent class.
According to the mapping information hold by the SpeedoField, the
Class Reference is mapped in the main table or in an external table.
The external can be the table of the targeted class in case of One-One
relationship.
As the implementation of this method is a bit complex, it has been divided
in two local methods:
- createLocalClassRefNameDefMapping
- createExternalClassRefNameDefMapping
- Specified by:
createClassRefNameDefMapping
in interface JormMIMappingBuilder
- Parameters:
cm
- is the MappingStructure which will host the mapping of the
referencend
- is the namedef corresponding to the referencesf
- is the Speedo meta object representing the persistent field.
referencing a class.
- Throws:
org.objectweb.jorm.api.PException
SpeedoException
- See Also:
createLocalClassRefNameDefMapping(RdbClassMultiMapping, Class, SpeedoCommonField, NameDef, NameDef, SpeedoClass)
,
createExternalClassRefNameDefMapping(RdbClassMultiMapping, Class, SpeedoCommonField, NameDef, RdbClassMultiMapping, NameDef, SpeedoClass)
createClassRefNameDefMapping
public void createClassRefNameDefMapping(org.objectweb.jorm.metainfo.api.GenClassMapping gcm,
org.objectweb.jorm.metainfo.api.NameDef nd,
SpeedoField sf)
throws org.objectweb.jorm.api.PException,
SpeedoException
- Creates the mapping of the name def (JORM meta object) corresponding to
a reference to a persistent class from a generic persistent class.
The class reference is always stored in into the table of the genric
class. But it is important to check if the column used for the class
reference can be reused for index or generic class identifier.
- Specified by:
createClassRefNameDefMapping
in interface JormMIMappingBuilder
- Parameters:
gcm
- is the MappingStructure which will host the mapping of the
referencend
- is the namedef corresponding to the referencesf
- is the Speedo meta object representing the persistent field
referencing a generic class.
- Throws:
org.objectweb.jorm.api.PException
SpeedoException
createGenClassElementMapping
public org.objectweb.jorm.metainfo.api.PrimitiveElementMapping createGenClassElementMapping(org.objectweb.jorm.metainfo.api.PrimitiveElement pe,
SpeedoField sf,
org.objectweb.jorm.metainfo.api.GenClassMapping gcm)
throws org.objectweb.jorm.api.PException,
SpeedoException
- It creates the mapping of a primitive field (element of the generic
class).
- Specified by:
createGenClassElementMapping
in interface JormMIMappingBuilder
- Parameters:
pe
- is the Jorm meta object representing a primitive fieldgcm
- is the MappingStructure which will host the mapping of the
fieldsf
- is the Speedo meta object representing the persistent field
referencing a generic class.
- 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.
SpeedoException
createGenClassIndexMapping
public org.objectweb.jorm.metainfo.api.PrimitiveElementMapping createGenClassIndexMapping(org.objectweb.jorm.metainfo.api.PrimitiveElement pe,
SpeedoField sf,
org.objectweb.jorm.metainfo.api.GenClassMapping gcm)
throws org.objectweb.jorm.api.PException,
SpeedoException
- It creates the mapping of a primitive field used as index in the generic
class.
- Specified by:
createGenClassIndexMapping
in interface JormMIMappingBuilder
- Parameters:
pe
- is the Jorm meta object representing a primitive fieldgcm
- is the MappingStructure which will host the mapping of the
fieldsf
- is the Speedo meta object representing the persistent field
referencing a generic class.
- 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.
SpeedoException
createGenClassIdentifierNameDefMapping
public void createGenClassIdentifierNameDefMapping(org.objectweb.jorm.metainfo.api.GenClassMapping gcm,
org.objectweb.jorm.metainfo.api.NameDef nd,
SpeedoField sf,
MIBuilderHelper mibh)
throws org.objectweb.jorm.api.PException,
SpeedoException
- Creates the mapping of the name def (JORM meta object) corresponding to
the identifier of a persistent generic class (collection, map, ...).
- Specified by:
createGenClassIdentifierNameDefMapping
in interface JormMIMappingBuilder
- Parameters:
gcm
- is the MappingStructure which will host the mapping of the
generic classnd
- is the namedef corresponding to the identifier of the
generic classsf
- is the Speedo meta object representing the persistent field
referencing a generic class.
- Throws:
org.objectweb.jorm.api.PException
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 GenClassMapping, assignes it to the mapping and builds
mapping structure for the class (RdbTable, directory name, ...).
- 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.sf
- is the SpeedoField corresponding to the generic class.
- 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
createGenClassRefNameDefMapping
public void createGenClassRefNameDefMapping(org.objectweb.jorm.metainfo.api.ClassMapping cm,
org.objectweb.jorm.metainfo.api.NameDef nd,
SpeedoCommonField sf)
throws org.objectweb.jorm.api.PException,
SpeedoException
- Description copied from interface:
JormMIMappingBuilder
- Creates the mapping of the name def (JORM meta object) corresponding to
a reference to a persistent generic class.
- Specified by:
createGenClassRefNameDefMapping
in interface JormMIMappingBuilder
- Parameters:
cm
- is the MappingStructure which will host the mapping of the
referencend
- is the namedef corresponding to the referencesf
- is the Speedo meta object representing the persistent field
referencing a generic class.
- Throws:
org.objectweb.jorm.api.PException
SpeedoException
getLogger
public org.objectweb.util.monolog.api.Logger getLogger()
- Specified by:
getLogger
in interface org.objectweb.util.monolog.api.Loggable
getLoggerFactory
public org.objectweb.util.monolog.api.LoggerFactory getLoggerFactory()
- Specified by:
getLoggerFactory
in interface org.objectweb.util.monolog.api.Loggable
setLogger
public void setLogger(org.objectweb.util.monolog.api.Logger logger)
- Specified by:
setLogger
in interface org.objectweb.util.monolog.api.Loggable
setLoggerFactory
public void setLoggerFactory(org.objectweb.util.monolog.api.LoggerFactory loggerFactory)
- Specified by:
setLoggerFactory
in interface org.objectweb.util.monolog.api.Loggable