org.alfresco.repo.avm.locking
Class AVMLockingServiceImpl

java.lang.Object
  extended by org.alfresco.repo.avm.locking.AVMLockingServiceImpl
All Implemented Interfaces:
AVMLockingService

public class AVMLockingServiceImpl
extends java.lang.Object
implements AVMLockingService

Implementation of the lock service.


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.alfresco.service.cmr.avm.locking.AVMLockingService
AVMLockingService.Type
 
Field Summary
static java.lang.String LOCK_TABLE
           
static java.lang.String STORES
           
static java.lang.String USERS
           
static java.lang.String WEB_PROJECTS
           
 
Constructor Summary
AVMLockingServiceImpl()
           
 
Method Summary
 void addWebProject(java.lang.String webProject)
          Add a web project to the locking tables if it doesn't already exist.
 AVMLock getLock(java.lang.String webProject, java.lang.String path)
          Get a lock on a given path
 java.util.List getStoreLocks(java.lang.String store)
          Get all locks that reside in a given store.
 java.util.List getUsersLocks(java.lang.String user)
          Get all the locks that a user owns.
 java.util.List getWebProjectLocks(java.lang.String webProject)
          Get all locks in a give web project.
 java.util.List getWebProjects()
          Get the names of all the web projects the service knows about.
 boolean hasAccess(NodeRef webProjectRef, java.lang.String avmPath, java.lang.String user)
          Is the user allowed to do anything to the given asset, other than read?
 boolean hasAccess(java.lang.String webProject, java.lang.String avmPath, java.lang.String user)
          Is the user allowed to do anything to the given asset, other than read?
 void init()
           
 void lockPath(AVMLock lock)
          Creates a lock of the given type on a path.
 void modifyLock(java.lang.String webProject, java.lang.String path, java.lang.String newPath, java.lang.String newStore, java.util.List usersToRemove, java.util.List usersToAdd)
          Modify a lock.
 void removeLock(java.lang.String webProject, java.lang.String path)
          Remove a lock.
 void removeLocksInDirectory(java.lang.String webProject, java.lang.String store, java.lang.String path)
          Remove all locks on files contained within a directory.
 void removeStoreLocks(java.lang.String store)
          Removes all locks residing in a store.
 void removeWebProject(java.lang.String webProject)
          Remove a web project and all associated data from the locking tables.
 void setAttributeService(AttributeService service)
          Setter for AttributeService reference.
 void setAuthorityService(AuthorityService service)
          Set the authority service reference.
 void setNodeService(NodeService service)
           
 void setPersonService(PersonService service)
          Set the person service reference.
 void setRetryingTransactionHelper(RetryingTransactionHelper helper)
          Setter for RetryingTransactionHelper reference.
 void setSearchService(SearchService service)
           
 void setWebProjectStore(java.lang.String webProjectStore)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOCK_TABLE

public static final java.lang.String LOCK_TABLE
See Also:
Constant Field Values

WEB_PROJECTS

public static final java.lang.String WEB_PROJECTS
See Also:
Constant Field Values

USERS

public static final java.lang.String USERS
See Also:
Constant Field Values

STORES

public static final java.lang.String STORES
See Also:
Constant Field Values
Constructor Detail

AVMLockingServiceImpl

public AVMLockingServiceImpl()
Method Detail

setWebProjectStore

public void setWebProjectStore(java.lang.String webProjectStore)
Parameters:
webProjectStore - The webProjectStore to set

setAttributeService

public void setAttributeService(AttributeService service)
Setter for AttributeService reference.

Parameters:
service -

setAuthorityService

public void setAuthorityService(AuthorityService service)
Set the authority service reference.

Parameters:
service -

setPersonService

public void setPersonService(PersonService service)
Set the person service reference.

Parameters:
service -

setRetryingTransactionHelper

public void setRetryingTransactionHelper(RetryingTransactionHelper helper)
Setter for RetryingTransactionHelper reference.

Parameters:
helper -

setSearchService

public void setSearchService(SearchService service)

setNodeService

public void setNodeService(NodeService service)

init

public void init()

getLock

public AVMLock getLock(java.lang.String webProject,
                       java.lang.String path)
Description copied from interface: AVMLockingService
Get a lock on a given path

Specified by:
getLock in interface AVMLockingService
Parameters:
webProject - The website for which to get the lock.
path - The path to check for a lock.
Returns:
The Lock structure or null if there is no lock.

