Package org.apache.cxf.resource
Interface ResourceManager
- All Known Implementing Classes:
DefaultResourceManager
,ResourceManagerImpl
public interface ResourceManager
Locates resources that are used at runtime. The
ResourceManager
queries registered
ResourceResolver
to find resources.-
Method Summary
Modifier and TypeMethodDescriptionvoid
addResourceResolver
(ResourceResolver resolver) Add aResourceResolver
.getResourceAsStream
(String name) Open stream to resource.Get all the currently registered resolvers.void
removeResourceResolver
(ResourceResolver resolver) Remove aResourceResolver
.<T> T
resolveResource
(String name, Class<T> type) Resolve a resource.<T> T
resolveResource
(String name, Class<T> type, List<ResourceResolver> resolvers) Resolve a resource with via a specified list of resovlers.
-
Method Details
-
resolveResource
Resolve a resource. The ResourceManager will query all of the registeredResourceResovler
objects until one manages to resolve the resource- Parameters:
name
- name of resource to resolve.type
- type of resource to resolve.- Returns:
- the resolved resource or null if nothing found.
-
resolveResource
Resolve a resource with via a specified list of resovlers. This allows resources to be specified with a locally defined list of resolvers.- Parameters:
name
- name of resource to resolve.type
- type of resource to resolve.resolvers
- list ofResourceResolvers to search.
- Returns:
- the resolved resource or null if nothing found.
-
getResourceAsStream
Open stream to resource.- Parameters:
name
- name of resource to resolve.- Returns:
- the InputStream to the resource or null if the resource cannot be found.
-
addResourceResolver
Add aResourceResolver
. The newly added resolver is added at the head of the list so the most recently added will be queried first.- Parameters:
resolver
- theResourceResolver
to add. Duplicates will be ignored.
-
removeResourceResolver
Remove aResourceResolver
.- Parameters:
resolver
- theResourceResolver
to remove. If not previously registered, it is ignored.
-
getResourceResolvers
List<ResourceResolver> getResourceResolvers()Get all the currently registered resolvers. This method should return an unmodifiable view of the list of resolvers so that resolvers added after this method has been called will alter the list returned.
-