Class PersistentItem<T extends Serializable>
- java.lang.Object
-
- org.gcube.resourcemanagement.support.server.utils.persistence.PersistentItem<T>
-
- All Implemented Interfaces:
PersistenceHandler<T>
public abstract class PersistentItem<T extends Serializable> extends Object implements PersistenceHandler<T>
Wrapping for data that can be persisted on the filesystem.new PersistentItem<DataTypeToPersist>(fileToStore, refreshDelay) { public void onLoad() { //... } // The other methods to overload // ... }- Author:
- Daniele Strollo (ISTI-CNR)
-
-
Field Summary
Fields Modifier and Type Field Description protected static StringLOG_PREFIX
-
Constructor Summary
Constructors Constructor Description PersistentItem()Deprecated.for internal use only.PersistentItem(String persistenceFileName)PersistentItem(String persistenceFileName, long refreshDelay)PersistentItem(T data, String persistenceFileName, long refreshDelay)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddestroy()Requires the destroy of the persistent resource.TgetData()Returns the corresponding persistent data.voidsetData(T data)Sets the new data to persist.protected voidsetPersistenceFileName(String persistenceFileName)protected voidsetRefreshDelay(long refreshDelay)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.gcube.resourcemanagement.support.server.utils.persistence.PersistenceHandler
onDestroy, onLoad, onRefresh
-
-
-
-
Field Detail
-
LOG_PREFIX
protected static final String LOG_PREFIX
- See Also:
- Constant Field Values
-
-
Method Detail
-
setPersistenceFileName
protected final void setPersistenceFileName(String persistenceFileName)
-
setRefreshDelay
protected final void setRefreshDelay(long refreshDelay)
-
destroy
public final void destroy()
Description copied from interface:PersistenceHandlerRequires the destroy of the persistent resource. The persistent file will be deleted and the onDestroy event will be raised.- Specified by:
destroyin interfacePersistenceHandler<T extends Serializable>
-
getData
public final T getData()
Returns the corresponding persistent data.- Specified by:
getDatain interfacePersistenceHandler<T extends Serializable>- Returns:
-
setData
public final void setData(T data)
Description copied from interface:PersistenceHandlerSets the new data to persist.- Specified by:
setDatain interfacePersistenceHandler<T extends Serializable>
-
-