org.datanucleus.store.mapped.mapping
Interface MappingManager

All Known Implementing Classes:
AbstractMappingManager

public interface MappingManager

Representation of a MappingManager, mapping a java mapping type to a datastore mapping type. Allows a java mapping type to map to multiple datastore mapping types. Allows a default datastore mapping type be assigned to each java mapping type.


Method Summary
 DatastoreField createDatastoreField(AbstractMemberMetaData fmd, DatastoreContainerObject datastoreContainer, JavaTypeMapping mapping, ColumnMetaData colmd, DatastoreField reference, ClassLoaderResolver clr)
          Method to create a datastore field for a PersistenceCapable mapping.
 DatastoreField createDatastoreField(JavaTypeMapping mapping, java.lang.String javaType, ColumnMetaData colmd)
          Method to create a datastore field (column) in a container (table).
 DatastoreField createDatastoreField(JavaTypeMapping mapping, java.lang.String javaType, int datastoreFieldIndex)
          Method to create a datastore field (column) in a container (table).
 DatastoreMapping createDatastoreMapping(JavaTypeMapping mapping, AbstractMemberMetaData fmd, int index, DatastoreField column)
          Method to create the datastore mapping for a java type mapping at a particular index.
 DatastoreMapping createDatastoreMapping(JavaTypeMapping mapping, DatastoreField column, java.lang.String javaType)
          Method to create the datastore mapping for a particular column and java type.
 JavaTypeMapping getMapping(java.lang.Class c)
          Accessor for a mapping, for a java type.
 JavaTypeMapping getMapping(java.lang.Class c, boolean serialised, boolean embedded, java.lang.String fieldName)
          Accessor for a mapping, for a java type.
 JavaTypeMapping getMapping(DatastoreContainerObject table, AbstractMemberMetaData mmd, ClassLoaderResolver clr, int fieldRole)
          Accessor for the mapping for the field of the specified table.
 JavaTypeMapping getMappingWithDatastoreMapping(java.lang.Class c, boolean serialised, boolean embedded, ClassLoaderResolver clr)
          Accessor for a mapping, for a java type complete with the datastore mapping.
 void loadDatastoreMapping(PluginManager mgr, ClassLoaderResolver clr, java.lang.String vendorId)
          Initialise the datastore mapping.
 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.
 

Method Detail

loadDatastoreMapping

void loadDatastoreMapping(PluginManager mgr,
                          ClassLoaderResolver clr,
                          java.lang.String vendorId)
Initialise the datastore mapping.

Parameters:
mgr - the PlyginManager
clr - the ClassLoaderResolver
vendorId - the datastore vendor id

registerDatastoreMapping

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

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

createDatastoreMapping

DatastoreMapping createDatastoreMapping(JavaTypeMapping mapping,
                                        AbstractMemberMetaData fmd,
                                        int index,
                                        DatastoreField column)
Method to create the datastore mapping for a java type mapping at a particular index.

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

createDatastoreMapping

DatastoreMapping createDatastoreMapping(JavaTypeMapping mapping,
                                        DatastoreField column,
                                        java.lang.String javaType)
Method to create the datastore mapping for a particular column and java type.

Parameters:
mapping - The java mapping
column - The column
javaType - The java type (isnt this stored in the java mapping ?)
Returns:
The datastore mapping

getMapping

JavaTypeMapping getMapping(java.lang.Class c)
Accessor for a mapping, for a java type. Same as calling "getMapping(c, false, false, (String)null);"

Parameters:
c - The java type
Returns:
The mapping

getMapping

JavaTypeMapping getMapping(java.lang.Class c,
                           boolean serialised,
                           boolean embedded,
                           java.lang.String fieldName)
Accessor for a mapping, for a java type.

Parameters:
c - The java type
serialised - Whether the type is serialised
embedded - Whether the type is embedded
fieldName - Name of the field (for logging only)
Returns:
The mapping

getMappingWithDatastoreMapping

JavaTypeMapping getMappingWithDatastoreMapping(java.lang.Class c,
                                               boolean serialised,
                                               boolean embedded,
                                               ClassLoaderResolver clr)
Accessor for a mapping, for a java type complete with the datastore mapping.

Parameters:
c - The java type
serialised - Whether the type is serialised
embedded - Whether the type is embedded
clr - ClassLoader resolver
Returns:
The mapping

getMapping

JavaTypeMapping getMapping(DatastoreContainerObject table,
                           AbstractMemberMetaData mmd,
                           ClassLoaderResolver clr,
                           int fieldRole)
Accessor for the mapping for the field of the specified table. Can be used for fields of a class, elements of a collection of a class, elements of an array of a class, keys of a map of a class, values of a map of a class. This is controlled by the final argument "roleForMember".

Parameters:
table - Table to add the mapping to
mmd - MetaData for the field/property to map
clr - The ClassLoaderResolver
fieldRole - Role that this mapping plays for the field/property
Returns:
The mapping for the field.

createDatastoreField

DatastoreField createDatastoreField(JavaTypeMapping mapping,
                                    java.lang.String javaType,
                                    int datastoreFieldIndex)
Method to create a datastore field (column) in a container (table).

Parameters:
mapping - The java mapping
javaType - The java type
datastoreFieldIndex - The index of the datastore field to create
Returns:
The datastore field

createDatastoreField

DatastoreField createDatastoreField(JavaTypeMapping mapping,
                                    java.lang.String javaType,
                                    ColumnMetaData colmd)
Method to create a datastore field (column) in a container (table). To be used for serialised PC element/key/value in a join table.

Parameters:
mapping - The java mapping
javaType - The java type
colmd - MetaData for the column to create
Returns:
The datastore field

createDatastoreField

DatastoreField createDatastoreField(AbstractMemberMetaData fmd,
                                    DatastoreContainerObject datastoreContainer,
                                    JavaTypeMapping mapping,
                                    ColumnMetaData colmd,
                                    DatastoreField reference,
                                    ClassLoaderResolver clr)
Method to create a datastore field for a PersistenceCapable mapping.

Parameters:
fmd - MetaData for the field
datastoreContainer - The container in the datastore
mapping - The java mapping
colmd - MetaData for the column to create
reference - The field to reference
clr - ClassLoader resolver
Returns:
The datastore field


Copyright © 2010. All Rights Reserved.