/** * {@inheritDoc} * * @see org.modeshape.graph.request.processor.RequestProcessor#process(org.modeshape.graph.request.CreateWorkspaceRequest) */ @Override public void process( CreateWorkspaceRequest request ) { String msg = GraphI18n.federatedSourceDoesNotSupportCreatingWorkspaces.text(getSourceName()); request.setError(new InvalidRequestException(msg)); }
@Override public void process( CreateWorkspaceRequest request ) { // There's a separate flag to allow creating workspaces (which may not require modifying existing data) // if (!updatesAllowed(request)) return; if (!repository.isWritable()) { String msg = GraphI18n.sourceIsReadOnly.text(repository.getSourceName()); request.setError(new InvalidRequestException(msg)); return; } WritablePathRepository writableRepo = (WritablePathRepository)repository; PathWorkspace workspace = writableRepo.createWorkspace(getExecutionContext(), request.desiredNameOfNewWorkspace(), request.conflictBehavior()); if (workspace == null) { String msg = GraphI18n.workspaceAlreadyExistsInRepository.text(request.desiredNameOfNewWorkspace(), repository.getSourceName()); request.setError(new InvalidWorkspaceException(msg)); } else { request.setActualRootLocation(Location.create(pathFactory.createRootPath(), repository.getRootNodeUuid())); request.setActualWorkspaceName(workspace.getName()); recordChange(request); } }
/** * {@inheritDoc} * * @see org.modeshape.graph.request.processor.RequestProcessor#process(org.modeshape.graph.request.CreateWorkspaceRequest) */ @Override public void process( CreateWorkspaceRequest request ) { if (!creatingWorkspacesAllowed(request)) return; String clonedWorkspaceName = null; WorkspaceType workspace = repository.createWorkspace(txn, request.desiredNameOfNewWorkspace(), request.conflictBehavior(), clonedWorkspaceName); if (workspace == null) { String msg = GraphI18n.workspaceAlreadyExistsInRepository.text(request.desiredNameOfNewWorkspace(), repository.getSourceName()); request.setError(new InvalidWorkspaceException(msg)); } else { Node root = txn.getRootNode(workspace); request.setActualRootLocation(Location.create(pathFactory.createRootPath(), root.getUuid())); request.setActualWorkspaceName(workspace.getName()); recordChange(request); } }
/** * {@inheritDoc} * * @see org.modeshape.graph.request.processor.RequestProcessor#process(org.modeshape.graph.request.CreateWorkspaceRequest) */ @Override public void process( CreateWorkspaceRequest request ) { if (!updatesAllowed(request)) return; MapWorkspace workspace = repository.createWorkspace(getExecutionContext(), request.desiredNameOfNewWorkspace(), request.conflictBehavior()); if (workspace == null) { String msg = GraphI18n.workspaceAlreadyExistsInRepository.text(request.desiredNameOfNewWorkspace(), repository.getSourceName()); request.setError(new InvalidWorkspaceException(msg)); } else { MapNode root = workspace.getRoot(); request.setActualRootLocation(Location.create(pathFactory.createRootPath(), root.getUuid())); request.setActualWorkspaceName(workspace.getName()); recordChange(request); } }