SolarMetric Kodo JDO 3.3.5 generated on August 31 2005

kodo.jdbc.meta
Class Mappings

java.lang.Object
  |
  +--kodo.jdbc.meta.Mappings

public class Mappings
extends Object

Mapping helper class.


Field Summary
static int DEFAULT
           
static int FALSE
           
static int FKOID_ALL
           
static int FKOID_FALSE
           
static int FKOID_TRUE
           
static int LOB
           
static int TRUE
           
static int UNIQUE
           
 
Constructor Summary
Mappings()
           
 
Method Summary
static void checkIndex(Mapping mapping, String name, int index, Column[] idxCols, int defaultIndexed)
          Check the index-related extensions on the given meta data, and make sure they are consistent with the schema.
static Column createColumn(Mapping mapping, String name, int jdbcType, int size, Table table)
          Create a new column for the given metadata.
static Table createTable(ClassMapping mapping, Schema schema)
          Create a new table for the given mapping.
static ClassMapping[] getClassMappingDefaults()
          Return the set of default mapping types.
static String getDeleteActionConstant(int i, boolean deferred)
          Return the foreign key delete action name for the given action.
static int getDeleteActionConstant(String str)
          Return the foreign key delete action for the given name.
static List getFieldMappingDefaults()
          Return the default set of available field mappings.
static ForeignKey getForeignKey(Mapping mapping, MappingInfo info, String attrPrefix, Table table, Table toTable)
          Return a foreign key between the given tables, based on linking information in the given mapping info.
static String getIndexedConstant(int i)
          Return the index type name for the given constant: UNIQUE, TRUE, or FALSE.
static int getIndexedConstant(String str)
          Return the constant index type for the given name: UNIQUE, TRUE, or FALSE.
static MappingInfoNotFoundException invalidMapping(String msg, Mapping mapping, Class forClass)
          Return an invalid mapping exception.
static MappingInfoNotFoundException invalidMapping(String msg, Mapping mapping, Class forClass, Object[] params)
          Return an invalid mapping exception.
static boolean isDeleteActionDeferred(String action)
          Return whether the given delete action constant represents a deferred foreign key.
static int isForeignKeyObjectId(ClassMapping mapping, ForeignKey fk)
          Return whether the given foreign key to the given mapping can be used to construct object id values.
static boolean isValue(int type)
          Return true if the given type code represents a simple JDBC value.
static void log(String msg, Mapping mapping, Class forClass)
          Log a warning about bad mapping info and return false.
static void log(String msg, Mapping mapping, Class forClass, Object[] params)
          Log a warning about bad mapping info and return false.
static ClassMapping newClassMappingInstance(String type, ClassMetaData meta)
          Return the mapping for the given mapping type.
static FieldMapping newFieldMappingInstance(String type, FieldMetaData meta)
          Return the mapping for the given mapping name.
static void setForeignKey(MappingInfo info, String attrPrefix, ForeignKey fk)
          Sets the attributes for linking with the given foreign key into the given mapping info.
protected static void validateMappingInfoAttributes(Mapping mapping, MappingInfo info)
          Validate the specified mapping by checking its mapping information attributes against a set of pre-defined valid names.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT

public static final int DEFAULT

TRUE

public static final int TRUE

FALSE

public static final int FALSE

UNIQUE

public static final int UNIQUE

LOB

public static final int LOB

FKOID_ALL

public static final int FKOID_ALL

FKOID_TRUE

public static final int FKOID_TRUE

FKOID_FALSE

public static final int FKOID_FALSE
Constructor Detail

Mappings

public Mappings()
Method Detail

log

public static void log(String msg,
                       Mapping mapping,
                       Class forClass)
Log a warning about bad mapping info and return false.
Parameters:
msg - the localizer key for the message; the 'this' ptr will be passed as a parameter to the message

log

public static void log(String msg,
                       Mapping mapping,
                       Class forClass,
                       Object[] params)
Log a warning about bad mapping info and return false.
Parameters:
msg - the localizer key for the message; the 'this' ptr will be passed as a parameter to the message
params - substitutions into the message

invalidMapping

public static MappingInfoNotFoundException invalidMapping(String msg,
                                                          Mapping mapping,
                                                          Class forClass)
