public class ResourceLoaderManager extends Object
ResourceLoaderManager
discovers and instantiates all
ResourceLoader
s defined. It also provides accesss to these resources,
either as URL
s or InputStream
s.
If you are working in a CDI managed environment, you should use
ResourceProvider
instead, as it provides automatic, contextual
management of resources. If you are outside a CDI managed environment, then
instantiating ResourceLoaderManager
provides access to the same
resources.
ResourceLoader
,
ResourceProvider
Constructor and Description |
---|
ResourceLoaderManager()
Instantiate a new instance, loading any resource loaders from the service
loader, and sorting them by precedence.
|
Modifier and Type | Method and Description |
---|---|
Properties |
getPropertiesBundle(String name)
Load a properties bundle by name.
|
Collection<Properties> |
getPropertiesBundles(String name)
Load all properties bundles known to the resource loader by name.
|
URL |
getResource(String name)
Load a resource by name.
|
InputStream |
getResourceAsStream(String name)
Load a resource by name.
|
Iterable<ResourceLoader> |
getResourceLoaders()
The discovered
ResourceLoader instances. |
Collection<URL> |
getResources(String name)
Load all resources known to the resource loader by name.
|
Collection<InputStream> |
getResourcesAsStream(String name)
Load all resources known to the resource loader by name.
|
public ResourceLoaderManager()
public Iterable<ResourceLoader> getResourceLoaders()
ResourceLoader
instances.public URL getResource(String name)
Load a resource by name.
The resource loaders will be searched in precedence order, the first result found being returned.
name
- the resource to loadnull
if no
resource can be loadedRuntimeException
- if an error occurs loading the resourcepublic Properties getPropertiesBundle(String name)
Load a properties bundle by name.
The resource loaders will be searched in precedence order, the first result found being returned.
name
- the name of the properties bundle to loadRuntimeException
- if an error occurs loading the properties bundlepublic Collection<Properties> getPropertiesBundles(String name)
Load all properties bundles known to the resource loader by name.
name
- the name of the properties bundle to loadRuntimeException
- if an error occurs loading the properties bundlespublic InputStream getResourceAsStream(String name)
Load a resource by name.
The resource loaders will be searched in precedence order, the first result found being returned.
name
- the resource to loadnull
if no resource can be loadedRuntimeException
- if an error occurs loading the resourcepublic Collection<URL> getResources(String name)
Load all resources known to the resource loader by name.
name
- the resource to loadRuntimeException
- if an error occurs loading the resourcepublic Collection<InputStream> getResourcesAsStream(String name)
Load all resources known to the resource loader by name.
name
- the resource to loadRuntimeException
- if an error occurs loading the resourceCopyright © 2008-2013 Seam Framework. All Rights Reserved.