Examples of PathFactory


Examples of org.jboss.dna.graph.property.PathFactory

        assert context != null;
        if (projections.size() != 1) return null;
        Projection projection = projections.get(0);
        assert projection != null;
        if (projection.getRules().size() != 1) return null;
        PathFactory pathFactory = context.getValueFactories().getPathFactory();
        List<Path> topLevelPaths = projection.getRules().get(0).getTopLevelPathsInRepository(pathFactory);
        if (topLevelPaths.size() != 1) return null;
        if (!topLevelPaths.get(0).isRoot()) return null;
        return new MirrorProjector(projection);
    }
View Full Code Here

Examples of org.jboss.dna.graph.property.PathFactory

                case UPDATE:
                case DO_NOT_REPLACE:
                    // See if there is an existing node at the desired location ...
                    Location parent = request.under();
                    if (parent.hasPath()) {
                        PathFactory pathFactory = getExecutionContext().getValueFactories().getPathFactory();
                        Path childPath = pathFactory.create(parent.getPath(), request.named());
                        Location childLocation = Location.create(childPath);
                        projectedNode = project(childLocation, request.inWorkspace(), request, true);
                        if (projectedNode != null) {
                            if (projectedNode.isProxy()) {
                                ProxyNode proxy = projectedNode.asProxy();
View Full Code Here

Examples of org.jboss.dna.graph.property.PathFactory

            toRegister.remove(cache.getNamespaceForPrefix(""));

            // Persist any namespaces that we didn't find ...
            if (!toRegister.isEmpty()) {
                Graph.Batch batch = store.batch();
                PathFactory pathFactory = store.getContext().getValueFactories().getPathFactory();
                for (Namespace namespace : toRegister) {
                    String prefix = namespace.getPrefix();
                    if (prefix.length() == 0) continue;
                    String uri = namespace.getNamespaceUri();
                    Path pathToNamespaceNode = pathFactory.create(parentOfNamespaceNodes, prefix);
                    batch.create(pathToNamespaceNode).with(namespaceProperties).and(uriPropertyName, uri).and();
                }
                batch.execute();
            }
View Full Code Here

Examples of org.jboss.dna.graph.property.PathFactory

    }

    protected String readUriFor( String prefix ) {
        // Read the store ...
        try {
            PathFactory pathFactory = store.getContext().getValueFactories().getPathFactory();
            Path pathToNamespaceNode = pathFactory.create(parentOfNamespaceNodes, prefix);
            Property uri = store.getProperty(uriPropertyName).on(pathToNamespaceNode);
            // Get the URI property value ...
            ValueFactory<String> stringFactory = store.getContext().getValueFactories().getStringFactory();
            return stringFactory.create(uri.getFirstValue());
        } catch (PathNotFoundException e) {
View Full Code Here

Examples of org.jboss.dna.graph.property.PathFactory

                    if (uri.equals(namespaceUri)) return prefix;
                }
            }
            if (generateIfMissing) {
                // Generated prefixes are simply "ns" followed by the SNS index ...
                PathFactory pathFactory = store.getContext().getValueFactories().getPathFactory();
                Path pathToNamespaceNode = pathFactory.create(parentOfNamespaceNodes, GENERATED_PREFIX);
                Property uriProperty = store.getContext().getPropertyFactory().create(uriPropertyName, namespaceUri);
                List<Property> props = new ArrayList<Property>(namespaceProperties);
                props.add(uriProperty);
                // Location actualLocation = store.createIfMissing(pathToNamespaceNode, props).andReturn().getLocation();
                store.create(pathToNamespaceNode, props).ifAbsent().and();
View Full Code Here

Examples of org.jboss.dna.graph.property.PathFactory

        }

        // Read the store ...
        String previousUri = null;
        ValueFactory<String> stringFactory = store.getContext().getValueFactories().getStringFactory();
        PathFactory pathFactory = store.getContext().getValueFactories().getPathFactory();
        Path pathToNamespaceNode = pathFactory.create(parentOfNamespaceNodes, prefix);
        try {
            Subgraph nsGraph = store.getSubgraphOfDepth(2).at(parentOfNamespaceNodes);
            // Iterate over the existing mappings, looking for one that uses the URI ...
            Location nsNodeWithPrefix = null;
            boolean updateNode = true;
View Full Code Here

Examples of org.jboss.dna.graph.property.PathFactory

        if (workspace == null) return null;
        PathNode node = null;

        if (location.getUuid() != null) {
            if (repository.getRootNodeUuid().equals(location.getUuid())) {
                PathFactory pathFactory = new ExecutionContext().getValueFactories().getPathFactory();
                return workspace.getNode(pathFactory.createRootPath());
            }
        }

        if (!location.hasPath()) {
            I18n msg = GraphI18n.pathConnectorRequestsMustHavePath;
            request.setError(new IllegalArgumentException(msg.text()));
            return null;
        }

        // Look up the node with the supplied path ...
        Path path = location.getPath();
        if (path != null) {
            node = workspace.getNode(path);
        }

        if (node == null && request != null) {
            if (path == null) {
                // Missing path, and could not find by UUID ...
                request.setError(new PathNotFoundException(location, pathFactory.createRootPath(),
                                                           GraphI18n.nodeDoesNotExist.text(path)));
                return null;
            }
            // Could not find the node given the supplied path, so find the lowest path that does exist ...
            Path lowestExisting = workspace.getLowestExistingPath(path);
View Full Code Here

Examples of org.jboss.dna.graph.property.PathFactory

        assert newParent != null;

        Set<UUID> uuidsInFromBranch = getUuidsUnderNode(original);
        MapNode existing;

        PathFactory pathFactory = context.getValueFactories().getPathFactory();

        // TODO: Need to handle removing/throwing root node
        if (removeExisting) {
            // Remove all of the nodes that have a UUID from under the original node, but DO NOT yet remove
            // a node that has the UUID of the original node (as this will be handled later) ...
View Full Code Here

Examples of org.jboss.dna.graph.property.PathFactory

            // Unable to create because of a duplicate name ...
            return null;
        }
        PathWorkspace original = getWorkspace(nameOfWorkspaceToClone);

        PathFactory pathFactory = context.getValueFactories().getPathFactory();
        Path rootPath = pathFactory.createRootPath();

        if (original != null) {
            // Copy the properties of the root node ...
            PathNode root = workspace.getNode(rootPath);
            PathNode origRoot = original.getNode(rootPath);
            workspace.removeProperties(context, rootPath, root.getProperties().keySet());
            workspace.setProperties(context, rootPath, origRoot.getProperties());

            // Loop over each child and call this method to copy the immediate children (and below).
            for (Segment childSegment : origRoot.getChildSegments()) {
                Path childPath = pathFactory.create(origRoot.getPath(), childSegment);
                PathNode originalNode = original.getNode(childPath);

                workspace.copyNode(context, originalNode, original, root, childSegment.getName(), true);
            }
        }
View Full Code Here

Examples of org.jboss.dna.graph.property.PathFactory

                              PathNode original,
                              PathWorkspace originalWorkspace,
                              PathNode newParent,
                              Name desiredName,
                              boolean recursive ) {
        PathFactory pathFactory = context.getValueFactories().getPathFactory();
        PathNode copy = createNode(context, newParent, desiredName, original.getProperties(), NodeConflictBehavior.REPLACE);

        if (recursive) {
            Path originalPath = original.getPath();

            for (Segment childSegment : original.getChildSegments()) {
                Path childPath = pathFactory.create(originalPath, childSegment);
                PathNode childNode = originalWorkspace.getNode(childPath);
                copyNode(context, childNode, originalWorkspace, copy, childSegment.getName(), true);
            }
        }
        return copy;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.