/** * Add a request to verify the existance and location of a node at the supplied location. * * @param at the location of the node to be verified * @param workspaceName the name of the workspace containing the node * @return the request; never null * @throws IllegalArgumentException if the location or workspace name is null */ public VerifyNodeExistsRequest verifyNodeExists( Location at, String workspaceName ) { return process(new VerifyNodeExistsRequest(at, workspaceName)); }
/** * Add a request to verify the existance and location of a node at the supplied location. * * @param at the location of the node to be verified * @param workspaceName the name of the workspace containing the node * @return this builder for method chaining; never null * @throws IllegalArgumentException if the location or workspace name is null */ public BatchRequestBuilder verifyNodeExists( Location at, String workspaceName ) { return add(new VerifyNodeExistsRequest(at, workspaceName)); }
/** * Process a request to lock a node or branch within a workspace * <p> * The default implementation of this method does nothing, as most connectors will not support locking. Any implementation of * this method should do nothing if the request is null. * </p> * <p> * Implementations that do support locking should throw a {@link LockFailedException} if the request could not be fulfilled. * </p> * * @param request the request */ public void process( LockBranchRequest request ) { Location actualLocation = request.at(); if (!actualLocation.hasPath()) { VerifyNodeExistsRequest nodeExists = new VerifyNodeExistsRequest(request.at(), request.inWorkspace()); process(nodeExists); if (nodeExists.hasError()) { request.setError(nodeExists.getError()); return; } actualLocation = nodeExists.getActualLocationOfNode(); } request.setActualLocation(actualLocation); }
/** * Process a request to unlock a node or branch within a workspace * <p> * The default implementation of this method does nothing, as most connectors will not support locking. Any implementation of * this method should do nothing if the request is null. * </p> * * @param request the request */ public void process( UnlockBranchRequest request ) { Location actualLocation = request.at(); if (!actualLocation.hasPath()) { VerifyNodeExistsRequest nodeExists = new VerifyNodeExistsRequest(request.at(), request.inWorkspace()); process(nodeExists); if (nodeExists.hasError()) { request.setError(nodeExists.getError()); return; } actualLocation = nodeExists.getActualLocationOfNode(); } request.setActualLocation(actualLocation); }
/** * {@inheritDoc} * * @see org.modeshape.graph.request.processor.RequestProcessor#process(org.modeshape.graph.request.VerifyNodeExistsRequest) */ @Override public void process( VerifyNodeExistsRequest request ) { // Figure out where this request is projected ... ProjectedNode projectedNode = project(request.at(), request.inWorkspace(), request, false); // Create the federated request ... FederatedRequest federatedRequest = new FederatedRequest(request); while (projectedNode != null) { if (projectedNode.isPlaceholder()) { PlaceholderNode placeholder = projectedNode.asPlaceholder(); // Create a request and set the results ... VerifyNodeExistsRequest placeholderRequest = new VerifyNodeExistsRequest(request.at(), request.inWorkspace()); placeholderRequest.setActualLocationOfNode(placeholder.location()); federatedRequest.add(placeholderRequest, true, true, null); } else if (projectedNode.isProxy()) { ProxyNode proxy = projectedNode.asProxy(); // Create and submit a request for the projection ... VerifyNodeExistsRequest pushDownRequest = new VerifyNodeExistsRequest(proxy.location(), proxy.workspaceName()); federatedRequest.add(pushDownRequest, proxy.isSameLocationAsOriginal(), false, proxy.projection()); } projectedNode = projectedNode.next(); } // Submit for processing ... submit(federatedRequest); }
VerifyNodeExistsRequest verifyRequest = new VerifyNodeExistsRequest(proxy.location(), proxy.workspaceName()); federatedRequest.add(verifyRequest, proxy.isSameLocationAsOriginal(), false, proxy.projection());
PlaceholderNode placeholder = projectedNode.asPlaceholder(); VerifyNodeExistsRequest placeholderRequest = new VerifyNodeExistsRequest(root, workspace.getName()); placeholderRequest.setActualLocationOfNode(placeholder.location()); federatedRequest.add(placeholderRequest, true, true, null); ProxyNode proxy = projectedNode.asProxy(); VerifyNodeExistsRequest pushDownRequest = new VerifyNodeExistsRequest(proxy.location(), proxy.workspaceName()); federatedRequest.add(pushDownRequest, proxy.isSameLocationAsOriginal(), false, proxy.projection());
VerifyNodeExistsRequest verifyRequest = new VerifyNodeExistsRequest(proxy.location(), proxy.workspaceName()); federatedRequest.add(verifyRequest, proxy.isSameLocationAsOriginal(), false, proxy.projection());
if (parentPath == null) { VerifyNodeExistsRequest verifySibling = new VerifyNodeExistsRequest(request.startingAfter(), request.inWorkspace()); process(verifySibling); actualSiblingLocation = verifySibling.getActualLocationOfNode();