Overview | Package | Class | Tree | Deprecated | Index | Help
| SolarMetric Kodo JDO 2.5.0 Reverse Schema Tool
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.solarmetric.rd.kodo.impl.jdbc.meta
Class Mapping

    java.lang.Object
      |
      +--com.solarmetric.rd.kodo.impl.jdbc.meta.Mapping

Direct Known Subclasses:
  com.solarmetric.rd.kodo.impl.jdbc.meta.ExtensionsMapping, Indicator

public abstract class Mapping
extends java.lang.Object

Base class for all mappings.

Field Summary
`static int` | `DEFAULT`
`static int` | `FALSE`
`static int` | `LOB`
`static int` | `TRUE`
`static int` | `UNIQUE`

Constructor Summary
`Mapping()`

Method Summary
`protected void` | `checkIndex(java.lang.String name, int index, com.solarmetric.rd.kodo.impl.jdbc.schema.Column[] idxCols, int defaultIndexed)` Check the index-related extensions on the given meta data, and make sure they are consistent with the schema.
`protected com.solarmetric.rd.kodo.impl.jdbc.schema.Column` | `createColumn(java.lang.String name, int jdbcType, int size, com.solarmetric.rd.kodo.impl.jdbc.schema.Table table)` Create a new column for the given metadata.
`void` | `delete(com.solarmetric.rd.kodo.runtime.StateManagerImpl sm, com.solarmetric.rd.kodo.impl.jdbc.runtime.JDBCStoreManager store, java.sql.Connection conn)` Override this method to customize flushing this mapping.
`abstract void` | `delete(com.solarmetric.rd.kodo.runtime.StateManagerImpl sm, com.solarmetric.rd.kodo.impl.jdbc.runtime.RowManager rm)` Set the where values appropriately to delete the proper instance, and set all relations on non-secondary tables as updates.
`abstract boolean` | `fromMappingInfo(com.solarmetric.rd.kodo.impl.jdbc.meta.MappingInfo info, boolean adapt)` Deserialize this mapping from a simple `MappingInfo` instance parsed from XML or some other format.
`protected com.solarmetric.rd.kodo.impl.jdbc.schema.DBDictionary` | `getDBDictionary()` Return the dictionary to use.
`protected com.solarmetric.rd.kodo.impl.jdbc.schema.ForeignKey` | `getForeignKey(com.solarmetric.rd.kodo.impl.jdbc.meta.MappingInfo info, java.lang.String attrSuffix, com.solarmetric.rd.kodo.impl.jdbc.schema.Table table, com.solarmetric.rd.kodo.impl.jdbc.schema.Table toTable)` Return a foreign key between the given tables, based on linking information in the given mapping info.
`protected org.apache.commons.logging.Log` | `getLog()` Return the log to write to.
`abstract com.solarmetric.rd.kodo.impl.jdbc.meta.MappingRepository` | `getMappingRepository()` Return the repository for this mapping.
`java.lang.String` | `getMappingType()` Return the abbreviated name of this mapping, or the full class name if it is a custom mapping.
`protected com.solarmetric.rd.kodo.impl.jdbc.schema.SchemaGroup` | `getSchemaGroup()` Return the system schema.
`abstract com.solarmetric.rd.kodo.impl.jdbc.schema.Table` | `getTable()` Return the mapping's data table.
`void` | `insert(com.solarmetric.rd.kodo.runtime.StateManagerImpl sm, com.solarmetric.rd.kodo.impl.jdbc.runtime.JDBCStoreManager store, java.sql.Connection conn)` Override this method to customize flushing this mapping.
`abstract void` | `insert(com.solarmetric.rd.kodo.runtime.StateManagerImpl sm, com.solarmetric.rd.kodo.impl.jdbc.runtime.RowManager rm)` Set values for the mapping into the proper rows.
`protected boolean` | `invalidMapping(java.lang.String msg)` Log a warning about bad mapping info and return false.
`java.lang.Boolean` | `isCustomDelete(com.solarmetric.rd.kodo.runtime.StateManagerImpl sm)` Return `Boolean.FALSE` if this mapping does not customize the delete process, `Boolean.TRUE` if it does, or null if it does customize the delete, but also relies on the standard delete method being called.
`java.lang.Boolean` | `isCustomInsert(com.solarmetric.rd.kodo.runtime.StateManagerImpl sm)` Return `Boolean.FALSE` if this mapping does not customize the insert process, `Boolean.TRUE` if it does, or null if it does customize the insert, but also relies on the standard insert method being called.
`java.lang.Boolean` | `isCustomUpdate(com.solarmetric.rd.kodo.runtime.StateManagerImpl sm)` Return `Boolean.FALSE` if this mapping does not customize the update process, `Boolean.TRUE` if it does, or null if it does customize the update, but also relies on the standard update method being called.
`abstract boolean` | `map()` Map a new instance of this mapping type.
`abstract void` | `refSchemaComponents()` Increment the reference count of all used schema components.
`void` | `reverseMap(com.solarmetric.rd.kodo.impl.jdbc.schema.SchemaGroup schema, com.solarmetric.rd.kodo.impl.jdbc.meta.ReverseMappingTool tool)` Create mappings from the schema, using the given tool.
`protected void` | `setForeignKey(com.solarmetric.rd.kodo.impl.jdbc.meta.MappingInfo info, java.lang.String attrSuffix, com.solarmetric.rd.kodo.impl.jdbc.schema.ForeignKey fk)` Sets the attributes for linking with the given foreign key into the given mapping info.
`abstract void` | `toMappingInfo(com.solarmetric.rd.kodo.impl.jdbc.meta.MappingInfo info)` Serialize this mapping to a simple `MappingInfo` instance for transfer to XML or some other format.
`void` | `update(com.solarmetric.rd.kodo.runtime.StateManagerImpl sm, com.solarmetric.rd.kodo.impl.jdbc.runtime.JDBCStoreManager store, java.sql.Connection conn)` Override this method to customize flushing this mapping.
`abstract void` | `update(com.solarmetric.rd.kodo.runtime.StateManagerImpl sm, com.solarmetric.rd.kodo.impl.jdbc.runtime.RowManager rm)` Set values for the mapping into the proper rows.

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

