Package org.jboss.solder.resourceLoader

An extensible, injectable resource loader that can provide provide URLs, managed input streams and sets of properties.

See:
          Description

Interface Summary
ResourceLoader A ResourceLoader is a pluggable contract for loading resources.
 

Class Summary
ResourceProvider The ResourceProvider allows dynamic loading of managed resources.
 

Annotation Types Summary
Resource An injection point qualifier that may be used to specify a resource to inject.
 

Package org.jboss.solder.resourceLoader Description

An extensible, injectable resource loader that can provide provide URLs, managed input streams and sets of properties.

If the resource name is known at development time, the resource can be injected:

 @Inject
 @Resource("WEB-INF/beans.xml")
 URL beansXml;

 @Inject
 @Resource("WEB-INF/web.xml")
 InputStream webXml;

 @Inject
 @Resource("META-INF/aws.properties")
 Properties awsProperties;
 

If the resource name is not known, the ResourceProvider can be injected, and the resource looked up dynamically:

 @Inject
 void readXml(ResourceProvider provider, String fileName) {
    InputStream webXml = provider.loadResourceStream(fileName);
 }
 

Any input stream injected, or created directly by the ResourceProvider is managed, and will be automatically closed when the bean declaring the injection point of the resource or provider is destroyed.

Author:
Pete Muir
See Also:
Resource, ResourceProvider, ResourceLoader, org.jboss.solder.resourceLoader.ResourceLoaderManager


Copyright © 2011 Seam Framework. All Rights Reserved.