Class PropertiesPersistingMetadataStore

java.lang.Object
org.springframework.integration.metadata.PropertiesPersistingMetadataStore
All Implemented Interfaces:
Closeable, Flushable, AutoCloseable, DisposableBean, InitializingBean, ConcurrentMetadataStore, MetadataStore

public class PropertiesPersistingMetadataStore extends Object implements ConcurrentMetadataStore, InitializingBean, DisposableBean, Closeable, Flushable
Properties file-based implementation of MetadataStore. To avoid conflicts each instance should be constructed with the unique key from which unique file name will be generated. By default, the properties file will be 'java.io.tmpdir' + "/spring-integration/metadata-store.properties", but the directory and filename are settable.
Since:
2.0
Author:
Oleg Zhurakousky, Mark Fisher, Gary Russell, Artem Bilan
  • Constructor Details

    • PropertiesPersistingMetadataStore

      public PropertiesPersistingMetadataStore()
  • Method Details

    • setBaseDirectory

      public void setBaseDirectory(String baseDirectory)
      Set the location for the properties file. Defaults to 'java.io.tmpdir' + "/spring-integration/".
      Parameters:
      baseDirectory - the directory.
    • setFileName

      public void setFileName(String fileName)
      Set the name of the properties file in setBaseDirectory(String). Defaults to metadata-store.properties,
      Parameters:
      fileName - the properties file name.
    • afterPropertiesSet

      public void afterPropertiesSet()
      Specified by:
      afterPropertiesSet in interface InitializingBean
    • put

      public void put(String key, String value)
      Description copied from interface: MetadataStore
      Writes a key value pair to this MetadataStore.
      Specified by:
      put in interface MetadataStore
      Parameters:
      key - The key.
      value - The value.
    • get

      public String get(String key)
      Description copied from interface: MetadataStore
      Reads a value for the given key from this MetadataStore.
      Specified by:
      get in interface MetadataStore
      Parameters:
      key - The key.
      Returns:
      The value.
    • remove

      public String remove(String key)
      Description copied from interface: MetadataStore
      Remove a value for the given key from this MetadataStore.
      Specified by:
      remove in interface MetadataStore
      Parameters:
      key - The key.
      Returns:
      The previous value associated with key, or null if there was no mapping for key.
    • putIfAbsent

      public String putIfAbsent(String key, String value)
      Description copied from interface: ConcurrentMetadataStore
      Atomically insert the key into the store.
      Specified by:
      putIfAbsent in interface ConcurrentMetadataStore
      Parameters:
      key - The key.
      value - The value.
      Returns:
      null if successful, the old value otherwise.
    • replace

      public boolean replace(String key, String oldValue, String newValue)
      Description copied from interface: ConcurrentMetadataStore
      Atomically replace the value for the key in the store if the old value matches the oldValue argument.
      Specified by:
      replace in interface ConcurrentMetadataStore
      Parameters:
      key - The key.
      oldValue - The old value.
      newValue - The new value.
      Returns:
      true if successful.
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
    • flush

      public void flush()
      Specified by:
      flush in interface Flushable
    • destroy

      public void destroy()
      Specified by:
      destroy in interface DisposableBean