Example usage for java.net URI isAbsolute

List of usage examples for java.net URI isAbsolute

Introduction

In this page you can find the example usage for java.net URI isAbsolute.

Prototype

public boolean isAbsolute() 

Source Link

Document

Tells whether or not this URI is absolute.

Usage

From source file:org.apache.hadoop.hive.ql.parse.DDLSemanticAnalyzer.java

private void validateSkewedLocationString(String newLocation) throws SemanticException {
    /* Validate location string. */
    try {/*from   w w  w  . j  a v a2 s.  co  m*/
        URI locUri = new URI(newLocation);
        if (!locUri.isAbsolute() || locUri.getScheme() == null || locUri.getScheme().trim().equals("")) {
            throw new SemanticException(newLocation + " is not absolute or has no scheme information. "
                    + "Please specify a complete absolute uri with scheme information.");
        }
    } catch (URISyntaxException e) {
        throw new SemanticException(e);
    }
}

From source file:de.interactive_instruments.ShapeChange.Target.FeatureCatalogue.FeatureCatalogue.java

private void initialiseFromOptions() {

    outputDirectory = options.parameter(this.getClass().getName(), "outputDirectory");
    if (outputDirectory == null)
        outputDirectory = options.parameter("outputDirectory");
    if (outputDirectory == null)
        outputDirectory = ".";

    outputFilename = options.parameter(this.getClass().getName(), "outputFilename");
    if (outputFilename == null)
        outputFilename = "FeatureCatalogue";

    docxTemplateFilePath = options.parameter(this.getClass().getName(), "docxTemplateFilePath");
    if (docxTemplateFilePath == null)
        docxTemplateFilePath = options.parameter("docxTemplateFilePath");
    // if no path is provided, use the directory of the default template
    if (docxTemplateFilePath == null) {
        docxTemplateFilePath = DOCX_TEMPLATE_URL;
        result.addDebug(this, 17, "docxTemplateFilePath", DOCX_TEMPLATE_URL);
    }/* w  w  w.j a  v  a 2  s  . co  m*/

    String s = options.parameter(this.getClass().getName(), "inheritedProperties");
    if (s != null && s.equals("true"))
        Inherit = true;

    s = options.parameter(this.getClass().getName(), "deleteXmlfile");
    if (s != null && s.equals("true"))
        deleteXmlFile = true;

    s = options.parameter(this.getClass().getName(), "package");
    if (s != null && s.length() > 0)
        Package = s;
    else
        Package = "";

    s = options.parameter(this.getClass().getName(), "outputFormat");
    if (s != null && s.length() > 0)
        OutputFormat = s;
    else
        OutputFormat = "";

    s = options.parameter(this.getClass().getName(), "featureTerm");
    if (s != null && s.length() > 0)
        featureTerm = s;

    s = options.parameter(this.getClass().getName(), "includeDiagrams");
    if (s != null && s.equals("true"))
        includeDiagrams = true;

    s = options.parameter(this.getClass().getName(), PARAM_DONT_TRANSFORM);
    if (s != null && s.equals("true"))
        dontTransform = true;

    s = options.parameter(this.getClass().getName(), PARAM_INCLUDE_CODELIST_URI);
    if (s != null && s.equalsIgnoreCase("false"))
        includeCodelistURI = false;

    // TBD: one could check that input has actually loaded the diagrams;
    // however, in future a transformation could create images as well

    s = options.parameter(this.getClass().getName(), "includeVoidable");
    if (s != null && s.equalsIgnoreCase("false"))
        includeVoidable = false;

    s = options.parameter(this.getClass().getName(), "includeTitle");
    if (s != null && s.equalsIgnoreCase("false"))
        includeTitle = false;

    if (model != null) {
        encoding = model.characterEncoding();
    }

    s = options.parameter(this.getClass().getName(), "xslTransformerFactory");
    if (s != null && s.length() > 0)
        xslTransformerFactory = s;

    s = options.parameter(this.getClass().getName(), "xslhtmlFile");
    if (s != null && s.length() > 0)
        xslhtmlfileName = s;

    s = options.parameter(this.getClass().getName(), "xslframeHtmlFileName");
    if (s != null && s.length() > 0)
        xslframeHtmlFileName = s;

    s = options.parameter(this.getClass().getName(), "xslfoFile");
    if (s != null && s.length() > 0)
        xslfofileName = s;

    s = options.parameter(this.getClass().getName(), "xslrtfFile");
    if (s != null && s.length() > 0)
        xslrtffileName = s;

    s = options.parameter(this.getClass().getName(), "xsldocxFile");
    if (s != null && s.length() > 0)
        xsldocxfileName = s;

    s = options.parameter(this.getClass().getName(), "xslxmlFile");
    if (s != null && s.length() > 0)
        xslxmlfileName = s;

    /*
     * first check the xslt path setting(s), then anything that depends on
     * it for example the css path defaults to the xslt path
     */
    s = options.parameter(this.getClass().getName(), "xsltPfad");
    if (s != null && s.length() > 0)
        xsltPath = s;

    s = options.parameter(this.getClass().getName(), "xsltPath");
    if (s != null && s.length() > 0)
        xsltPath = s;

    /*
     * check cssPath only after xslt path has been checked if no value is
     * provided for cssPath it defaults to the xslt path
     */
    s = options.parameter(this.getClass().getName(), "cssPath");
    if (s != null && s.length() > 0) {
        cssPath = s;
    } else {
        cssPath = xsltPath;
    }

    s = options.parameter(this.getClass().getName(), "lang");
    if (s != null && s.length() > 0)
        lang = s;

    s = options.parameter(this.getClass().getName(), "noAlphabeticSortingForProperties");
    if (s != null && s.trim().length() > 0)
        noAlphabeticSortingForProperties = s.trim();

    s = options.parameter(this.getClass().getName(), "xslLocalizationUri");
    if (s != null && s.length() > 0) {

        try {

            URI locXslUri;
            if (s.startsWith("http")) {
                locXslUri = new URI(s);
            } else {
                locXslUri = new URI(s);
                File f;
                if (!locXslUri.isAbsolute()) {
                    f = new File(s);
                    locXslUri = f.toURI();
                }
            }

            hrefMappings.put(localizationXslDefaultUri, locXslUri);

        } catch (URISyntaxException e) {
            result.addError(this, 15, "xslLocalizationUri", s, e.toString());
        }

    }

    s = options.parameter(this.getClass().getName(), "localizationMessagesUri");
    if (s != null && s.length() > 0) {

        try {

            URI locMsgUri;
            if (s.startsWith("http")) {
                locMsgUri = new URI(s);
            } else {
                locMsgUri = new URI(s);
                File f;
                if (!locMsgUri.isAbsolute()) {
                    f = new File(s);
                    locMsgUri = f.toURI();
                }
            }

            hrefMappings.put(localizationMessagesDefaultUri, locMsgUri);

        } catch (URISyntaxException e) {
            result.addError(this, 15, "localizationMessagesUri", s, e.toString());
        }
    }
}