org.apache.openjpa.jdbc.meta.strats
Class AbstractVersionStrategy

java.lang.Object
  extended by org.apache.openjpa.jdbc.meta.strats.AbstractStrategy
      extended by org.apache.openjpa.jdbc.meta.strats.AbstractVersionStrategy
All Implemented Interfaces:
Strategy, VersionStrategy
Direct Known Subclasses:
ColumnVersionStrategy, NoneVersionStrategy, StateComparisonVersionStrategy, SuperclassVersionStrategy

public abstract class AbstractVersionStrategy
extends AbstractStrategy
implements VersionStrategy

No-op strategy for easy extension.

Author:
Abe White

Field Summary
protected  Version vers
          The owning version.
 
Constructor Summary
AbstractVersionStrategy()
           
 
Method Summary
 void afterLoad(OpenJPAStateManager sm, JDBCStore store)
          This method is called after data is loaded into the instance, in case the version indicator works off of a state image.
 boolean checkVersion(OpenJPAStateManager sm, JDBCStore store, boolean updateVersion)
          Checks the version of the given state manager with the version stored in memory.
 int compareVersion(Object v1, Object v2)
           
 void load(OpenJPAStateManager sm, JDBCStore store, Result res)
          Load data.
 boolean select(Select sel, ClassMapping mapping)
          Select the data for this indicator.
 void setVersion(Version owner)
          Set the version that uses this strategy.
 
Methods inherited from class org.apache.openjpa.jdbc.meta.strats.AbstractStrategy
customDelete, customInsert, customUpdate, delete, getAlias, initialize, insert, isCustomDelete, isCustomInsert, isCustomUpdate, map, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.openjpa.jdbc.meta.Strategy
customDelete, customInsert, customUpdate, delete, getAlias, initialize, insert, isCustomDelete, isCustomInsert, isCustomUpdate, map, update
 

Field Detail

vers

protected Version vers
The owning version.

Constructor Detail

AbstractVersionStrategy

public AbstractVersionStrategy()
Method Detail

setVersion

public void setVersion(Version owner)
Description copied from interface: VersionStrategy
Set the version that uses this strategy. This will be called before use.

Specified by:
setVersion in interface VersionStrategy

select

public boolean select(Select sel,
                      ClassMapping mapping)
Description copied from interface: VersionStrategy
Select the data for this indicator.

Specified by:
select in interface VersionStrategy
mapping - the known base class being selected; this may not be the base class in the inheritance hierarchy
Returns:
true if anything was selected; false otherwise

load

public void load(OpenJPAStateManager sm,
                 JDBCStore store,
                 Result res)
          throws SQLException
Description copied from interface: VersionStrategy
Load data.

Specified by:
load in interface VersionStrategy
Throws:
SQLException

afterLoad

public void afterLoad(OpenJPAStateManager sm,
                      JDBCStore store)
Description copied from interface: VersionStrategy
This method is called after data is loaded into the instance, in case the version indicator works off of a state image.

Specified by:
afterLoad in interface VersionStrategy

checkVersion

public boolean checkVersion(OpenJPAStateManager sm,
                            JDBCStore store,
                            boolean updateVersion)
                     throws SQLException
Description copied from interface: VersionStrategy
Checks the version of the given state manager with the version stored in memory.

Specified by:
checkVersion in interface VersionStrategy
Returns:
true if the in-memory version was up-to-date, false otherwise
Throws:
SQLException

compareVersion

public int compareVersion(Object v1,
                          Object v2)
Specified by:
compareVersion in interface VersionStrategy
See Also:
StoreManager.compareVersion(org.apache.openjpa.kernel.OpenJPAStateManager, java.lang.Object, java.lang.Object)


Copyright © 2006 Apache Software Foundation. All Rights Reserved.