Package org.jboss.dna.graph.connector.federation.FederatedRequest

Examples of org.jboss.dna.graph.connector.federation.FederatedRequest.ProjectedRequest


     *
     * @see org.jboss.dna.graph.request.processor.RequestProcessor#process(org.jboss.dna.graph.request.RenameNodeRequest)
     */
    @Override
    public void process( RenameNodeRequest request ) {
        ProjectedRequest projected = federatedRequest.getFirstProjectedRequest();
        assert !projected.hasNext();
        RenameNodeRequest source = (RenameNodeRequest)projected.getRequest();
        if (checkErrorOrCancel(request, source)) return;
        Location locationBefore = source.getActualLocationBefore();
        Location locationAfter = source.getActualLocationBefore();
        locationBefore = projectToFederated(request.at(), projected.getProjection(), locationBefore, request);
        locationAfter = projectToFederated(request.at(), projected.getSecondProjection(), locationAfter, request);
        request.setActualLocations(locationBefore, locationAfter);
    }
View Full Code Here


     *
     * @see org.jboss.dna.graph.request.processor.RequestProcessor#process(org.jboss.dna.graph.request.CopyBranchRequest)
     */
    @Override
    public void process( CopyBranchRequest request ) {
        ProjectedRequest projected = federatedRequest.getFirstProjectedRequest();
        assert !projected.hasNext();
        CopyBranchRequest source = (CopyBranchRequest)projected.getRequest();
        if (checkErrorOrCancel(request, source)) return;
        Location locationBefore = source.getActualLocationBefore();
        Location locationAfter = source.getActualLocationBefore();
        locationBefore = projectToFederated(request.from(), projected.getProjection(), locationBefore, request);
        locationAfter = projectToFederated(request.into(), projected.getSecondProjection(), locationAfter, request);
        request.setActualLocations(locationBefore, locationAfter);
    }
View Full Code Here

     *
     * @see org.jboss.dna.graph.request.processor.RequestProcessor#process(org.jboss.dna.graph.request.CloneBranchRequest)
     */
    @Override
    public void process( CloneBranchRequest request ) {
        ProjectedRequest projected = federatedRequest.getFirstProjectedRequest();
        assert !projected.hasNext();
        CloneBranchRequest source = (CloneBranchRequest)projected.getRequest();
        if (checkErrorOrCancel(request, source)) return;
        Location locationBefore = source.getActualLocationBefore();
        Location locationAfter = source.getActualLocationBefore();
        locationBefore = projectToFederated(request.from(), projected.getProjection(), locationBefore, request);
        locationAfter = projectToFederated(request.into(), projected.getSecondProjection(), locationAfter, request);
        request.setActualLocations(locationBefore, locationAfter);
        if (source.removeExisting()) {
            Set<Location> removed = new HashSet<Location>();
            for (Location location : request.getRemovedNodes()) {
                removed.add(projectToFederated(projected.getSecondProjection(), location, request));
            }
            request.setRemovedNodes(Collections.unmodifiableSet(removed));
        }
    }
View Full Code Here

     *
     * @see org.jboss.dna.graph.request.processor.RequestProcessor#process(org.jboss.dna.graph.request.MoveBranchRequest)
     */
    @Override
    public void process( MoveBranchRequest request ) {
        ProjectedRequest projected = federatedRequest.getFirstProjectedRequest();
        assert !projected.hasNext();
        MoveBranchRequest source = (MoveBranchRequest)projected.getRequest();
        if (checkErrorOrCancel(request, source)) return;
        Location locationBefore = source.getActualLocationBefore();
        Location locationAfter = source.getActualLocationBefore();
        locationBefore = projectToFederated(request.from(), projected.getProjection(), locationBefore, request);
        Projection afterProjection = projected.getSecondProjection();
        if (afterProjection == null) projected.getProjection();
        locationAfter = projectToFederated(request.into(), afterProjection, locationAfter, request);
        request.setActualLocations(locationBefore, locationAfter);
    }
