public PathRequestProcessor( ExecutionContext context, PathRepository repository, Observer observer, boolean updatesAllowed, PathRepositoryTransaction txn ) { super(repository.getSourceName(), context, observer); this.repository = repository; pathFactory = context.getValueFactories().getPathFactory(); this.updatesAllowed = updatesAllowed; this.txn = txn; }
public MapRequestProcessor( ExecutionContext context, MapRepository repository, Observer observer, boolean updatesAllowed ) { super(repository.getSourceName(), context, observer); this.repository = repository; pathFactory = context.getValueFactories().getPathFactory(); propertyFactory = context.getPropertyFactory(); this.updatesAllowed = updatesAllowed; }
/** * Create the node at the supplied path under the current path, and return the Create operation for the last node created. * The caller <i>must</i> call {@link Graph.Create#and()} to complete the operation. * * @param segment the name segment for the child * @return the newly-created but incomplete operation */ protected Graph.Create<Graph.Batch> createIfMissing( Name segment ) { Path nodePath = context.getValueFactories().getPathFactory().create(path, segment); Graph.Create<Graph.Batch> result = batch.create(nodePath).orUpdate(); return result; }
protected BaseTransaction( ExecutionContext context, Repository<NodeType, WorkspaceType> repository, UUID rootNodeUuid ) { this.rootNodeUuid = rootNodeUuid; this.context = context; this.propertyFactory = context.getPropertyFactory(); this.valueFactories = context.getValueFactories(); this.pathFactory = valueFactories.getPathFactory(); this.nameFactory = valueFactories.getNameFactory(); this.repository = repository; this.rootLocation = Location.create(pathFactory.createRootPath(), rootNodeUuid); }
/** * Utility to create a {@link Path.Segment} from a string, where there will be no index * * @param name the string form of the path segment, which may include a 1-based same-name-sibling index * @return the path object * @throws ValueFormatException if a path could not be created from the supplied string */ protected Path.Segment segment( String name ) { return context.getValueFactories().getPathFactory().createSegment(name); }
/** * Utility to create a {@link Path} from a string. * * @param path the string form of the path * @return the path object * @throws ValueFormatException if a path could not be created from the supplied string */ protected Path path( String path ) { return context.getValueFactories().getPathFactory().create(path); }
public void addChild( Location parent, String childName ) { Path path = context.getValueFactories().getPathFactory().create(parent.getPath(), segment(childName)); Map<Name, Property> properties = Collections.emptyMap(); List<ProjectedNode> grandChildren = Collections.emptyList(); PlaceholderNode child = new PlaceholderNode(Location.create(path), properties, grandChildren); this.children.add(child); }
public PathNode createNode( ExecutionContext context, String pathToNewNode, Map<Name, Property> properties, NodeConflictBehavior conflictBehavior ) { PathFactory pathFactory = context.getValueFactories().getPathFactory(); Path newPath = pathFactory.create(pathToNewNode); return createNode(context, getNode(newPath.getParent()), newPath.getLastSegment().getName(), properties, conflictBehavior); }
protected Path getAbsolutePath( Path absoluteOrRelative ) { Path result = absoluteOrRelative; if (!result.isAbsolute()) { result = getGraph().getContext().getValueFactories().getPathFactory().create(getLocation().getPath(), result); result = result.getNormalizedPath(); } return result; }
public SubgraphNode getNode( Name relativePath ) { Path path = getGraph().getContext() .getValueFactories() .getPathFactory() .create(getLocation().getPath(), relativePath); path = path.getNormalizedPath(); return getNode(path); }
@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"); } }
public Location child( Location parent, String childName ) { Path path = context.getValueFactories().getPathFactory().create(parent.getPath(), segment(childName)); return Location.create(path); }
@Before public void beforeEach() { context = new ExecutionContext(); context.getNamespaceRegistry().register("ex", "http://www.example.com"); paths = context.getValueFactories().getPathFactory(); }
private Location actualLocationOf( Location location ) { // If the location has a path, then use the location if (location.hasPath()) return location; // Otherwise, create a new location with an artificial path ... Path path = context.getValueFactories().getPathFactory().create("/a/b/c/d"); return Location.create(path, location.getIdProperties()); } }
/** * {@inheritDoc} */ public void setProperty( String nodePath, String propertyName, Object... values ) { Path path = context.getValueFactories().getPathFactory().create(nodePath); Name name = context.getValueFactories().getNameFactory().create(propertyName); setProperty(path, name, values); }
@Override public void process( CloneWorkspaceRequest request ) { // Just update the actual location String workspaceName = request.desiredNameOfTargetWorkspace(); assert workspaceName != null; request.setActualWorkspaceName(workspaceName); request.setActualRootLocation(Location.create(context.getValueFactories().getPathFactory().createRootPath())); }
@Override public void process( CreateWorkspaceRequest request ) { // Just update the actual location String workspaceName = request.desiredNameOfNewWorkspace(); if (workspaceName == null) workspaceName = "default"; request.setActualWorkspaceName(workspaceName); request.setActualRootLocation(Location.create(context.getValueFactories().getPathFactory().createRootPath())); }
@Override public void process( CreateNodeRequest request ) { // Just update the actual location ... Location parent = actualLocationOf(request.under()); // just make sure it has a path ... Name name = request.named(); Path childPath = context.getValueFactories().getPathFactory().create(parent.getPath(), name); request.setActualLocationOfNode(Location.create(childPath)); }
@Before public void beforeEach() { context = new ExecutionContext(); pathFactory = context.getValueFactories().getPathFactory(); registry = context.getNamespaceRegistry(); encoder = new UrlEncoder(); repositoryPath = pathFactory.create("/a/b/c"); sourcePath = pathFactory.create("/x/y"); validExceptions = new Path[] {pathFactory.create("e/f"), pathFactory.create("e/g")}; rule = new Projection.PathRule(repositoryPath, sourcePath, validExceptions); }