@ThreadSafe public class InfinispanBinaryStore extends AbstractBinaryStore
BinaryStore implementation that uses Infinispan for persisting binary values.| Modifier and Type | Class and Description |
|---|---|
protected static class |
InfinispanBinaryStore.DummyReducer |
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_CHUNK_SIZE |
logger, MEDIUM_BUFFER_SIZE| Constructor and Description |
|---|
InfinispanBinaryStore(org.infinispan.manager.CacheContainer cacheContainer,
boolean dedicatedCacheContainer,
String metadataCacheName,
String blobCacheName)
Creates a new instance.
|
InfinispanBinaryStore(org.infinispan.manager.CacheContainer cacheContainer,
boolean dedicatedCacheContainer,
String metadataCacheName,
String blobCacheName,
int chunkSize)
Creates a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
protected BinaryKey |
binaryKeyFromCacheKey(String key) |
protected String |
dataKeyFrom(BinaryKey key) |
Iterable<BinaryKey> |
getAllBinaryKeys()
Obtain an iterable implementation containing all of the store's binary keys.
|
List<org.infinispan.Cache<?,?>> |
getCaches() |
String |
getExtractedText(BinaryValue binary)
Returns the extracted text of a binary value, or
null if such text hasn't been stored previously (but the binary
value can be found in the store) |
InputStream |
getInputStream(BinaryKey binaryKey)
Get an
InputStream to the binary content with the supplied key. |
protected String |
getStoredMimeType(BinaryValue binary)
Returns the stored mime-type of a binary value.
|
protected boolean |
isMetadataKey(String str) |
protected String |
lockKeyFrom(BinaryKey key) |
void |
markAsUnused(Iterable<BinaryKey> keys)
Mark the supplied binary keys as unused, but key them in quarantine until needed again (at which point they're removed from
quarantine) or until
BinaryStore.removeValuesUnusedLongerThan(long, TimeUnit) is called. |
protected String |
metadataKeyFrom(BinaryKey key) |
void |
removeValuesUnusedLongerThan(long minimumAge,
TimeUnit unit)
Remove binary values that have been
unused for at least the specified amount of time. |
void |
shutdown()
Shuts down the store.
|
void |
start()
Initialize the store and get ready for use.
|
void |
storeExtractedText(BinaryValue binary,
String extractedText)
Stores the extracted text of a binary value into this store.
|
protected void |
storeMimeType(BinaryValue binary,
String mimeType)
Stores the given mime-type for a binary value.
|
BinaryValue |
storeValue(InputStream inputStream)
Store the binary value and return the JCR representation.
|
protected String |
textKeyFrom(BinaryKey key) |
bestBufferSize, detector, extractors, getMimeType, getMinimumBinarySizeInBytes, getText, hasBinary, setMimeTypeDetector, setMinimumBinarySizeInBytes, setTextExtractors, storeValuepublic static final int DEFAULT_CHUNK_SIZE
public InfinispanBinaryStore(org.infinispan.manager.CacheContainer cacheContainer,
boolean dedicatedCacheContainer,
String metadataCacheName,
String blobCacheName)
cacheContainer - cache container which used for cache managementdedicatedCacheContainer - true if the cache container should be started/stopped when store is start or stoppedmetadataCacheName - name of the cache used for metadatablobCacheName - name of the cache used for store of chunked binary valuespublic InfinispanBinaryStore(org.infinispan.manager.CacheContainer cacheContainer,
boolean dedicatedCacheContainer,
String metadataCacheName,
String blobCacheName,
int chunkSize)
cacheContainer - cache container which used for cache managementdedicatedCacheContainer - true if the cache container should be started/stopped when store is start or stoppedmetadataCacheName - name of the cache used for metadatablobCacheName - name of the cache used for store of chunked binary valueschunkSize - the size (in bytes) of a chunkprotected final boolean isMetadataKey(String str)
public void start()
BinaryStorestart in interface BinaryStorestart in class AbstractBinaryStorepublic void shutdown()
BinaryStoreshutdown in interface BinaryStoreshutdown in class AbstractBinaryStorepublic List<org.infinispan.Cache<?,?>> getCaches()
public BinaryValue storeValue(InputStream inputStream) throws BinaryStoreException, SystemFailureException
BinaryStoreinputStream - the stream containing the binary content to be stored; may not be nullBinaryStoreException - if there any unexpected problemSystemFailureExceptionpublic InputStream getInputStream(BinaryKey binaryKey) throws BinaryStoreException
BinaryStoreInputStream to the binary content with the supplied key.binaryKey - the key to the binary content; never nullnever nullBinaryStoreException - if there is a problem reading the content from the store or if a valid, non-null
InputStream cannot be returned for the given key.public void markAsUnused(Iterable<BinaryKey> keys) throws BinaryStoreException
BinaryStoreBinaryStore.removeValuesUnusedLongerThan(long, TimeUnit) is called. This method ignores any keys for
values not stored within this store.keys - the keys for the binary values that are no longer neededBinaryStoreException - if there is a problem marking any of the supplied binary values as unusedpublic void removeValuesUnusedLongerThan(long minimumAge,
TimeUnit unit)
throws BinaryStoreException
BinaryStoreunused for at least the specified amount of time.minimumAge - the minimum time that a binary value has been unused before it can be
removed; must be non-negativeunit - the time unit for the minimum age; may not be nullBinaryStoreException - if there is a problem removing the unused valuesprotected String getStoredMimeType(BinaryValue binary) throws BinaryStoreException
AbstractBinaryStoregetStoredMimeType in class AbstractBinaryStorebinary - a non-null BinaryValueString if a stored mimetype exists, or null if such a value doesn't exist yet.BinaryStoreException - if there's a problem accessing the binary store or if the binary value cannot be found in the
storeprotected void storeMimeType(BinaryValue binary, String mimeType) throws BinaryStoreException
AbstractBinaryStorestoreMimeType in class AbstractBinaryStorebinary - a non-null BinaryValuemimeType - a non-empty StringBinaryStoreException - if there's a problem accessing the binary storepublic String getExtractedText(BinaryValue binary) throws BinaryStoreException
AbstractBinaryStorenull if such text hasn't been stored previously (but the binary
value can be found in the store)getExtractedText in class AbstractBinaryStorebinary - a non-null BinaryValue instance from which the text was extractedString representing the extracted text, or null if such text hasn't been stored in this store
previously.BinaryStoreException - if the binary value cannot be found in the store.public void storeExtractedText(BinaryValue binary, String extractedText) throws BinaryStoreException
AbstractBinaryStorestoreExtractedText in class AbstractBinaryStorebinary - a non-null BinaryValue instance from which the text was extractedextractedText - a non-null and non-blank string representing the extracted textBinaryStoreException - if the operation fails or if the extracted text cannot be stored for the given binary value
(regardless of the reason)public Iterable<BinaryKey> getAllBinaryKeys() throws BinaryStoreException
BinaryStoreBinaryKeys only as the iterator is used.BinaryStoreException - if anything unexpected happens.Copyright © 2008-2014 JBoss, a division of Red Hat. All Rights Reserved.