@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 WebApp. 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.
Please note that this API is not marked as final and it can change in one of the next versions of the application. If you have suggestions, comments about it, please let us know.
| Constructor and Description |
|---|
LockHandlerWithContext() |
| Modifier and Type | Method and Description |
|---|---|
abstract boolean |
isSaveAllowed(java.lang.String contextId,
java.net.URL url,
int timeoutSeconds)
Checks if save is allowed for a resource identified by its URL.
|
boolean |
isSaveAllowed(java.net.URL url,
int timeoutSeconds)
Checks if save is allowed for a resource identified by its URL.
|
abstract void |
unlock(java.lang.String contextId,
java.net.URL resource)
Unlock a specific resource
|
void |
unlock(java.net.URL resource)
Unlock a specific resource
|
abstract void |
updateLock(java.lang.String contextId,
java.net.URL resource,
int timeoutSeconds)
Lock a specific resource if it has never been locked before or refresh the lock.
|
void |
updateLock(java.net.URL resource,
int timeoutSeconds)
Lock a specific resource if it has never been locked before or refresh the lock.
|
isLockEnabledpublic final boolean isSaveAllowed(java.net.URL url,
int timeoutSeconds)
isSaveAllowed in class LockHandlerBaseurl - The URL for which the check is performed.timeoutSeconds - The timeout in seconds to set for the lock .true if saving is allowed.public abstract boolean isSaveAllowed(java.lang.String contextId,
java.net.URL url,
int timeoutSeconds)
contextId - The ID of the user context, as defined by the
URLStreamHandlerWithContext 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 .true if saving is allowed.public final void unlock(java.net.URL resource)
throws LockException
resource - The URL to unlockLockException - When could not unlock properly.public abstract void unlock(java.lang.String contextId,
java.net.URL resource)
throws LockException
contextId - The ID of the user context, as defined by the
URLStreamHandlerWithContext implementation for the URL's protocol.resource - The URL to unlockLockException - When could not unlock properly.public final void updateLock(java.net.URL resource,
int timeoutSeconds)
throws LockException
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.LockException - When could not lock properly.public abstract void updateLock(java.lang.String contextId,
java.net.URL resource,
int timeoutSeconds)
throws LockException
contextId - The ID of the user context, as defined by the
URLStreamHandlerWithContext 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.LockException - When could not lock properly.© Copyright SyncRO Soft SRL 2002 - 2016. All rights reserved.