Package org.apache.cxf.resource

# Class DefaultResourceManager

java.lang.Object
org.apache.cxf.resource.DefaultResourceManager

All Implemented Interfaces:
  `ResourceManager`

Direct Known Subclasses:
  `ResourceManagerImpl`

public class DefaultResourceManager extends Object implements ResourceManager

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected boolean`
  `firstCalled`
  `protected final List<ResourceResolver>`
  `registeredResolvers`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `DefaultResourceManager()`
  `DefaultResourceManager(List<? extends ResourceResolver> resolvers)`
  `DefaultResourceManager(ResourceResolver resolver)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `final void`
  `addResourceResolver(ResourceResolver resolver)`
  Add a `ResourceResolver`.
  `final void`
  `addResourceResolvers(Collection<? extends ResourceResolver> resolvers)`
  `final InputStream`
  `getResourceAsStream(String name)`
  Open stream to resource.
  `final List<ResourceResolver>`
  `getResourceResolvers()`
  Get all the currently registered resolvers.
  `protected void`
  `onFirstResolve()`
  `final void`
  `removeResourceResolver(ResourceResolver resolver)`
  Remove a `ResourceResolver`.
  `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.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### registeredResolvers

    protected final List<ResourceResolver> registeredResolvers

  - ### firstCalled

    protected boolean firstCalled

- ## Constructor Details

  - ### DefaultResourceManager

    public DefaultResourceManager()

  - ### DefaultResourceManager

    public DefaultResourceManager(ResourceResolver resolver)

  - ### DefaultResourceManager

    public DefaultResourceManager(List<? extends ResourceResolver> resolvers)

- ## Method Details

  - ### onFirstResolve

    protected void onFirstResolve()

  - ### resolveResource

    public final <T> T resolveResource(String name, Class<T> type)
    Description copied from interface: `ResourceManager`
    Resolve a resource. The ResourceManager will query all of the registered `ResourceResovler` objects until one manages to resolve the resource
    Specified by:
      `resolveResource` in interface `ResourceManager`
    Parameters:
      `name` - name of resource to resolve.
      `type` - type of resource to resolve.
    Returns:
      the resolved resource or null if nothing found.

  - ### resolveResource

    public final <T> T resolveResource(String name, Class<T> type, List<ResourceResolver> resolvers)
    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 interface `ResourceManager`
    Parameters:
      `name` - name of resource to resolve.
      `type` - type of resource to resolve.
      `resolvers` - list of `ResourceResolvers to search.`
    Returns:
      the resolved resource or null if nothing found.

  - ### getResourceAsStream

    public final InputStream getResourceAsStream(String name)
    Description copied from interface: `ResourceManager`
    Open stream to resource.
    Specified by:
      `getResourceAsStream` in interface `ResourceManager`
    Parameters:
      `name` - name of resource to resolve.
    Returns:
      the InputStream to the resource or null if the resource cannot be found.

  - ### addResourceResolver

    public final void addResourceResolver(ResourceResolver resolver)
    Description copied from interface: `ResourceManager`
    Add a `ResourceResolver`. 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 interface `ResourceManager`
    Parameters:
      `resolver` - the `ResourceResolver` to add. Duplicates will be ignored.

  - ### addResourceResolvers

    public final void addResourceResolvers(Collection<? extends ResourceResolver> resolvers)

  - ### removeResourceResolver

    public final void removeResourceResolver(ResourceResolver resolver)
    Description copied from interface: `ResourceManager`
    Remove a `ResourceResolver`.
    Specified by:
      `removeResourceResolver` in interface `ResourceManager`
    Parameters:
      `resolver` - the `ResourceResolver` to remove. If not previously registered, it is ignored.

  - ### getResourceResolvers

    public final List<ResourceResolver> 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 interface `ResourceManager`