Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.modeshape.graph.request
Class LockBranchRequest

    java.lang.Object
      org.modeshape.graph.request.Request
          org.modeshape.graph.request.ChangeRequest
              org.modeshape.graph.request.LockBranchRequest

All Implemented Interfaces:
  Serializable, Cloneable

    public class LockBranchRequest

extends ChangeRequest

Instruction to lock an existing node or branch. Connectors that do not support locking must ignore this request.

See Also:
  Serialized Form

Nested Class Summary
`static class` | `LockBranchRequest.LockScope`

Constructor Summary
`LockBranchRequest(Location at, String workspaceName, LockBranchRequest.LockScope isDeep, long lockTimeoutInMillis)` Create a request to lock the node or branch at the supplied location.

Method Summary
`Location` | `at()` Get the location defining the node that is to be read.
`void` | `cancel()` Cancel this request.
`Location` | `changedLocation()` Get the location of the top-most node that is to be changed by this request.
`String` | `changedWorkspace()` Get the name of the workspace that was changed by this request.
`boolean` | `changes(String workspace, Path path)` Determine if this request changes the branch at the given path.
`LockBranchRequest` | `clone()` This method does not clone the results.
`boolean` | `equals(Object obj)`
`Location` | `getActualLocation()` Get the actual location of the node that was locked.
`RequestType` | `getType()` Returns the type of the request
`int` | `hashCode()`
`String` | `inWorkspace()` Get the name of the workspace in which the node exists.
`boolean` | `isReadOnly()` Return whether this request only reads information.
`LockBranchRequest.LockScope` | `lockScope()` Get whether the lock should include all of the descendants of the node as well as the node itself
`long` | `lockTimeoutInMillis()` Gets the maximum length of the lock in milliseconds
`void` | `setActualLocation(Location actualLocation)` Sets the actual and complete location of the node being locked.
`String` | `toString()`

Methods inherited from class org.modeshape.graph.request.Request
`checkNotFrozen, freeze, getError, hasError, isCancelled, isFrozen, printable, printable, setError, setLatchForFreezing`

Methods inherited from class java.lang.Object
`finalize, getClass, notify, notifyAll, wait, wait, wait`

Constructor Detail

### LockBranchRequest

    public LockBranchRequest(Location at,
                             String workspaceName,
                             LockBranchRequest.LockScope isDeep,
                             long lockTimeoutInMillis)

  Create a request to lock the node or branch at the supplied location.

  Parameters:
    `at` - the location of the node to be read
    `workspaceName` - the name of the workspace containing the node
    `isDeep` - whether the lock should be deep (i.e., should include all of the node's descendants)
    `lockTimeoutInMillis` - the number of milliseconds that the lock should last before the lock times out; zero (0) indicates that the connector default should be used
  Throws:
    `IllegalArgumentException` - if the location or workspace name is null

Method Detail

### isReadOnly

    public boolean isReadOnly()

  Return whether this request only reads information.

  Specified by:
    `isReadOnly` in class `Request`
  Returns:
    true if this request reads information, or false if it requests that the repository content be changed in some way
  See Also:
    `Request.isReadOnly()`

### at

    public Location at()

  Get the location defining the node that is to be read.

  Returns:
    the location of the node; never null

### inWorkspace

    public String inWorkspace()

  Get the name of the workspace in which the node exists.

  Returns:
    the name of the workspace; never null

### lockScope

    public LockBranchRequest.LockScope lockScope()

  Get whether the lock should include all of the descendants of the node as well as the node itself

  Returns:
    `LockBranchRequest.LockScope.SELF_AND_DESCENDANTS` if the lock should include all of the descendants of the node, `LockBranchRequest.LockScope.SELF_ONLY` otherwise

### lockTimeoutInMillis

    public long lockTimeoutInMillis()

  Gets the maximum length of the lock in milliseconds

  Returns:
    the number of milliseconds that the lock should last before the lock times out; zero (0) indicates that the connector default should be used

### setActualLocation

    public void setActualLocation(Location actualLocation)

  Sets the actual and complete location of the node being locked. This method must be called when processing the request, and the actual location must have a `path`.

  Parameters:
    `actualLocation` - the actual location of the node before being locked
  Throws:
    `IllegalArgumentException` - if the either location is null or is missing its path
    `IllegalStateException` - if the request is frozen

### getActualLocation

    public Location getActualLocation()

  Get the actual location of the node that was locked.

  Returns:
    the actual location of the node being locked, or null if the actual location was not set

### changes

    public boolean changes(String workspace,
                           Path path)

  Determine if this request changes the branch at the given path.

  Specified by:
    `changes` in class `ChangeRequest`
  Parameters:
    `workspace` - the name of the workspace; may not be null
    `path` - the path; may not be null
  Returns:
    true if this request changes a node under the given path
  See Also:
    `ChangeRequest.changes(java.lang.String, org.modeshape.graph.property.Path)`

### changedLocation

    public Location changedLocation()

  Get the location of the top-most node that is to be changed by this request. If this request has been completed, this location will always have a `path`.

  Specified by:
    `changedLocation` in class `ChangeRequest`
  Returns:
    the location changed by this request
  See Also:
    `ChangeRequest.changedLocation()`

### changedWorkspace

    public String changedWorkspace()

  Get the name of the workspace that was changed by this request.

  Specified by:
    `changedWorkspace` in class `ChangeRequest`
  Returns:
    the name of the workspace changed by this request
  See Also:
    `ChangeRequest.changedWorkspace()`

### cancel

    public void cancel()

  Cancel this request. After this method is called, the `cancellation flag` is set, and any current or future processing of the request may be affected by the cancellation. (Note however, that processors may choose to not respect this request.)

  This method is safe to be called by different threads.

  Overrides:
    `cancel` in class `Request`
  See Also:
    `Request.cancel()`

### hashCode

    public int hashCode()

  Overrides:
    `hashCode` in class `Object`
  See Also:
    `Object.hashCode()`

### equals

    public boolean equals(Object obj)

  Overrides:
    `equals` in class `Object`
  See Also:
    `Object.equals(java.lang.Object)`

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`
  See Also:
    `Object.toString()`

### clone

    public LockBranchRequest clone()

  This method does not clone the results.

  This method does not clone the results.

  Specified by:
    `clone` in class `ChangeRequest`
  See Also:
    `ChangeRequest.clone()`

### getType

    public RequestType getType()

  Description copied from class: `Request`
  Returns the type of the request

  Specified by:
    `getType` in class `Request`
  Returns:
    the type of the request

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2008-2012 JBoss, a division of Red Hat. All Rights Reserved.