|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jboss.solder.resourceLoader.ResourceProvider
@Veto public class ResourceProvider
The ResourceProvider allows dynamic loading of managed resources. For example:
@Inject
void readXml(ResourceProvider provider, String fileName)
{
InputStream webXml = provider.loadResourceStream(fileName);
}
If you know the name of the resource you are loading at development time you
can inject it directly using the @
qualifier.
Resource
If a input stream is loaded, it will be automatically closed when the InputStream goes out of scope. If a URL is used to create an input stream, the application is responsible for closing it. For this reason it is recommended that managed input streams are used where possible.
Resource,
Serialized Form| Method Summary | |
|---|---|
Properties |
loadPropertiesBundle(String name)
Load a properties bundle. |
Collection<Properties> |
loadPropertiesBundles(String name)
Load all properties bundles known to the resource loader by name. |
URL |
loadResource(String name)
Load a resource. |
Collection<URL> |
loadResources(String name)
Load all resources known to the resource loader by name. |
Collection<InputStream> |
loadResourcesStreams(String name)
Load all resources known to the resource loader by name. |
InputStream |
loadResourceStream(String name)
Load a resource. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public InputStream loadResourceStream(String name)
Load a resource.
The resource loaders will be searched in precedence order, the first result found being returned. The default search order is:
However extensions may extend this list.
name - the resource to load
null if no resource can be loaded
RuntimeException - if an error occurs loading the resourcepublic Collection<InputStream> loadResourcesStreams(String name)
Load all resources known to the resource loader by name.
By default, Solder will search:
However extensions may extend this list.
name - the resource to load
RuntimeException - if an error occurs loading the resourcepublic URL loadResource(String name)
Load a resource.
The resource loaders will be searched in precedence order, the first result found being returned. The default search order is:
However extensions may extend this list.
name - the resource to load
null if no
resource can be loaded
RuntimeException - if an error occurs loading the resourcepublic Collection<URL> loadResources(String name)
Load all resources known to the resource loader by name.
By default, Solder will search:
However extensions may extend this list.
name - the resource to load
RuntimeException - if an error occurs loading the resourcepublic Properties loadPropertiesBundle(String name)
Load a properties bundle.
The resource loaders will be searched in precedence order, the first result found being returned. The default search order is:
However extensions may extend this list.
name - the name of the properties bundle to load
RuntimeException - if an error occurs loading the resourcepublic Collection<Properties> loadPropertiesBundles(String name)
Load all properties bundles known to the resource loader by name.
By default, Solder will search:
However extensions may extend this list.
name - the name of the properties bundle to load
RuntimeException - if an error occurs loading the properties bundle
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||