Examples of URI


Examples of java.net.URI

        }
        return null;
    }

    public static File getClasspathForClass(Class<?> targetClass) {
        URI location;
        try {
            location = targetClass.getProtectionDomain().getCodeSource().getLocation().toURI();
        } catch (URISyntaxException e) {
            throw new UncheckedIOException(e);
        }
        if (!location.getScheme().equals("file")) {
            throw new GradleException(String.format("Cannot determine Gradle home using codebase '%s'.", location));
        }
        return new File(location.getPath());
    }
View Full Code Here

Examples of java.net.URI

    public Connection<Message> connect(URI destinationAddress) {
        if (!destinationAddress.getScheme().equals("channel")) {
            throw new IllegalArgumentException(String.format("Cannot create a connection to destination URI with unknown scheme: %s.",
                    destinationAddress));
        }
        URI connectionAddress = toConnectionAddress(destinationAddress);
        Connection<Message> connection = connector.connect(connectionAddress);
        try {
            connection.dispatch(new ConnectRequest(destinationAddress));
        } catch (Throwable e) {
            connection.stop();
View Full Code Here

Examples of java.net.URI

        return connection;
    }

    private URI toConnectionAddress(URI destinationAddress) {
        String content = destinationAddress.getSchemeSpecificPart();
        URI connectionAddress;
        try {
            connectionAddress = new URI(StringUtils.substringBeforeLast(content, "!"));
        } catch (URISyntaxException e) {
            throw new UncheckedException(e);
        }
        return connectionAddress;
    }
View Full Code Here

Examples of java.net.URI

                Class<?> desktopClass = Class.forName("java.awt.Desktop");
                // Desktop.isDesktopSupported()
                Boolean supported = (Boolean) desktopClass.
                    getMethod("isDesktopSupported").
                    invoke(null, new Object[0]);
                URI uri = new URI(url);
                if (supported) {
                    // Desktop.getDesktop();
                    Object desktop = desktopClass.getMethod("getDesktop").
                        invoke(null, new Object[0]);
                    // desktop.browse(uri);
View Full Code Here

Examples of java.net.URI

                currentToken = jj_consume_token(Collation);
                currentToken = jj_consume_token(URILiteralToOperator);
                String collation = unquote(currentToken.image);
                if(collation != null) {
                    try {
                        URI url = new URI(collation);
                        spec.setCollation(url);
                    } catch (URISyntaxException e) {
                        error("err:XQST0046");
                    }
                }
View Full Code Here

Examples of java.net.URI

                currentToken = jj_consume_token(Collation);
                currentToken = jj_consume_token(URILiteralToOperator);
                collation = unquote(currentToken.image);
                if(collation != null) {
                    try {
                        URI url = new URI(collation);
                        spec.setCollation(url);
                    } catch (URISyntaxException e) {
                        error("err:XQST0046");
                    }
                }
View Full Code Here

Examples of java.net.URI

        // which may be empty. The base-uri property of all other node types is the empty sequence.       
        switch(nodekind) {
            case NodeKind.DOCUMENT:
            case NodeKind.ELEMENT: {
                final String uri = node.baseUri();
                final URI baseUri = dynEnv.getStaticContext().getBaseURI();
                if(uri == null) {
                    if(node.getDataModel() == XQueryDataModel.INSTANCE) {
                        if(baseUri != null) {
                            return AnyURIValue.valueOf(baseUri);
                        }
                    }
                    break;
                } else {
                    if(baseUri == null) {
                        return AnyURIValue.valueOf(uri);
                    } else {
                        final URI resolved = baseUri.resolve(uri);
                        return AnyURIValue.valueOf(resolved);
                    }
                }
            }
            case NodeKind.PROCESSING_INSTRUCTION:
View Full Code Here

Examples of java.net.URI

        // If $relative is the empty sequence, the empty sequence is returned.
        Item firstItem = argv.getItem(0);
        if(firstItem.isEmpty()) {
            return ValueSequence.EMPTY_SEQUENCE;
        }
        final URI relative;
        String relativeStr = firstItem.stringValue();
        try {
            if(relativeStr.length() == 0) {
                relative = null;
            } else {
                relative = new URI(relativeStr);
                if(relative.isAbsolute()) {// If $relative is an absolute URI reference, it is returned unchanged.
                    return AnyURIValue.valueOf(relative);
                }
            }
        } catch (URISyntaxException e) {
            throw new DynamicError("err:FORG0002", "Invalid URI form: " + relativeStr);
        }
        final URI baseUri;
        final int arglen = argv.size();
        if(arglen == 2) {
            Item secondItem = argv.getItem(1);
            String baseStr = secondItem.stringValue();
            baseUri = URI.create(baseStr);
        } else {
            baseUri = dynEnv.getStaticContext().getBaseURI();
            if(baseUri == null) {
                throw new DynamicError("err:FONS0005", "BaseUri is not set in the static context.");
            }
        }
        if(relative == null) {// If $relative is the zero-length string, returns the value of the base-uri property.
            return AnyURIValue.valueOf(baseUri);
        }
        final URI resolved = baseUri.resolve(relative);
        return AnyURIValue.valueOf(resolved);
    }
View Full Code Here

Examples of java.net.URI

    }

    public static URI resolveURI(String relativeUri, StaticContext staticEnv)
            throws XQueryException {
        assert (relativeUri != null && staticEnv != null);
        URI baseUri = staticEnv.getBaseURI();
        if(baseUri == null) {
            throw new DynamicError("err:FONS0005", "BaseUri is not set in the static context.");
        }
        return resolveURI(relativeUri, baseUri);
    }
View Full Code Here

Examples of java.net.URI

    public static URI resolveURI(String relativeUri, URI baseUri) throws XQueryException {
        assert (relativeUri != null && baseUri != null);
        if(relativeUri.length() == 0) {// If $relative is the zero-length string, returns the value of the base-uri property.
            return baseUri;
        }
        final URI resolved = baseUri.resolve(relativeUri);
        return resolved;
    }
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.