Package org.apache.nifi.couchbase
Class CouchbaseMapCacheClient
java.lang.Object
org.apache.nifi.components.AbstractConfigurableComponent
org.apache.nifi.controller.AbstractControllerService
org.apache.nifi.couchbase.CouchbaseMapCacheClient
- All Implemented Interfaces:
ConfigurableComponent,ControllerService,AtomicDistributedMapCacheClient<Long>,DistributedMapCacheClient
@Tags({"distributed","cache","map","cluster","couchbase"})
@CapabilityDescription("Provides the ability to communicate with a Couchbase Server cluster as a DistributedMapCacheServer. This can be used in order to share a Map between nodes in a NiFi cluster. Couchbase Server cluster can provide a high available and persistent cache storage.")
public class CouchbaseMapCacheClient
extends AbstractControllerService
implements AtomicDistributedMapCacheClient<Long>
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate com.couchbase.client.java.Bucketprivate static final org.slf4j.Logger -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()voidconfigure(ConfigurationContext context) <K> booleancontainsKey(K key, Serializer<K> keySerializer) private <V> Vdeserialize(com.couchbase.client.java.document.BinaryDocument doc, Deserializer<V> valueDeserializer) <K,V> AtomicCacheEntry <K, V, Long> fetch(K key, Serializer<K> keySerializer, Deserializer<V> valueDeserializer) <K,V> V get(K key, Serializer<K> keySerializer, Deserializer<V> valueDeserializer) <K,V> V getAndPutIfAbsent(K key, V value, Serializer<K> keySerializer, Serializer<V> valueSerializer, Deserializer<V> valueDeserializer) protected List<PropertyDescriptor> <K,V> void put(K key, V value, Serializer<K> keySerializer, Serializer<V> valueSerializer) <K,V> boolean putIfAbsent(K key, V value, Serializer<K> keySerializer, Serializer<V> valueSerializer) <K> booleanremove(K key, Serializer<K> serializer) longremoveByPattern(String regex) <K,V> boolean replace(AtomicCacheEntry<K, V, Long> entry, Serializer<K> keySerializer, Serializer<V> valueSerializer) private <V> com.couchbase.client.java.document.DocumenttoDocument(String docId, V value, Serializer<V> valueSerializer) private <V> com.couchbase.client.java.document.DocumenttoDocument(String docId, V value, Serializer<V> valueSerializer, long revision) private <K> StringtoDocumentId(K key, Serializer<K> keySerializer) Methods inherited from class org.apache.nifi.controller.AbstractControllerService
abstractClearConfigContext, abstractStoreConfigContext, disabled, enabled, getConfigurationContext, getControllerServiceLookup, getIdentifier, getLogger, getNodeTypeProvider, getProperty, getStateManager, init, initialize, isEnabledMethods inherited from class org.apache.nifi.components.AbstractConfigurableComponent
customValidate, equals, getPropertyDescriptor, getPropertyDescriptors, getSupportedDynamicPropertyDescriptor, hashCode, onPropertyModified, toString, validateMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.nifi.components.ConfigurableComponent
getIdentifier, getPropertyDescriptor, getPropertyDescriptors, onPropertyModified, validateMethods inherited from interface org.apache.nifi.controller.ControllerService
initialize, isStateful, migratePropertiesMethods inherited from interface org.apache.nifi.distributed.cache.client.DistributedMapCacheClient
keySet, putAll, removeAndGet, removeByPatternAndGet, subMap
-
Field Details
-
logger
private static final org.slf4j.Logger logger -
clusterService
-
bucket
private com.couchbase.client.java.Bucket bucket
-
-
Constructor Details
-
CouchbaseMapCacheClient
public CouchbaseMapCacheClient()
-
-
Method Details
-
getSupportedPropertyDescriptors
- Overrides:
getSupportedPropertyDescriptorsin classAbstractConfigurableComponent
-
configure
-
toDocument
private <V> com.couchbase.client.java.document.Document toDocument(String docId, V value, Serializer<V> valueSerializer) throws IOException - Throws:
IOException
-
toDocument
private <V> com.couchbase.client.java.document.Document toDocument(String docId, V value, Serializer<V> valueSerializer, long revision) throws IOException - Throws:
IOException
-
toDocumentId
- Throws:
IOException
-
putIfAbsent
public <K,V> boolean putIfAbsent(K key, V value, Serializer<K> keySerializer, Serializer<V> valueSerializer) throws IOException - Specified by:
putIfAbsentin interfaceDistributedMapCacheClient- Throws:
IOException
-
fetch
public <K,V> AtomicCacheEntry<K,V, fetchLong> (K key, Serializer<K> keySerializer, Deserializer<V> valueDeserializer) throws IOException - Specified by:
fetchin interfaceAtomicDistributedMapCacheClient<Long>- Throws:
IOException
-
getAndPutIfAbsent
public <K,V> V getAndPutIfAbsent(K key, V value, Serializer<K> keySerializer, Serializer<V> valueSerializer, Deserializer<V> valueDeserializer) throws IOException - Specified by:
getAndPutIfAbsentin interfaceDistributedMapCacheClient- Throws:
IOException
-
replace
public <K,V> boolean replace(AtomicCacheEntry<K, V, throws IOExceptionLong> entry, Serializer<K> keySerializer, Serializer<V> valueSerializer) - Specified by:
replacein interfaceAtomicDistributedMapCacheClient<Long>- Throws:
IOException
-
containsKey
- Specified by:
containsKeyin interfaceDistributedMapCacheClient- Throws:
IOException
-
put
public <K,V> void put(K key, V value, Serializer<K> keySerializer, Serializer<V> valueSerializer) throws IOException - Specified by:
putin interfaceDistributedMapCacheClient- Throws:
IOException
-
get
public <K,V> V get(K key, Serializer<K> keySerializer, Deserializer<V> valueDeserializer) throws IOException - Specified by:
getin interfaceDistributedMapCacheClient- Throws:
IOException
-
deserialize
private <V> V deserialize(com.couchbase.client.java.document.BinaryDocument doc, Deserializer<V> valueDeserializer) throws IOException - Throws:
IOException
-
close
- Specified by:
closein interfaceDistributedMapCacheClient- Throws:
IOException
-
remove
- Specified by:
removein interfaceDistributedMapCacheClient- Throws:
IOException
-
removeByPattern
- Specified by:
removeByPatternin interfaceDistributedMapCacheClient- Throws:
IOException
-