org.jboss.solder.resourceLoader
Interface ResourceLoader

All Superinterfaces:
Sortable

public interface ResourceLoader
extends Sortable

A ResourceLoader is a pluggable contract for loading resources.

Solder comes with a resource loader which uses the classpath to locate resources, and a resource loader that uses the ServletContext (if available).

To register a custom ResourceLoader you should implement this interface, and register it as a ServiceProvider for the ResourceLoader service.

Author:
Pete Muir
See Also:
ResourceProvider, Resource

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.jboss.solder.util.Sortable
Sortable.Comparator
 
Method Summary
 URL getResource(String name)
           Get the URL for a resource.
 InputStream getResourceAsStream(String name)
           Get the InputStream for a resource.
 Collection<URL> getResources(String name)
           Get the URLs known to all resource loaders for a given name.
 Collection<InputStream> getResourcesAsStream(String name)
           Get the input streams known to all resource loaders for a given name.
 
Methods inherited from interface org.jboss.solder.util.Sortable
getPrecedence
 

Method Detail

getResource

URL getResource(String name)

Get the URL for a resource.

The resource loaders are searched in precedence order, stopping when a resource is found.

Parameters:
name - the resource to get the URL for
Returns:
the URL, or null if the resource does not exist
Throws:
RuntimeException - if an error occurs loading the resource

getResourceAsStream

InputStream getResourceAsStream(String name)

Get the InputStream for a resource.

The resource loaders are searched in precedence order, stopping when a resource is found.

Parameters:
name - the resource to get the InputStream for
Returns:
the InputStream, or null if the resource does not exist
Throws:
RuntimeException - if an error occurs loading the resource

getResources

Collection<URL> getResources(String name)

Get the URLs known to all resource loaders for a given name.

Parameters:
name - the resource to get the URLs for
Returns:
the URLs, or an empty collection if no resources are found
Throws:
RuntimeException - if an error occurs loading the resource

getResourcesAsStream

Collection<InputStream> getResourcesAsStream(String name)

Get the input streams known to all resource loaders for a given name.

Parameters:
name - name the resource to get the input streams for
Returns:
the input streams, or an empty collection if no resources are found
Throws:
RuntimeException - if an error occurs loading the resource


Copyright © 2011 Seam Framework. All Rights Reserved.