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, Artem Bilan
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidclose()voiddestroy()voidflush()Reads a value for the given key from this MetadataStore.voidWrites a key value pair to this MetadataStore.putIfAbsent(String key, String value) Atomically insert the key into the store.Remove a value for the given key from this MetadataStore.booleanAtomically replace the value for the key in the store if the old value matches the oldValue argument.voidsetBaseDirectory(String baseDirectory) Set the location for the properties file.voidsetFileName(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:
afterPropertiesSetin interfaceInitializingBean
-
put
Description copied from interface:MetadataStoreWrites a key value pair to this MetadataStore.- Specified by:
putin interfaceMetadataStore- Parameters:
key- The key.value- The value.
-
get
Description copied from interface:MetadataStoreReads a value for the given key from this MetadataStore.- Specified by:
getin interfaceMetadataStore- Parameters:
key- The key.- Returns:
- The value.
-
remove
Description copied from interface:MetadataStoreRemove a value for the given key from this MetadataStore.- Specified by:
removein 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:ConcurrentMetadataStoreAtomically insert the key into the store.- Specified by:
putIfAbsentin interfaceConcurrentMetadataStore- Parameters:
key- The key.value- The value.- Returns:
- null if successful, the old value otherwise.
-
replace
Description copied from interface:ConcurrentMetadataStoreAtomically replace the value for the key in the store if the old value matches the oldValue argument.- Specified by:
replacein interfaceConcurrentMetadataStore- Parameters:
key- The key.oldValue- The old value.newValue- The new value.- Returns:
- true if successful.
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
flush
-
destroy
public void destroy()- Specified by:
destroyin interfaceDisposableBean
-