Interface ResourceProvider<A extends Resource>
- Type Parameters:
A
- the resource type
- All Known Subinterfaces:
AsyncResourceProvider<A>
- All Known Implementing Classes:
AbstractResourceProvider
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 TypeMethodDescriptiongetResource
(URI uri) Resolves the resource identified by the specified URI.getResources
(URI uri) 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 nullIllegalArgumentException
- if the kind of resource specified in the URI is not provided by the providerResourceException
- if there was an error resolving the resource
-
getResources
Stream<? extends Resource> getResources(URI uri) throws NullPointerException, IllegalArgumentException, ResourceException 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 nullIllegalArgumentException
- if the kind of resource specified in the URI is not provided by the providerResourceException
- if there was an error resolving resources
-
getSupportedSchemes
Returns the kinds of resources supported by the provider.
- Returns:
- a list of resource kinds
-