Class URLResourceReader

java.lang.Object
ddf.catalog.resource.impl.URLResourceReader
All Implemented Interfaces:
ddf.catalog.resource.ResourceReader, ddf.catalog.util.Describable, org.codice.ddf.platform.services.common.Describable

public class URLResourceReader extends Object implements ddf.catalog.resource.ResourceReader
A URLResourceReader retrieves a Resource from a local or remote file system using a URI. The URI is used to specify the file location. A URLResourceReader supports URIs with HTTP, HTTPS, and file schemes.
  • Constructor Details

    • URLResourceReader

      public URLResourceReader(org.codice.ddf.cxf.client.ClientBuilderFactory clientBuilderFactory)
      Default URLResourceReader constructor.
    • URLResourceReader

      public URLResourceReader(ddf.mime.MimeTypeMapper mimeTypeMapper, org.codice.ddf.cxf.client.ClientBuilderFactory clientBuilderFactory)
  • Method Details

    • getURLSupportedSchemes

      public Set<String> getURLSupportedSchemes()
    • getVersion

      public String getVersion()
      Specified by:
      getVersion in interface ddf.catalog.util.Describable
      Specified by:
      getVersion in interface org.codice.ddf.platform.services.common.Describable
    • getId

      public String getId()
      Specified by:
      getId in interface ddf.catalog.util.Describable
      Specified by:
      getId in interface org.codice.ddf.platform.services.common.Describable
    • getTitle

      public String getTitle()
      Specified by:
      getTitle in interface ddf.catalog.util.Describable
      Specified by:
      getTitle in interface org.codice.ddf.platform.services.common.Describable
    • getDescription

      public String getDescription()
      Specified by:
      getDescription in interface ddf.catalog.util.Describable
      Specified by:
      getDescription in interface org.codice.ddf.platform.services.common.Describable
    • getOrganization

      public String getOrganization()
      Specified by:
      getOrganization in interface ddf.catalog.util.Describable
      Specified by:
      getOrganization in interface org.codice.ddf.platform.services.common.Describable
    • getSupportedSchemes

      public Set<String> getSupportedSchemes()
      Supported schemes are HTTP, HTTPS, and file
      Specified by:
      getSupportedSchemes in interface ddf.catalog.resource.ResourceReader
      Returns:
      set of supported schemes
    • getMimeTypeMapper

      public ddf.mime.MimeTypeMapper getMimeTypeMapper()
    • setMimeTypeMapper

      public void setMimeTypeMapper(ddf.mime.MimeTypeMapper mimeTypeMapper)
    • setRootResourceDirectories

      public void setRootResourceDirectories(Set<String> rootResourceDirectoryPaths)
      Sets the directories that the URLResourceReader has permission to access when attempting to download a resource linked by a file URL.
      Parameters:
      rootResourceDirectoryPaths - a set of absolute paths specifying which directories the URLResourceReader has permission to access when attempting to download resources linked by a file URL. A null or empty input clears all root resource directory paths from the URLResourceReader (this effectively blocks all resource downloads linked by file URLs).
    • getRootResourceDirectories

      public Set<String> getRootResourceDirectories()
    • setFollowRedirects

      public void setFollowRedirects(Boolean redirect)
      Specifies whether the code should follow server issued redirection (HTTP Response codes between 300 and 400)
      Parameters:
      redirect - true - follow redirections automatically false - do not follow server issued redirections
    • getFollowRedirects

      public Boolean getFollowRedirects()
      Gets the autoRedirect property
      Returns:
      true if the server issued redirections should be automatically followed
    • retrieveResource

      public ddf.catalog.operation.ResourceResponse retrieveResource(URI resourceURI, Map<String,Serializable> properties) throws IOException, ddf.catalog.resource.ResourceNotFoundException
      Retrieves a Resource based on a URI and provided arguments. A connection is made to the URI to obtain the Resource's InputStream and build a ResourceResponse from that. If the URI's scheme is HTTP or HTTPS, the Resource's name gets set to the URI passed in, otherwise, if it is a file scheme, the name is set to the actual file name.
      Specified by:
      retrieveResource in interface ddf.catalog.resource.ResourceReader
      Parameters:
      resourceURI - A URI that defines what Resource to retrieve and how to do it.
      properties - Any additional arguments that should be passed to the ResourceReader.
      Returns:
      A ResourceResponse containing the retrieved Resource.
      Throws:
      IOException
      ddf.catalog.resource.ResourceNotFoundException
    • getWebClient

      protected org.apache.cxf.jaxrs.client.WebClient getWebClient(URI uri, Map<String,Serializable> properties)
    • getOptions

      public Set<String> getOptions(ddf.catalog.data.Metacard metacard)
      Specified by:
      getOptions in interface ddf.catalog.resource.ResourceReader