SolarMetric Kodo JDO 2.5.0 Reverse Schema Tool

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

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.ColumnVersionIndicator
Direct Known Subclasses:
VersionDateIndicator, VersionNumberIndicator

public abstract class ColumnVersionIndicator
extends VersionIndicator

Abstract base class for version indicators that use a column to hold version information.


Field Summary
 
Fields inherited from class com.solarmetric.rd.kodo.impl.jdbc.meta.Mapping
DEFAULT, FALSE, LOB, TRUE, UNIQUE
 
Constructor Summary
ColumnVersionIndicator()
           
 
Method Summary
 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.
 com.solarmetric.rd.kodo.impl.jdbc.schema.Column getColumn()
          Return the column used to hold version info.
protected abstract  int getDataStoreTypeCode()
          Return the FieldMapping type code for the type of the column.
protected  int getJDBCType()
          Return the JDBC type of the column for this indicator.
protected abstract  java.lang.Object getNextVersion(java.lang.Object currentVersion)
          Return the next version object, given the current one (which may be null for newly-persisted objects).
 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.
 void load(com.solarmetric.rd.kodo.runtime.StateManagerImpl sm, com.solarmetric.rd.kodo.impl.jdbc.runtime.JDBCStoreManager store, com.solarmetric.rd.kodo.impl.jdbc.runtime.Result res)
          Load virtual row data.
 boolean map()
          Map a new instance of this mapping type.
protected abstract  boolean needsRefresh(java.lang.Object mem, java.lang.Object db)
          Return true if mem is not up-to-date with db.
 void refSchemaComponents()
          Increment the reference count of all used schema components.
 void select(com.solarmetric.rd.kodo.impl.jdbc.runtime.Select sel)
          Select the virtual row columns of this mapping.
 void setColumn(com.solarmetric.rd.kodo.impl.jdbc.schema.Column col)
          Set the column used to hold version info.
 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, newInstance, newInstance, postLoad, toString
 
Methods inherited from class com.solarmetric.rd.kodo.impl.jdbc.meta.Indicator
delete, getMappingRepository, getOwnerMapping, getTable, setOwnerMapping
 
Methods inherited from class com.solarmetric.rd.kodo.impl.jdbc.meta.Mapping
checkIndex, createColumn, delete, getDBDictionary, getForeignKey, getLog, getMappingType, getSchemaGroup, insert, invalidMapping, isCustomDelete, isCustomInsert, isCustomUpdate, reverseMap, setForeignKey, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ColumnVersionIndicator

public ColumnVersionIndicator()
Method Detail

getDataStoreTypeCode

protected abstract int getDataStoreTypeCode()
Return the FieldMapping type code for the type of the column.


getJDBCType

protected int getJDBCType()
Return the JDBC type of the column for this indicator. Defaults to the preferred type for getDataStoreTypeCode().


getNextVersion

protected abstract java.lang.Object getNextVersion(java.lang.Object currentVersion)
Return the next version object, given the current one (which may be null for newly-persisted objects).


needsRefresh

protected abstract boolean needsRefresh(java.lang.Object mem,
                                        java.lang.Object db)
Return true if mem is not up-to-date with db.


getColumn

public com.solarmetric.rd.kodo.impl.jdbc.schema.Column getColumn()
Return the column used to hold version info.


setColumn

public void setColumn(com.solarmetric.rd.kodo.impl.jdbc.schema.Column col)
Set the column used to hold version info.


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

refSchemaComponents

public void refSchemaComponents()
Description copied from class: Mapping
Increment the reference count of all used schema components.

Overrides:
refSchemaComponents in class Indicator

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)

select

public void select(com.solarmetric.rd.kodo.impl.jdbc.runtime.Select sel)
Description copied from class: Indicator
Select the virtual row columns of this mapping.

Overrides:
select in class Indicator

load

public void load(com.solarmetric.rd.kodo.runtime.StateManagerImpl sm,
                 com.solarmetric.rd.kodo.impl.jdbc.runtime.JDBCStoreManager store,
                 com.solarmetric.rd.kodo.impl.jdbc.runtime.Result res)
          throws java.sql.SQLException
Description copied from class: VersionIndicator
Load virtual row data.

Overrides:
load in class VersionIndicator
java.sql.SQLException

insert

public void insert(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. For class mappings, this method will be called only after the corresponding method has been called for all fields of this mapping.

Overrides:
insert in class Indicator
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)

SolarMetric Kodo JDO 2.5.0 Reverse Schema Tool

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