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:
Serializable
,DataCachePCData
,PCData
Specialized
PCData
implementation for data caching. This
implementation is properly synchronized.- Author:
- Patrick Linskey
- See Also:
-
Field Summary
Fields inherited from class org.apache.openjpa.kernel.AbstractPCData
NULL
-
Constructor Summary
ConstructorDescriptionDataCachePCDataImpl
(Object oid, ClassMetaData meta) DataCachePCDataImpl
(Object oid, ClassMetaData meta, String name) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
clearData
(int index) protected void
Check if this field is in use of "order by" by other field collections in inverse relation.getData
(int index) Return the data stored in the given field index.Returns the instance-level impl data, or null if none.getImplData
(int index) getIntermediate
(int index) long
Gets the original timeout of this instance.Returns the current version object that this data was loaded from.boolean
isLoaded
(int index) Whether the given field index has stored data.boolean
Whether this data is timed out.Return a newPCData
implementation of the right type for embedded instances.void
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 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
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 Details
-
DataCachePCDataImpl
-
DataCachePCDataImpl
Constructor.
-
-
Method Details
-
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
Description copied from interface:PCData
Return the data stored in the given field index.- Specified by:
getData
in interfacePCData
- Overrides:
getData
in classPCDataImpl
-
setData
- Overrides:
setData
in classPCDataImpl
-
clearData
public void clearData(int index) - Overrides:
clearData
in classPCDataImpl
-
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
Description copied from interface:PCData
Sets the stored instance-level impl data.- Specified by:
setImplData
in interfacePCData
- Overrides:
setImplData
in classPCDataImpl
-
getImplData
- Overrides:
getImplData
in classPCDataImpl
-
setImplData
- Overrides:
setImplData
in classPCDataImpl
-
getIntermediate
- Overrides:
getIntermediate
in classPCDataImpl
-
setIntermediate
- 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
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
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
Description copied from interface:PCData
Store all loaded fields of the state manager.- Specified by:
store
in interfacePCData
- Overrides:
store
in classPCDataImpl
-
store
Description copied from interface:PCData
Store the given fields from the state manager.- Specified by:
store
in interfacePCData
- Overrides:
store
in classPCDataImpl
-
storeField
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
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
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
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
Description copied from class:PCDataImpl
Return a newPCData
implementation of the right type for embedded instances. Returns aPCDataImpl
by default.- Overrides:
newEmbeddedPCData
in classPCDataImpl
-