Class PersistenceImpl

  • All Implemented Interfaces:
    Persistence

    public class PersistenceImpl
    extends java.lang.Object
    implements Persistence

    Class that provides access to the Transformer persistence service.

    If a module uses the persistence service any data persisted is saved over restarts of Transformer and is also available on multiple Transformers is they are clustered together. In order for this persistence API to work properly, the following table needs to exist in the database the persistence service is configured to connect to:

    CREATE TABLE if not exists TF_LEGACY_PERSISTENCE (
      JTM_KEY TEXT PRIMARY KEY NOT NULL
      JTM_VALUE TEXT
     );
    • Constructor Detail

      • PersistenceImpl

        public PersistenceImpl()
    • Method Detail

      • createMap

        public static java.util.Map<java.lang.String,​java.lang.String> createMap​(java.lang.String... keyValues)
      • put

        public void put​(PersistedValue persistedValue)
        Description copied from interface: Persistence

        Store a value, multiple puts with the same key will override previously stored values

        Specified by:
        put in interface Persistence
        Parameters:
        persistedValue - value to be stored
      • query

        public PersistedValue[] query​(java.lang.String query)
        Description copied from interface: Persistence

        Query for all entries whose keys start with the query

        Specified by:
        query in interface Persistence
        Parameters:
        query - prefix to query for
        Returns:
        Array of PersistedValue objects. Never null
      • delete

        public void delete​(java.lang.String key)
        Description copied from interface: Persistence

        Delete a key from the database

        Specified by:
        delete in interface Persistence
        Parameters:
        key - Key to delete
      • addChangeListener

        @Deprecated
        public void addChangeListener​(java.lang.String prefix,
                                      PersistenceChangeListener listener)
        Deprecated.
        Description copied from interface: Persistence

        Does nothing

        Specified by:
        addChangeListener in interface Persistence
        Parameters:
        prefix - Prefix of keys we're interested in
        listener - Object to be called when data changes