View Full Code Here

     *
     * @see org.jboss.dna.graph.request.processor.RequestProcessor#process(org.jboss.dna.graph.request.VerifyWorkspaceRequest)
     */
    @Override
    public void process( VerifyWorkspaceRequest request ) {
        ProjectedRequest projectedRequest = federatedRequest.getFirstProjectedRequest();
        assert projectedRequest != null;
        Location actualLocation = Location.create(getExecutionContext().getValueFactories().getPathFactory().createRootPath());
        while (projectedRequest != null) {
            VerifyNodeExistsRequest readFromSource = (VerifyNodeExistsRequest)projectedRequest.getRequest();
            if (readFromSource.hasError()) {
                request.setError(readFromSource.getError());
                continue;
            }
            request.setError(null);
            if (readFromSource.isCancelled()) {
                request.cancel();
                return;
            }

            Location sourceLocation = readFromSource.getActualLocationOfNode();
            if (sourceLocation.hasIdProperties()) {
                // Accumulate the identification properties ...
                for (Property propertyInSource : sourceLocation.getIdProperties()) {
                    Name name = propertyInSource.getName();
                    Property existing = actualLocation.getIdProperty(name);
                    if (existing != null) {
                        // Merge the property values ...
                        propertyInSource = merge(existing, propertyInSource, propertyFactory, true);
                    }
                    actualLocation = actualLocation.with(propertyInSource);
                }
            }
            projectedRequest = projectedRequest.next();
        }
        request.setActualRootLocation(actualLocation);
    }
