/**
  * {@inheritDoc}
  *
  * @see
  *     org.modeshape.graph.request.processor.RequestProcessor#process(org.modeshape.graph.request.ReadAllPropertiesRequest)
  */
 @Override
 public void process(ReadAllPropertiesRequest request) {
   if (request == null) return;
   try {
     Workspace workspace = workspaceFor(request.inWorkspace());
     Node node = workspace.node(request.at());
     Location actualLocation = workspace.locationFor(node);
     request.setActualLocationOfNode(actualLocation);
     // Read the properties ...
     for (PropertyIterator iter = node.getProperties(); iter.hasNext(); ) {
       request.addProperty(workspace.propertyFor(iter.nextProperty()));
     }
     // Add in the 'jcr:uuid' property ...
     if (actualLocation.hasIdProperties()) {
       request.addProperty(workspace.propertyFor(ModeShapeLexicon.UUID, actualLocation.getUuid()));
     }
     // Get the number of children ...
     NodeIterator childIter = node.getNodes();
     int numChildren = (int) childIter.getSize();
     if (numChildren == -1) {
       numChildren = 0;
       while (childIter.hasNext()) {
         childIter.nextNode();
         ++numChildren;
       }
     }
     request.setNumberOfChildren(numChildren);
     setCacheableInfo(request);
   } catch (Throwable e) {
     request.setError(e);
   }
 }
 /**
  * {@inheritDoc}
  *
  * @see
  *     org.modeshape.graph.request.processor.RequestProcessor#process(org.modeshape.graph.request.ReadNodeRequest)
  */
 @Override
 public void process(ReadNodeRequest request) {
   if (request == null) return;
   try {
     Workspace workspace = workspaceFor(request.inWorkspace());
     Node node = workspace.node(request.at());
     Location actualLocation = workspace.locationFor(node);
     request.setActualLocationOfNode(actualLocation);
     // Read the children ...
     for (NodeIterator iter = node.getNodes(); iter.hasNext(); ) {
       request.addChild(workspace.locationFor(iter.nextNode()));
     }
     // Read the properties ...
     for (PropertyIterator iter = node.getProperties(); iter.hasNext(); ) {
       request.addProperty(workspace.propertyFor(iter.nextProperty()));
     }
     // Add in the 'jcr:uuid' property ...
     if (actualLocation.hasIdProperties()) {
       request.addProperty(workspace.propertyFor(ModeShapeLexicon.UUID, actualLocation.getUuid()));
     }
     setCacheableInfo(request);
   } catch (Throwable e) {
     request.setError(e);
   }
 }
 /**
  * Create a request to create a node with the given properties under the supplied location.
  *
  * @param parentLocation the location of the existing parent node, under which the new child
  *     should be created
  * @param workspaceName the name of the workspace containing the parent
  * @param childName the name of the new child to create under the existing parent
  * @param properties the properties of the new node, which should include any {@link
  *     Location#getIdProperties() identification properties} for the new node
  * @param conflictBehavior the expected behavior if an equivalently-named child already exists
  *     under the <code>into</code> location
  * @throws IllegalArgumentException if the location, workspace name, child name, or the conflict
  *     behavior is null
  */
 public CreateNodeRequest(
     Location parentLocation,
     String workspaceName,
     Name childName,
     NodeConflictBehavior conflictBehavior,
     Property... properties) {
   CheckArg.isNotNull(parentLocation, "parentLocation");
   CheckArg.isNotNull(workspaceName, "workspaceName");
   CheckArg.isNotNull(conflictBehavior, "conflictBehavior");
   CheckArg.isNotNull(childName, "childName");
   this.under = parentLocation;
   this.workspaceName = workspaceName;
   this.childName = childName;
   this.conflictBehavior = conflictBehavior;
   int number = properties.length + (under.hasIdProperties() ? under.getIdProperties().size() : 0);
   List<Property> props = new ArrayList<Property>(number);
   for (Property property : properties) {
     if (property != null) props.add(property);
   }
   this.properties = Collections.unmodifiableList(props);
 }