public class PropertiesPersistingMetadataStore extends java.lang.Object implements ConcurrentMetadataStore, org.springframework.beans.factory.InitializingBean, org.springframework.beans.factory.DisposableBean, java.io.Closeable, java.io.Flushable
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.| Constructor and Description |
|---|
PropertiesPersistingMetadataStore() |
| Modifier and Type | Method and Description |
|---|---|
void |
afterPropertiesSet() |
void |
close() |
void |
destroy() |
void |
flush() |
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.
|
void |
setBaseDirectory(java.lang.String baseDirectory)
Set the location for the properties file.
|
void |
setFileName(java.lang.String fileName)
Set the name of the properties file in
setBaseDirectory(String). |
public void setBaseDirectory(java.lang.String baseDirectory)
'java.io.tmpdir' + "/spring-integration/".baseDirectory - the directory.public void setFileName(java.lang.String fileName)
setBaseDirectory(String).
Defaults to metadata-store.properties,fileName - the properties file name.public void afterPropertiesSet()
throws java.lang.Exception
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBeanjava.lang.Exceptionpublic void put(java.lang.String key,
java.lang.String value)
MetadataStoreput in interface MetadataStorekey - The key.value - The value.public java.lang.String get(java.lang.String key)
MetadataStoreget in interface MetadataStorekey - The key.public java.lang.String remove(java.lang.String key)
MetadataStoreremove in interface MetadataStorekey - The key.public java.lang.String putIfAbsent(java.lang.String key,
java.lang.String value)
ConcurrentMetadataStoreputIfAbsent in interface ConcurrentMetadataStorekey - The key.value - The value.public boolean replace(java.lang.String key,
java.lang.String oldValue,
java.lang.String newValue)
ConcurrentMetadataStorereplace in interface ConcurrentMetadataStorekey - The key.oldValue - The old value.newValue - The new value.public void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseablejava.io.IOExceptionpublic void flush()
flush in interface java.io.Flushablepublic void destroy()
throws java.lang.Exception
destroy in interface org.springframework.beans.factory.DisposableBeanjava.lang.Exception