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 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