Package org.nuxeo.ecm.liveconnect.core
Class AbstractLiveConnectBlobProvider<O extends OAuth2ServiceProvider>
java.lang.Object
org.nuxeo.ecm.core.blob.AbstractBlobProvider
org.nuxeo.ecm.liveconnect.core.AbstractLiveConnectBlobProvider<O>
- Type Parameters:
O
- The OAuth2 service provider type.
- All Implemented Interfaces:
BlobProvider
,DocumentBlobProvider
,LiveConnectBlobProvider<O>
,BatchUpdateBlobProvider
- Direct Known Subclasses:
BoxBlobProvider
,GoogleDriveBlobProvider
public abstract class AbstractLiveConnectBlobProvider<O extends OAuth2ServiceProvider>
extends AbstractBlobProvider
implements LiveConnectBlobProvider<O>, BatchUpdateBlobProvider, DocumentBlobProvider
Basic implementation of
BlobProvider
for live connect.- Since:
- 8.1
-
Field Summary
Fields inherited from class org.nuxeo.ecm.core.blob.AbstractBlobProvider
blobProviderId, properties
Fields inherited from interface org.nuxeo.ecm.liveconnect.update.BatchUpdateBlobProvider
MAX_RESULT
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected URI
Parse aURI
.protected String
buildBlobKey
(LiveConnectFileInfo fileInfo) Check the given list of document for change and update if needed.void
close()
Should be overriden by subclasses needing something different.protected abstract String
final com.google.api.client.auth.oauth2.Credential
getCredential
(String user) protected com.google.api.client.auth.oauth2.Credential
getCredential
(LiveConnectFileInfo fileInfo) protected com.google.api.client.auth.oauth2.Credential
getCredential
(NuxeoOAuth2Token token) protected CredentialFactory
Should be overriden by subclasses needing another credential factory.protected LiveConnectFile
getFile
(LiveConnectFileInfo fileInfo) Returns theLiveConnectFile
from cache, if it doesn't exist retrieves it with API and cache it.protected final LiveConnectFile
getFileFromCache
(LiveConnectFileInfo fileInfo) protected final <T extends Serializable>
TgetFromCache
(String key) protected abstract String
protected boolean
hasChanged
(SimpleManagedBlob blob, LiveConnectFile file) Should be overriden by subclasses wanting to rely on a different fields.protected final void
invalidateInCache
(LiveConnectFileInfo fileInfo) boolean
isVersion
(ManagedBlob blob) Should be overriden by subclasses needing something different.boolean
performsExternalAccessControl
(BlobInfo blobInfo) Checks if the blob provider performs external access control checks.void
Trigger the documents update for the implementing providers.protected final void
protected final <T extends Serializable>
voidputInCache
(String key, T object) Should be overriden by subclasses needing something different.protected abstract LiveConnectFile
retrieveFile
(LiveConnectFileInfo fileInfo) Retrieves the file with API.boolean
Checks if sync is supported.protected SimpleManagedBlob
toBlob
(LiveConnectFile file) toBlob
(LiveConnectFileInfo fileInfo) protected LiveConnectFileInfo
toFileInfo
(String key) protected LiveConnectFileInfo
toFileInfo
(ManagedBlob blob) Should be overriden by subclasses needing something different.Methods inherited from class org.nuxeo.ecm.core.blob.AbstractBlobProvider
allowByteRange, getProperties, hasCreateFromKeyPermission, initialize, isColdStorageMode, isRecordMode, isTransactional, isTransient, supportsUserUpdate, supportsUserUpdateDefaultFalse, supportsUserUpdateDefaultTrue
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.nuxeo.ecm.core.blob.BlobProvider
allowByteRange, allowDirectDownload, canConvert, deleteBlob, getAppLinks, getAvailableConversions, getBinaryGarbageCollector, getBinaryManager, getFile, getProperties, getStatus, getStream, getStream, getThumbnail, getURI, hasCreateFromKeyPermission, initialize, isColdStorageMode, isRecordMode, isTransactional, isTransient, readBlob, supportsUserUpdate, updateBlob, writeBlob
Methods inherited from interface org.nuxeo.ecm.core.blob.DocumentBlobProvider
freezeVersion, getConvertedStream
-
Constructor Details
-
AbstractLiveConnectBlobProvider
public AbstractLiveConnectBlobProvider()
-
-
Method Details
-
close
public void close()Should be overriden by subclasses needing something different.- Specified by:
close
in interfaceBlobProvider
-
readBlob
Should be overriden by subclasses needing something different.- Specified by:
readBlob
in interfaceBlobProvider
- Parameters:
blobInfo
- the blob information- Returns:
- the blob
- Throws:
IOException
-
writeBlob
Should be overriden by subclasses needing something different.- Specified by:
writeBlob
in interfaceBlobProvider
- Parameters:
blob
- the blob- Returns:
- the blob key
- Throws:
IOException
-
performsExternalAccessControl
Description copied from interface:BlobProvider
Checks if the blob provider performs external access control checks.- Specified by:
performsExternalAccessControl
in interfaceBlobProvider
- Parameters:
blobInfo
- the blob information to be read- Returns:
true
if the provider performs security checks before reading a blob,false
otherwise
-
supportsSync
public boolean supportsSync()Description copied from interface:BlobProvider
Checks if sync is supported.Sync refers to the fact that a blob from this provider may be synced with a remote system (like Nuxeo Drive) or with a process that updates things in the blob (like Binary Metadata, or WOPI).
- Specified by:
supportsSync
in interfaceBlobProvider
- Returns:
true
if sync is supported
-
isVersion
Should be overriden by subclasses needing something different.- Specified by:
isVersion
in interfaceBlobProvider
- Parameters:
blob
- the managed blob- Returns:
- true if the blob is a version or a revision
-
checkChangesAndUpdateBlob
Description copied from interface:BatchUpdateBlobProvider
Check the given list of document for change and update if needed. Note that session.save still needs to be called on changed documents.- Specified by:
checkChangesAndUpdateBlob
in interfaceBatchUpdateBlobProvider
- Parameters:
docs
- to be checked for update- Returns:
- the list of DocumentModel that have changed
-
processDocumentsUpdate
public void processDocumentsUpdate()Description copied from interface:BatchUpdateBlobProvider
Trigger the documents update for the implementing providers.- Specified by:
processDocumentsUpdate
in interfaceBatchUpdateBlobProvider
-
hasChanged
Should be overriden by subclasses wanting to rely on a different fields. -
getOAuth2Provider
- Specified by:
getOAuth2Provider
in interfaceLiveConnectBlobProvider<O extends OAuth2ServiceProvider>
-
toBlob
- Specified by:
toBlob
in interfaceLiveConnectBlobProvider<O extends OAuth2ServiceProvider>
- Throws:
IOException
-
toBlob
-
buildBlobKey
-
toFileInfo
-
toFileInfo
- Since:
- 8.4
-
getFile
Returns theLiveConnectFile
from cache, if it doesn't exist retrieves it with API and cache it.- Parameters:
fileInfo
- the file info- Returns:
- the
LiveConnectFile
from cache, if it doesn't exist retrieves it with API and cache it - Throws:
IOException
-
getCredential
protected com.google.api.client.auth.oauth2.Credential getCredential(LiveConnectFileInfo fileInfo) throws IOException - Throws:
IOException
-
getCredential
protected com.google.api.client.auth.oauth2.Credential getCredential(NuxeoOAuth2Token token) throws IOException - Throws:
IOException
-
getCredential
public final com.google.api.client.auth.oauth2.Credential getCredential(String user) throws IOException - Throws:
IOException
-
getCredentialFactory
Should be overriden by subclasses needing another credential factory. -
getFromCache
-
putInCache
-
invalidateInCache
-
getFileFromCache
-
putFileInCache
-
asURI
Parse aURI
.- Returns:
- the
URI
or null if it fails
-
getCacheName
-
getPageProviderNameForUpdate
-
retrieveFile
Retrieves the file with API.- Parameters:
fileInfo
- the file info- Returns:
- the file retrieved from API
- Throws:
IOException
-