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; }
public CreateAt<Graph> and( String name, Object... values ) { ExecutionContext context = getContext(); PropertyFactory factory = context.getPropertyFactory(); NameFactory nameFactory = context.getValueFactories().getNameFactory(); properties.add(factory.create(nameFactory.create(name), values)); return this; }
/** * Set a property on a node, starting with the name. The interface returned from this method should be used to specify the * value(s) and the location of the node onto which the property should be set. * * @param propertyName the property name * @return the interface used to specify the values */ public SetValues<BatchConjunction> set( String propertyName ) { Name name = getContext().getValueFactories().getNameFactory().create(propertyName); return set(name); }
/** * Create a path given the supplied string representation. * * @param path the string form of the path * @return the path */ protected Path path( String path ) { return context.getValueFactories().getPathFactory().create(path); }
/** * 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); }
/** * Request to read the node given by the supplied reference value. * * @param reference the reference property value that is to be resolved into a node * @return the node that is read from the repository * @throws ValueFormatException if the supplied reference could not be converted to an identifier property value */ public Node resolve( Reference reference ) { CheckArg.isNotNull(reference, "reference"); UUID uuid = getContext().getValueFactories().getUuidFactory().create(reference); return getNodeAt(uuid); }
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); }
public SubgraphNode getNode( Name relativePath ) { Path path = getGraph().getContext() .getValueFactories() .getPathFactory() .create(getLocation().getPath(), relativePath); path = path.getNormalizedPath(); return getNode(path); }
/** * Create a new execution context that mirrors this context but that uses the supplied {@link PropertyFactory * factory}. * * @param propertyFactory the new propertyfactory implementation, or null if the default implementation should be used * @return the execution context that is identical with this execution context, but which uses the supplied property * factory implementation; never null */ public ExecutionContext with( PropertyFactory propertyFactory ) { return new ExecutionContext(getSecurityContext(), getNamespaceRegistry(), getValueFactories(), propertyFactory, getMimeTypeDetector(), getTextExtractor(), getClassLoaderFactory(), getData(), getProcessId()); }
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; }
protected void assertNextRequestIsCreate( Location parent, String child, Property... properties ) { Name name = context.getValueFactories().getNameFactory().create(child); Request request = executedRequests.poll(); assertThat(request, is(instanceOf(CreateNodeRequest.class))); CreateNodeRequest create = (CreateNodeRequest)request; assertThat(create.under(), is(parent)); assertThat(create.named(), is(name)); assertThat(create.properties(), hasItems(properties)); }
@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()); } }
@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"); } }
@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())); }
public MockSequencerContext( ExecutionContext context, String inputPath ) { super(context, context.getValueFactories().getPathFactory().create(inputPath), null, null, new SimpleProblems()); getNamespaceRegistry().register("modedtd", "http://www.modeshape.org/dtd/1.0"); getNamespaceRegistry().register("modexml", "http://www.modeshape.org/xml/1.0"); } }
@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)); }