SolarMetric Kodo JDO 3.3.5 generated on August 31 2005

kodo.jdbc.meta
Class StateImageVersionIndicator

java.lang.Object
  |
  +--kodo.jdbc.meta.Indicator
        |
        +--kodo.jdbc.meta.VersionIndicator
              |
              +--kodo.jdbc.meta.StateImageVersionIndicator
All Implemented Interfaces:
Mapping

public class StateImageVersionIndicator
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:


Inner Class Summary
 class StateImageVersionIndicator.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 String TYPE
           
 
Constructor Summary
StateImageVersionIndicator()
           
 
Method Summary
 int compareVersion(Object v1, Object v2)
          Compare the two states.
 void customInsert(KodoStateManager sm)
          This method is for class mappings that take over the insert process, but still want to use this indicator for optimistic locking.
 StateImageVersionIndicator.CustomUpdate customUpdate(KodoStateManager sm, 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.
 void fromMappingInfo(MappingInfo info, boolean adapt)
          The default implementation will raise warnings for any mapping attributes that are declared but not in the list of the valid attributes for this mapping.
 String getMappingType()
          Return the abbreviated name of this mapping, or the full class name if it is a custom mapping.
 Table getTable()
          Return the mapping's primary data table.
 void insert(KodoStateManager sm, RowManager rm)
          Packages the version information based on the inserted state.
 boolean map()
          Map a new instance of this mapping type.
 void postLoad(KodoStateManager sm, 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(SchemaGroup schema, ReverseMappingTool tool)
          Create mappings from the schema, using the given tool.
 boolean synchVersion(KodoStateManager sm, JDBCStoreManager store)
          Synchronize the version of the given state manager with the version stored in memory.
 void toMappingInfo(MappingInfo info)
          Serialize this mapping to a simple MappingInfo instance for transfer to XML or some other format.
 void update(KodoStateManager sm, RowManager rm)
          Set values for the mapping into the proper rows.
 
Methods inherited from class kodo.jdbc.meta.VersionIndicator
getDefaults, load, newInstance, toString
 
Methods inherited from class kodo.jdbc.meta.Indicator
addMappingInfoAttributes, delete, delete, getColumns, getDBDictionary, getMappingRepository, getOwnerMapping, insert, isCustomDelete, isCustomInsert, isCustomUpdate, refSchemaComponents, select, setOwnerMapping, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TYPE

public static final String TYPE
Constructor Detail

StateImageVersionIndicator

public StateImageVersionIndicator()
Method Detail

getMappingType

public String getMappingType()
Description copied from interface: Mapping
Return the abbreviated name of this mapping, or the full class name if it is a custom mapping.

getTable

public Table getTable()
Description copied from interface: Mapping
Return the mapping's primary data table.
Overrides:
getTable in class Indicator

toMappingInfo

public void toMappingInfo(MappingInfo info)
Description copied from interface: Mapping
Serialize this mapping to a simple MappingInfo instance for transfer to XML or some other format.

fromMappingInfo

public void fromMappingInfo(MappingInfo info,
                            boolean adapt)
Description copied from class: Indicator
The default implementation will raise warnings for any mapping attributes that are declared but not in the list of the valid attributes for this mapping.
Overrides:
fromMappingInfo in class Indicator
Following copied from class: kodo.jdbc.meta.Indicator
See Also:
Indicator.addMappingInfoAttributes(java.util.Collection)

map

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

reverseMap

public void reverseMap(SchemaGroup schema,
                       ReverseMappingTool tool)
Description copied from interface: 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 Indicator

compareVersion

public int compareVersion(Object v1,
                          Object v2)
Compare the two states. Since we do not have any timestamp information, we can only return either StoreManager.VERSION_DIFFERENT or StoreManager.VERSION_SAME.
Overrides:
compareVersion in class VersionIndicator
Following copied from class: kodo.jdbc.meta.VersionIndicator
See Also:
StoreManager.compareVersion(kodo.runtime.KodoStateManager, java.lang.Object, java.lang.Object)

insert

public void insert(KodoStateManager sm,
                   RowManager rm)
            throws 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

customInsert

public void customInsert(KodoStateManager sm)
                  throws SQLException
This method is for class mappings that take over the insert process, but still want to use this indicator for optimistic locking.

update

public void update(KodoStateManager sm,
                   RowManager rm)
            throws SQLException
Description copied from interface: Mapping
Set values for the mapping into the proper rows.
Overrides:
update in class Indicator
Following copied from interface: kodo.jdbc.meta.Mapping
See Also:
Mapping.insert(kodo.runtime.KodoStateManager, kodo.jdbc.sql.RowManager)

customUpdate

public StateImageVersionIndicator.CustomUpdate customUpdate(KodoStateManager sm,
                                                            Table table,
                                                            boolean record)
                                                     throws 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 StateImageVersionIndicator.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

postLoad

public void postLoad(KodoStateManager sm,
                     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(KodoStateManager sm,
                            JDBCStoreManager store)
                     throws SQLException
Description copied from class: VersionIndicator
Synchronize the version of the given state manager with the version stored in memory.
Overrides:
synchVersion in class VersionIndicator
Following copied from class: kodo.jdbc.meta.VersionIndicator
See Also:
StoreManager.synchVersion(kodo.runtime.KodoStateManager, java.lang.Object)

SolarMetric Kodo JDO 3.3.5 generated on August 31 2005

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