SolarMetric Kodo JDO 2.5.0 Reverse Schema Tool

com.solarmetric.rd.kodo.impl.jdbc.meta.map
Class StateImageIndicator

java.lang.Object
  |
  +--com.solarmetric.rd.kodo.impl.jdbc.meta.Mapping
        |
        +--com.solarmetric.rd.kodo.impl.jdbc.meta.Indicator
              |
              +--com.solarmetric.rd.kodo.impl.jdbc.meta.VersionIndicator
                    |
                    +--com.solarmetric.rd.kodo.impl.jdbc.meta.map.StateImageIndicator

public class StateImageIndicator
extends VersionIndicator

Bases versioning on the values of the object's persistent state. This indicator has the following limitations when determining whether an optimistic lock violation has occurred:


Nested Class Summary
static class StateImageIndicator.CustomUpdate
          Row implementation we use to pass to versionable mappings so they can set up the where conditions we need to add to update statements.
 
Field Summary
static java.lang.String TYPE
           
 
Fields inherited from class com.solarmetric.rd.kodo.impl.jdbc.meta.Mapping
DEFAULT, FALSE, LOB, TRUE, UNIQUE
 
Constructor Summary
StateImageIndicator()
           
 
Method Summary
 void customInsert(com.solarmetric.rd.kodo.runtime.StateManagerImpl sm)
          This method is for class mappings that take over the insert process, but still want to use this indicator for optimistic locking.
 StateImageIndicator.CustomUpdate customUpdate(com.solarmetric.rd.kodo.runtime.StateManagerImpl sm, com.solarmetric.rd.kodo.impl.jdbc.schema.Table table, boolean record)
          This method is for class mappings that take over the update process, but still want to use this indicator for optimistic locking.
 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.
 java.lang.String getMappingType()
          Return the abbreviated name of this mapping, or the full class name if it is a custom mapping.
 void insert(com.solarmetric.rd.kodo.runtime.StateManagerImpl sm, com.solarmetric.rd.kodo.impl.jdbc.runtime.RowManager rm)
          Packages the version information based on the inserted state.
 boolean map()
          Map a new instance of this mapping type.
 void postLoad(com.solarmetric.rd.kodo.runtime.StateManagerImpl sm, com.solarmetric.rd.kodo.impl.jdbc.runtime.JDBCStoreManager store)
          This method is called after data is loaded into the instance, in case the version indicator works off of a state image.
 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.
 boolean synchVersion(com.solarmetric.rd.kodo.runtime.StateManagerImpl sm, com.solarmetric.rd.kodo.impl.jdbc.runtime.JDBCStoreManager store, java.sql.Connection conn)
          Synchronize the version of the given state manager with the version stored in memory.
 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.RowManager rm)
          Set values for the mapping into the proper rows.
 
Methods inherited from class com.solarmetric.rd.kodo.impl.jdbc.meta.VersionIndicator
getDefaults, load, newInstance, newInstance, toString
 
Methods inherited from class com.solarmetric.rd.kodo.impl.jdbc.meta.Indicator
delete, getMappingRepository, getOwnerMapping, getTable, refSchemaComponents, select, setOwnerMapping
 
Methods inherited from class com.solarmetric.rd.kodo.impl.jdbc.meta.Mapping
checkIndex, createColumn, delete, getDBDictionary, getForeignKey, getLog, getSchemaGroup, insert, invalidMapping, isCustomDelete, isCustomInsert, isCustomUpdate, setForeignKey, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TYPE

public static final java.lang.String TYPE
See Also:
Constant Field Values
Constructor Detail

StateImageIndicator

public StateImageIndicator()
Method Detail

getMappingType

public java.lang.String getMappingType()
Description copied from class: Mapping
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.

Overrides:
getMappingType in class Mapping

toMappingInfo

public void toMappingInfo(com.solarmetric.rd.kodo.impl.jdbc.meta.MappingInfo info)
Description copied from class: Mapping
Serialize this mapping to a simple MappingInfo instance for transfer to XML or some other format.

