PersistentItem (Resource Management Library 2.0.0-2.17.1 API)
Date: 2014-01-09

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.gcube.resourcemanagement.support.server.utils.persistence
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
`protected static String` | `LOG_PREFIX`

Constructor Summary
`PersistentItem()` Deprecated. for internal use only.
`PersistentItem(String persistenceFileName)`
`PersistentItem(String persistenceFileName, long refreshDelay)`
`PersistentItem(T data, String persistenceFileName, long refreshDelay)`

Method Summary
`void` | `destroy()` Requires the destroy of the persistent resource.
`T` | `getData()` Returns the corresponding persistent data.
`void` | `setData(T data)` Sets the new data to persist.
`protected void` | `setPersistenceFileName(String persistenceFileName)`
`protected void` | `setRefreshDelay(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

Constructor Detail

### PersistentItem

    public PersistentItem()

  Deprecated. for internal use only.

### PersistentItem

    public PersistentItem(String persistenceFileName)

### PersistentItem

    public PersistentItem(String persistenceFileName,
                          long refreshDelay)

### PersistentItem

    public PersistentItem(T data,
                          String persistenceFileName,
                          long refreshDelay)

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: `PersistenceHandler`
  Requires the destroy of the persistent resource. The persistent file will be deleted and the onDestroy event will be raised.

  Specified by:
    `destroy` in interface `PersistenceHandler<T extends Serializable>`

### getData

    public final T getData()

  Returns the corresponding persistent data.

  Specified by:
    `getData` in interface `PersistenceHandler<T extends Serializable>`
  Returns:

### setData

    public final void setData(T data)

  Description copied from interface: `PersistenceHandler`
  Sets the new data to persist.

  Specified by:
    `setData` in interface `PersistenceHandler<T extends Serializable>`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2014. All Rights Reserved.