Return an invalid mapping exception.
Parameters:
msg - the localizer key for the message; the 'this' ptr will be passed as a parameter to the message

invalidMapping

public static MappingInfoNotFoundException invalidMapping(String msg,
                                                          Mapping mapping,
                                                          Class forClass,
                                                          Object[] params)
Return an invalid mapping exception.
Parameters:
msg - the localizer key for the message; the 'this' ptr will be passed as a parameter to the message
params - the object parameters to send to the message

createTable

public static Table createTable(ClassMapping mapping,
                                Schema schema)
Create a new table for the given mapping.

createColumn

public static Column createColumn(Mapping mapping,
                                  String name,
                                  int jdbcType,
                                  int size,
                                  Table table)
Create a new column for the given metadata.

getForeignKey

public static ForeignKey getForeignKey(Mapping mapping,
                                       MappingInfo info,
                                       String attrPrefix,
                                       Table table,
                                       Table toTable)
Return a foreign key between the given tables, based on linking information in the given mapping info. If no foreign key can be created, an appropriate exception is thrown.

setForeignKey

public static void setForeignKey(MappingInfo info,
                                 String attrPrefix,
                                 ForeignKey fk)
Sets the attributes for linking with the given foreign key into the given mapping info.
Parameters:
attrPrefix - the prefix to place on the 'column' and 'constant' attributes used to record this foreign key, or null for no prefix

isForeignKeyObjectId

public static int isForeignKeyObjectId(ClassMapping mapping,
                                       ForeignKey fk)
Return whether the given foreign key to the given mapping can be used to construct object id values. This is an expensive operation; its results should be cached.
Returns:
FKOID_ALL, FKOID_TRUE, or FKOID_FALSE

checkIndex

public static void checkIndex(Mapping mapping,
                              String name,
                              int index,
                              Column[] idxCols,
                              int defaultIndexed)
Check the index-related extensions on the given meta data, and make sure they are consistent with the schema. The index will be added if defaultIndexed is TRUE or UNIQUE and it does not already exist. Mappings should use this method with the appropriate defaultIndexed setting when installing themselves, and with a defaultIndexed setting of DEFAULT when reading themselves from mapping info. This ensures that mappings are created with the appropriate indexing, and that indexes are created afterwords whenever a user changes the mapping information to explicitly mark a field indexed, but that indexes are not added to existing schemas that don't want them.

isDeleteActionDeferred

public static boolean isDeleteActionDeferred(String action)
Return whether the given delete action constant represents a deferred foreign key.

getDeleteActionConstant

public static int getDeleteActionConstant(String str)
Return the foreign key delete action for the given name.

getDeleteActionConstant

public static String getDeleteActionConstant(int i,
                                             boolean deferred)
Return the foreign key delete action name for the given action.

getIndexedConstant

public static int getIndexedConstant(String str)
Return the constant index type for the given name: UNIQUE, TRUE, or FALSE.

getIndexedConstant

public static String getIndexedConstant(int i)
Return the index type name for the given constant: UNIQUE, TRUE, or FALSE.

isValue

public static boolean isValue(int type)
Return true if the given type code represents a simple JDBC value.

newFieldMappingInstance

public static FieldMapping newFieldMappingInstance(String type,
                                                   FieldMetaData meta)
Return the mapping for the given mapping name.

getFieldMappingDefaults

public static List getFieldMappingDefaults()
Return the default set of available field mappings.

newClassMappingInstance

public static ClassMapping newClassMappingInstance(String type,
                                                   ClassMetaData meta)
Return the mapping for the given mapping type.

getClassMappingDefaults

public static ClassMapping[] getClassMappingDefaults()
Return the set of default mapping types.

validateMappingInfoAttributes

protected static void validateMappingInfoAttributes(Mapping mapping,
                                                    MappingInfo info)
Validate the specified mapping by checking its mapping information attributes against a set of pre-defined valid names. If the name is not found a warning will be raised (including a hint if there are any valid attribute names that are similar).

SolarMetric Kodo JDO 3.3.5 generated on August 31 2005

Copyright 2001,2002 SolarMetric, Inc. All Rights Reserved.