org.datanucleus.store.rdbms.mapping
Class RDBMSMappingManager

java.lang.Object
  extended by org.datanucleus.store.mapped.mapping.AbstractMappingManager
      extended by org.datanucleus.store.rdbms.mapping.RDBMSMappingManager
All Implemented Interfaces:
org.datanucleus.store.mapped.mapping.MappingManager
Direct Known Subclasses:
OracleRDBMSMappingManager

public class RDBMSMappingManager
extends org.datanucleus.store.mapped.mapping.AbstractMappingManager

Mapping manager for RDBMS datastores. Provides mappings from standard Java types defined in org.datanucleus.store.mapped.mapping to datastore mappings for JDBC types.


Nested Class Summary
protected  class RDBMSMappingManager.RDBMSTypeMapping
           
 
Nested classes/interfaces inherited from class org.datanucleus.store.mapped.mapping.AbstractMappingManager
org.datanucleus.store.mapped.mapping.AbstractMappingManager.TypeMapping
 
Field Summary
protected static org.datanucleus.util.Localiser LOCALISER_RDBMS
           
 
Fields inherited from class org.datanucleus.store.mapped.mapping.AbstractMappingManager
LOCALISER, storeMgr
 
Constructor Summary
RDBMSMappingManager(org.datanucleus.store.mapped.MappedStoreManager storeMgr)
          Constructor for a mapping manager for an ORM datastore.
 
Method Summary
 org.datanucleus.store.mapped.DatastoreField createDatastoreField(org.datanucleus.metadata.AbstractMemberMetaData mmd, org.datanucleus.store.mapped.DatastoreContainerObject datastoreContainer, org.datanucleus.store.mapped.mapping.JavaTypeMapping mapping, org.datanucleus.metadata.ColumnMetaData colmd, org.datanucleus.store.mapped.DatastoreField reference, org.datanucleus.ClassLoaderResolver clr)
          Method to create a datastore field for a PersistenceCapable mapping.
 org.datanucleus.store.mapped.DatastoreField createDatastoreField(org.datanucleus.store.mapped.mapping.JavaTypeMapping mapping, java.lang.String javaType, org.datanucleus.metadata.ColumnMetaData colmd)
          Method to create a datastore field for a Java type mapping.
 org.datanucleus.store.mapped.DatastoreField createDatastoreField(org.datanucleus.store.mapped.mapping.JavaTypeMapping mapping, java.lang.String javaType, int datastoreFieldIndex)
          Method to create a datastore field for a Java type mapping.
 org.datanucleus.store.mapped.mapping.DatastoreMapping createDatastoreMapping(org.datanucleus.store.mapped.mapping.JavaTypeMapping mapping, org.datanucleus.metadata.AbstractMemberMetaData mmd, int index, org.datanucleus.store.mapped.DatastoreField column)
          Method to create the datastore mapping for a java type mapping at a particular index.
 org.datanucleus.store.mapped.mapping.DatastoreMapping createDatastoreMapping(org.datanucleus.store.mapped.mapping.JavaTypeMapping mapping, org.datanucleus.store.mapped.DatastoreField column, java.lang.String javaType)
          Method to create the datastore mapping for a particular column and java type.
 void deregisterDatastoreMappingsForJDBCType(java.lang.String jdbcTypeName)
          Utility to deregister all mappings for a JDBC type.
protected  java.lang.Class getDatastoreMappingClass(java.lang.String fieldName, java.lang.String javaType, java.lang.String jdbcType, java.lang.String sqlType, org.datanucleus.ClassLoaderResolver clr)
          Accessor for a datastore mapping class for the specified java type (and optional jdbc type or sql type).
 void loadDatastoreMapping(org.datanucleus.plugin.PluginManager mgr, org.datanucleus.ClassLoaderResolver clr, java.lang.String vendorId)
          Load all datastore mappings defined in the associated plugins.
 void registerDatastoreMapping(java.lang.String javaTypeName, java.lang.Class datastoreMappingType, java.lang.String jdbcType, java.lang.String sqlType, boolean dflt)
          Utility to register a datastore mapping for a java type, and the SQL/JDBC types it can be mapped to.
 
Methods inherited from class org.datanucleus.store.mapped.mapping.AbstractMappingManager
getDefaultJavaTypeMapping, getElementMappingClass, getKeyMappingClass, getMapping, getMapping, getMapping, getMappingClass, getMappingWithDatastoreMapping, getOverrideMappingClass, getValueMappingClass
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOCALISER_RDBMS

protected static final org.datanucleus.util.Localiser LOCALISER_RDBMS
Constructor Detail

RDBMSMappingManager

public RDBMSMappingManager(org.datanucleus.store.mapped.MappedStoreManager storeMgr)
Constructor for a mapping manager for an ORM datastore.

Parameters:
storeMgr - The StoreManager
Method Detail

loadDatastoreMapping

public void loadDatastoreMapping(org.datanucleus.plugin.PluginManager mgr,
                                 org.datanucleus.ClassLoaderResolver clr,
                                 java.lang.String vendorId)
Load all datastore mappings defined in the associated plugins. We handle RDBMS datastore mappings so refer to rdbms-mapping-class, jdbc-type, sql-type in particular.