getUsersLocks

public java.util.List getUsersLocks(java.lang.String user)
Description copied from interface: AVMLockingService
Get all the locks that a user owns.

Specified by:
getUsersLocks in interface AVMLockingService
Parameters:
user - The name of the user.
Returns:
The (possibly empty list) of the user's locks.

lockPath

public void lockPath(AVMLock lock)
Description copied from interface: AVMLockingService
Creates a lock of the given type on a path. The lock is used to control access to all the corresponding paths in the given path's web project.

Specified by:
lockPath in interface AVMLockingService
Parameters:
lock - The lock structure to create.

removeLock

public void removeLock(java.lang.String webProject,
                       java.lang.String path)
Description copied from interface: AVMLockingService
Remove a lock.

Specified by:
removeLock in interface AVMLockingService
Parameters:
webProject - The web project the lock lives in.
path - The store relative path of the lock.

removeLocksInDirectory

public void removeLocksInDirectory(java.lang.String webProject,
                                   java.lang.String store,
                                   java.lang.String path)
Description copied from interface: AVMLockingService
Remove all locks on files contained within a directory.

Specified by:
removeLocksInDirectory in interface AVMLockingService

addWebProject

public void addWebProject(java.lang.String webProject)
Description copied from interface: AVMLockingService
Add a web project to the locking tables if it doesn't already exist.

Specified by:
addWebProject in interface AVMLockingService
Parameters:
webProject - The web project name.

getWebProjectLocks

public java.util.List getWebProjectLocks(java.lang.String webProject)
Description copied from interface: AVMLockingService
Get all locks in a give web project.

Specified by:
getWebProjectLocks in interface AVMLockingService
Parameters:
webProject - The web project name.
Returns:
All the locks found.

removeWebProject

public void removeWebProject(java.lang.String webProject)
Description copied from interface: AVMLockingService
Remove a web project and all associated data from the locking tables.

Specified by:
removeWebProject in interface AVMLockingService
Parameters:
webProject - The web project name.

getStoreLocks

public java.util.List getStoreLocks(java.lang.String store)
Description copied from interface: AVMLockingService
Get all locks that reside in a given store.

Specified by:
getStoreLocks in interface AVMLockingService
Parameters:
store - The store name.
Returns:
All the locks found.

modifyLock

public void modifyLock(java.lang.String webProject,
                       java.lang.String path,
                       java.lang.String newPath,
                       java.lang.String newStore,
                       java.util.List usersToRemove,
                       java.util.List usersToAdd)
Description copied from interface: AVMLockingService
Modify a lock. Null change parameters are ignored.

Specified by:
modifyLock in interface AVMLockingService
Parameters:
webProject - The name of the web project.
path - The path of the lock.
newPath - The path that the lock should be given. (may be null)
newStore - The store that the lock should be given. (may be null)
usersToRemove - List of users to remove from the lock. (may be null)
usersToAdd - List of users to add to the lock. (may be null)

removeStoreLocks

public void removeStoreLocks(java.lang.String store)
Description copied from interface: AVMLockingService
Removes all locks residing in a store.

Specified by:
removeStoreLocks in interface AVMLockingService
Parameters:
store - The store name.

hasAccess

public boolean hasAccess(java.lang.String webProject,
                         java.lang.String avmPath,
                         java.lang.String user)
Description copied from interface: AVMLockingService
Is the user allowed to do anything to the given asset, other than read?

Specified by:
hasAccess in interface AVMLockingService
Parameters:
webProject - The name of the web project that this path is being checked in.
avmPath - A full avmPath
user - The name of the user, group, role to check on.
Returns:
Whether the user has access.

hasAccess

public boolean hasAccess(NodeRef webProjectRef,
                         java.lang.String avmPath,
                         java.lang.String user)
Description copied from interface: AVMLockingService
Is the user allowed to do anything to the given asset, other than read?

Specified by:
hasAccess in interface AVMLockingService
Parameters:
webProjectRef - The NodeRef to the web project that this path is being checked in.
avmPath - A full avmPath
user - The name of the user, group, role to check on.
Returns:
Whether the user has access.

getWebProjects

public java.util.List getWebProjects()
Description copied from interface: AVMLockingService
Get the names of all the web projects the service knows about.

Specified by:
getWebProjects in interface AVMLockingService
Returns:
The list of web project names.


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