public class GoogleDriveBlobProvider extends Object implements ExtendedBlobProvider, BatchUpdateBlobProvider, LinkedAppsProvider
Modifier and Type | Class and Description |
---|---|
static class |
GoogleDriveBlobProvider.FileInfo
Information about a file stored in Google Drive.
|
Modifier and Type | Field and Description |
---|---|
static String |
CLIENT_ID_PROP |
static String |
DEFAULT_EXPORT_MIMETYPE |
static String |
PREFIX |
static String |
SERVICE_ACCOUNT_ID_PROP |
static String |
SERVICE_ACCOUNT_P12_PATH_PROP |
MAX_RESULT
PREFERRED_ICON_SIZE
Constructor and Description |
---|
GoogleDriveBlobProvider() |
Modifier and Type | Method and Description |
---|---|
List<DocumentModel> |
checkChangesAndUpdateBlob(List<DocumentModel> docs)
Check the given list of document for change and update if needed.
|
void |
close()
Closes this blob provider and releases resources that may be held by it.
|
ManagedBlob |
freezeVersion(ManagedBlob blob)
Returns a new managed blob pointing to a fixed version of the original blob.
|
List<AppLink> |
getAppLinks(String username,
ManagedBlob blob)
Returns a list of application links for the given blob.
|
Map<String,URI> |
getAvailableConversions(ManagedBlob blob,
BlobManager.UsageHint hint)
Gets a map of available MIME type conversions and corresponding
URI for a managed blob. |
String |
getBlobPrefix() |
String |
getClientId() |
InputStream |
getConvertedStream(ManagedBlob blob,
String mimeType)
Gets an
InputStream for a conversion to the given MIME type. |
String |
getPageProviderNameForUpdate() |
InputStream |
getStream(ManagedBlob blob)
Gets an
InputStream for the data of a managed blob. |
InputStream |
getThumbnail(ManagedBlob blob)
Gets an
InputStream for a thumbnail of a managed blob. |
URI |
getURI(ManagedBlob blob,
BlobManager.UsageHint usage)
Gets an
URI for the content of a managed blob. |
void |
initialize(String blobProviderId,
Map<String,String> properties)
Initializes the blob provider.
|
boolean |
isVersion(ManagedBlob blob)
Returns true if version of the blob is a version.
|
Blob |
readBlob(BlobManager.BlobInfo blobInfo)
Reads a
Blob from storage. |
String |
writeBlob(Blob blob,
Document doc)
Writes a
Blob to storage and returns information about it. |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
processDocumentsUpdate
public static final String PREFIX
public static final String SERVICE_ACCOUNT_ID_PROP
public static final String SERVICE_ACCOUNT_P12_PATH_PROP
public static final String CLIENT_ID_PROP
public static final String DEFAULT_EXPORT_MIMETYPE
public void initialize(String blobProviderId, Map<String,String> properties) throws IOException
BlobProvider
initialize
in interface BlobProvider
blobProviderId
- the blob provider id for this binary managerproperties
- initialization propertiesIOException
public void close()
BlobProvider
close
in interface BlobProvider
public Blob readBlob(BlobManager.BlobInfo blobInfo)
BlobProvider
Blob
from storage.readBlob
in interface BlobProvider
blobInfo
- the blob informationpublic String writeBlob(Blob blob, Document doc)
BlobProvider
Blob
to storage and returns information about it.
Called to store a user-created blob.
writeBlob
in interface BlobProvider
blob
- the blobdoc
- the document to which this blob belongspublic URI getURI(ManagedBlob blob, BlobManager.UsageHint usage) throws IOException
ExtendedBlobProvider
URI
for the content of a managed blob.getURI
in interface ExtendedBlobProvider
blob
- the managed blobusage
- BlobManager.UsageHint
URI
, or null
if none availableIOException
public Map<String,URI> getAvailableConversions(ManagedBlob blob, BlobManager.UsageHint hint) throws IOException
ExtendedBlobProvider
URI
for a managed blob.getAvailableConversions
in interface ExtendedBlobProvider
blob
- the managed blobhint
- BlobManager.UsageHint
URI
, which may be emptyIOException
public InputStream getThumbnail(ManagedBlob blob) throws IOException
ExtendedBlobProvider
InputStream
for a thumbnail of a managed blob.
Like all InputStream
, the result must be closed when done with it to avoid resource leaks.
getThumbnail
in interface ExtendedBlobProvider
blob
- the managed blobIOException
public InputStream getStream(ManagedBlob blob) throws IOException
ExtendedBlobProvider
InputStream
for the data of a managed blob.
Like all InputStream
, the result must be closed when done with it to avoid resource leaks.
getStream
in interface ExtendedBlobProvider
blob
- the managed blobIOException
public InputStream getConvertedStream(ManagedBlob blob, String mimeType) throws IOException
ExtendedBlobProvider
InputStream
for a conversion to the given MIME type.
Like all InputStream
, the result must be closed when done with it to avoid resource leaks.
getConvertedStream
in interface ExtendedBlobProvider
blob
- the managed blobmimeType
- the MIME type to convert tonull
if no conversion is available for the given MIME typeIOException
public List<AppLink> getAppLinks(String username, ManagedBlob blob) throws IOException
LinkedAppsProvider
getAppLinks
in interface LinkedAppsProvider
IOException
public ManagedBlob freezeVersion(ManagedBlob blob) throws IOException
ExtendedBlobProvider
freezeVersion
in interface ExtendedBlobProvider
blob
- the original managed blobnull
if no change is neededIOException
public String getClientId()
public List<DocumentModel> checkChangesAndUpdateBlob(List<DocumentModel> docs)
BatchUpdateBlobProvider
checkChangesAndUpdateBlob
in interface BatchUpdateBlobProvider
public String getPageProviderNameForUpdate()
getPageProviderNameForUpdate
in interface BatchUpdateBlobProvider
public String getBlobPrefix()
getBlobPrefix
in interface BatchUpdateBlobProvider
public boolean isVersion(ManagedBlob blob)
ExtendedBlobProvider
isVersion
in interface ExtendedBlobProvider
blob
- the managed blobCopyright © 2015 Nuxeo SA. All rights reserved.