Class SimpleMetadataStore

java.lang.Object
org.springframework.integration.metadata.SimpleMetadataStore
All Implemented Interfaces:
ConcurrentMetadataStore, MetadataStore

public class SimpleMetadataStore
extends java.lang.Object
implements ConcurrentMetadataStore
Simple implementation of MetadataStore that uses a ConcurrentMap for the data store. The metadata may not be persisted across application restarts, if the provided ConcurrentMap is an in-memory instance.
Since:
2.0
  • Constructor Summary

    Constructors 
    Constructor Description
    SimpleMetadataStore()
    Instantiate a SimpleMetadataStore using an in-memory ConcurrentHashMap.
    SimpleMetadataStore​(java.util.concurrent.ConcurrentMap<java.lang.String,​java.lang.String> metadata)
    Instantiate a SimpleMetadataStore using the provided ConcurrentMap.
  • Method Summary

    Modifier and Type Method Description
    java.lang.String get​(java.lang.String key)
    Reads a value for the given key from this MetadataStore.
    void put​(java.lang.String key, java.lang.String value)
    Writes a key value pair to this MetadataStore.
    java.lang.String putIfAbsent​(java.lang.String key, java.lang.String value)
    Atomically insert the key into the store.
    java.lang.String remove​(java.lang.String key)
    Remove a value for the given key from this MetadataStore.
    boolean replace​(java.lang.String key, java.lang.String oldValue, java.lang.String newValue)
    Atomically replace the value for the key in the store if the old value matches the oldValue argument.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • SimpleMetadataStore

      public SimpleMetadataStore()
      Instantiate a SimpleMetadataStore using an in-memory ConcurrentHashMap.
    • SimpleMetadataStore

      public SimpleMetadataStore​(java.util.concurrent.ConcurrentMap<java.lang.String,​java.lang.String> metadata)
      Instantiate a SimpleMetadataStore using the provided ConcurrentMap. The implementation may be a distributed map provided by projects such as Redis and Hazelcast.
      Parameters:
      metadata - the ConcurrentMap instance for metadata.
      Since:
      4.1.4
  • Method Details

    • put

      public void put​(java.lang.String key, java.lang.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 java.lang.String get​(java.lang.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 java.lang.String remove​(java.lang.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 java.lang.String putIfAbsent​(java.lang.String key, java.lang.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​(java.lang.String key, java.lang.String oldValue, java.lang.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.