public class DataStoreBlobStore extends java.lang.Object implements DataStore, SharedDataStore, BlobStore, GarbageCollectableBlobStore
DataStore.getMinRecordLength()SharedDataStore.Type| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_CACHE_SIZE |
static java.lang.String |
MEM_CACHE_NAME |
| Constructor and Description |
|---|
DataStoreBlobStore(DataStore delegate) |
DataStoreBlobStore(DataStore delegate,
boolean encodeLengthInId) |
DataStoreBlobStore(DataStore delegate,
boolean encodeLengthInId,
int cacheSizeInMB) |
| Modifier and Type | Method and Description |
|---|---|
void |
addMetadataRecord(java.io.InputStream stream,
java.lang.String name)
Adds the root record.
|
DataRecord |
addRecord(java.io.InputStream stream)
Creates a new data record.
|
void |
clearCache()
Clear the cache.
|
void |
clearInUse()
Clear the in-use list.
|
void |
close()
Close the data store
|
long |
countDeleteChunks(java.util.List<java.lang.String> chunkIds,
long maxLastModifiedTime)
Deletes the blobs with the given ids.
|
void |
deleteAllMetadataRecords(java.lang.String prefix)
Deletes all records matching the given prefix.
|
int |
deleteAllOlderThan(long min)
Delete objects that have a modified date older than the specified date.
|
boolean |
deleteChunks(java.util.List<java.lang.String> chunkIds,
long maxLastModifiedTime)
Deletes the blobs with the given ids.
|
boolean |
deleteMetadataRecord(java.lang.String name)
Deletes the root record represented by the given parameters.
|
java.util.Iterator<java.lang.String> |
getAllChunkIds(long maxLastModifiedTime)
Gets all the identifiers.
|
java.util.Iterator<DataIdentifier> |
getAllIdentifiers()
Get all identifiers.
|
java.util.List<DataRecord> |
getAllMetadataRecords(java.lang.String prefix)
Gets the all root records.
|
java.lang.String |
getBlobId(java.lang.String reference)
Returns the blobId that referred by the given binary reference.
|
long |
getBlobLength(java.lang.String encodedBlobId)
Get the length of the blob.
|
long |
getBlockSizeMin()
Get the minimum block size (if there is any).
|
CacheStats |
getCacheStats() |
DataStore |
getDataStore() |
java.io.InputStream |
getInputStream(java.lang.String encodedBlobId)
Returns a new stream for given blobId.
|
DataRecord |
getMetadataRecord(java.lang.String name)
Retrieves the metadata record with the given name
|
int |
getMinRecordLength()
Get the minimum size of an object that should be stored in this data store.
|
DataRecord |
getRecord(DataIdentifier identifier)
Returns the identified data record.
|
DataRecord |
getRecordFromReference(java.lang.String reference)
Returns the record that matches the given binary reference.
|
DataRecord |
getRecordIfStored(DataIdentifier identifier)
Check if a record for the given identifier exists, and return it if yes.
|
java.lang.String |
getReference(java.lang.String encodedBlobId)
Returns a secure reference to blob referred by blobid, or
null if no such
reference is available. |
SharedDataStore.Type |
getType()
Gets the type.
|
void |
init(java.lang.String homeDir)
Initialized the data store
|
int |
readBlob(java.lang.String encodedBlobId,
long pos,
byte[] buff,
int off,
int length)
Read a number of bytes from a blob.
|
java.util.Iterator<java.lang.String> |
resolveChunks(java.lang.String blobId)
Resolve chunks stored in the blob store from the given Id.
|
void |
setBlobStatsCollector(BlobStatsCollector stats) |
void |
setBlockSize(int x)
Set the block size used by this blob store, if the blob store splits
binaries into blocks.
|
void |
setMaxCachedBinarySize(int maxCachedBinarySize) |
void |
startMark()
Start the mark phase.
|
int |
sweep()
Remove all unused blocks.
|
java.lang.String |
toString() |
void |
updateModifiedDateOnAccess(long before)
From now on, update the modified date of an object even when accessing it.
|
java.lang.String |
writeBlob(java.io.InputStream stream)
Write a blob from an input stream.
|
java.lang.String |
writeBlob(java.lang.String tempFileName)
Write a blob from a temporary file.
|
public static final int DEFAULT_CACHE_SIZE
public static final java.lang.String MEM_CACHE_NAME
public DataStoreBlobStore(DataStore delegate)
public DataStoreBlobStore(DataStore delegate, boolean encodeLengthInId)
public DataStoreBlobStore(DataStore delegate, boolean encodeLengthInId, int cacheSizeInMB)
public DataRecord getRecordIfStored(DataIdentifier identifier) throws DataStoreException
DataStoregetRecordIfStored in interface DataStoreidentifier - data identifierDataStoreException - if the data store could not be accessedpublic DataRecord getRecord(DataIdentifier identifier) throws DataStoreException
DataStoregetRecord in interface DataStoreidentifier - data identifierDataStoreException - if the data store could not be accessed,
or if the given identifier is invalidpublic DataRecord getRecordFromReference(java.lang.String reference) throws DataStoreException
DataStorenull if the reference is invalid, for example if it
points to a record that does not exist.getRecordFromReference in interface DataStorereference - binary referencenullDataStoreException - if the data store could not be accessedpublic DataRecord addRecord(java.io.InputStream stream) throws DataStoreException
DataStoreThe given stream is consumed and not closed by this method. It is the responsibility of the caller to close the stream. A typical call pattern would be:
InputStream stream = ...;
try {
record = store.addRecord(stream);
} finally {
stream.close();
}
addRecord in interface DataStorestream - binary streamDataStoreException - if the data store could not be accessedpublic void updateModifiedDateOnAccess(long before)
DataStoreupdateModifiedDateOnAccess in interface DataStorebefore - - update the modified date to the current time if it is older than this valuepublic int deleteAllOlderThan(long min)
throws DataStoreException
DataStoredeleteAllOlderThan in interface DataStoremin - the minimum timeDataStoreExceptionpublic java.util.Iterator<DataIdentifier> getAllIdentifiers() throws DataStoreException
DataStoregetAllIdentifiers in interface DataStoreDataStoreException - if the list could not be readpublic void init(java.lang.String homeDir)
throws RepositoryException
DataStorepublic int getMinRecordLength()
DataStoregetMinRecordLength in interface DataStorepublic void close()
throws DataStoreException
DataStoreclose in interface DataStoreDataStoreException - if a problem occurredpublic java.lang.String writeBlob(java.io.InputStream stream)
throws java.io.IOException
BlobStorepublic int readBlob(java.lang.String encodedBlobId,
long pos,
byte[] buff,
int off,
int length)
throws java.io.IOException
BlobStorepublic long getBlobLength(java.lang.String encodedBlobId)
throws java.io.IOException
BlobStoregetBlobLength in interface BlobStoreencodedBlobId - the blob idjava.io.IOExceptionpublic java.lang.String getBlobId(java.lang.String reference)
BlobStorenull if the reference is invalid, for example if it
points to a blob that does not exist.public java.lang.String getReference(java.lang.String encodedBlobId)
BlobStorenull if no such
reference is available.getReference in interface BlobStoreencodedBlobId - blobId referring the blob for which reference is requirednullpublic java.io.InputStream getInputStream(java.lang.String encodedBlobId)
throws java.io.IOException
BlobStoreread
return the same sequence of bytes as long as neither call throws
an exception.getInputStream in interface BlobStoreencodedBlobId - the blob idjava.io.IOExceptionpublic void setBlockSize(int x)
GarbageCollectableBlobStoresetBlockSize in interface GarbageCollectableBlobStorex - the block size in bytes.public java.lang.String writeBlob(java.lang.String tempFileName)
throws java.io.IOException
GarbageCollectableBlobStorewriteBlob in interface GarbageCollectableBlobStoretempFileName - the temporary file namejava.io.IOExceptionpublic int sweep()
throws java.io.IOException
GarbageCollectableBlobStoresweep in interface GarbageCollectableBlobStorejava.io.IOExceptionpublic void startMark()
throws java.io.IOException
GarbageCollectableBlobStorestartMark in interface GarbageCollectableBlobStorejava.io.IOExceptionpublic void clearInUse()
DataStoreclearInUse in interface DataStoreclearInUse in interface GarbageCollectableBlobStorepublic void clearCache()
GarbageCollectableBlobStoreclearCache in interface GarbageCollectableBlobStorepublic long getBlockSizeMin()
GarbageCollectableBlobStoregetBlockSizeMin in interface GarbageCollectableBlobStorepublic java.util.Iterator<java.lang.String> getAllChunkIds(long maxLastModifiedTime)
throws java.lang.Exception
GarbageCollectableBlobStoregetAllChunkIds in interface GarbageCollectableBlobStoremaxLastModifiedTime - the max last modified time to consider for retrieval,
with the special value '0' meaning no filtering by timejava.lang.Exception - the exceptionpublic boolean deleteChunks(java.util.List<java.lang.String> chunkIds,
long maxLastModifiedTime)
throws java.lang.Exception
GarbageCollectableBlobStoredeleteChunks in interface GarbageCollectableBlobStorechunkIds - the chunk idsmaxLastModifiedTime - the max last modified time to consider for retrieval,
with the special value '0' meaning no filtering by timejava.lang.Exception - the exceptionpublic long countDeleteChunks(java.util.List<java.lang.String> chunkIds,
long maxLastModifiedTime)
throws java.lang.Exception
GarbageCollectableBlobStorecountDeleteChunks in interface GarbageCollectableBlobStorechunkIds - the chunk idsmaxLastModifiedTime - the max last modified time to consider for retrieval,
with the special value '0' meaning no filtering by timejava.lang.Exception - the exceptionpublic java.util.Iterator<java.lang.String> resolveChunks(java.lang.String blobId)
throws java.io.IOException
GarbageCollectableBlobStoreresolveChunks in interface GarbageCollectableBlobStoreblobId - the blob idjava.io.IOException - Signals that an I/O exception has occurred.public void addMetadataRecord(java.io.InputStream stream,
java.lang.String name)
throws DataStoreException
SharedDataStoreaddMetadataRecord in interface SharedDataStorestream - the streamname - the name of the root recordDataStoreException - the data store exceptionpublic DataRecord getMetadataRecord(java.lang.String name)
SharedDataStoregetMetadataRecord in interface SharedDataStorename - the name of the recordpublic java.util.List<DataRecord> getAllMetadataRecords(java.lang.String prefix)
SharedDataStoregetAllMetadataRecords in interface SharedDataStorepublic boolean deleteMetadataRecord(java.lang.String name)
SharedDataStoredeleteMetadataRecord in interface SharedDataStorename - the name of the root recordpublic void deleteAllMetadataRecords(java.lang.String prefix)
SharedDataStoredeleteAllMetadataRecords in interface SharedDataStoreprefix - metadata type identifierpublic SharedDataStore.Type getType()
SharedDataStoregetType in interface SharedDataStorepublic java.lang.String toString()
toString in class java.lang.Objectpublic DataStore getDataStore()
public CacheStats getCacheStats()
public void setMaxCachedBinarySize(int maxCachedBinarySize)
public void setBlobStatsCollector(BlobStatsCollector stats)
"Copyright © 2010 - 2018 Adobe Systems Incorporated. All Rights Reserved"