org.springframework.osgi.io
Class OsgiBundleResourceLoader

java.lang.Object
  extended by org.springframework.core.io.DefaultResourceLoader
      extended by org.springframework.osgi.io.OsgiBundleResourceLoader
All Implemented Interfaces:
ResourceLoader

public class OsgiBundleResourceLoader
extends DefaultResourceLoader

OSGi specific ResourceLoader implementation. The loader resolves paths inside an OSGi bundle using the bundle entries for resource loading for any unqualified resource string. Also understands the "bundle:" resource prefix for explicit loading of resources from the bundle. When the bundle prefix is used the target resource must be contained within the bundle (or attached fragments), the classpath is not searched.

Author:
Adrian Colyer, Costin Leau
See Also:
Bundle, OsgiBundleResource

Field Summary
 
Fields inherited from interface org.springframework.core.io.ResourceLoader
CLASSPATH_URL_PREFIX
 
Constructor Summary
OsgiBundleResourceLoader(Bundle bundle)
          Creates a OSGi aware ResourceLoader using the given bundle.
 
Method Summary
 Bundle getBundle()
          Return the bundle for this resource.
 Resource getResource(String location)
          Implementation of getResource that delegates to the bundle for any unqualified resource reference or a reference starting with "bundle:"
protected  Resource getResourceByPath(String path)
           
 
Methods inherited from class org.springframework.core.io.DefaultResourceLoader
getClassLoader, setClassLoader
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OsgiBundleResourceLoader

public OsgiBundleResourceLoader(Bundle bundle)
Creates a OSGi aware ResourceLoader using the given bundle.

Parameters:
bundle -
Method Detail

getResourceByPath

protected Resource getResourceByPath(String path)
Overrides:
getResourceByPath in class DefaultResourceLoader

getResource

public Resource getResource(String location)
Implementation of getResource that delegates to the bundle for any unqualified resource reference or a reference starting with "bundle:"

Specified by:
getResource in interface ResourceLoader
Overrides:
getResource in class DefaultResourceLoader

getBundle

public final Bundle getBundle()
Return the bundle for this resource.



Copyright © 2006-2007 Spring Framework. All Rights Reserved.