Package org.nuxeo.wopi
Class WOPIServiceImpl
- java.lang.Object
-
- org.nuxeo.runtime.model.DefaultComponent
-
- org.nuxeo.wopi.WOPIServiceImpl
-
- All Implemented Interfaces:
Adaptable,Component,Extensible,TimestampedService,WOPIService
public class WOPIServiceImpl extends DefaultComponent implements WOPIService
- Since:
- 10.3
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classWOPIServiceImpl.WOPIDiscoveryInvalidationclassWOPIServiceImpl.WOPIDiscoveryInvalidator
-
Field Summary
Fields Modifier and Type Field Description protected CheckFileInfoUpdatercheckFileInfoUpdaterprotected StringdiscoveryURLstatic StringDOWNLOAD_REASONprotected Map<String,Map<String,String>>extensionActionURLsprotected Map<String,String>extensionAppNamesprotected WOPIServiceImpl.WOPIDiscoveryInvalidatorinvalidatorprotected PublicKeyoldProofKeystatic StringPLACEHOLDER_IS_LICENSED_USERstatic StringPLACEHOLDER_IS_LICENSED_USER_VALUEprotected PublicKeyproofKeystatic StringSUPPORTED_APP_NAMES_PROPERTY_KEYprotected static StringWOPI_DISCOVERY_INVAL_PUBSUB_TOPICstatic StringWOPI_PROPERTY_NAMESPACEstatic StringXP_CHECK_FILE_INFO_UPDATER-
Fields inherited from class org.nuxeo.runtime.model.DefaultComponent
lastModified, name
-
-
Constructor Summary
Constructors Constructor Description WOPIServiceImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected org.apache.http.impl.client.CloseableHttpClientbuildHttpClient()booleancheckDownloadBlob(DocumentModel doc, String xpath, Blob blob)Checks whether the download of the blob is allowed.protected voidconfigureProxy(org.apache.http.impl.client.HttpClientBuilder builder)protected byte[]fetchDiscovery()protected voidfireRefreshDiscovery()StringgetActionURL(Blob blob, String action)Returns the WOPI action url given abloband anaction.protected byte[]getDiscovery()protected StringgetExtension(Blob blob)protected KeyValueStoregetKeyValueStore()protected List<String>getSupportedAppNames()WOPIBlobInfogetWOPIBlobInfo(Blob blob)Returns aWOPIBlobInfofor the given blob if it is supported by WOPI,nullotherwise.protected booleanhasDiscoveryURL()booleanisEnabled()Returns @{code true} if WOPI is enabled,falseotherwise.booleanisSupported(Blob blob)Returnstrueif the givenblobis supported by WOPI,falseotherwise.protected voidloadDiscovery()protected booleanloadDiscovery(byte[] discoveryBytes)booleanrefreshDiscovery()Refreshes the WOPI discovery: fetches the data from the discovery URL, stores it and loads it in memory.protected voidregisterApp(WOPIDiscovery.App app)protected voidregisterInvalidator()voidstart(ComponentContext context)Start the component.voidstop(ComponentContext context)Stop the component.protected voidstoreDiscovery(byte[] discoveryBytes)protected voidunregisterInvalidator()Map<String,Serializable>updateCheckFileInfoProperties(Map<String,Serializable> checkFileInfoProperties)booleanverifyProofKey(String proofKeyHeader, String oldProofKeyHeader, String url, String accessToken, String timestampHeader)Verifies that the request originate from Office Online.-
Methods inherited from class org.nuxeo.runtime.model.DefaultComponent
activate, addRuntimeMessage, addRuntimeMessage, deactivate, getAdapter, getDescriptor, getDescriptors, getLastModified, getRegistry, register, registerContribution, registerExtension, setLastModified, setModifiedNow, setName, unregister, unregisterContribution, unregisterExtension
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.nuxeo.runtime.model.Component
applicationStarted, getApplicationStartedOrder
-
-
-
-
Field Detail
-
XP_CHECK_FILE_INFO_UPDATER
public static final String XP_CHECK_FILE_INFO_UPDATER
- See Also:
- Constant Field Values
-
PLACEHOLDER_IS_LICENSED_USER
public static final String PLACEHOLDER_IS_LICENSED_USER
- See Also:
- Constant Field Values
-
PLACEHOLDER_IS_LICENSED_USER_VALUE
public static final String PLACEHOLDER_IS_LICENSED_USER_VALUE
- See Also:
- Constant Field Values
-
WOPI_PROPERTY_NAMESPACE
public static final String WOPI_PROPERTY_NAMESPACE
- See Also:
- Constant Field Values
-
SUPPORTED_APP_NAMES_PROPERTY_KEY
public static final String SUPPORTED_APP_NAMES_PROPERTY_KEY
- See Also:
- Constant Field Values
-
DOWNLOAD_REASON
public static final String DOWNLOAD_REASON
- See Also:
- Constant Field Values
-
WOPI_DISCOVERY_INVAL_PUBSUB_TOPIC
protected static final String WOPI_DISCOVERY_INVAL_PUBSUB_TOPIC
- See Also:
- Constant Field Values
-
proofKey
protected PublicKey proofKey
-
oldProofKey
protected PublicKey oldProofKey
-
discoveryURL
protected String discoveryURL
-
invalidator
protected WOPIServiceImpl.WOPIDiscoveryInvalidator invalidator
-
checkFileInfoUpdater
protected CheckFileInfoUpdater checkFileInfoUpdater
-
-
Method Detail
-
start
public void start(ComponentContext context)
Description copied from interface:ComponentStart the component. This method is called after all the components were resolved and activated- Specified by:
startin interfaceComponent- Overrides:
startin classDefaultComponent
-
stop
public void stop(ComponentContext context)
Description copied from interface:ComponentStop the component.- Specified by:
stopin interfaceComponent- Overrides:
stopin classDefaultComponent
-
hasDiscoveryURL
protected boolean hasDiscoveryURL()
-
registerInvalidator
protected void registerInvalidator()
-
unregisterInvalidator
protected void unregisterInvalidator()
-
loadDiscovery
protected void loadDiscovery()
-
loadDiscovery
protected boolean loadDiscovery(byte[] discoveryBytes)
-
fireRefreshDiscovery
protected void fireRefreshDiscovery()
-
registerApp
protected void registerApp(WOPIDiscovery.App app)
-
isEnabled
public boolean isEnabled()
Description copied from interface:WOPIServiceReturns @{code true} if WOPI is enabled,falseotherwise.The WOPI discovery XML file has been loaded.
- Specified by:
isEnabledin interfaceWOPIService
-
getWOPIBlobInfo
public WOPIBlobInfo getWOPIBlobInfo(Blob blob)
Description copied from interface:WOPIServiceReturns aWOPIBlobInfofor the given blob if it is supported by WOPI,nullotherwise.- Specified by:
getWOPIBlobInfoin interfaceWOPIService
-
isSupported
public boolean isSupported(Blob blob)
Description copied from interface:WOPIServiceReturnstrueif the givenblobis supported by WOPI,falseotherwise.This method relies on checking that the blob's filename extension is supported by the WOPI discovery.
- Specified by:
isSupportedin interfaceWOPIService
-
getActionURL
public String getActionURL(Blob blob, String action)
Description copied from interface:WOPIServiceReturns the WOPI action url given abloband anaction.- Specified by:
getActionURLin interfaceWOPIService
-
verifyProofKey
public boolean verifyProofKey(String proofKeyHeader, String oldProofKeyHeader, String url, String accessToken, String timestampHeader)
Description copied from interface:WOPIServiceVerifies that the request originate from Office Online.- Specified by:
verifyProofKeyin interfaceWOPIService
-
refreshDiscovery
public boolean refreshDiscovery()
Description copied from interface:WOPIServiceRefreshes the WOPI discovery: fetches the data from the discovery URL, stores it and loads it in memory.- Specified by:
refreshDiscoveryin interfaceWOPIService- Returns:
trueif refreshing the discovery has succeeded,falseotherwise
-
fetchDiscovery
protected byte[] fetchDiscovery()
-
buildHttpClient
protected org.apache.http.impl.client.CloseableHttpClient buildHttpClient()
-
configureProxy
protected void configureProxy(org.apache.http.impl.client.HttpClientBuilder builder)
-
getDiscovery
protected byte[] getDiscovery()
-
storeDiscovery
protected void storeDiscovery(byte[] discoveryBytes)
-
getKeyValueStore
protected KeyValueStore getKeyValueStore()
-
checkDownloadBlob
public boolean checkDownloadBlob(DocumentModel doc, String xpath, Blob blob)
Description copied from interface:WOPIServiceChecks whether the download of the blob is allowed.- Specified by:
checkDownloadBlobin interfaceWOPIService- Returns:
trueif download is allowed
-
updateCheckFileInfoProperties
public Map<String,Serializable> updateCheckFileInfoProperties(Map<String,Serializable> checkFileInfoProperties)
- Specified by:
updateCheckFileInfoPropertiesin interfaceWOPIService
-
-