Package org.apache.openjpa.datacache
Class DataCachePCDataImpl
- java.lang.Object
-
- org.apache.openjpa.kernel.AbstractPCData
-
- org.apache.openjpa.kernel.PCDataImpl
-
- org.apache.openjpa.datacache.DataCachePCDataImpl
-
- All Implemented Interfaces:
java.io.Serializable
,DataCachePCData
,PCData
public class DataCachePCDataImpl extends PCDataImpl implements DataCachePCData
SpecializedPCData
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
Constructors Constructor Description DataCachePCDataImpl(java.lang.Object oid, ClassMetaData meta)
DataCachePCDataImpl(java.lang.Object oid, ClassMetaData meta, java.lang.String name)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.java.lang.Object
getData(int index)
Return the data stored in the given field index.java.lang.Object
getImplData()
Returns the instance-level impl data, or null if none.java.lang.Object
getImplData(int index)
java.lang.Object
getIntermediate(int index)
long
getTimeOut()
Gets the original timeout of this instance.java.lang.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 newPCData
implementation of the right type for embedded instances.void
setData(int index, java.lang.Object val)
void
setImplData(int index, java.lang.Object val)
void
setImplData(java.lang.Object val)
Sets the stored instance-level impl data.void
setIntermediate(int index, java.lang.Object val)
void
setLoaded(int index, boolean loaded)
void
setVersion(java.lang.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, java.util.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 java.lang.Object
toData(FieldMetaData fmd, java.lang.Object val, StoreContext ctx)
Transform the given field value to a data value for caching.protected java.lang.Object
toNestedData(ValueMetaData vmd, java.lang.Object val, StoreContext ctx)
Transform the given nested value to a cachable value.-
Methods inherited from class org.apache.openjpa.kernel.PCDataImpl
getCache, 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
-
-
-
-
Constructor Detail
-
DataCachePCDataImpl
public DataCachePCDataImpl(java.lang.Object oid, ClassMetaData meta)
-
DataCachePCDataImpl
public DataCachePCDataImpl(java.lang.Object oid, ClassMetaData meta, java.lang.String name)
Constructor.
-
-
Method Detail
-
isTimedOut
public boolean isTimedOut()
Description copied from interface:DataCachePCData
Whether this data is timed out.- Specified by:
isTimedOut
in interfaceDataCachePCData
-
getTimeOut
public long getTimeOut()
Description copied from interface:DataCachePCData
Gets the original timeout of this instance.- Specified by:
getTimeOut
in interfaceDataCachePCData
- Returns:
- -1 for no timeout ever.
-
getData
public java.lang.Object getData(int index)
Description copied from interface:PCData
Return the data stored in the given field index.- Specified by:
getData
in interfacePCData
- Overrides:
getData
in classPCDataImpl
-
setData
public void setData(int index, java.lang.Object val)
- Overrides:
setData
in classPCDataImpl
-
clearData
public void clearData(int index)
- Overrides:
clearData
in classPCDataImpl
-
getImplData
public java.lang.Object getImplData()
Description copied from interface:PCData
Returns the instance-level impl data, or null if none.- Specified by:
getImplData
in interfacePCData
- Overrides:
getImplData
in classPCDataImpl
-
setImplData
public void setImplData(java.lang.Object val)
Description copied from interface:PCData
Sets the stored instance-level impl data.- Specified by:
setImplData
in interfacePCData
- Overrides:
setImplData
in classPCDataImpl
-
getImplData
public java.lang.Object getImplData(int index)
- Overrides:
getImplData
in classPCDataImpl
-
setImplData
public void setImplData(int index, java.lang.Object val)
- Overrides:
setImplData
in classPCDataImpl
-
getIntermediate
public java.lang.Object getIntermediate(int index)
- Overrides:
getIntermediate
in classPCDataImpl
-
setIntermediate
public void setIntermediate(int index, java.lang.Object val)
- Overrides:
setIntermediate
in classPCDataImpl
-
isLoaded
public boolean isLoaded(int index)
Description copied from interface:PCData
Whether the given field index has stored data.- Specified by:
isLoaded
in interfacePCData
- Overrides:
isLoaded
in classPCDataImpl
-
setLoaded
public void setLoaded(int index, boolean loaded)
- Overrides:
setLoaded
in classPCDataImpl
-
getVersion
public java.lang.Object getVersion()
Description copied from interface:PCData
Returns the current version object that this data was loaded from.- Specified by:
getVersion
in interfacePCData
- Overrides:
getVersion
in classPCDataImpl
-
setVersion
public void setVersion(java.lang.Object version)
Description copied from interface:PCData
Sets the current version object that this data was loaded from.- Specified by:
setVersion
in interfacePCData
- Overrides:
setVersion
in classPCDataImpl
-
store
public void store(OpenJPAStateManager sm)
Description copied from interface:PCData
Store all loaded fields of the state manager.- Specified by:
store
in interfacePCData
- Overrides:
store
in classPCDataImpl
-
store
public void store(OpenJPAStateManager sm, java.util.BitSet fields)
Description copied from interface:PCData
Store the given fields from the state manager.- Specified by:
store
in interfacePCData
- Overrides:
store
in classPCDataImpl
-
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 classPCDataImpl
-
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 java.lang.Object toData(FieldMetaData fmd, java.lang.Object val, StoreContext ctx)
Description copied from class:AbstractPCData
Transform the given field value to a data value for caching. ReturnAbstractPCData.NULL
if unable to cache.- Overrides:
toData
in classAbstractPCData
-
toNestedData
protected java.lang.Object toNestedData(ValueMetaData vmd, java.lang.Object val, StoreContext ctx)
Description copied from class:AbstractPCData
Transform the given nested value to a cachable value. ReturnAbstractPCData.NULL
if the value cannot be cached.- Overrides:
toNestedData
in classAbstractPCData
-
newEmbeddedPCData
public AbstractPCData newEmbeddedPCData(OpenJPAStateManager sm)
Description copied from class:PCDataImpl
Return a newPCData
implementation of the right type for embedded instances. Returns aPCDataImpl
by default.- Overrides:
newEmbeddedPCData
in classPCDataImpl
-
-