Package org.jboss.dna.graph.property

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


        if (!graph.getWorkspaces().contains(srcWorkspace)) {
            throw new NoSuchWorkspaceException(JcrI18n.workspaceNameIsInvalid.text(graph.getSourceName(), this.name));
        }

        // Create the paths ...
        PathFactory factory = context.getValueFactories().getPathFactory();
        Path srcPath = null;
        Path destPath = null;
        try {
            srcPath = factory.create(srcAbsPath);
        } catch (ValueFormatException e) {
            throw new PathNotFoundException(JcrI18n.invalidPathParameter.text(srcAbsPath, "srcAbsPath"), e);
        }
        try {
            destPath = factory.create(destAbsPath);
        } catch (ValueFormatException e) {
            throw new PathNotFoundException(JcrI18n.invalidPathParameter.text(destAbsPath, "destAbsPath"), e);
        }

        // Doing a literal test here because the path factory will canonicalize "/node[1]" to "/node"
View Full Code Here


                      String destAbsPath ) throws PathNotFoundException, RepositoryException {
        CheckArg.isNotEmpty(srcAbsPath, "srcAbsPath");
        CheckArg.isNotEmpty(destAbsPath, "destAbsPath");

        // Create the paths ...
        PathFactory factory = context.getValueFactories().getPathFactory();
        Path srcPath = null;
        Path destPath = null;
        try {
            srcPath = factory.create(srcAbsPath);
        } catch (ValueFormatException e) {
            throw new PathNotFoundException(JcrI18n.invalidPathParameter.text(srcAbsPath, "srcAbsPath"), e);
        }
        try {
            destPath = factory.create(destAbsPath);
        } catch (ValueFormatException e) {
            throw new PathNotFoundException(JcrI18n.invalidPathParameter.text(destAbsPath, "destAbsPath"), e);
        }

        // Doing a literal test here because the path factory will canonicalize "/node[1]" to "/node"
View Full Code Here

            /*
             * Need two path factories here.  One uses the permanent namespace mappings to parse the constraints.
             * The other also looks at the transient mappings to parse the checked value
             */
            PathFactory repoPathFactory = context.getValueFactories().getPathFactory();
            PathFactory sessionPathFactory = jcrValue.sessionCache().context().getValueFactories().getPathFactory();
            Path value = sessionPathFactory.create(((JcrValue)valueToMatch).value());
            value = value.getNormalizedPath();

            for (int i = 0; i < constraints.length; i++) {
                boolean matchesDescendants = constraints[i].endsWith("*");
                Path constraintPath = repoPathFactory.create(matchesDescendants ? constraints[i].substring(0,
View Full Code Here

        // We have a path, so see if the path is one of the existing placeholder nodes ...
        ProjectedNode result = isPlaceholder(location);
        if (result != null) return result;

        // Otherwise this node lives below one (or more) of the projections, and we figure this out each time ...
        final PathFactory pathFactory = context.getValueFactories().getPathFactory();
        for (Projection projection : projections) {
            if (requiresUpdate && projection.isReadOnly()) continue;
            // Project the federated repository path into the paths as they would exist in the source ...
            Set<Path> pathsInSource = projection.getPathsInSource(path, pathFactory);
            for (Path pathInSource : pathsInSource) {
View Full Code Here

        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;
        Path topLevelPath = topLevelPaths.get(0);
        assert topLevelPath != null;
        if (topLevelPath.isRoot()) return null;
View Full Code Here

        if (second.getRules().size() != 1) return null;
        Rule firstRule = first.getRules().get(0);
        Rule secondRule = second.getRules().get(0);
        assert firstRule != null;
        assert secondRule != null;
        PathFactory pathFactory = context.getValueFactories().getPathFactory();
        List<Path> firstTopLevelPaths = first.getRules().get(0).getTopLevelPathsInRepository(pathFactory);
        if (firstTopLevelPaths.size() != 1) return null;
        List<Path> secondTopLevelPaths = second.getRules().get(0).getTopLevelPathsInRepository(pathFactory);
        if (secondTopLevelPaths.size() != 1) return null;
        Path firstTopLevelPath = firstTopLevelPaths.get(0);
View Full Code Here

     * @param placeholderNodes the collection into which should be placed the materialized placeholders
     */
    protected static void loadPlaceholderNodes( ExecutionContext context,
                                                Iterable<Projection> projections,
                                                Collection<PlaceholderNode> placeholderNodes ) {
        final PathFactory pathFactory = context.getValueFactories().getPathFactory();
        Map<Path, ProxyNode> proxyNodesByPath = new HashMap<Path, ProxyNode>();
        Map<Path, PlaceholderNode> placeholdersByPath = new HashMap<Path, PlaceholderNode>();
        for (Projection projection : projections) {
            // Create for all of the top-level nodes ...
            for (Path path : projection.getTopLevelPathsInRepository(pathFactory)) {
View Full Code Here

        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

                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

            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

TOP

Related Classes of org.jboss.dna.graph.property.PathFactory

Copyright © 2018 www.massapicom. 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.