org.apache.xbean.osgi.bundle.util
Class BundleResourceHelper
java.lang.Object
org.apache.xbean.osgi.bundle.util.BundleResourceHelper
- Direct Known Subclasses:
- EquinoxBundleResourceHelper
public class BundleResourceHelper
- extends java.lang.Object
Helper for finding resources in a 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
#getResource(String) and {@link #getResources(String)} methods that do delegate META-INF resource lookups
to the wired bundles.
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 jar URLs.
- Version:
- $Rev: 1165841 $ $Date: 2011-09-06 14:02:40 -0700 (Tue, 06 Sep 2011) $
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SEARCH_WIRED_BUNDLES
public static final java.lang.String SEARCH_WIRED_BUNDLES
CONVERT_RESOURCE_URLS
public static final java.lang.String CONVERT_RESOURCE_URLS
bundle
protected final org.osgi.framework.Bundle bundle
searchWiredBundles
protected boolean searchWiredBundles
convertResourceUrls
protected boolean convertResourceUrls
BundleResourceHelper
public BundleResourceHelper(org.osgi.framework.Bundle bundle)
BundleResourceHelper
public BundleResourceHelper(org.osgi.framework.Bundle bundle,
boolean searchWiredBundles,
boolean convertResourceUrls)
setSearchWiredBundles
public void setSearchWiredBundles(boolean search)
getSearchWiredBundles
public boolean getSearchWiredBundles()
setConvertResourceUrls
public void setConvertResourceUrls(boolean convert)
getConvertResourceUrls
public boolean getConvertResourceUrls()
getResource
public java.net.URL getResource(java.lang.String name)
getResources
public java.util.Enumeration<java.net.URL> getResources(java.lang.String name)
throws java.io.IOException
- Throws:
java.io.IOException
convert
protected java.net.URL convert(java.net.URL url)
findResource
protected java.net.URL findResource(java.lang.String name)
findResources
protected java.util.Enumeration<java.net.URL> findResources(java.lang.String name)
throws java.io.IOException
- Throws:
java.io.IOException
convertedFindResource
protected java.net.URL convertedFindResource(java.lang.String name)
- Lookup resource and return converted URL (in a generic way).
- Parameters:
name -
- Returns:
convertedFindResources
protected java.util.Enumeration<java.net.URL> convertedFindResources(java.lang.String name)
throws java.io.IOException
- Lookup resources and return converted URLs (in a generic way).
- Parameters:
name -
- Returns:
-
- Throws:
java.io.IOException
getSearchWiredBundles
public static boolean getSearchWiredBundles(boolean defaultValue)
getConvertResourceUrls
public static boolean getConvertResourceUrls(boolean defaultValue)
Copyright © 2005-2012 The Apache Software Foundation. All Rights Reserved.