See Also:
  Constant Field Values

### TRUE

    public static final int TRUE

See Also:
  Constant Field Values

### FALSE

    public static final int FALSE

See Also:
  Constant Field Values

### UNIQUE

    public static final int UNIQUE

See Also:
  Constant Field Values

### LOB

    public static final int LOB

See Also:
  Constant Field Values

Constructor Detail

### Mapping

    public Mapping()

Method Detail

### getMappingType

    public java.lang.String getMappingType()

  Return the abbreviated name of this mapping, or the full class name if it is a custom mapping. Returns the full class name by default.

### toMappingInfo

    public abstract void toMappingInfo(com.solarmetric.rd.kodo.impl.jdbc.meta.MappingInfo info)

  Serialize this mapping to a simple `MappingInfo` instance for transfer to XML or some other format.

### fromMappingInfo

    public abstract boolean fromMappingInfo(com.solarmetric.rd.kodo.impl.jdbc.meta.MappingInfo info,
                                            boolean adapt)

  Deserialize this mapping from a simple `MappingInfo` instance parsed from XML or some other format. If the info is incompatible and `adapt` is true, try to adapt to the new info, else return false. This method must validate the given mapping information using the `SchemaGroup.findTable(java.lang.String)` method to find any needed tables, the `Table.getColumn(java.lang.String)` method to retrieve columns from those tables, and the `Column.isCompatible(int, int)` method to check all column types. This is important, as some schema groups use these methods to build themselves up dynamically rather than reading schema information from the database.

### map

    public abstract boolean map()

  Map a new instance of this mapping type. If the underlying metadata cannot be mapped using this type, return false.

### reverseMap

    public void reverseMap(com.solarmetric.rd.kodo.impl.jdbc.schema.SchemaGroup schema,
                           com.solarmetric.rd.kodo.impl.jdbc.meta.ReverseMappingTool tool)

  Create mappings from the schema, using the given tool. Implement this method if you want the class mapping to be a candidate when reverse-mapping a schema to java classes. Note that this method will be invoked on a template instance, so you cannot rely on the metadata or owning repository being set.

### getTable

    public abstract com.solarmetric.rd.kodo.impl.jdbc.schema.Table getTable()

  Return the mapping's data table.

### refSchemaComponents

    public abstract void refSchemaComponents()

  Increment the reference count of all used schema components.

### insert

    public abstract void insert(com.solarmetric.rd.kodo.runtime.StateManagerImpl sm,
                                com.solarmetric.rd.kodo.impl.jdbc.runtime.RowManager rm)
                         throws java.sql.SQLException

  Set values for the mapping into the proper rows. For class mappings, this method will be called only after the corresponding method has been called for all fields of this mapping.

    `java.sql.SQLException`

### update

    public abstract void update(com.solarmetric.rd.kodo.runtime.StateManagerImpl sm,
                                com.solarmetric.rd.kodo.impl.jdbc.runtime.RowManager rm)
                         throws java.sql.SQLException

  Set values for the mapping into the proper rows.

    `java.sql.SQLException`
  See Also:
    `insert(com.solarmetric.rd.kodo.runtime.StateManagerImpl, com.solarmetric.rd.kodo.impl.jdbc.runtime.RowManager)`

### delete

    public abstract void delete(com.solarmetric.rd.kodo.runtime.StateManagerImpl sm,
                                com.solarmetric.rd.kodo.impl.jdbc.runtime.RowManager rm)
                         throws java.sql.SQLException

  Set the where values appropriately to delete the proper instance, and set all relations on non-secondary tables as updates. This allows foreign key analysis.

    `java.sql.SQLException`
  See Also:
    `insert(com.solarmetric.rd.kodo.runtime.StateManagerImpl, com.solarmetric.rd.kodo.impl.jdbc.runtime.RowManager)`

