Package org.jboss.dna.graph.property

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


        if (degree == 0) return this;
        int endIndex = this.segments.size() - degree;
        if (endIndex == 0) return this.isAbsolute() ? RootPath.INSTANCE : null;
        if (endIndex < 0) {
            String msg = GraphI18n.pathAncestorDegreeIsInvalid.text(this.getString(), Inflector.getInstance().ordinalize(degree));
            throw new InvalidPathException(msg);
        }
        return subpath(0, endIndex);
    }
View Full Code Here


        CheckArg.isNonNegative(degree, "degree");
        if (degree == 0) {
            return this;
        }
        String msg = GraphI18n.pathAncestorDegreeIsInvalid.text(this.getString(), Inflector.getInstance().ordinalize(degree));
        throw new InvalidPathException(msg);
    }
View Full Code Here

    @Override
    public Path resolve( Path relativePath ) {
        CheckArg.isNotNull(relativePath, "relative path");
        if (relativePath.isAbsolute()) {
            String msg = GraphI18n.pathIsNotRelative.text(relativePath);
            throw new InvalidPathException(msg);
        }
        // Make an absolute path out of the supplied relative path ...
        return new BasicPath(relativePath.getSegmentsList(), true).getNormalizedPath();
    }
View Full Code Here

     * @see org.jboss.dna.graph.property.Path#getCanonicalPath()
     */
    public Path getCanonicalPath() {
        if (!this.isAbsolute()) {
            String msg = GraphI18n.pathIsNotAbsolute.text(this);
            throw new InvalidPathException(msg);
        }
        if (this.isNormalized()) return this;
        return this.getNormalizedPath();
    }
View Full Code Here

        for (Segment segment : this) {
            if (segment.isSelfReference()) continue;
            if (segment.isParentReference()) {
                if (newSegments.isEmpty()) {
                    if (this.isAbsolute()) {
                        throw new InvalidPathException(CommonI18n.pathCannotBeNormalized.text(this));
                    }
                } else if (!newSegments.getLast().isParentReference()) {
                    newSegments.removeLast();
                    continue;
                }
View Full Code Here

     */
    public Path relativeTo( Path startingPath ) {
        CheckArg.isNotNull(startingPath, "to");
        if (!this.isAbsolute()) {
            String msg = GraphI18n.pathIsNotAbsolute.text(this);
            throw new InvalidPathException(msg);
        }
        if (startingPath.isRoot()) {
            // We just want a relative path containing the same segments ...
            return relativeToRoot();
        }
        if (!startingPath.isAbsolute()) {
            String msg = GraphI18n.pathIsNotAbsolute.text(startingPath);
            throw new InvalidPathException(msg);
        }

        // Count the number of segments up to the common ancestor (relative path is what remains) ...
        int lengthOfCommonAncestor = 0;
        Iterator<Segment> thisIter = this.getNormalizedPath().iterator();
View Full Code Here

     */
    public Path resolve( Path relativePath ) {
        CheckArg.isNotNull(relativePath, "relative path");
        if (!this.isAbsolute()) {
            String msg = GraphI18n.pathIsNotAbsolute.text(this);
            throw new InvalidPathException(msg);
        }
        if (relativePath.isAbsolute()) {
            String msg = GraphI18n.pathIsNotRelative.text(relativePath);
            throw new InvalidPathException(msg);
        }
        // If the relative path is the self or parent reference ...
        relativePath = relativePath.getNormalizedPath();
        if (relativePath.size() == 1) {
            Segment onlySegment = relativePath.getSegment(0);
View Full Code Here

    // Requests that result in errors
    // ----------------------------------------------------------------------------------------------------------------

    @Test( expected = InvalidPathException.class )
    public void shouldPropogateExceptionFromConnectorWhenMovingLocationIsNotFound() {
        connection.error = new InvalidPathException();
        graph.move(validUuid).into(validPath);
    }
View Full Code Here

        graph.move(validUuid).into(validPath);
    }

    @Test( expected = InvalidPathException.class )
    public void shouldPropogateExceptionFromConnectorWhenCopyLocationIsNotFound() {
        connection.error = new InvalidPathException();
        graph.copy(validUuid).into(validPath);
    }
View Full Code Here

        graph.copy(validUuid).into(validPath);
    }

    @Test( expected = InvalidPathException.class )
    public void shouldPropogateExceptionFromConnectorWhenDeleteLocationIsNotFound() {
        connection.error = new InvalidPathException();
        graph.delete(validUuid);
    }
View Full Code Here

TOP

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

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.