Class PersistenceImpl
- java.lang.Object
-
- com.caplin.transformer.module.persistence.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 Summary
Constructors Constructor Description PersistenceImpl()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addChangeListener(java.lang.String prefix, PersistenceChangeListener listener)
Deprecated.static java.util.Map<java.lang.String,java.lang.String>
createMap(java.lang.String... keyValues)
void
delete(java.lang.String key)
Delete a key from the databasePersistedValue
get(java.lang.String key)
Retreive afrom Transformers persistence store
void
put(PersistedValue persistedValue)
Store a value, multiple puts with the same key will override previously stored valuesPersistedValue[]
query(java.lang.String query)
Query for all entries whose keys start with the query
-
-
-
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 interfacePersistence
- Parameters:
persistedValue
- value to be stored
-
get
public PersistedValue get(java.lang.String key)
Description copied from interface:Persistence
Retreive a
from Transformers persistence store
- Specified by:
get
in interfacePersistence
- Parameters:
key
- The key associated with the entry- Returns:
- The persisted value if it exists, null otherwise
-
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 interfacePersistence
- 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 interfacePersistence
- 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 interfacePersistence
- Parameters:
prefix
- Prefix of keys we're interested inlistener
- Object to be called when data changes
-
-