Class URIResolver

java.lang.Object
io.nosqlbench.nb.api.content.URIResolver
All Implemented Interfaces:
ContentResolver

public class URIResolver
extends java.lang.Object
implements ContentResolver
This is a stateful search object for resources like Paths or URLs. It provides the abilitiy to look for URIs in any form, with simple pluggable search back-ends, in some preferential order.
  • Constructor Summary

    Constructors 
    Constructor Description
    URIResolver()  
  • Method Summary

    Modifier and Type Method Description
    URIResolver all()
    Include resources from all known places, including remote URLs, the local default filesystem, and the classpath, which includes the jars that hold the current runtime application.
    URIResolver extension​(java.lang.String extension)  
    URIResolver extraPaths​(java.lang.String extraPath)  
    URIResolver inCP()
    Include resources within the classpath.
    URIResolver inFS()
    Includ resources in the default filesystem
    URIResolver inURLs()
    Include resources in remote URLs
    java.util.List<Content<?>> resolve​(java.lang.String uri)  
    java.util.List<Content<?>> resolve​(java.net.URI uri)
    Locate the content referenced by the specified name.
    java.util.List<Content<?>> resolveAll​(java.lang.String uri)  
    java.util.List<Content<?>> resolveAll​(java.net.URI uri)  
    java.util.List<java.nio.file.Path> resolveDirectory​(java.net.URI uri)
    Return a list of matching directory Paths for the URI which are accessible under the scheme of the implementing resolver.
    Content<?> resolveOne​(java.lang.String candidatePath)  
    java.lang.String toString()  

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface io.nosqlbench.nb.api.content.ContentResolver

    resolveDirectory
  • Constructor Details

  • Method Details

    • all

      public URIResolver all()
      Include resources from all known places, including remote URLs, the local default filesystem, and the classpath, which includes the jars that hold the current runtime application.
      Returns:
      this URISearch
    • inFS

      public URIResolver inFS()
      Includ resources in the default filesystem
      Returns:
      this URISearch
    • inURLs

      public URIResolver inURLs()
      Include resources in remote URLs
      Returns:
      this URISearch
    • inCP

      public URIResolver inCP()
      Include resources within the classpath.
      Returns:
      this URISearch
    • resolve

      public java.util.List<Content<?>> resolve​(java.lang.String uri)
      Specified by:
      resolve in interface ContentResolver
    • resolveDirectory

      public java.util.List<java.nio.file.Path> resolveDirectory​(java.net.URI uri)
      Description copied from interface: ContentResolver
      Return a list of matching directory Paths for the URI which are accessible under the scheme of the implementing resolver. It is possible that a logical path can return more than one physical directory path, such as with jar files.
      Specified by:
      resolveDirectory in interface ContentResolver
      Returns:
      A list of accessible paths matching the uri, or an empty list
    • resolve

      public java.util.List<Content<?>> resolve​(java.net.URI uri)
      Description copied from interface: ContentResolver
      Locate the content referenced by the specified name. Content is any URL or file path which contains data to be loaded.

      Implementors should take care to ensure the following conditions are met:

      • For URL style content, resolution is only successful if a stream to download the content is acquired.
      • For file paths, resolution is only successful if the filesystem does a standard access check for readability of a file that is present.
      A content resolver may be given a path which is fundamentally incompatible with the schemes supported by the resolver implementation. It is required that the resolver return null for such URI values.
      Specified by:
      resolve in interface ContentResolver
      Parameters:
      uri - The URI of a content location, like a file name or URL.
      Returns:
      A content element which may then be used to access the content
    • resolveAll

      public java.util.List<Content<?>> resolveAll​(java.lang.String uri)
    • resolveAll

      public java.util.List<Content<?>> resolveAll​(java.net.URI uri)
    • extension

      public URIResolver extension​(java.lang.String extension)
    • extraPaths

      public URIResolver extraPaths​(java.lang.String extraPath)
    • resolveOne

      public Content<?> resolveOne​(java.lang.String candidatePath)
    • toString

      public java.lang.String toString()
      Overrides:
      toString in class java.lang.Object