org.entityfs.util.lock.cmd
Class LockCommandUtil

java.lang.Object
  extended by org.entityfs.util.lock.cmd.LockCommandUtil

public final class LockCommandUtil
extends Object

Utility class with static methods for acquiring locks.

Since:
1.0
Author:
Karl Gustafsson

Method Summary
static Collection<LockCommand> getLockCommandCollection(LockCommand... cmds)
          Get a collection containing all supplied lock commands.
static Collection<LockCommand> getLockCommandsForAccessControls(Entity... ents)
          Get the lock commands required for acquiring the locks required for performing access controls on the supplied entities.
static Collection<LockCommand> getLockCommandsForAccessControlsOrNull(Entity... ents)
          Get the lock commands required for acquiring the locks required for performing access controls on the supplied entities.
static LockCollection lock(Collection<? extends LockCommand> cmds)
          Use the file system's LockCommandExecutor to execute all supplied lock commands.
static LockCollection lock(LockCommand... cmds)
          Use the file system's LockCommandExecutor to execute all supplied lock commands.
static LockCollection lockForAccessControllingMethod(Collection<? extends LockCommand> cmds, Entity... ents)
          Execute the supplied lock commands and lock all necessary locks for performing access controls on the supplied entities.
static LockCollection lockForAccessControllingMethod(LockCommand[] cmds, Entity... ents)
          Execute the supplied lock commands and lock all necessary locks for performing access controls on the supplied entities.
static LockCollection lockForAccessControllingMethod(LockCommand cmd, Entity... ents)
          Execute the supplied lock command and lock all necessary locks for performing access controls on the supplied entities.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getLockCommandCollection

public static Collection<LockCommand> getLockCommandCollection(LockCommand... cmds)
Get a collection containing all supplied lock commands.

Parameters:
cmds - The lock commands. May be empty.
Returns:
A lock command collection, or null if the supplied array was empty.

getLockCommandsForAccessControlsOrNull

public static Collection<LockCommand> getLockCommandsForAccessControlsOrNull(Entity... ents)
Get the lock commands required for acquiring the locks required for performing access controls on the supplied entities.

Parameters:
ents - The entities to perform access controls on. May be empty or null.
Returns:
All commands necessary, or null if no locking is required.

getLockCommandsForAccessControls

public static Collection<LockCommand> getLockCommandsForAccessControls(Entity... ents)
Get the lock commands required for acquiring the locks required for performing access controls on the supplied entities.

Parameters:
ents - The entities to perform access controls on. May be empty or null.
Returns:
All commands necessary, or an empty collection if no locking is required.

lock

public static LockCollection lock(Collection<? extends LockCommand> cmds)
Use the file system's LockCommandExecutor to execute all supplied lock commands.

Parameters:
cmds - The lock commands to execute. May be null.
Returns:
A lock collection containing all locked locks. For entities that live in file systems that are not locking, no locks will be added to the collection.
See Also:
lockForAccessControllingMethod(Collection, Entity[])

lock

public static LockCollection lock(LockCommand... cmds)
Use the file system's LockCommandExecutor to execute all supplied lock commands.

Parameters:
cmds - The lock commands to execute.
Returns:
A lock collection containing all locked locks. For entities that live in file systems that are not locking, no locks will be added to the collection.
Since:
1.1
See Also:
lockForAccessControllingMethod(LockCommand[], Entity...)

lockForAccessControllingMethod

public static LockCollection lockForAccessControllingMethod(LockCommand[] cmds,
                                                            Entity... ents)
Execute the supplied lock commands and lock all necessary locks for performing access controls on the supplied entities.

Parameters:
cmds - The lock commands to execute. May be null.
ents - The entities to acquire locks for future authorization controls on. May be empty.
Returns:
A lock collection containing all locked locks. For entities that live in file systems that are not locking, no locks will be added to the collection. (Neither from the supplied lock commands nor from lock commands required for access controls.)
See Also:
lock(Collection), lockForAccessControllingMethod(Collection, Entity[]), lockForAccessControllingMethod(LockCommand, Entity[])

lockForAccessControllingMethod

public static LockCollection lockForAccessControllingMethod(LockCommand cmd,
                                                            Entity... ents)
                                                     throws NullPointerException
Execute the supplied lock command and lock all necessary locks for performing access controls on the supplied entities.

Parameters:
cmd - The lock command to execute.
ents - The entities to acquire locks for future authorization controls on. May be empty.
Returns:
A lock collection containing all locked locks. For entities that live in file systems that are not locking, no locks will be added to the collection. (Neither from the supplied lock commands nor from lock commands required for access controls.)
Throws:
NullPointerException - If cmd is null.
See Also:
lock(Collection), lockForAccessControllingMethod(Collection, Entity[]), lockForAccessControllingMethod(LockCommand[], Entity[])

lockForAccessControllingMethod

public static LockCollection lockForAccessControllingMethod(Collection<? extends LockCommand> cmds,
                                                            Entity... ents)
Execute the supplied lock commands and lock all necessary locks for performing access controls on the supplied entities.

Parameters:
cmds - The lock commands to execute. May be null.
ents - The entities to acquire locks for future authorization controls on. May be empty.
Returns:
A lock collection containing all locked locks. For entities that live in file systems that are not locking, no locks will be added to the collection. (Neither from the supplied lock commands nor from lock commands required for access controls.)
See Also:
lock(Collection), lockForAccessControllingMethod(LockCommand[], Entity[]), lockForAccessControllingMethod(LockCommand, Entity[])