org.modeshape.graph.request
Class SetPropertyRequest

java.lang.Object
  extended by org.modeshape.graph.request.Request
      extended by org.modeshape.graph.request.ChangeRequest
          extended by org.modeshape.graph.request.SetPropertyRequest
All Implemented Interfaces:
Serializable, Cloneable

public class SetPropertyRequest
extends ChangeRequest

Instruction to set a particular property on the node at the specified location. This request never removes the node, even if the property is empty.

See Also:
Serialized Form

Constructor Summary
SetPropertyRequest(Location on, String workspaceName, Property property)
          Create a request to set the property on the node at the supplied location.
 
Method Summary
 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.
 SetPropertyRequest clone()
           This method does not clone the results.
 boolean equals(Object obj)
          
 Location getActualLocationOfNode()
          Get the actual location of the node that was updated.
 RequestType getType()
          Returns the type of the request
 int hashCode()
          
 String inWorkspace()
          Get the name of the workspace in which the node exists.
 boolean isNewProperty()
          Get whether the property was created.
 boolean isReadOnly()
          Return whether this request only reads information.
 Location on()
          Get the location defining the node that is to be updated.
 Property property()
          Get the property that is being set.
 void setActualLocationOfNode(Location actual)
          Sets the actual and complete location of the node being updated.
 void setNewProperty(boolean created)
          Record that the property did not exist prior to the processing of this request and was actually created by this request.
 String toString()
          
 
Methods inherited from class org.modeshape.graph.request.Request
checkNotFrozen, freeze, getError, hasError, isCancelled, isFrozen, setError, setLatchForFreezing
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SetPropertyRequest

public SetPropertyRequest(Location on,
                          String workspaceName,
                          Property property)
Create a request to set the property on the node at the supplied location.

Parameters:
on - the location of the node to be read
workspaceName - the name of the workspace containing the node
property - the new property on the node
Throws:
IllegalArgumentException - if the location, workspace name, or property 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()

on

public Location on()
Get the location defining the node that is to be updated.

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

property

public Property property()
Get the property that is being set.

Returns:
the new property; never null

setActualLocationOfNode

public void setActualLocationOfNode(Location actual)
Sets the actual and complete location of the node being updated. This method must be called when processing the request, and the actual location must have a path.

Parameters:
actual - the actual location of the node being updated, or null if the current location should be used
Throws:
IllegalArgumentException - if the actual location is not equal to the current location, or if the actual location does not have a path.
IllegalStateException - if the request is frozen

getActualLocationOfNode

public Location getActualLocationOfNode()
Get the actual location of the node that was updated.

Returns:
the actual location, or null if the actual location was not set

setNewProperty

public void setNewProperty(boolean created)
Record that the property did not exist prior to the processing of this request and was actually created by this request. This method must be called when processing the request, and the actual location must have a path .

Parameters:
created - true if the property was created by this request, or false if this request updated an existing property
Throws:
IllegalStateException - if the request is frozen

isNewProperty

public boolean isNewProperty()
Get whether the property was created.

Returns:
true if this request created the property, or false if this request changed an existing property

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)

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)

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()

toString

public String toString()

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

clone

public SetPropertyRequest 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


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