public class AzureBlobStoreBackend extends AbstractSharedBackend
Constructor and Description |
---|
AzureBlobStoreBackend() |
Modifier and Type | Method and Description |
---|---|
void |
addMetadataRecord(File input,
String name)
Adds a metadata record with the specified name
|
void |
addMetadataRecord(InputStream input,
String name)
Adds a metadata record with the specified name
|
void |
close()
Close backend and release resources like database connection if any.
|
void |
deleteAllMetadataRecords(String prefix)
Deletes all the metadata records with the specified prefix.
|
boolean |
deleteMetadataRecord(String name)
Deletes the metadata record with the specified name
|
void |
deleteRecord(DataIdentifier identifier)
Delete record identified by identifier.
|
boolean |
exists(DataIdentifier identifier)
This method check the existence of record in backend.
|
Iterator<DataIdentifier> |
getAllIdentifiers()
Returns identifiers of all records that exists in backend.
|
List<DataRecord> |
getAllMetadataRecords(String prefix)
Gets all the metadata with a specified prefix.
|
Iterator<DataRecord> |
getAllRecords()
Returns a list of all DataRecords
|
protected com.microsoft.azure.storage.blob.CloudBlobContainer |
getAzureContainer() |
DataRecord |
getMetadataRecord(String name)
Gets the metadata of the specified name.
|
byte[] |
getOrCreateReferenceKey()
Returns the reference key of this backend.
|
DataRecord |
getRecord(DataIdentifier identifier)
Gets the record with the specified identifier
|
void |
init()
Initialize
|
boolean |
metadataRecordExists(String name)
Checks if the metadata record with the specified name exists.
|
InputStream |
read(DataIdentifier identifier)
Return inputstream of record identified by identifier.
|
void |
setProperties(Properties properties) |
void |
write(DataIdentifier identifier,
File file)
Stores file to backend with identifier used as key.
|
getReferenceFromIdentifier
public void setProperties(Properties properties)
protected com.microsoft.azure.storage.blob.CloudBlobContainer getAzureContainer() throws DataStoreException
DataStoreException
public void init() throws DataStoreException
SharedBackend
DataStoreException
public InputStream read(DataIdentifier identifier) throws DataStoreException
SharedBackend
identifier
- identifier of record.DataStoreException
- if record not found or any error.public void write(DataIdentifier identifier, File file) throws DataStoreException
SharedBackend
identifier
- key of the filefile
- file that would be stored in backend.DataStoreException
- for any error.public byte[] getOrCreateReferenceKey() throws DataStoreException
AbstractSharedBackend
This method is called only once during the lifetime of a backend instance and the return value is cached in memory, so it's no problem if the implementation is slow.
getOrCreateReferenceKey
in class AbstractSharedBackend
DataStoreException
- if the key is not availablepublic DataRecord getRecord(DataIdentifier identifier) throws DataStoreException
SharedBackend
identifier
- the record identifierDataStoreException
public Iterator<DataIdentifier> getAllIdentifiers() throws DataStoreException
SharedBackend
DataStoreException
public Iterator<DataRecord> getAllRecords() throws DataStoreException
SharedBackend
DataStoreException
public boolean exists(DataIdentifier identifier) throws DataStoreException
SharedBackend
identifier
- identifier to be checked.DataStoreException
public void close() throws DataStoreException
SharedBackend
DataStoreException
public void deleteRecord(DataIdentifier identifier) throws DataStoreException
SharedBackend
DataStoreException
public void addMetadataRecord(InputStream input, String name) throws DataStoreException
SharedBackend
input
- the record input streamname
- the nameDataStoreException
public void addMetadataRecord(File input, String name) throws DataStoreException
SharedBackend
input
- the record filename
- the nameDataStoreException
public DataRecord getMetadataRecord(String name)
SharedBackend
name
- the name of the recordpublic List<DataRecord> getAllMetadataRecords(String prefix)
SharedBackend
prefix
- the prefix of the records to retrievepublic boolean deleteMetadataRecord(String name)
SharedBackend
name
- the name of the recordpublic void deleteAllMetadataRecords(String prefix)
SharedBackend
prefix
- the prefix of the recordpublic boolean metadataRecordExists(String name)
SharedBackend
name
- the name of the recordCopyright © 2012–2019 The Apache Software Foundation. All rights reserved.