| java.lang.Object org.jpox.store.mapping.AbstractMappingManager
AbstractMappingManager | abstract public class AbstractMappingManager implements MappingManager(Code) | | Base implementation of a MappingManager. Datastores should extend this to add their own specifics, and to
add the initialisation of their supported types.
The idea behind a MappingManager is that at the Java side we have a series of Java type mappings,
and at the datastore side we have a series of datastore type mappings. We need a link between the two
to say that "this Java type can map to any of these 3 datastore types, and by default use this one".
version: $Revision: 1.77 $ |
Inner Class :protected class TypeMapping | |
Method Summary | |
protected Class | getDefaultJavaTypeMapping(TypeManager typeMgr, Class javaType) Method to return the default java type mapping class for a specified java type. | protected Class | getElementMappingClass(DatastoreContainerObject container, AbstractMemberMetaData fmd, DatastoreAdapter dba, ClassLoaderResolver clr) Convenience accessor for the mapping class of the element mapping for a collection/array of PC elements. | protected Class | getKeyMappingClass(DatastoreContainerObject container, AbstractMemberMetaData fmd, DatastoreAdapter dba, ClassLoaderResolver clr) Convenience accessor for the mapping class of the key mapping for a map of PC keys. | public JavaTypeMapping | getMapping(Class c, boolean serialised, boolean embedded, StoreManager storeMgr, String fieldName) Accessor for the mapping for the specified class. | public JavaTypeMapping | getMapping(Class c, boolean serialised, boolean embedded, StoreManager storeMgr, ClassLoaderResolver clr) Accessor for the mapping for the specified class. | public JavaTypeMapping | getMapping(DatastoreContainerObject datastoreContainer, AbstractMemberMetaData fmd, DatastoreAdapter dba, ClassLoaderResolver clr, int roleForField) 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. | protected Class | getMappingClass(Class c, boolean serialised, boolean embedded, String fieldName, TypeManager typeMgr, ApiAdapter api) Accessor for the mapping class for the specified class. | protected Class | getOverrideMappingClass(Class mappingClass, AbstractMemberMetaData fmd, int roleForField) Convenience method to allow overriding of particular mapping classes. | protected Class | getValueMappingClass(DatastoreContainerObject container, AbstractMemberMetaData fmd, DatastoreAdapter dba, ClassLoaderResolver clr) Convenience accessor for the mapping class of the value mapping for a map of PC values. | abstract public void | loadDatastoreMapping(PluginManager mgr, ClassLoaderResolver clr, String vendorId) Load all datastore mappings defined in the associated plugins. | abstract public void | registerDatastoreMapping(String javaTypeName, Class datastoreMappingType, String jdbcType, String sqlType, boolean dflt) Utility to register a datastore mapping for a java type, and the SQL/JDBC types it can be mapped to. |
AbstractMappingManager | public AbstractMappingManager()(Code) | | Default constructor.
|
getDefaultJavaTypeMapping | protected Class getDefaultJavaTypeMapping(TypeManager typeMgr, Class javaType)(Code) | | Method to return the default java type mapping class for a specified java type.
Parameters: javaType - java type Parameters: typeMgr - the TypeManager The mapping class to use (by default) |
getElementMappingClass | protected Class getElementMappingClass(DatastoreContainerObject container, AbstractMemberMetaData fmd, DatastoreAdapter dba, ClassLoaderResolver clr)(Code) | | Convenience accessor for the mapping class of the element mapping for a collection/array of PC elements.
Currently only used where the collection/array elements are either serialised or embedded into a join table.
Parameters: container - The container Parameters: fmd - MetaData for the collection field containing the collection/array of PCs Parameters: dba - Database adapter Parameters: clr - ClassLoader resolver The mapping class |
getKeyMappingClass | protected Class getKeyMappingClass(DatastoreContainerObject container, AbstractMemberMetaData fmd, DatastoreAdapter dba, ClassLoaderResolver clr)(Code) | | Convenience accessor for the mapping class of the key mapping for a map of PC keys.
Currently only used where the keys are either serialised or embedded into a join table.
Parameters: container - The container Parameters: fmd - MetaData for the field containing the map that this key is for Parameters: dba - Database adapter Parameters: clr - ClassLoader resolver The mapping class |
getMapping | public JavaTypeMapping getMapping(Class c, boolean serialised, boolean embedded, StoreManager storeMgr, String fieldName)(Code) | | Accessor for the mapping for the specified class.
TODO Merge this with the method below, or at least say why use this or the other
Parameters: c - Java type Parameters: serialised - Whether the type is serialised Parameters: embedded - Whether the type is embedded Parameters: storeMgr - Manager for the datastore Parameters: fieldName - Name of the field (for logging) The mapping for the class. |
getMapping | public JavaTypeMapping getMapping(Class c, boolean serialised, boolean embedded, StoreManager storeMgr, ClassLoaderResolver clr)(Code) | | Accessor for the mapping for the specified class.
Usually only called by JDOQL query expressions.
Parameters: c - Java type Parameters: serialised - Whether the type is serialised Parameters: embedded - Whether the type is embedded Parameters: storeMgr - Manager for the store Parameters: clr - ClassLoader resolver The mapping for the class. |
getMapping | public JavaTypeMapping getMapping(DatastoreContainerObject datastoreContainer, AbstractMemberMetaData fmd, DatastoreAdapter dba, ClassLoaderResolver clr, int roleForField)(Code) | | 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 "roleForField".
Parameters: datastoreContainer - Table to add the mapping to Parameters: fmd - FieldMetaData for the field to map Parameters: dba - Datastore adapter Parameters: clr - The ClassLoaderResolver Parameters: roleForField - Role that this mapping plays for the field The mapping for the field. |
getMappingClass | protected Class getMappingClass(Class c, boolean serialised, boolean embedded, String fieldName, TypeManager typeMgr, ApiAdapter api)(Code) | | Accessor for the mapping class for the specified class.
Provides special handling for interface types and for classes that are
being embedded in a field (detected using the FieldMetaData argument).
Refers others to its mapping manager lookup.
Parameters: c - Class to query Parameters: serialised - Whether the field is serialised Parameters: embedded - Whether the field is embedded Parameters: fieldName - The full field name (for logging only) Parameters: typeMgr - the TypeManager Parameters: api - API Adapter The mapping class for the class |
getOverrideMappingClass | protected Class getOverrideMappingClass(Class mappingClass, AbstractMemberMetaData fmd, int roleForField)(Code) | | Convenience method to allow overriding of particular mapping classes.
Parameters: mappingClass - The mapping class selected Parameters: fmd - Field meta data for the field (if appropriate) Parameters: roleForField - Role for the field (e.g collection element) The mapping class to use |
getValueMappingClass | protected Class getValueMappingClass(DatastoreContainerObject container, AbstractMemberMetaData fmd, DatastoreAdapter dba, ClassLoaderResolver clr)(Code) | | Convenience accessor for the mapping class of the value mapping for a map of PC values.
Currently only used where the value are either serialised or embedded into a join table.
Parameters: container - The container Parameters: fmd - MetaData for the field containing the map that this value is for Parameters: dba - Database adapter Parameters: clr - ClassLoader resolver The mapping class |
loadDatastoreMapping | abstract public void loadDatastoreMapping(PluginManager mgr, ClassLoaderResolver clr, String vendorId)(Code) | | Load all datastore mappings defined in the associated plugins.
To be implemented by the datastore mapping managers since they have the knowledge of
the attributes supported by that datastore (e.g RDBMS datastores use jdbc-type, sql-type)
Parameters: mgr - the PluginManager Parameters: clr - the ClassLoaderResolver Parameters: vendorId - the datastore vendor id |
registerDatastoreMapping | abstract public void registerDatastoreMapping(String javaTypeName, Class datastoreMappingType, String jdbcType, String sqlType, boolean dflt)(Code) | | 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 Parameters: datastoreMappingType - The datastore mapping Parameters: jdbcType - The JDBC type that can be used Parameters: sqlType - The SQL type that can be used Parameters: dflt - Whether this type should be used as the default mapping for this Java type |
|
|