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
-
Constructor Summary
Constructors Constructor Description PropertiesPersistingMetadataStore()
-
Method Summary
Modifier and Type Method Description void
afterPropertiesSet()
void
close()
void
destroy()
void
flush()
String
get(String key)
Reads a value for the given key from this MetadataStore.void
put(String key, String value)
Writes a key value pair to this MetadataStore.String
putIfAbsent(String key, String value)
Atomically insert the key into the store.String
remove(String key)
Remove a value for the given key from this MetadataStore.boolean
replace(String key, String oldValue, String newValue)
Atomically replace the value for the key in the store if the old value matches the oldValue argument.void
setBaseDirectory(String baseDirectory)
Set the location for the properties file.void
setFileName(String fileName)
Set the name of the properties file insetBaseDirectory(String)
.
-
Constructor Details
-
PropertiesPersistingMetadataStore
public PropertiesPersistingMetadataStore()
-
-
Method Details
-
setBaseDirectory
Set the location for the properties file. Defaults to'java.io.tmpdir' + "/spring-integration/"
.- Parameters:
baseDirectory
- the directory.
-
setFileName
Set the name of the properties file insetBaseDirectory(String)
. Defaults tometadata-store.properties
,- Parameters:
fileName
- the properties file name.
-
afterPropertiesSet
public void afterPropertiesSet()- Specified by:
afterPropertiesSet
in interfaceInitializingBean
-
put
Description copied from interface:MetadataStore
Writes a key value pair to this MetadataStore.- Specified by:
put
in interfaceMetadataStore
- Parameters:
key
- The key.value
- The value.
-
get
Description copied from interface:MetadataStore
Reads a value for the given key from this MetadataStore.- Specified by:
get
in interfaceMetadataStore
- Parameters:
key
- The key.- Returns:
- The value.
-
remove
Description copied from interface:MetadataStore
Remove a value for the given key from this MetadataStore.- Specified by:
remove
in interfaceMetadataStore
- Parameters:
key
- The key.- Returns:
- The previous value associated with key, or null if there was no mapping for key.
-
putIfAbsent
Description copied from interface:ConcurrentMetadataStore
Atomically insert the key into the store.- Specified by:
putIfAbsent
in interfaceConcurrentMetadataStore
- Parameters:
key
- The key.value
- The value.- Returns:
- null if successful, the old value otherwise.
-
replace
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 interfaceConcurrentMetadataStore
- Parameters:
key
- The key.oldValue
- The old value.newValue
- The new value.- Returns:
- true if successful.
-
close
public void close()- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-
flush
public void flush() -
destroy
public void destroy()- Specified by:
destroy
in interfaceDisposableBean
-