org.alfresco.service.cmr.avm.locking
Interface AVMLockingService

All Known Implementing Classes:
AVMLockingServiceImpl

public interface AVMLockingService

Service to handle AVM locking. Note that this service is a low-level service and does no "self-permissioning" e.g. checking ownership of locks.


Nested Class Summary
static class AVMLockingService.LockState
          Enumeration of the state of a lock's with respect to a specific user.
 
Method Summary
 java.util.Map getLockData(java.lang.String avmStore, java.lang.String path)
          Get the data associated with a lock
 java.lang.String getLockOwner(java.lang.String avmStore, java.lang.String path)
          Get the current holder of a lock on AVM store path
 AVMLockingService.LockState getLockState(java.lang.String avmStore, java.lang.String path, java.lang.String lockOwner)
          Get the state of a lock with respect to a given AVM store, path and user
 boolean hasAccess(org.alfresco.service.cmr.repository.NodeRef webProject, java.lang.String avmPath, java.lang.String lockOwner)
          Deprecated. This will move into a WCMLockingService
 boolean hasAccess(java.lang.String webProject, java.lang.String avmPath, java.lang.String lockOwner)
          Deprecated. This will move into a WCMLockingService
 void lock(java.lang.String avmStore, java.lang.String path, java.lang.String lockOwner, java.util.Map lockData)
          Creates a lock of the given type on a path within an AVM store.
 boolean modifyLock(java.lang.String avmStore, java.lang.String path, java.lang.String lockOwner, java.lang.String newAvmStore, java.lang.String newPath, java.util.Map lockData)
          Modify a lock if it exists or do nothing if it doesn't.
 void removeLock(java.lang.String avmStore, java.lang.String path)
          Remove a lock.
 void removeLocks(java.lang.String avmStore)
          Remove all locks for a specific AVM store
 void removeLocks(java.lang.String avmStore, java.util.Map lockDataToMatch)
          Remove all locks for a specific AVM store that also optionally match a map of lock data entries.
 void removeLocks(java.lang.String avmStore, java.lang.String dirPath, java.util.Map lockDataToMatch)
          Remove all locks for a specific AVM store that start with a given directory path that also optionally match a map of lock data entries.
 

Method Detail

lock

void lock(java.lang.String avmStore,
          java.lang.String path,
          java.lang.String lockOwner,
          java.util.Map lockData)
Creates a lock of the given type on a path within an AVM store.

Parameters:
avmStore - the name of the AVM store
path - the relative path of the lock
lockOwner - the user taking the lock
lockData - additional data to append to the lock

modifyLock

boolean modifyLock(java.lang.String avmStore,
                   java.lang.String path,
                   java.lang.String lockOwner,
                   java.lang.String newAvmStore,
                   java.lang.String newPath,
                   java.util.Map lockData)
Modify a lock if it exists or do nothing if it doesn't. The user supplied must already hold the lock if it exists.

Parameters:
avmStore - the name of the AVM store
path - the relative path of the lock
lockOwner - the user taking the lock and who must also own the existing lock
newAvmStore - the name of the new AVM store
newPath - the new relative path of the lock
lockData - the new additional data to append to the lock
Returns:
true if the lock was modified or false if no lock existed

getLockOwner

java.lang.String getLockOwner(java.lang.String avmStore,
                              java.lang.String path)
Get the current holder of a lock on AVM store path

Parameters:
avmStore - the name of the AVM store
path - the relative path of the lock
Returns:
Returns the user holding the lock or null

getLockState

AVMLockingService.LockState getLockState(java.lang.String avmStore,
                                         java.lang.String path,
                                         java.lang.String lockOwner)
Get the state of a lock with respect to a given AVM store, path and user

Parameters:
avmStore - the name of the AVM store
path - the relative path of the lock
lockOwner - the user who might own the lock
Returns:
the state of the lock with respect to the given user

getLockData

java.util.Map getLockData(java.lang.String avmStore,
                          java.lang.String path)
Get the data associated with a lock

Parameters:
avmStore - the name of the AVM store
path - the relative path of the lock
Returns:
the state of the lock with respect to the given user

removeLock

void removeLock(java.lang.String avmStore,
                java.lang.String path)
Remove a lock.

Parameters:
webProject - the name of the web project
path - the relative path of the lock

removeLocks

void removeLocks(java.lang.String avmStore)
Remove all locks for a specific AVM store

Parameters:
avmStore - the name of the AVM store

removeLocks

void removeLocks(java.lang.String avmStore,
                 java.lang.String dirPath,
                 java.util.Map lockDataToMatch)
Remove all locks for a specific AVM store that start with a given directory path that also optionally match a map of lock data entries.

Parameters:
avmStore - the name of the AVM store
dirPath - optional - start with given directory path or null to match all
lockDataToMatch - optional - lock data to match (note: all entries must match) or null/empty to match all

removeLocks

void removeLocks(java.lang.String avmStore,
                 java.util.Map lockDataToMatch)
Remove all locks for a specific AVM store that also optionally match a map of lock data entries.

Parameters:
avmStore - the name of the AVM store
lockDataToMatch - optional - lock data to match (note: all entries must match) or null/empty to match all

hasAccess

boolean hasAccess(java.lang.String webProject,
                  java.lang.String avmPath,
                  java.lang.String lockOwner)
Deprecated. This will move into a WCMLockingService

Is the user allowed to do anything to the given asset, other than read?

Parameters:
webProject - the name of the WCM project
path - the relative path of the lock
lockOwner - the user to check
Returns:
true if the user has access (either holds the lock or there is no lock, etc)

hasAccess

boolean hasAccess(org.alfresco.service.cmr.repository.NodeRef webProject,
                  java.lang.String avmPath,
                  java.lang.String lockOwner)
Deprecated. This will move into a WCMLockingService

Is the user allowed to do anything to the given asset, other than read?

Parameters:
webProject - the name of the WCM project
path - the relative path of the lock
lockOwner - the user to check
Returns:
true if the user has access (either holds the lock or there is no lock, etc)


Copyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.