Package org.alfresco.repo.webdav
Class LockInfoImpl
java.lang.Object
org.alfresco.repo.webdav.LockInfoImpl
- All Implemented Interfaces:
Serializable,LockInfo
Class to represent a WebDAV lock info. Instances of this class are accessible my multiple threads as they are kept in the
LockStore. Clients of this class are expected to synchronise externally using the provided ReentrantReadWriteLock.- Author:
- Ivan Rybnikov
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructorLockInfoImpl(String token, String scope, String depth) Constructor -
Method Summary
Modifier and TypeMethodDescriptionvoidaddSharedLockToken(String token) Adds new shared lock token to sharedLockTokens list.protected DatedateNow()Hook to allow unit testing - gets the current date/time.static LockInfogetDepth()Returns lock depthGetter for exclusive lock token.Retrieve the expiry date/time for this lock, or null if it never expires.getOwner()Who owns the lock?longRemaining time before lock expires, in seconds.getScope()Returns lock scopeGetter for sharedLockTokens list.booleanIs it an exclusive lock?booleanWhether this lock has expired.booleanisLocked()Returns true if node has shared or exclusive locksbooleanisShared()Is it a shared lock?voidSetter for lock depthvoidsetExclusiveLockToken(String token) Setter for exclusive lock tokenvoidsetExpires(Date expires) Set the expiry date/time for this lock.voidSet the username of who owns the lock.voidSetter for lock scope.voidsetSharedLockTokens(Set<String> sharedLockTokens) Setter for sharedLockTokens list.voidsetTimeoutMinutes(int lockTimeoutMins) Sets the expiry date/time to lockTimeout minutes into the future.voidsetTimeoutSeconds(int lockTimeoutSecs) Sets the expiry date/time to lockTimeout seconds into the future.toJSON()toString()Return the lock info as a string
-
Field Details
-
ADDINFO_WEBDAV_MARKER
- See Also:
-
-
Constructor Details
-
LockInfoImpl
public LockInfoImpl()Default constructor -
LockInfoImpl
Constructor- Parameters:
token- Exclusive lock tokenscope- Lock scope (shared/exclusive)depth- Lock depth (0/infinity)
-
-
Method Details
-
isLocked
public boolean isLocked()Returns true if node has shared or exclusive locks -
setExclusiveLockToken
Setter for exclusive lock token- Specified by:
setExclusiveLockTokenin interfaceLockInfo- Parameters:
token- Lock token
-
getExclusiveLockToken
Getter for exclusive lock token.- Specified by:
getExclusiveLockTokenin interfaceLockInfo- Returns:
- String
-
setScope
Setter for lock scope. -
getScope
Returns lock scope -
setDepth
Setter for lock depth -
getDepth
Returns lock depth -
toString
Return the lock info as a string -
toJSON
-
fromJSON
-
isExpired
public boolean isExpired()Whether this lock has expired. If no expiry is set (i.e. expires is null) then false is always returned. -
isExclusive
public boolean isExclusive()Is it an exclusive lock?- Specified by:
isExclusivein interfaceLockInfo- Returns:
- true if exclusive.
-
getOwner
Who owns the lock? -
setOwner
Set the username of who owns the lock. -
setExpires
Set the expiry date/time for this lock. Set to null for never expires.- Specified by:
setExpiresin interfaceLockInfo- Parameters:
expires- the expires to set
-
getExpires
Retrieve the expiry date/time for this lock, or null if it never expires.- Specified by:
getExpiresin interfaceLockInfo- Returns:
- the expires
-
getRemainingTimeoutSeconds
public long getRemainingTimeoutSeconds()Remaining time before lock expires, in seconds.- Specified by:
getRemainingTimeoutSecondsin interfaceLockInfo
-
setTimeoutSeconds
public void setTimeoutSeconds(int lockTimeoutSecs) Sets the expiry date/time to lockTimeout seconds into the future. Provide a lockTimeout of WebDAV.TIMEOUT_INFINITY for never expires.- Specified by:
setTimeoutSecondsin interfaceLockInfo- Parameters:
lockTimeoutSecs- int
-
setTimeoutMinutes
public void setTimeoutMinutes(int lockTimeoutMins) Sets the expiry date/time to lockTimeout minutes into the future. Provide a lockTimeout of WebDAV.TIMEOUT_INFINITY for never expires.- Specified by:
setTimeoutMinutesin interfaceLockInfo- Parameters:
lockTimeoutMins- int
-
dateNow
Hook to allow unit testing - gets the current date/time.- Returns:
- Date
-