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 class
WOPIServiceImpl.WOPIDiscoveryInvalidation
class
WOPIServiceImpl.WOPIDiscoveryInvalidator
-
Field Summary
Fields Modifier and Type Field Description protected String
discoveryURL
protected Map<String,Map<String,String>>
extensionActionURLs
protected Map<String,String>
extensionAppNames
protected WOPIServiceImpl.WOPIDiscoveryInvalidator
invalidator
protected PublicKey
oldProofKey
static String
PLACEHOLDER_IS_LICENSED_USER
static String
PLACEHOLDER_IS_LICENSED_USER_VALUE
protected PublicKey
proofKey
static String
SUPPORTED_APP_NAMES_PROPERTY_KEY
protected static String
WOPI_DISCOVERY_INVAL_PUBSUB_TOPIC
static String
WOPI_PROPERTY_NAMESPACE
-
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 byte[]
fetchDiscovery()
protected void
fireRefreshDiscovery()
String
getActionURL(Blob blob, String action)
Returns the WOPI action url given ablob
and anaction
.protected byte[]
getDiscovery()
protected String
getExtension(Blob blob)
protected KeyValueStore
getKeyValueStore()
protected List<String>
getSupportedAppNames()
WOPIBlobInfo
getWOPIBlobInfo(Blob blob)
Returns aWOPIBlobInfo
for the given blob if it is supported by WOPI,null
otherwise.protected boolean
hasDiscoveryURL()
boolean
isEnabled()
Returns @{code true} if WOPI is enabled,false
otherwise.protected void
loadDiscovery()
protected boolean
loadDiscovery(byte[] discoveryBytes)
boolean
refreshDiscovery()
Refreshes the WOPI discovery: fetches the data from the discovery URL, stores it and loads it in memory.protected void
registerApp(WOPIDiscovery.App app)
protected void
registerInvalidator()
void
start(ComponentContext context)
Start the component.protected void
storeDiscovery(byte[] discoveryBytes)
boolean
verifyProofKey(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, stop, 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
-
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
-
WOPI_DISCOVERY_INVAL_PUBSUB_TOPIC
protected static final String WOPI_DISCOVERY_INVAL_PUBSUB_TOPIC
- See Also:
- Constant Field Values
-
extensionAppNames
protected Map<String,String> extensionAppNames
-
oldProofKey
protected PublicKey oldProofKey
-
discoveryURL
protected String discoveryURL
-
invalidator
protected WOPIServiceImpl.WOPIDiscoveryInvalidator invalidator
-
-
Constructor Detail
-
WOPIServiceImpl
public WOPIServiceImpl()
-
-
Method Detail
-
start
public void start(ComponentContext context)
Description copied from interface:Component
Start the component. This method is called after all the components were resolved and activated- Specified by:
start
in interfaceComponent
- Overrides:
start
in classDefaultComponent
-
hasDiscoveryURL
protected boolean hasDiscoveryURL()
-
registerInvalidator
protected void registerInvalidator()
-
loadDiscovery
protected void loadDiscovery()
-
loadDiscovery
protected boolean loadDiscovery(byte[] discoveryBytes)
-
fireRefreshDiscovery
protected void fireRefreshDiscovery()
-
getSupportedAppNames
protected List<String> getSupportedAppNames()
-
registerApp
protected void registerApp(WOPIDiscovery.App app)
-
isEnabled
public boolean isEnabled()
Description copied from interface:WOPIService
Returns @{code true} if WOPI is enabled,false
otherwise.The WOPI discovery XML file has been loaded.
- Specified by:
isEnabled
in interfaceWOPIService
-
getWOPIBlobInfo
public WOPIBlobInfo getWOPIBlobInfo(Blob blob)
Description copied from interface:WOPIService
Returns aWOPIBlobInfo
for the given blob if it is supported by WOPI,null
otherwise.- Specified by:
getWOPIBlobInfo
in interfaceWOPIService
-
getActionURL
public String getActionURL(Blob blob, String action)
Description copied from interface:WOPIService
Returns the WOPI action url given ablob
and anaction
.- Specified by:
getActionURL
in interfaceWOPIService
-
getExtension
protected String getExtension(Blob blob)
-
verifyProofKey
public boolean verifyProofKey(String proofKeyHeader, String oldProofKeyHeader, String url, String accessToken, String timestampHeader)
Description copied from interface:WOPIService
Verifies that the request originate from Office Online.- Specified by:
verifyProofKey
in interfaceWOPIService
-
refreshDiscovery
public boolean refreshDiscovery()
Description copied from interface:WOPIService
Refreshes the WOPI discovery: fetches the data from the discovery URL, stores it and loads it in memory.- Specified by:
refreshDiscovery
in interfaceWOPIService
- Returns:
true
if refreshing the discovery has succeeded,false
otherwise
-
fetchDiscovery
protected byte[] fetchDiscovery()
-
getDiscovery
protected byte[] getDiscovery()
-
storeDiscovery
protected void storeDiscovery(byte[] discoveryBytes)
-
getKeyValueStore
protected KeyValueStore getKeyValueStore()
-
-