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, propertiesFields inherited from interface org.nuxeo.ecm.liveconnect.update.BatchUpdateBlobProvider
MAX_RESULT -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected URIParse aURI.protected StringbuildBlobKey(LiveConnectFileInfo fileInfo) Check the given list of document for change and update if needed.voidclose()Should be overriden by subclasses needing something different.protected abstract Stringfinal com.google.api.client.auth.oauth2.CredentialgetCredential(String user) protected com.google.api.client.auth.oauth2.CredentialgetCredential(LiveConnectFileInfo fileInfo) protected com.google.api.client.auth.oauth2.CredentialgetCredential(NuxeoOAuth2Token token) protected CredentialFactoryShould be overriden by subclasses needing another credential factory.protected LiveConnectFilegetFile(LiveConnectFileInfo fileInfo) Returns theLiveConnectFilefrom cache, if it doesn't exist retrieves it with API and cache it.protected final LiveConnectFilegetFileFromCache(LiveConnectFileInfo fileInfo) protected final <T extends Serializable>
TgetFromCache(String key) protected abstract Stringprotected booleanhasChanged(SimpleManagedBlob blob, LiveConnectFile file) Should be overriden by subclasses wanting to rely on a different fields.protected final voidinvalidateInCache(LiveConnectFileInfo fileInfo) booleanisVersion(ManagedBlob blob) Should be overriden by subclasses needing something different.booleanperformsExternalAccessControl(BlobInfo blobInfo) Checks if the blob provider performs external access control checks.voidTrigger the documents update for the implementing providers.protected final voidprotected final <T extends Serializable>
voidputInCache(String key, T object) Should be overriden by subclasses needing something different.protected abstract LiveConnectFileretrieveFile(LiveConnectFileInfo fileInfo) Retrieves the file with API.booleanChecks if sync is supported.protected SimpleManagedBlobtoBlob(LiveConnectFile file) toBlob(LiveConnectFileInfo fileInfo) protected LiveConnectFileInfotoFileInfo(String key) protected LiveConnectFileInfotoFileInfo(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, supportsUserUpdateDefaultTrueMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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, writeBlobMethods 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:
closein interfaceBlobProvider
-
readBlob
Should be overriden by subclasses needing something different.- Specified by:
readBlobin interfaceBlobProvider- Parameters:
blobInfo- the blob information- Returns:
- the blob
- Throws:
IOException
-
writeBlob
Should be overriden by subclasses needing something different.- Specified by:
writeBlobin interfaceBlobProvider- Parameters:
blob- the blob- Returns:
- the blob key
- Throws:
IOException
-
performsExternalAccessControl
Description copied from interface:BlobProviderChecks if the blob provider performs external access control checks.- Specified by:
performsExternalAccessControlin interfaceBlobProvider- Parameters:
blobInfo- the blob information to be read- Returns:
trueif the provider performs security checks before reading a blob,falseotherwise
-
supportsSync
public boolean supportsSync()Description copied from interface:BlobProviderChecks 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:
supportsSyncin interfaceBlobProvider- Returns:
trueif sync is supported
-
isVersion
Should be overriden by subclasses needing something different.- Specified by:
isVersionin interfaceBlobProvider- Parameters:
blob- the managed blob- Returns:
- true if the blob is a version or a revision
-
checkChangesAndUpdateBlob
Description copied from interface:BatchUpdateBlobProviderCheck 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:
checkChangesAndUpdateBlobin interfaceBatchUpdateBlobProvider- Parameters:
docs- to be checked for update- Returns:
- the list of DocumentModel that have changed
-
processDocumentsUpdate
public void processDocumentsUpdate()Description copied from interface:BatchUpdateBlobProviderTrigger the documents update for the implementing providers.- Specified by:
processDocumentsUpdatein interfaceBatchUpdateBlobProvider
-
hasChanged
Should be overriden by subclasses wanting to rely on a different fields. -
getOAuth2Provider
- Specified by:
getOAuth2Providerin interfaceLiveConnectBlobProvider<O extends OAuth2ServiceProvider>
-
toBlob
- Specified by:
toBlobin interfaceLiveConnectBlobProvider<O extends OAuth2ServiceProvider>- Throws:
IOException
-
toBlob
-
buildBlobKey
-
toFileInfo
-
toFileInfo
- Since:
- 8.4
-
getFile
Returns theLiveConnectFilefrom cache, if it doesn't exist retrieves it with API and cache it.- Parameters:
fileInfo- the file info- Returns:
- the
LiveConnectFilefrom 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
URIor 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
-