Class MongoDbMetadataStore
java.lang.Object
org.springframework.integration.mongodb.metadata.MongoDbMetadataStore
- All Implemented Interfaces:
- ConcurrentMetadataStore,- MetadataStore
MongoDbMetadataStore implementation of 
ConcurrentMetadataStore.
 Use this MetadataStore to
 achieve meta-data persistence shared across application instances and
 restarts.- Since:
- 4.2
- Author:
- Senthil Arumugam, Samiraj Panneer Selvam, Artem Bilan, Gary Russell
- 
Constructor SummaryConstructorsConstructorDescriptionMongoDbMetadataStore(MongoTemplate template) Configure the MongoDbMetadataStore by providedMongoTemplateand default collection name -DEFAULT_COLLECTION_NAME.MongoDbMetadataStore(MongoTemplate template, String collectionName) Configure the MongoDbMetadataStore by providedMongoTemplateand collection name.MongoDbMetadataStore(MongoDatabaseFactory factory) Configure the MongoDbMetadataStore by providedMongoDatabaseFactoryand default collection name -DEFAULT_COLLECTION_NAME.MongoDbMetadataStore(MongoDatabaseFactory factory, String collectionName) Configure the MongoDbMetadataStore by providedMongoDatabaseFactoryand collection name.
- 
Method SummaryModifier and TypeMethodDescriptionGet thevaluefor the providedkeyperformingfindOneMongoDB operation.voidStore a metadatavalueunder providedkeyto the configuredcollectionName.putIfAbsent(String key, String value) If the specified key is not already associated with a value, associate it with the given value.Remove the metadata entry for the providedkeyand return itsvalue, if any, usingfindAndRemoveMongoDB operation.booleanReplace an existing metadata entryvaluewith a new one.
- 
Constructor Details- 
MongoDbMetadataStoreConfigure the MongoDbMetadataStore by providedMongoDatabaseFactoryand default collection name -DEFAULT_COLLECTION_NAME.- Parameters:
- factory- the mongodb factory
 
- 
MongoDbMetadataStoreConfigure the MongoDbMetadataStore by providedMongoDatabaseFactoryand collection name.- Parameters:
- factory- the mongodb factory
- collectionName- the collection name where it persists the data
 
- 
MongoDbMetadataStoreConfigure the MongoDbMetadataStore by providedMongoTemplateand default collection name -DEFAULT_COLLECTION_NAME.- Parameters:
- template- the mongodb template
 
- 
MongoDbMetadataStoreConfigure the MongoDbMetadataStore by providedMongoTemplateand collection name.- Parameters:
- template- the mongodb template
- collectionName- the collection name where it persists the data
 
 
- 
- 
Method Details- 
putStore a metadatavalueunder providedkeyto the configuredcollectionName.If a document does not exist with the specified key, the method performs aninsert. If a document exists with the specifiedkey, the method performs anupdate.- Specified by:
- putin interface- MetadataStore
- Parameters:
- key- the metadata entry key
- value- the metadata entry value
- See Also:
 
- 
getGet thevaluefor the providedkeyperformingfindOneMongoDB operation.- Specified by:
- getin interface- MetadataStore
- Parameters:
- key- the metadata entry key
- Returns:
- the metadata entry value or null if doesn't exist.
- See Also:
 
- 
removeRemove the metadata entry for the providedkeyand return itsvalue, if any, usingfindAndRemoveMongoDB operation.- Specified by:
- removein interface- MetadataStore
- Parameters:
- key- the metadata entry key
- Returns:
- the metadata entry value or null if doesn't exist.
- See Also:
 
- 
putIfAbsentIf the specified key is not already associated with a value, associate it with the given value. This is equivalent to
 except that the action is performed atomically.if (!map.containsKey(key)) return map.put(key, value); else return map.get(key);- Specified by:
- putIfAbsentin interface- ConcurrentMetadataStore
- Parameters:
- key- the metadata entry key
- value- the metadata entry value to store
- Returns:
- null if successful, the old value otherwise.
- See Also:
 
- 
replaceReplace an existing metadata entryvaluewith a new one. Otherwise does nothing. PerformsupdateFirstif a document for the providedkeyandoldValueexists in thecollectionName.- Specified by:
- replacein interface- ConcurrentMetadataStore
- Parameters:
- key- the metadata entry key
- oldValue- the metadata entry old value to replace
- newValue- the metadata entry new value to put
- Returns:
- trueif replace was successful,- falseotherwise.
- See Also:
 
 
-