Specified by:
loadDatastoreMapping in interface org.datanucleus.store.mapped.mapping.MappingManager
Specified by:
loadDatastoreMapping in class org.datanucleus.store.mapped.mapping.AbstractMappingManager
Parameters:
mgr - the PluginManager
clr - the ClassLoaderResolver
vendorId - the datastore vendor id

registerDatastoreMapping

public void registerDatastoreMapping(java.lang.String javaTypeName,
                                     java.lang.Class datastoreMappingType,
                                     java.lang.String jdbcType,
                                     java.lang.String sqlType,
                                     boolean dflt)
Utility to register a datastore mapping for a java type, and the SQL/JDBC types it can be mapped to. This can also be called to change the default setting of a mapping - just supply the same values of java/JDBC/SQL types and a different default value

Specified by:
registerDatastoreMapping in interface org.datanucleus.store.mapped.mapping.MappingManager
Specified by:
registerDatastoreMapping in class org.datanucleus.store.mapped.mapping.AbstractMappingManager
Parameters:
javaTypeName - Name of the java type
datastoreMappingType - The datastore mapping
jdbcType - The JDBC type that can be used
sqlType - The SQL type that can be used
dflt - Whether this type should be used as the default mapping for this Java type

deregisterDatastoreMappingsForJDBCType

public void deregisterDatastoreMappingsForJDBCType(java.lang.String jdbcTypeName)
Utility to deregister all mappings for a JDBC type.

Parameters:
jdbcTypeName - The JDBC type name

getDatastoreMappingClass

protected java.lang.Class getDatastoreMappingClass(java.lang.String fieldName,
                                                   java.lang.String javaType,
                                                   java.lang.String jdbcType,
                                                   java.lang.String sqlType,
                                                   org.datanucleus.ClassLoaderResolver clr)
Accessor for a datastore mapping class for the specified java type (and optional jdbc type or sql type).

Parameters:
fieldName - Name of the field (if known)
javaType - The java type
jdbcType - The JDBC type
sqlType - The SQL Type
clr - ClassLoader resolver to use
Returns:
The datastore mapping class

createDatastoreMapping

public org.datanucleus.store.mapped.mapping.DatastoreMapping createDatastoreMapping(org.datanucleus.store.mapped.mapping.JavaTypeMapping mapping,
                                                                                    org.datanucleus.metadata.AbstractMemberMetaData mmd,
                                                                                    int index,
                                                                                    org.datanucleus.store.mapped.DatastoreField column)
Method to create the datastore mapping for a java type mapping at a particular index.

Parameters:
mapping - The java mapping
mmd - MetaData for the field/property
index - Index of the column
column - The column
Returns:
The datastore mapping

createDatastoreMapping

public org.datanucleus.store.mapped.mapping.DatastoreMapping createDatastoreMapping(org.datanucleus.store.mapped.mapping.JavaTypeMapping mapping,
                                                                                    org.datanucleus.store.mapped.DatastoreField column,
                                                                                    java.lang.String javaType)
Method to create the datastore mapping for a particular column and java type. If the column is specified it is linked to the created datastore mapping.

Parameters:
mapping - The java mapping
column - The column (can be null)
javaType - The java type
Returns:
The datastore mapping

createDatastoreField

public org.datanucleus.store.mapped.DatastoreField createDatastoreField(org.datanucleus.store.mapped.mapping.JavaTypeMapping mapping,
                                                                        java.lang.String javaType,
                                                                        int datastoreFieldIndex)
Method to create a datastore field for a Java type mapping. This is NOT used for PersistenceCapable mappings - see method below.

Parameters:
mapping - Java type mapping for the field
javaType - The type of field being stored in this column
datastoreFieldIndex - Index of the datastore field to use
Returns:
The datastore field

createDatastoreField

public org.datanucleus.store.mapped.DatastoreField createDatastoreField(org.datanucleus.store.mapped.mapping.JavaTypeMapping mapping,
                                                                        java.lang.String javaType,
                                                                        org.datanucleus.metadata.ColumnMetaData colmd)
Method to create a datastore field for a Java type mapping. This is used for serialised PC elements/keys/values in a join table. TODO Merge this with the method above.

Parameters:
mapping - Java type mapping for the field
javaType - The type of field being stored in this column
colmd - MetaData for the column
Returns:
The datastore field

createDatastoreField

public org.datanucleus.store.mapped.DatastoreField createDatastoreField(org.datanucleus.metadata.AbstractMemberMetaData mmd,
                                                                        org.datanucleus.store.mapped.DatastoreContainerObject datastoreContainer,
                                                                        org.datanucleus.store.mapped.mapping.JavaTypeMapping mapping,
                                                                        org.datanucleus.metadata.ColumnMetaData colmd,
                                                                        org.datanucleus.store.mapped.DatastoreField reference,
                                                                        org.datanucleus.ClassLoaderResolver clr)
Method to create a datastore field for a PersistenceCapable mapping.

Parameters:
mmd - MetaData for the field whose mapping it is
datastoreContainer - Datastore class where we create the datastore field
mapping - The Java type for this field
colmd - The columnMetaData for this datastore field
reference - The datastore field we are referencing
clr - ClassLoader resolver
Returns:
The DatastoreField


Copyright © 2009. All Rights Reserved.