org.apache.cxf.resource

## Class DefaultResourceManager

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

- All Implemented Interfaces:
    ResourceManager

      public class DefaultResourceManager
      extends Object
      implements ResourceManager

- - ### Field Summary

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

  - ### Constructor Summary

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

  - ### Method Summary

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

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

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

- - ### Field Detail

    - #### registeredResolvers

          protected final List<ResourceResolver> registeredResolvers

    - #### firstCalled

          protected boolean firstCalled

  - ### Constructor Detail

    - #### DefaultResourceManager

          public DefaultResourceManager()

    - #### DefaultResourceManager

          public DefaultResourceManager(ResourceResolver resolver)

    - #### DefaultResourceManager

          public DefaultResourceManager(List<? extends ResourceResolver> resolvers)

  - ### Method Detail

    - #### 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 a copy 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`

Apache CXF