Package org.apache.uima.resource

Examples of org.apache.uima.resource.RelativePathResolver


    // set metadata
    this.setMetaData(spec.getMetaData());

    // now attempt to create a URL, which can actually be used to access the data
    // Get Relative Path Resolver
    RelativePathResolver relPathResolver = null;
    if (aAdditionalParams != null) {
      relPathResolver = (RelativePathResolver) aAdditionalParams.get(PARAM_RELATIVE_PATH_RESOLVER);
    }
    if (relPathResolver == null) {
      relPathResolver = new RelativePathResolver_impl();
    }

    // Get the file URL, resolving relative path as necessary
    try {
      mFileUrl = relPathResolver.resolveRelativePath(new URL(mUri.toString()));
    } catch (IOException e) {
      // this is OK. The URI may not be a valid URL (e.g. it may use a non-standard protocol).
      // in this case getUrl returns null but getUri can still be used to access the URI
    }
    return true;
View Full Code Here


    // If we get here, aSpecifier is supported by this implementation.
    FileResourceSpecifier spec = (FileResourceSpecifier) aSpecifier;

    // Get Relative Path Resolver
    RelativePathResolver relPathResolver = null;
    if (aAdditionalParams != null) {
      relPathResolver = (RelativePathResolver) aAdditionalParams.get(PARAM_RELATIVE_PATH_RESOLVER);
    }
    if (relPathResolver == null) {
      relPathResolver = new RelativePathResolver_impl();
    }
     
    // Get the file URL, resolving relative path as necessary
    IOException ioEx = null;
    try {
      // Get the file URL from the specifier.  If the user has passed a file path
      // (e.g. c:\Program Files\...) instead of a URL, be lenient and convert it to
      // a URL
      URL relativeUrl;
      try {
        relativeUrl = new URL(spec.getFileUrl());
      }
      catch (MalformedURLException e) {
        //try to treat the URL as a file name. 
        File file = new File(spec.getFileUrl());
        if (file.isAbsolute()) {
          //for absolute paths, use File.toURL(), which handles
          //windows absolute paths correctly
          relativeUrl = file.toURL();
        } else {
          //for relative paths, we can' use File.toURL() because it always
          //produces an absolute URL.  Instead we do the following, which
          //won't work for windows absolute paths (but that's OK, since we
          //know we're working with a relative path)
          relativeUrl = new URL("file", "", spec.getFileUrl());
        }
      }
     
      //resolve relative paths
      mFileUrl = relPathResolver.resolveRelativePath(relativeUrl);

      // Store local cache info, even though it is not used
      if (spec.getLocalCache() == null) {
        mLocalCache = null;
      } else {
View Full Code Here

    // set metadata
    this.setMetaData(spec.getMetaData());

    // now attempt to create a URL, which can actually be used to access the data
    // Get Relative Path Resolver
    RelativePathResolver relPathResolver = null;
    if (aAdditionalParams != null) {
      relPathResolver = (RelativePathResolver) aAdditionalParams.get(PARAM_RELATIVE_PATH_RESOLVER);
    }
    if (relPathResolver == null) {
      relPathResolver = new RelativePathResolver_impl();
    }

    // Get the file URL, resolving relative path as necessary
    try {
      mFileUrl = relPathResolver.resolveRelativePath(new URL(mUri.toString()));
    } catch (IOException e) {
      // this is OK. The URI may not be a valid URL (e.g. it may use a non-standard protocol).
      // in this case getUrl returns null but getUri can still be used to access the URI
    }
    return true;
View Full Code Here

    // If we get here, aSpecifier is supported by this implementation.
    FileResourceSpecifier spec = (FileResourceSpecifier) aSpecifier;

    // Get Relative Path Resolver
    RelativePathResolver relPathResolver = null;
    if (aAdditionalParams != null) {
      relPathResolver = (RelativePathResolver) aAdditionalParams.get(PARAM_RELATIVE_PATH_RESOLVER);
    }
    if (relPathResolver == null) {
      relPathResolver = new RelativePathResolver_impl();
    }
     
    // Get the file URL, resolving relative path as necessary
    IOException ioEx = null;
    try {
      // Get the file URL from the specifier.  If the user has passed a file path
      // (e.g. c:\Program Files\...) instead of a URL, be lenient and convert it to
      // a URL
      URL relativeUrl;
      try {
        relativeUrl = new URL(spec.getFileUrl());
      }
      catch (MalformedURLException e) {
        //try to treat the URL as a file name. 
        File file = new File(spec.getFileUrl());
        if (file.isAbsolute()) {
          //for absolute paths, use File.toURL(), which handles
          //windows absolute paths correctly
          relativeUrl = file.toURL();
        } else {
          //for relative paths, we can' use File.toURL() because it always
          //produces an absolute URL.  Instead we do the following, which
          //won't work for windows absolute paths (but that's OK, since we
          //know we're working with a relative path)
          relativeUrl = new URL("file", "", spec.getFileUrl());
        }
      }
     
      //resolve relative paths
      mFileUrl = relPathResolver.resolveRelativePath(relativeUrl);

      // Store local cache info, even though it is not used
      if (spec.getLocalCache() == null) {
        mLocalCache = null;
      } else {
View Full Code Here

    // set metadata
    this.setMetaData(spec.getMetaData());

    // now attempt to create a URL, which can actually be used to access the data
    // Get Relative Path Resolver
    RelativePathResolver relPathResolver = null;
    if (aAdditionalParams != null) {
      relPathResolver = (RelativePathResolver) aAdditionalParams.get(PARAM_RELATIVE_PATH_RESOLVER);
    }
    if (relPathResolver == null) {
      relPathResolver = new RelativePathResolver_impl();
    }

    // Get the file URL, resolving relative path as necessary
    try {
      mFileUrl = relPathResolver.resolveRelativePath(new URL(mUri.toString()));
    } catch (IOException e) {
      // this is OK. The URI may not be a valid URL (e.g. it may use a non-standard protocol).
      // in this case getUrl returns null but getUri can still be used to access the URI
    }
    return true;
View Full Code Here

    // If we get here, aSpecifier is supported by this implementation.
    FileResourceSpecifier spec = (FileResourceSpecifier) aSpecifier;

    // Get Relative Path Resolver
    RelativePathResolver relPathResolver = null;
    if (aAdditionalParams != null) {
      relPathResolver = (RelativePathResolver) aAdditionalParams.get(PARAM_RELATIVE_PATH_RESOLVER);
    }
    if (relPathResolver == null) {
      relPathResolver = new RelativePathResolver_impl();
    }
     
    // Get the file URL, resolving relative path as necessary
    IOException ioEx = null;
    try {
      // Get the file URL from the specifier.  If the user has passed a file path
      // (e.g. c:\Program Files\...) instead of a URL, be lenient and convert it to
      // a URL
      URL relativeUrl;
      try {
        relativeUrl = new URL(spec.getFileUrl());
      }
      catch (MalformedURLException e) {
        //try to treat the URL as a file name. 
        File file = new File(spec.getFileUrl());
        if (file.isAbsolute()) {
          //for absolute paths, use File.toURL(), which handles
          //windows absolute paths correctly
          relativeUrl = file.toURL();
        } else {
          //for relative paths, we can' use File.toURL() because it always
          //produces an absolute URL.  Instead we do the following, which
          //won't work for windows absolute paths (but that's OK, since we
          //know we're working with a relative path)
          relativeUrl = new URL("file", "", spec.getFileUrl());
        }
      }
     
      //resolve relative paths
      mFileUrl = relPathResolver.resolveRelativePath(relativeUrl);

      // Store local cache info, even though it is not used
      if (spec.getLocalCache() == null) {
        mLocalCache = null;
      } else {
View Full Code Here

    // set metadata
    this.setMetaData(spec.getMetaData());

    // now attempt to create a URL, which can actually be used to access the data
    // Get Relative Path Resolver
    RelativePathResolver relPathResolver = null;
    if (aAdditionalParams != null) {
      relPathResolver = (RelativePathResolver) aAdditionalParams.get(PARAM_RELATIVE_PATH_RESOLVER);
    }
    if (relPathResolver == null) {
      relPathResolver = new RelativePathResolver_impl();
    }

    // Get the file URL, resolving relative path as necessary
    try {
      mFileUrl = relPathResolver.resolveRelativePath(new URL(mUri.toString()));
    } catch (IOException e) {
      // this is OK. The URI may not be a valid URL (e.g. it may use a non-standard protocol).
      // in this case getUrl returns null but getUri can still be used to access the URI
    }
    return true;
View Full Code Here

    // If we get here, aSpecifier is supported by this implementation.
    FileResourceSpecifier spec = (FileResourceSpecifier) aSpecifier;

    // Get Relative Path Resolver
    RelativePathResolver relPathResolver = null;
    if (aAdditionalParams != null) {
      relPathResolver = (RelativePathResolver) aAdditionalParams.get(PARAM_RELATIVE_PATH_RESOLVER);
    }
    if (relPathResolver == null) {
      relPathResolver = new RelativePathResolver_impl();
    }
     
    // Get the file URL, resolving relative path as necessary
    IOException ioEx = null;
    try {
      // Get the file URL from the specifier.  If the user has passed a file path
      // (e.g. c:\Program Files\...) instead of a URL, be lenient and convert it to
      // a URL
      URL relativeUrl;
      try {
        relativeUrl = new URL(spec.getFileUrl());
      }
      catch (MalformedURLException e) {
        //try to treat the URL as a file name. 
        File file = new File(spec.getFileUrl());
        if (file.isAbsolute()) {
          //for absolute paths, use File.toURL(), which handles
          //windows absolute paths correctly
          relativeUrl = file.toURL();
        } else {
          //for relative paths, we can' use File.toURL() because it always
          //produces an absolute URL.  Instead we do the following, which
          //won't work for windows absolute paths (but that's OK, since we
          //know we're working with a relative path)
          relativeUrl = new URL("file", "", spec.getFileUrl());
        }
      }
     
      //resolve relative paths
      mFileUrl = relPathResolver.resolveRelativePath(relativeUrl);

      // Store local cache info, even though it is not used
      if (spec.getLocalCache() == null) {
        mLocalCache = null;
      } else {
View Full Code Here

TOP

Related Classes of org.apache.uima.resource.RelativePathResolver

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.