### isCustomInsert

    public java.lang.Boolean isCustomInsert(com.solarmetric.rd.kodo.runtime.StateManagerImpl sm)

  Return `Boolean.FALSE` if this mapping does not customize the insert process, `Boolean.TRUE` if it does, or null if it does customize the insert, but also relies on the standard insert method being called. Implement the `insert(StateManagerImpl,JDBCStoreManager,Connection)` method to implement the custom insertion behavior.

### isCustomUpdate

    public java.lang.Boolean isCustomUpdate(com.solarmetric.rd.kodo.runtime.StateManagerImpl sm)

  Return `Boolean.FALSE` if this mapping does not customize the update process, `Boolean.TRUE` if it does, or null if it does customize the update, but also relies on the standard update method being called. Implement the `update(StateManagerImpl,JDBCStoreManager,Connection)` method to override the default update behavior.

### isCustomDelete

    public java.lang.Boolean isCustomDelete(com.solarmetric.rd.kodo.runtime.StateManagerImpl sm)

  Return `Boolean.FALSE` if this mapping does not customize the delete process, `Boolean.TRUE` if it does, or null if it does customize the delete, but also relies on the standard delete method being called. Implement the `delete(StateManagerImpl,JDBCStoreManager,Connection)` method to override the default deletion behavior.

### insert

    public void insert(com.solarmetric.rd.kodo.runtime.StateManagerImpl sm,
                       com.solarmetric.rd.kodo.impl.jdbc.runtime.JDBCStoreManager store,
                       java.sql.Connection conn)
                throws java.sql.SQLException

  Override this method to customize flushing this mapping. For classes, this method must also flush all fields. For fields, this method is called after the owning object is inserted, so if this field is in a row with other fields, that row will already exist.

    `java.sql.SQLException`

### update

    public void update(com.solarmetric.rd.kodo.runtime.StateManagerImpl sm,
                       com.solarmetric.rd.kodo.impl.jdbc.runtime.JDBCStoreManager store,
                       java.sql.Connection conn)
                throws java.sql.SQLException

  Override this method to customize flushing this mapping. For classes, this method must also flush all fields.

    `java.sql.SQLException`

### delete

    public void delete(com.solarmetric.rd.kodo.runtime.StateManagerImpl sm,
                       com.solarmetric.rd.kodo.impl.jdbc.runtime.JDBCStoreManager store,
                       java.sql.Connection conn)
                throws java.sql.SQLException

  Override this method to customize flushing this mapping. For classes, this method must also flush all fields. For fields, this method will be called after the owning object is deleted.

    `java.sql.SQLException`

### getMappingRepository

    public abstract com.solarmetric.rd.kodo.impl.jdbc.meta.MappingRepository getMappingRepository()

  Return the repository for this mapping.

### getDBDictionary

    protected com.solarmetric.rd.kodo.impl.jdbc.schema.DBDictionary getDBDictionary()

  Return the dictionary to use.

### getLog

    protected org.apache.commons.logging.Log getLog()

  Return the log to write to.

### getSchemaGroup

    protected com.solarmetric.rd.kodo.impl.jdbc.schema.SchemaGroup getSchemaGroup()

  Return the system schema.

### invalidMapping

    protected boolean invalidMapping(java.lang.String msg)

  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

### createColumn

    protected com.solarmetric.rd.kodo.impl.jdbc.schema.Column createColumn(java.lang.String name,
                                                                           int jdbcType,
                                                                           int size,
                                                                           com.solarmetric.rd.kodo.impl.jdbc.schema.Table table)

  Create a new column for the given metadata.

### getForeignKey

    protected com.solarmetric.rd.kodo.impl.jdbc.schema.ForeignKey getForeignKey(com.solarmetric.rd.kodo.impl.jdbc.meta.MappingInfo info,
                                                                                java.lang.String attrSuffix,
                                                                                com.solarmetric.rd.kodo.impl.jdbc.schema.Table table,
                                                                                com.solarmetric.rd.kodo.impl.jdbc.schema.Table toTable)

  Return a foreign key between the given tables, based on linking information in the given mapping info.

### setForeignKey

    protected void setForeignKey(com.solarmetric.rd.kodo.impl.jdbc.meta.MappingInfo info,
                                 java.lang.String attrSuffix,
                                 com.solarmetric.rd.kodo.impl.jdbc.schema.ForeignKey fk)

  Sets the attributes for linking with the given foreign key into the given mapping info.

### checkIndex

    protected void checkIndex(java.lang.String name,
                              int index,
                              com.solarmetric.rd.kodo.impl.jdbc.schema.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.

Overview | Package | Class | Tree | Deprecated | Index | Help
| SolarMetric Kodo JDO 2.5.0 Reverse Schema Tool
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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