Specified by:
toMappingInfo in class Mapping

fromMappingInfo

public boolean fromMappingInfo(com.solarmetric.rd.kodo.impl.jdbc.meta.MappingInfo info,
                               boolean adapt)
Description copied from class: Mapping
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.

Specified by:
fromMappingInfo in class Mapping

map

public boolean map()
Description copied from class: Mapping
Map a new instance of this mapping type. If the underlying metadata cannot be mapped using this type, return false.

Specified by:
map in class Mapping

reverseMap

public void reverseMap(com.solarmetric.rd.kodo.impl.jdbc.schema.SchemaGroup schema,
                       com.solarmetric.rd.kodo.impl.jdbc.meta.ReverseMappingTool tool)
Description copied from class: Mapping
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.

Overrides:
reverseMap in class Mapping

insert

public void insert(com.solarmetric.rd.kodo.runtime.StateManagerImpl sm,
                   com.solarmetric.rd.kodo.impl.jdbc.runtime.RowManager rm)
            throws java.sql.SQLException
Packages the version information based on the inserted state. Custom mappings that override the insert process can safely call this method with a null row manager.

Overrides:
insert in class Indicator
java.sql.SQLException

customInsert

public void customInsert(com.solarmetric.rd.kodo.runtime.StateManagerImpl sm)
                  throws java.sql.SQLException
This method is for class mappings that take over the insert process, but still want to use this indicator for optimistic locking.

java.sql.SQLException

update

public void update(com.solarmetric.rd.kodo.runtime.StateManagerImpl sm,
                   com.solarmetric.rd.kodo.impl.jdbc.runtime.RowManager rm)
            throws java.sql.SQLException
Description copied from class: Mapping
Set values for the mapping into the proper rows.

Overrides:
update in class Indicator
java.sql.SQLException
See Also:
Mapping.insert(com.solarmetric.rd.kodo.runtime.StateManagerImpl, com.solarmetric.rd.kodo.impl.jdbc.runtime.RowManager)

customUpdate

public StateImageIndicator.CustomUpdate customUpdate(com.solarmetric.rd.kodo.runtime.StateManagerImpl sm,
                                                     com.solarmetric.rd.kodo.impl.jdbc.schema.Table table,
                                                     boolean record)
                                              throws java.sql.SQLException
This method is for class mappings that take over the update process, but still want to use this indicator for optimistic locking.

Parameters:
sm - the instance to test
table - only state image values in this table will be tested; if the custom mapping uses different updates for different tables, this method can be called multiple times for the multiple tables
record - set this parameter to true the last time you call this method, so the indicator can setup the next version of the given state manager
Returns:
a StateImageIndicator.CustomUpdate whose getSQL method yields a boolean SQL expression that tests whether the current record is equal to our recorded state image, and whose setParameters method parameterizes the given prepared statement with the values used in the above boolean expression
java.sql.SQLException

postLoad

public void postLoad(com.solarmetric.rd.kodo.runtime.StateManagerImpl sm,
                     com.solarmetric.rd.kodo.impl.jdbc.runtime.JDBCStoreManager store)
Description copied from class: VersionIndicator
This method is called after data is loaded into the instance, in case the version indicator works off of a state image.

Overrides:
postLoad in class VersionIndicator

synchVersion

public boolean synchVersion(com.solarmetric.rd.kodo.runtime.StateManagerImpl sm,
                            com.solarmetric.rd.kodo.impl.jdbc.runtime.JDBCStoreManager store,
                            java.sql.Connection conn)
                     throws java.sql.SQLException
Description copied from class: VersionIndicator
Synchronize the version of the given state manager with the version stored in memory.

Specified by:
synchVersion in class VersionIndicator
java.sql.SQLException
See Also:
StoreManager.synchVersion(com.solarmetric.rd.kodo.runtime.StateManagerImpl, java.lang.Object)

SolarMetric Kodo JDO 2.5.0 Reverse Schema Tool

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