Class AbstractTransientStore

java.lang.Object
org.nuxeo.ecm.core.transientstore.AbstractTransientStore
All Implemented Interfaces:
TransientStore, TransientStoreProvider
Direct Known Subclasses:
SimpleTransientStore

public abstract class AbstractTransientStore extends Object implements TransientStoreProvider
Base class for a TransientStore implementation.
Since:
7.2
  • Field Details

  • Constructor Details

    • AbstractTransientStore

      public AbstractTransientStore()
  • Method Details

    • init

      public void init(TransientStoreConfig config)
      Description copied from interface: TransientStoreProvider
      Initializes the store from the given config.
      Specified by:
      init in interface TransientStoreProvider
    • shutdown

      public abstract void shutdown()
      Description copied from interface: TransientStoreProvider
      Shuts down the store.
      Specified by:
      shutdown in interface TransientStoreProvider
    • exists

      public abstract boolean exists(String key)
      Description copied from interface: TransientStore
      Returns true if an entry exists with the given key.
      Specified by:
      exists in interface TransientStore
    • putParameter

      public abstract void putParameter(String key, String parameter, Serializable value)
      Description copied from interface: TransientStore
      Sets parameter to value in the entry with the given key.

      If entry does not exist a new entry is created. If parameter already exists in the entry it is overwritten.

      Specified by:
      putParameter in interface TransientStore
    • getParameter

      public abstract Serializable getParameter(String key, String parameter)
      Description copied from interface: TransientStore
      Gets the value of parameter in the entry with the given key.

      Returns null if entry or parameter does not exist.

      Specified by:
      getParameter in interface TransientStore
    • putParameters

      public abstract void putParameters(String key, Map<String,Serializable> parameters)
      Description copied from interface: TransientStore
      Puts parameters in the entry with the given key. Overwrites any existing parameter in the entry.

      If entry does not exist a new entry is created.

      Specified by:
      putParameters in interface TransientStore
    • getParameters

      public abstract Map<String,Serializable> getParameters(String key)
      Description copied from interface: TransientStore
      Gets values of the parameters in the entry with the given key.

      Returns null if entry does not exist.

      Specified by:
      getParameters in interface TransientStore
    • getBlobs

      public abstract List<Blob> getBlobs(String key)
      Description copied from interface: TransientStore
      Gets the blobs associated with the entry with the given key.

      Returns null if entry does not exist.

      Specified by:
      getBlobs in interface TransientStore
    • getSize

      public abstract long getSize(String key)
      Description copied from interface: TransientStore
      Returns the size of the blobs associated with the entry with the given key or -1 if entry does not exist.
      Specified by:
      getSize in interface TransientStore
    • isCompleted

      public abstract boolean isCompleted(String key)
      Description copied from interface: TransientStore
      Returns true if the entry with the given key is ready.
      Specified by:
      isCompleted in interface TransientStore
    • setCompleted

      public abstract void setCompleted(String key, boolean completed)
      Description copied from interface: TransientStore
      Marks the entry with the given key as ready.

      If entry does not exist a new entry is created.

      Specified by:
      setCompleted in interface TransientStore
    • release

      public abstract void release(String key)
      Description copied from interface: TransientStore
      Informs the store that the entry with the given key can be released if TTL or GC parameters require to do some cleanup.

      Has no effect if entry does not exist.

      Specified by:
      release in interface TransientStore
    • persistBlobs

      protected abstract void persistBlobs(String key, long sizeOfBlobs, List<Map<String,String>> blobInfos)
      Updates the total storage size and the storage size of the entry with the given key according to sizeOfBlobs and stores the blob information in this entry.
    • setStorageSize

      protected abstract void setStorageSize(long newSize)
      Sets the size of the disk storage in bytes.
    • incrementStorageSize

      protected abstract long incrementStorageSize(long size)
    • decrementStorageSize

      protected abstract long decrementStorageSize(long size)
    • removeAllEntries

      protected abstract void removeAllEntries()
    • removeEntry

      protected abstract void removeEntry(String key)
    • putBlobs

      public void putBlobs(String key, List<Blob> blobs)
      Description copied from interface: TransientStore
      Associates the given blobs with the entry with the given key.

      If entry does not exist a new entry is created.

      Specified by:
      putBlobs in interface TransientStore
    • storeBlobs

      protected List<Map<String,String>> storeBlobs(String key, List<Blob> blobs)
    • getCachingDirectory

      public File getCachingDirectory(String key)
    • getCachingDirName

      protected String getCachingDirName(String key)
    • getSizeOfBlobs

      protected long getSizeOfBlobs(List<Blob> blobs)
    • loadBlobs

      protected List<Blob> loadBlobs(List<Map<String,String>> blobInfos)
    • doGC

      public void doGC()
      Description copied from interface: TransientStoreProvider
      Runs garbage collecting to delete the file system resources that are associated with entries that were removed.
      Specified by:
      doGC in interface TransientStoreProvider
    • getKeyCachingDirName

      protected String getKeyCachingDirName(String dir)
    • getFilePathSize

      protected long getFilePathSize(Path entry)
    • remove

      public void remove(String key)
      Description copied from interface: TransientStore
      Removes entry with the given key.

      Has no effect if entry does not exist.

      Specified by:
      remove in interface TransientStore
    • removeBlobs

      protected void removeBlobs(String key)
    • removeAll

      public void removeAll()
      Description copied from interface: TransientStoreProvider
      Removes all entries from the store.
      Specified by:
      removeAll in interface TransientStoreProvider
    • getCacheDir

      public File getCacheDir()