org.exolab.castor.jdo.engine

Class JDOMappingLoader

Implemented Interfaces:
MappingLoader

public final class JDOMappingLoader
extends AbstractMappingLoader

A JDO implementation of mapping helper. Creates JDO class descriptors from the mapping file.
Version:
$Revision: 7272 $ $Date: 2006-04-13 07:37:49 -0600 (Thu, 13 Apr 2006) $
Authors:
Assaf Arkin
Ralf Joachim

Nested Class Summary

Nested classes/interfaces inherited from class org.exolab.castor.mapping.loader.AbstractMappingLoader

AbstractMappingLoader.TypeInfoReference

Field Summary

Fields inherited from class org.exolab.castor.mapping.loader.AbstractMappingLoader

EMPTY_ARGS, STRING_ARG, VALUE_OF

Constructor Summary

JDOMappingLoader(ClassLoader loader)
Constructs a new mapping helper.

Method Summary

protected ClassDescriptor
createClassDescriptor(ClassMapping clsMap)
protected AbstractFieldDescriptor
createFieldDesc(Class javaClass, FieldMapping fieldMap)
Creates a single field descriptor.
static String
definition2param(String sqlTypeDef)
Extracts parameter for type convertor from the SQL type definition of the form "SQL_TYPE_NAME[PARAMETER]".
static String
definition2type(String sqlTypeDef)
Extracts SQL type name from the the SQL type definition of the form "SQL_TYPE_NAME[PARAMETER]".
protected FieldDescriptor
findIdentityByName(List fldList, String idName, Class javaClass)
BindingType
getBindingType()
protected String[]
getSqlTypes(FieldMapping fieldMap)
Parse the sql type attribute to build an array of types, needed to support whitespace inside parameterized types (see Bug 1045).
protected TypeInfo
getTypeInfo(Class fieldType, CollectionHandler colHandler, FieldMapping fieldMap)
void
loadMapping(MappingRoot mapping, Object param)
protected void
resolveRelations(ClassDescriptor clsDesc)

Methods inherited from class org.exolab.castor.mapping.loader.AbstractMappingLoader

checkFieldNameDuplicates, createClassDescriptor, createClassDescriptors, createFieldDesc, createFieldDescriptors, createFieldHandler, createFieldHandlers, divideFieldDescriptors, findAccessor, getDepended, getExtended, getIdColumnIndex, getIdentityColumnNames, getInternalContext, getOrigin, getSourceType, getTypeInfo, isPrimitive, loadMapping, resolveRelations, resolveType, setInternalContext

Methods inherited from class org.exolab.castor.mapping.loader.AbstractMappingLoader2

addDescriptor, clear, descriptorIterator, getClassLoader, getDescriptor, isAllowRedefinition, loadMapping, setAllowRedefinitions, setClassLoader

Constructor Details

JDOMappingLoader

public JDOMappingLoader(ClassLoader loader)
Constructs a new mapping helper. This constructor is used by a derived class.
Parameters:
loader - The class loader to use, null for the default

Method Details

createClassDescriptor

protected ClassDescriptor createClassDescriptor(ClassMapping clsMap)
            throws MappingException
Overrides:
createClassDescriptor in interface AbstractMappingLoader

createFieldDesc

protected AbstractFieldDescriptor createFieldDesc(Class javaClass,
                                                  FieldMapping fieldMap)
            throws MappingException
Creates a single field descriptor. The field mapping is used to create a new stock FieldDescriptor. Implementations may extend this class to create a more suitable descriptor.
Overrides:
createFieldDesc in interface AbstractMappingLoader
Parameters:
javaClass - The class to which the field belongs.
fieldMap - The field mapping information.
Returns:
The field descriptor.
Throws:
MappingException - The field or its accessor methods are not found, not accessible, not of the specified type, etc.

definition2param

public static String definition2param(String sqlTypeDef)
Extracts parameter for type convertor from the SQL type definition of the form "SQL_TYPE_NAME[PARAMETER]". If the type is not parameterized, returns null.
Parameters:
sqlTypeDef - SQL type definition (e.g. char[01]).
Returns:
Parameter (e.g. "01") or null if not parameterized.

definition2type

public static String definition2type(String sqlTypeDef)
Extracts SQL type name from the the SQL type definition of the form "SQL_TYPE_NAME[PARAMETER]".
Parameters:
sqlTypeDef - SQL type definition (e.g. char[01]).
Returns:
SQL type name (e.g. "char").

findIdentityByName

protected FieldDescriptor findIdentityByName(List fldList,
                                             String idName,
                                             Class javaClass)
            throws MappingException

getBindingType

public BindingType getBindingType()
Specified by:
getBindingType in interface MappingLoader

getSqlTypes

protected String[] getSqlTypes(FieldMapping fieldMap)
Parse the sql type attribute to build an array of types, needed to support whitespace inside parameterized types (see Bug 1045).

getTypeInfo

protected TypeInfo getTypeInfo(Class fieldType,
                               CollectionHandler colHandler,
                               FieldMapping fieldMap)
            throws MappingException
Overrides:
getTypeInfo in interface AbstractMappingLoader

loadMapping

public void loadMapping(MappingRoot mapping,
                        Object param)
            throws MappingException
Overrides:
loadMapping in interface AbstractMappingLoader

resolveRelations

protected void resolveRelations(ClassDescriptor clsDesc)
Overrides:
resolveRelations in interface AbstractMappingLoader

Intalio Inc. (C) 1999-2008. All rights reserved http://www.intalio.com