Class BundleResourceHelper
java.lang.Object
org.apache.xbean.osgi.bundle.util.BundleResourceHelper
- Direct Known Subclasses:
EquinoxBundleResourceHelper
Helper for finding resources in a
In OSGi, resource lookup on resources in the META-INF directory using
Bundle.
In OSGi, resource lookup on resources in the META-INF directory using
Bundle.getResource(String) or
Bundle.getResources(String) does not return the resources found in the wired bundles of the bundle
(wired via Import-Package or DynamicImport-Package). This class loader implementation provides
and {@link #getResources(String)} methods that do delegate <i>META-INF</i> resource lookups
to the wired bundles.
<br/>
The URLs returned by {@link Bundle#getResource(String)} or {@link Bundle#getResources(String)} methods are
OSGi framework specific "bundle" URLs. If enabled, this helper can convert the framework specific URLs into
regular <tt>jar</tt> URLs.- Version:
- $Rev: 1331428 $ $Date: 2012-04-27 15:39:19 +0200 (Fri, 27 Apr 2012) $
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionBundleResourceHelper(org.osgi.framework.Bundle bundle) BundleResourceHelper(org.osgi.framework.Bundle bundle, boolean searchWiredBundles, boolean convertResourceUrls) -
Method Summary
Modifier and TypeMethodDescriptionprotected URLprotected URLconvertedFindResource(String name) Lookup resource and return converted URL (in a generic way).protected Enumeration<URL>convertedFindResources(String name) Lookup resources and return converted URLs (in a generic way).protected URLfindResource(String name) protected Enumeration<URL>findResources(String name) booleanstatic booleangetConvertResourceUrls(boolean defaultValue) getResource(String name) getResources(String name) booleanstatic booleangetSearchWiredBundles(boolean defaultValue) voidsetConvertResourceUrls(boolean convert) voidsetSearchWiredBundles(boolean search)
-
Field Details
-
SEARCH_WIRED_BUNDLES
-
CONVERT_RESOURCE_URLS
-
bundle
protected final org.osgi.framework.Bundle bundle -
searchWiredBundles
protected boolean searchWiredBundles -
convertResourceUrls
protected boolean convertResourceUrls
-
-
Constructor Details
-
BundleResourceHelper
public BundleResourceHelper(org.osgi.framework.Bundle bundle) -
BundleResourceHelper
public BundleResourceHelper(org.osgi.framework.Bundle bundle, boolean searchWiredBundles, boolean convertResourceUrls)
-
-
Method Details
-
setSearchWiredBundles
public void setSearchWiredBundles(boolean search) -
getSearchWiredBundles
public boolean getSearchWiredBundles() -
setConvertResourceUrls
public void setConvertResourceUrls(boolean convert) -
getConvertResourceUrls
public boolean getConvertResourceUrls() -
getResource
-
getResources
- Throws:
IOException
-
convert
-
findResource
-
findResources
- Throws:
IOException
-
convertedFindResource
Lookup resource and return converted URL (in a generic way).- Parameters:
name-- Returns:
-
convertedFindResources
Lookup resources and return converted URLs (in a generic way).- Parameters:
name-- Returns:
- Throws:
IOException
-
getSearchWiredBundles
public static boolean getSearchWiredBundles(boolean defaultValue) -
getConvertResourceUrls
public static boolean getConvertResourceUrls(boolean defaultValue)
-