Interface ResourceProvider<A extends Resource>

Type Parameters:
A - the resource type
All Known Subinterfaces:
AsyncResourceProvider<A>
All Known Implementing Classes:
AbstractResourceProvider

public interface ResourceProvider<A extends Resource>

A resource provider is used to resolve some particular kinds of resources.

It shall be used by a ResourceService to resolve resources based on their kind specified in the scheme of the resource URI.

Since:
1.0
Author:
Jeremy Kuhn
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    Resolves the resource identified by the specified URI.
    Stream<? extends Resource>
    Resolves the resources that exist at the location identified by the specified URI.
    Returns the kinds of resources supported by the provider.
  • Method Details

    • getResource

      Resolves the resource identified by the specified URI.

      Parameters:
      uri - a uri
      Returns:
      a resource
      Throws:
      NullPointerException - if the specified URI is null
      IllegalArgumentException - if the kind of resource specified in the URI is not provided by the provider
      ResourceException - if there was an error resolving the resource
    • getResources

      Resolves the resources that exist at the location identified by the specified URI.

      The returned result depends on the kind of resource considered and the provider itself. For instance a file resource provider could implement some kind of pattern in the specified URI to return multiple resources (eg. file:/a/**/b.txt), but not all kind of resources can be listed in such a way, for instance it is not possible to list resources on a classpath or at a given URL.

      Parameters:
      uri - a URI
      Returns:
      a stream or resources
      Throws:
      NullPointerException - if the specified URI is null
      IllegalArgumentException - if the kind of resource specified in the URI is not provided by the provider
      ResourceException - if there was an error resolving resources
    • getSupportedSchemes

      Set<String> getSupportedSchemes()

      Returns the kinds of resources supported by the provider.

      Returns:
      a list of resource kinds