org.modeshape.graph.request
Class ReadAllPropertiesRequest

java.lang.Object
  extended by org.modeshape.graph.request.Request
      extended by org.modeshape.graph.request.CacheableRequest
          extended by org.modeshape.graph.request.ReadAllPropertiesRequest
All Implemented Interfaces:
Serializable, Iterable<Property>, Cacheable

public class ReadAllPropertiesRequest
extends CacheableRequest
implements Iterable<Property>

Instruction to read the properties and the number of children of the node at the specifed location.

See Also:
Serialized Form

Field Summary
static int UNKNOWN_NUMBER_OF_CHILDREN
           
 
Constructor Summary
ReadAllPropertiesRequest(Location at, String workspaceName)
          Create a request to read the properties and number of children of a node at the supplied location.
 
Method Summary
 void addProperties(Iterable<Property> properties)
          Add a property that was read from the RepositoryConnection
 void addProperties(Property... properties)
          Add a property that was read from the RepositoryConnection
 Property addProperty(Property property)
          Add a property that was read from the RepositoryConnection
 Location at()
          Get the location defining the node that is to be read.
 void cancel()
          Cancel this request.
 boolean equals(Object obj)
          
 Location getActualLocationOfNode()
          Get the actual location of the node whose properties were read.
 int getNumberOfChildren()
          Get the number of children for this node.
 Collection<Property> getProperties()
          Get the properties that were read from the RepositoryConnection.
 Map<Name,Property> getPropertiesByName()
          Get the properties that were read from the RepositoryConnection.
 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.
 Iterator<Property> iterator()
          
 void setActualLocationOfNode(Location actual)
          Sets the actual and complete location of the node whose properties have been read.
 void setNumberOfChildren(int numberOfChildren)
          Set the number of children for this node
 String toString()
          
 
Methods inherited from class org.modeshape.graph.request.CacheableRequest
getCachePolicy, getTimeLoaded, setCachePolicy, setTimeLoaded
 
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
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

UNKNOWN_NUMBER_OF_CHILDREN

public static final int UNKNOWN_NUMBER_OF_CHILDREN
See Also:
Constant Field Values
Constructor Detail

ReadAllPropertiesRequest

public ReadAllPropertiesRequest(Location at,
                                String workspaceName)
Create a request to read the properties and number of children of a node at the supplied location.

Parameters:
at - the location of the node to be read
workspaceName - the name of the workspace containing the node
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

getPropertiesByName

public Map<Name,Property> getPropertiesByName()
Get the properties that were read from the RepositoryConnection.

Returns:
the properties, as a map of property name to property; never null

getProperties

public Collection<Property> getProperties()
Get the properties that were read from the RepositoryConnection.

Returns:
the collection of properties; never null

iterator

public Iterator<Property> iterator()

Specified by:
iterator in interface Iterable<Property>
See Also:
Iterable.iterator()

addProperty

public Property addProperty(Property property)
Add a property that was read from the RepositoryConnection

Parameters:
property - the property that was read
Returns:
the previous property that had the same name, or null if there was no previously-recorded property with the same name
Throws:
IllegalArgumentException - if the property is null
IllegalStateException - if the request is frozen

addProperties

public void addProperties(Property... properties)
Add a property that was read from the RepositoryConnection

Parameters:
properties - the properties that were read
Throws:
IllegalArgumentException - if the property is null
IllegalStateException - if the request is frozen

addProperties

public void addProperties(Iterable<Property> properties)
Add a property that was read from the RepositoryConnection

Parameters:
properties - the properties that were read
Throws:
IllegalArgumentException - if the property is null
IllegalStateException - if the request is frozen

getNumberOfChildren

public int getNumberOfChildren()
Get the number of children for this node.

Returns:
the number of children, or UNKNOWN_NUMBER_OF_CHILDREN if the number of children was not yet read

setNumberOfChildren

public void setNumberOfChildren(int numberOfChildren)
Set the number of children for this node

Parameters:
numberOfChildren - the number of children
Throws:
IllegalArgumentException - if the number of childre is negative
IllegalStateException - if the request is frozen

setActualLocationOfNode

public void setActualLocationOfNode(Location actual)
Sets the actual and complete location of the node whose properties have been read. 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 read, or null if the current location should be used
Throws:
IllegalArgumentException - if the actual location is null or does not have a path.
IllegalStateException - if the request is frozen

getActualLocationOfNode

public Location getActualLocationOfNode()
Get the actual location of the node whose properties were read.

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

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

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-2012 JBoss, a division of Red Hat. All Rights Reserved.