org.apache.openjpa.datacache
Class DataCachePCDataImpl

java.lang.Object
  extended by org.apache.openjpa.kernel.AbstractPCData
      extended by org.apache.openjpa.kernel.PCDataImpl
          extended by org.apache.openjpa.datacache.DataCachePCDataImpl
All Implemented Interfaces:
Serializable, DataCachePCData, PCData

public class DataCachePCDataImpl
extends PCDataImpl
implements DataCachePCData

Specialized PCData implementation for data caching. This implementation is properly synchronized.

Author:
Patrick Linskey
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.apache.openjpa.kernel.AbstractPCData
NULL
 
Constructor Summary
DataCachePCDataImpl(Object oid, ClassMetaData meta)
          Constructor.
 
Method Summary
 void clearData(int index)
           
protected  void clearInverseRelationCache(OpenJPAStateManager sm, FieldMetaData fmd)
          Check if this field is in use of "order by" by other field collections in inverse relation.
 Object getData(int index)
          Return the data stored in the given field index.
 Object getImplData()
          Returns the instance-level impl data, or null if none.
 Object getImplData(int index)
           
 Object getIntermediate(int index)
           
 Object getVersion()
          Returns the current version object that this data was loaded from.
 boolean isLoaded(int index)
          Whether the given field index has stored data.
 boolean isTimedOut()
          Whether this data is timed out.
 AbstractPCData newEmbeddedPCData(OpenJPAStateManager sm)
          Return a new PCData implementation of the right type for embedded instances.
 void setData(int index, Object val)
           
 void setImplData(int index, Object val)
           
 void setImplData(Object val)
          Sets the stored instance-level impl data.
 void setIntermediate(int index, Object val)
           
 void setLoaded(int index, boolean loaded)
           
 void setVersion(Object version)
          Sets the current version object that this data was loaded from.
 void store(OpenJPAStateManager sm)
          Store all loaded fields of the state manager.
 void store(OpenJPAStateManager sm, BitSet fields)
          Store the given fields from the state manager.
protected  void storeField(OpenJPAStateManager sm, FieldMetaData fmd)
          Store field-level information from the given state manager.
protected  Object toData(FieldMetaData fmd, Object val, StoreContext ctx)
          Transform the given field value to a data value for caching.
protected  Object toNestedData(ValueMetaData vmd, Object val, StoreContext ctx)
          Transform the given nested value to a cachable value.
 
Methods inherited from class org.apache.openjpa.kernel.PCDataImpl
getId, getLoaded, getType, load, load, loadField, loadImplData, loadImplData, loadIntermediate, loadVersion, storeImplData, storeImplData, storeIntermediate, storeVersion
 
Methods inherited from class org.apache.openjpa.kernel.AbstractPCData
toEmbeddedData, toEmbeddedField, toField, toNestedField, toNestedFields, toRelationData, toRelationField, toRelationFields
 
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.kernel.PCData
getId, getType, load, load
 

Constructor Detail

DataCachePCDataImpl

public DataCachePCDataImpl(Object oid,
                           ClassMetaData meta)
Constructor.

Method Detail

isTimedOut

public boolean isTimedOut()
Description copied from interface: DataCachePCData
Whether this data is timed out.

Specified by:
isTimedOut in interface DataCachePCData

getData

public Object getData(int index)
Description copied from interface: PCData
Return the data stored in the given field index.

Specified by:
getData in interface PCData
Overrides:
getData in class PCDataImpl

setData

public void setData(int index,
                    Object val)
Overrides:
setData in class PCDataImpl

clearData

public void clearData(int index)
Overrides:
clearData in class PCDataImpl

getImplData

public Object getImplData()
Description copied from interface: PCData
Returns the instance-level impl data, or null if none.

Specified by:
getImplData in interface PCData
Overrides:
getImplData in class PCDataImpl

setImplData

public void setImplData(Object val)
Description copied from interface: PCData
Sets the stored instance-level impl data.

Specified by:
setImplData in interface PCData
Overrides:
setImplData in class PCDataImpl

getImplData

public Object getImplData(int index)
Overrides:
getImplData in class PCDataImpl

setImplData

public void setImplData(int index,
                        Object val)
Overrides:
setImplData in class PCDataImpl

getIntermediate

public Object getIntermediate(int index)
Overrides:
getIntermediate in class PCDataImpl

setIntermediate

public void setIntermediate(int index,
                            Object val)
Overrides:
setIntermediate in class PCDataImpl

isLoaded

public boolean isLoaded(int index)
Description copied from interface: PCData
Whether the given field index has stored data.

Specified by:
isLoaded in interface PCData
Overrides:
isLoaded in class PCDataImpl

setLoaded

public void setLoaded(int index,
                      boolean loaded)
Overrides:
setLoaded in class PCDataImpl

getVersion

public Object getVersion()
Description copied from interface: PCData
Returns the current version object that this data was loaded from.

Specified by:
getVersion in interface PCData
Overrides:
getVersion in class PCDataImpl

setVersion

public void setVersion(Object version)
Description copied from interface: PCData
Sets the current version object that this data was loaded from.

Specified by:
setVersion in interface PCData
Overrides:
setVersion in class PCDataImpl

store

public void store(OpenJPAStateManager sm)
Description copied from interface: PCData
Store all loaded fields of the state manager.

Specified by:
store in interface PCData
Overrides:
store in class PCDataImpl

store

public void store(OpenJPAStateManager sm,
                  BitSet fields)
Description copied from interface: PCData
Store the given fields from the state manager.

Specified by:
store in interface PCData
Overrides:
store in class PCDataImpl

storeField

protected void storeField(OpenJPAStateManager sm,
                          FieldMetaData fmd)
Store field-level information from the given state manager. Special process of checking if the cached collection data is out of order.

Overrides:
storeField in class PCDataImpl

clearInverseRelationCache

protected void clearInverseRelationCache(OpenJPAStateManager sm,
                                         FieldMetaData fmd)
Check if this field is in use of "order by" by other field collections in inverse relation. If it is, clear the other field cache because it could be out of order.


toData

protected Object toData(FieldMetaData fmd,
                        Object val,
                        StoreContext ctx)
Description copied from class: AbstractPCData
Transform the given field value to a data value for caching. Return AbstractPCData.NULL if unable to cache.

Overrides:
toData in class AbstractPCData

toNestedData

protected Object toNestedData(ValueMetaData vmd,
                              Object val,
                              StoreContext ctx)
Description copied from class: AbstractPCData
Transform the given nested value to a cachable value. Return AbstractPCData.NULL if the value cannot be cached.

Overrides:
toNestedData in class AbstractPCData

newEmbeddedPCData

public AbstractPCData newEmbeddedPCData(OpenJPAStateManager sm)
Description copied from class: PCDataImpl
Return a new PCData implementation of the right type for embedded instances. Returns a PCDataImpl by default.

Overrides:
newEmbeddedPCData in class PCDataImpl


Copyright © 2006-2010 Apache Software Foundation. All Rights Reserved.