Package org.apache.cxf.resource
Class DefaultResourceManager
java.lang.Object
org.apache.cxf.resource.DefaultResourceManager
- All Implemented Interfaces:
ResourceManager
- Direct Known Subclasses:
ResourceManagerImpl
-
Field Summary
-
Constructor Summary
ConstructorDescriptionDefaultResourceManager
(List<? extends ResourceResolver> resolvers) DefaultResourceManager
(ResourceResolver resolver) -
Method Summary
Modifier and TypeMethodDescriptionfinal void
addResourceResolver
(ResourceResolver resolver) Add aResourceResolver
.final void
addResourceResolvers
(Collection<? extends ResourceResolver> resolvers) final InputStream
getResourceAsStream
(String name) Open stream to resource.final List<ResourceResolver>
Get all the currently registered resolvers.protected void
final void
removeResourceResolver
(ResourceResolver resolver) Remove aResourceResolver
.final <T> T
resolveResource
(String name, Class<T> type) Resolve a resource.final <T> T
resolveResource
(String name, Class<T> type, List<ResourceResolver> resolvers) Resolve a resource with via a specified list of resovlers.
-
Field Details
-
registeredResolvers
-
firstCalled
protected boolean firstCalled
-
-
Constructor Details
-
DefaultResourceManager
public DefaultResourceManager() -
DefaultResourceManager
-
DefaultResourceManager
-
-
Method Details
-
onFirstResolve
protected void onFirstResolve() -
resolveResource
Description copied from interface:ResourceManager
Resolve a resource. The ResourceManager will query all of the registeredResourceResovler
objects until one manages to resolve the resource- Specified by:
resolveResource
in interfaceResourceManager
- Parameters:
name
- name of resource to resolve.type
- type of resource to resolve.- Returns:
- the resolved resource or null if nothing found.
-
resolveResource
Description copied from interface:ResourceManager
Resolve a resource with via a specified list of resovlers. This allows resources to be specified with a locally defined list of resolvers.- Specified by:
resolveResource
in interfaceResourceManager
- 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
Description copied from interface:ResourceManager
Open stream to resource.- Specified by:
getResourceAsStream
in interfaceResourceManager
- Parameters:
name
- name of resource to resolve.- Returns:
- the InputStream to the resource or null if the resource cannot be found.
-
addResourceResolver
Description copied from interface:ResourceManager
Add aResourceResolver
. The newly added resolver is added at the head of the list so the most recently added will be queried first.- Specified by:
addResourceResolver
in interfaceResourceManager
- Parameters:
resolver
- theResourceResolver
to add. Duplicates will be ignored.
-
addResourceResolvers
-
removeResourceResolver
Description copied from interface:ResourceManager
Remove aResourceResolver
.- Specified by:
removeResourceResolver
in interfaceResourceManager
- Parameters:
resolver
- theResourceResolver
to remove. If not previously registered, it is ignored.
-
getResourceResolvers
Description copied from interface:ResourceManager
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.- Specified by:
getResourceResolvers
in interfaceResourceManager
-