Class LockHandlerWithContext
java.lang.Object
ro.sync.exml.plugin.lock.LockHandlerBase
ro.sync.ecss.extensions.api.webapp.plugin.LockHandlerWithContext
- All Implemented Interfaces:
LockHandler
@API(src=PRIVATE,
type=EXTENDABLE)
public abstract class LockHandlerWithContext
extends LockHandlerBase
A base-class to be extended to implement lock/unlock functionality.
This class should be used with URLs, for whose protocol the URLStreamHandler
implements
URLStreamHandlerWithContext
. It is this implementation which decides what contextId
means.
It is intended to be used in Oxygen XML Web Author. It provides similar functionality to LockHandlerBase
,
but is designed to work in a multi-user setting. Every method receives an extra parameter that identifies
the user on behalf of which the resource should be locked.
To make Web Author use this class, one should register a LockHandlerFactoryPluginExtension
.
- Since:
- 18
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract boolean
isSaveAllowed
(String contextId, URL url, int timeoutSeconds) Checks if save is allowed for a resource identified by its URL.final boolean
isSaveAllowed
(URL url, int timeoutSeconds) Checks if save is allowed for a resource identified by its URL.abstract void
Unlock a specific resourcefinal void
Unlock a specific resourceabstract void
updateLock
(String contextId, URL resource, int timeoutSeconds) Lock a specific resource if it has never been locked before or refresh the lock.final void
updateLock
(URL resource, int timeoutSeconds) Lock a specific resource if it has never been locked before or refresh the lock.Methods inherited from class ro.sync.exml.plugin.lock.LockHandlerBase
isLockEnabled
-
Constructor Details
-
LockHandlerWithContext
public LockHandlerWithContext()
-
-
Method Details
-
isSaveAllowed
Checks if save is allowed for a resource identified by its URL.- Specified by:
isSaveAllowed
in classLockHandlerBase
- Parameters:
url
- The URL for which the check is performed.timeoutSeconds
- The timeout in seconds to set for the lock .- Returns:
true
if saving is allowed.
-
isSaveAllowed
Checks if save is allowed for a resource identified by its URL.- Parameters:
contextId
- The ID of the user context, as defined by theURLStreamHandlerWithContext
implementation for the URL's protocol.url
- The URL for which the check is performed.timeoutSeconds
- The timeout in seconds to set for the lock .- Returns:
true
if saving is allowed.
-
unlock
Unlock a specific resource- Parameters:
resource
- The URL to unlock- Throws:
LockException
- When could not unlock properly.
-
unlock
Unlock a specific resource- Parameters:
contextId
- The ID of the user context, as defined by theURLStreamHandlerWithContext
implementation for the URL's protocol.resource
- The URL to unlock- Throws:
LockException
- When could not unlock properly.
-
updateLock
Lock a specific resource if it has never been locked before or refresh the lock. This will get called at the beginning to lock the resource and after that periodically.- Parameters:
resource
- The URL to lock.timeoutSeconds
- The timeout in seconds to set for the lock (so that the lock expires after the timeout passes). The refresh on the lock is called about every (timeout/2) seconds.- Throws:
LockException
- When could not lock properly.
-
updateLock
public abstract void updateLock(String contextId, URL resource, int timeoutSeconds) throws LockException Lock a specific resource if it has never been locked before or refresh the lock. This will get called at the beginning to lock the resource and after that periodically.- Parameters:
contextId
- The ID of the user context, as defined by theURLStreamHandlerWithContext
implementation for the URL's protocol.resource
- The URL to lock.timeoutSeconds
- The timeout in seconds to set for the lock (so that the lock expires after the timeout passes). The refresh on the lock is called about every (timeout/2) seconds.- Throws:
LockException
- When could not lock properly.
-