/** * {@inheritDoc} * * @see org.modeshape.graph.request.processor.RequestProcessor#process(org.modeshape.graph.request.VerifyWorkspaceRequest) */ @Override public void process( VerifyWorkspaceRequest request ) { record(request); // Need to add this loopback in so we can use this with JCR layer test cases request.setActualWorkspaceName(request.getActualWorkspaceName() == null ? DEFAULT_WORKSPACE_NAME : request.getActualWorkspaceName()); request.setActualRootLocation(request.getActualLocationOfRoot() == null ? defaultWorkspaceRoot : request.getActualLocationOfRoot()); }
/** * {@inheritDoc} * * @see java.lang.Object#toString() */ @Override public String toString() { String workspaceName = this.workspaceName != null ? "'" + workspaceName() + "'" : "default"; return "verify workspace " + workspaceName; }
/** * {@inheritDoc} * <p> * This method does not clone the results. * </p> */ @Override public VerifyWorkspaceRequest clone() { return new VerifyWorkspaceRequest(workspaceName); } }
/** * Switch this graph to use another existing workspace in the same source. * * @param workspaceName the name of the existing workspace that this graph should begin using, or null if the graph should use * the "default" workspace in the source (if there is one) * @return the workspace; never null * @throws InvalidWorkspaceException if the workspace with the supplied name does not exist, or if null is supplied as the * workspace name but the source does not have a default workspace */ public Workspace useWorkspace( String workspaceName ) { VerifyWorkspaceRequest request = requests.verifyWorkspace(workspaceName); return setWorkspace(request.getActualWorkspaceName(), request.getActualLocationOfRoot()); }
@Override public void process( VerifyWorkspaceRequest request ) { PathWorkspace original = getWorkspace(request, request.workspaceName()); if (original != null) { Path path = getExecutionContext().getValueFactories().getPathFactory().createRootPath(); request.setActualRootLocation(Location.create(path, repository.getRootNodeUuid())); request.setActualWorkspaceName(original.getName()); } }
@SuppressWarnings( "synthetic-access" ) public void execute( ExecutionContext context, Request request ) throws RepositorySourceException { lastExecutedRequest = request; if (request instanceof VerifyWorkspaceRequest) { VerifyWorkspaceRequest workspaceRequest = (VerifyWorkspaceRequest)request; workspaceRequest.setActualRootLocation(Location.create(context.getValueFactories() .getPathFactory() .createRootPath())); workspaceRequest.setActualWorkspaceName("default"); } }
VerifyNodeExistsRequest readFromSource = (VerifyNodeExistsRequest)projectedRequest.getRequest(); if (readFromSource.hasError()) { request.setError(readFromSource.getError()); return; request.setError(null); if (readFromSource.isCancelled()) { request.cancel(); return; request.setActualRootLocation(actualLocation);
FederatedWorkspace workspace = getWorkspace(request, request.workspaceName()); if (workspace != null) { request.setActualWorkspaceName(workspace.getName());
/** * {@inheritDoc} * * @see org.modeshape.graph.request.processor.RequestProcessor#process(org.modeshape.graph.request.VerifyWorkspaceRequest) */ @Override public void process( VerifyWorkspaceRequest request ) { VerifyNodeExistsRequest source = (VerifyNodeExistsRequest)federatedRequest.getFirstProjectedRequest().getRequest(); if (checkErrorOrCancel(request, source)) return; assert source.getActualLocationOfNode().getPath().isRoot(); request.setActualRootLocation(source.getActualLocationOfNode()); }
/** * Set the actual location of the root node in the new workspace. * * @param actualLocationOfRoot the actual location of the workspace's root node. * @throws IllegalStateException if the request is frozen */ public void setActualRootLocation( Location actualLocationOfRoot ) { checkNotFrozen(); this.actualLocationOfRoot = actualLocationOfRoot; }
/** * {@inheritDoc} * * @see org.modeshape.graph.request.processor.RequestProcessor#process(org.modeshape.graph.request.VerifyWorkspaceRequest) */ @Override public void process( VerifyWorkspaceRequest request ) { MapWorkspace original = getWorkspace(request, request.workspaceName()); if (original != null) { Path path = getExecutionContext().getValueFactories().getPathFactory().createRootPath(); request.setActualRootLocation(Location.create(path, original.getRoot().getUuid())); request.setActualWorkspaceName(original.getName()); } }
/** * Set the actual name of the workspace. * * @param actualWorkspaceName the actual name of the workspace; never null * @throws IllegalStateException if the request is frozen */ public void setActualWorkspaceName( String actualWorkspaceName ) { checkNotFrozen(); CheckArg.isNotNull(actualWorkspaceName, "actualWorkspaceName"); this.actualWorkspaceName = actualWorkspaceName; }
/** * {@inheritDoc} * * @see org.modeshape.graph.request.processor.RequestProcessor#process(org.modeshape.graph.request.VerifyWorkspaceRequest) */ @Override public void process( VerifyWorkspaceRequest request ) { WorkspaceType original = getWorkspace(request, request.workspaceName()); if (original != null) { Path path = getExecutionContext().getValueFactories().getPathFactory().createRootPath(); Node root = txn.getRootNode(original); request.setActualRootLocation(Location.create(path, root.getUuid())); request.setActualWorkspaceName(original.getName()); } }
/** * {@inheritDoc} * * @see org.modeshape.graph.request.processor.RequestProcessor#process(org.modeshape.graph.request.VerifyWorkspaceRequest) */ @Override public void process( VerifyWorkspaceRequest request ) { record(request); // Need to add this loopback in so we can use this with JCR layer test cases request.setActualWorkspaceName(request.getActualWorkspaceName() == null ? DEFAULT_WORKSPACE_NAME : request.getActualWorkspaceName()); request.setActualRootLocation(request.getActualLocationOfRoot() == null ? defaultWorkspaceRoot : request.getActualLocationOfRoot()); }
/** * {@inheritDoc} * * @see java.lang.Object#equals(java.lang.Object) */ @Override public boolean equals( Object obj ) { if (obj == this) return true; if (this.getClass().isInstance(obj)) { VerifyWorkspaceRequest that = (VerifyWorkspaceRequest)obj; if (!this.workspaceName.equals(that.workspaceName())) return false; return true; } return false; }
/** * Add a request to verify the existance of the named workspace. * * @param workspaceName the desired name of the workspace, or null if the source's default workspace should be used * @return this builder for method chaining; never null */ public BatchRequestBuilder verifyWorkspace( String workspaceName ) { return add(new VerifyWorkspaceRequest(workspaceName)); }
@Override public void process( VerifyWorkspaceRequest request ) { // Just update the actual location String workspaceName = request.workspaceName(); if (workspaceName == null) workspaceName = "default"; request.setActualWorkspaceName(workspaceName); request.setActualRootLocation(Location.create(context.getValueFactories().getPathFactory().createRootPath())); }
/** * Add a request to verify the existance of the named workspace. * * @param workspaceName the desired name of the workspace, or null if the source's default workspace should be used * @return the request; never null */ public VerifyWorkspaceRequest verifyWorkspace( String workspaceName ) { return process(new VerifyWorkspaceRequest(workspaceName)); }