View Full Code Here

    }

    protected final void process( FederatedRequest forked ) {
        // Determine whether this is a single mirror request ...
        Request original = forked.original();
        ProjectedRequest projectedRequest = forked.getFirstProjectedRequest();
        boolean sameLocation = projectedRequest != null && !projectedRequest.hasNext() && projectedRequest.isSameLocation();

        // Set the cachable information ...
        if (original instanceof CacheableRequest) {
            CacheableRequest cacheableOriginal = (CacheableRequest)original;
            cacheableOriginal.setCachePolicy(getDefaultCachePolicy());
            while (projectedRequest != null) {
                Request requestToSource = projectedRequest.getRequest();
                if (cacheableOriginal != null) {
                    setCacheableInfo(cacheableOriginal, ((CacheableRequest)requestToSource).getCachePolicy());
                }
                projectedRequest = projectedRequest.next();
            }
        }

        // Now do the join on this request ...
        if (sameLocation) {
View Full Code Here

     *
     * @see org.jboss.dna.graph.request.processor.RequestProcessor#process(org.jboss.dna.graph.request.VerifyNodeExistsRequest)
     */
    @Override
    public void process( VerifyNodeExistsRequest request ) {
        ProjectedRequest projectedRequest = federatedRequest.getFirstProjectedRequest();
        assert projectedRequest != null;
        request.setCachePolicy(getDefaultCachePolicy());
        Location actualLocation = request.at();
        int numMerged = 0;
        while (projectedRequest != null) {
            VerifyNodeExistsRequest readFromSource = (VerifyNodeExistsRequest)projectedRequest.getRequest();
            if (readFromSource.hasError()) {
                projectedRequest = projectedRequest.next();
                continue;
            }
            if (readFromSource.isCancelled()) {
                request.cancel();
                return;
            }

            // Make sure we have an actual location ...
            Location sourceLocation = readFromSource.getActualLocationOfNode();
            actualLocation = determineActualLocation(actualLocation, sourceLocation, projectedRequest.getProjection());

            if (sourceLocation.hasIdProperties()) {
                // Accumulate the identification properties ...
                for (Property propertyInSource : sourceLocation.getIdProperties()) {
                    Name name = propertyInSource.getName();
                    Property existing = actualLocation.getIdProperty(name);
                    if (existing != null) {
                        // Merge the property values ...
                        propertyInSource = merge(existing, propertyInSource, propertyFactory, true);
                    }
                    actualLocation = actualLocation.with(propertyInSource);
                }
            }
            setCacheableInfo(request, readFromSource.getCachePolicy());
            projectedRequest = projectedRequest.next();
            ++numMerged;
        }
        if (numMerged == 0) {
            // No source requests had results ...
            setPathNotFound(request, request.at(), federatedRequest.getFirstProjectedRequest());
View Full Code Here

    @Override
    public void process( ReadNodeRequest request ) {
        Path federatedPath = request.at().getPath();
        Map<Name, Property> properties = request.getPropertiesByName();
        Map<Name, Integer> childSnsIndexes = new HashMap<Name, Integer>();
        ProjectedRequest projectedRequest = federatedRequest.getFirstProjectedRequest();
        assert projectedRequest != null;
        request.setCachePolicy(getDefaultCachePolicy());
        Location actualLocation = request.at();
        int numMerged = 0;
        while (projectedRequest != null) {
            Request sourceRequest = projectedRequest.getRequest();
            if (sourceRequest.hasError()) {
                projectedRequest = projectedRequest.next();
                continue;
            }
            if (sourceRequest.isCancelled()) {
                request.cancel();
                return;
            }

            Projection projection = projectedRequest.getProjection();
            if (sourceRequest instanceof VerifyNodeExistsRequest) {
                // We needed to verify the existance of a child node ...
                VerifyNodeExistsRequest verify = (VerifyNodeExistsRequest)sourceRequest;
                Location childInSource = verify.getActualLocationOfNode();
                Location childInRepos = getChildLocationWithCorrectSnsIndex(childInSource,
                                                                            federatedPath,
                                                                            childSnsIndexes,
                                                                            projection);
                request.addChild(childInRepos);
                if (federatedPath == null) federatedPath = childInRepos.getPath().getParent();
            } else {
                ReadNodeRequest readFromSource = (ReadNodeRequest)sourceRequest;
                Location sourceLocation = readFromSource.getActualLocationOfNode();
                if (sourceLocation.hasIdProperties()) {
                    // Accumulate the identification properties ...
                    for (Property propertyInSource : sourceLocation.getIdProperties()) {
                        Name name = propertyInSource.getName();
                        Property existing = actualLocation.getIdProperty(name);
                        if (existing != null) {
                            // Merge the property values ...
                            propertyInSource = merge(existing, propertyInSource, propertyFactory, true);
                        }
                        actualLocation = actualLocation.with(propertyInSource);
                    }
                }

                // Make sure we have an actual location ...
                actualLocation = determineActualLocation(actualLocation, sourceLocation, projection);
                if (federatedPath == null) federatedPath = actualLocation.getPath();

                // Add all the children from the source ...
                for (Location childInSource : readFromSource.getChildren()) {
                    request.addChild(getChildLocationWithCorrectSnsIndex(childInSource,
                                                                         federatedPath,
                                                                         childSnsIndexes,
                                                                         projection));
                }

                // Add all the properties ...
                for (Property propertyInSource : readFromSource.getProperties()) {
                    Name name = propertyInSource.getName();
                    Property existing = properties.get(name);
                    if (existing != null) {
                        // Merge the property values ...
                        propertyInSource = merge(existing, propertyInSource, propertyFactory, true);
                    }
                    properties.put(name, propertyInSource);
                }
                setCacheableInfo(request, readFromSource.getCachePolicy());
            }
            projectedRequest = projectedRequest.next();
            ++numMerged;
        }
        if (numMerged == 0) {
            // No source requests had results ...
            setPathNotFound(request, request.at(), federatedRequest.getFirstProjectedRequest());
View Full Code Here

     */
    @Override
    public void process( ReadAllChildrenRequest request ) {
        Path federatedPath = request.of().getPath();
        Map<Name, Integer> childSnsIndexes = new HashMap<Name, Integer>();
        ProjectedRequest projectedRequest = federatedRequest.getFirstProjectedRequest();
        assert projectedRequest != null;
        request.setCachePolicy(getDefaultCachePolicy());
        Location actualLocation = request.of();
        int numMerged = 0;
        while (projectedRequest != null) {
            Request sourceRequest = projectedRequest.getRequest();
            if (sourceRequest.hasError()) {
                projectedRequest = projectedRequest.next();
                continue;
            }
            if (sourceRequest.isCancelled()) {
                request.cancel();
                return;
            }

            Projection projection = projectedRequest.getProjection();
            if (sourceRequest instanceof VerifyNodeExistsRequest) {
                // We needed to verify the existance of a child node ...
                VerifyNodeExistsRequest verify = (VerifyNodeExistsRequest)sourceRequest;
                Location childInSource = verify.getActualLocationOfNode();
                Location childInRepos = getChildLocationWithCorrectSnsIndex(childInSource,
                                                                            federatedPath,
                                                                            childSnsIndexes,
                                                                            projection);
                request.addChild(childInRepos);
                if (federatedPath == null) federatedPath = childInRepos.getPath().getParent();
            } else {
                ReadAllChildrenRequest readFromSource = (ReadAllChildrenRequest)sourceRequest;
                Location sourceLocation = readFromSource.getActualLocationOfNode();
                if (sourceLocation.hasIdProperties()) {
                    // Accumulate the identification properties ...
                    for (Property propertyInSource : sourceLocation.getIdProperties()) {
                        Name name = propertyInSource.getName();
                        Property existing = actualLocation.getIdProperty(name);
                        if (existing != null) {
                            // Merge the property values ...
                            propertyInSource = merge(existing, propertyInSource, propertyFactory, true);
                        }
                        actualLocation = actualLocation.with(propertyInSource);
                    }
                }

                // Make sure we have an actual location ...
                actualLocation = determineActualLocation(actualLocation, readFromSource.getActualLocationOfNode(), projection);
                if (federatedPath == null) federatedPath = actualLocation.getPath();

                // Add all the children from the source ...
                for (Location childInSource : readFromSource.getChildren()) {
                    request.addChild(getChildLocationWithCorrectSnsIndex(childInSource,
                                                                         federatedPath,
                                                                         childSnsIndexes,
                                                                         projection));
                }
                setCacheableInfo(request, readFromSource.getCachePolicy());
            }

            projectedRequest = projectedRequest.next();
            ++numMerged;
        }
        if (numMerged == 0) {
            // No source requests had results ...
            setPathNotFound(request, request.of(), federatedRequest.getFirstProjectedRequest());
View Full Code Here

     * @see org.jboss.dna.graph.request.processor.RequestProcessor#process(org.jboss.dna.graph.request.ReadAllPropertiesRequest)
     */
    @Override
    public void process( ReadAllPropertiesRequest request ) {
        Map<Name, Property> properties = request.getPropertiesByName();
        ProjectedRequest projectedRequest = federatedRequest.getFirstProjectedRequest();
        assert projectedRequest != null;
        request.setCachePolicy(getDefaultCachePolicy());
        Location actualLocation = request.at();
        int numMerged = 0;
        while (projectedRequest != null) {
            ReadAllPropertiesRequest readFromSource = (ReadAllPropertiesRequest)projectedRequest.getRequest();
            if (readFromSource.hasError()) {
                projectedRequest = projectedRequest.next();
                continue;
            }
            if (readFromSource.isCancelled()) {
                request.cancel();
                return;
            }

            // Make sure we have an actual location ...
            Location sourceLocation = readFromSource.getActualLocationOfNode();
            actualLocation = determineActualLocation(actualLocation, sourceLocation, projectedRequest.getProjection());

            if (sourceLocation.hasIdProperties()) {
                // Accumulate the identification properties ...
                for (Property propertyInSource : sourceLocation.getIdProperties()) {
                    Name name = propertyInSource.getName();
                    Property existing = actualLocation.getIdProperty(name);
                    if (existing != null) {
                        // Merge the property values ...
                        propertyInSource = merge(existing, propertyInSource, propertyFactory, true);
                    }
                    actualLocation = actualLocation.with(propertyInSource);
                }
            }

            // Add all the properties ...
            for (Property propertyInSource : readFromSource.getProperties()) {
                Name name = propertyInSource.getName();
                Property existing = properties.get(name);
                if (existing != null) {
                    // Merge the property values ...
                    propertyInSource = merge(existing, propertyInSource, propertyFactory, true);
                }
                properties.put(name, propertyInSource);
            }
            setCacheableInfo(request, readFromSource.getCachePolicy());
            projectedRequest = projectedRequest.next();
            ++numMerged;
        }
        if (numMerged == 0) {
            // No source requests had results ...
            setPathNotFound(request, request.at(), federatedRequest.getFirstProjectedRequest());
View Full Code Here

TOP

Related Classes of org.jboss.dna.graph.connector.federation.FederatedRequest.ProjectedRequest

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.