Class PersistenceImpl
java.lang.Object
com.caplin.transformer.module.persistence.PersistenceImpl
- All Implemented Interfaces:
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
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addChangeListener
(String prefix, PersistenceChangeListener listener) Deprecated.void
Delete a key from the databaseRetreive afrom Transformers persistence store
void
put
(PersistedValue persistedValue) Store a value, multiple puts with the same key will override previously stored valuesQuery for all entries whose keys start with the query
-
Constructor Details
-
PersistenceImpl
public PersistenceImpl()
-
-
Method Details
-
createMap
-
put
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
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
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
Description copied from interface:Persistence
Delete a key from the database
- Specified by:
delete
in interfacePersistence
- Parameters:
key
- Key to delete
-
addChangeListener
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
-