*
* @see org.osgi.framework.Bundle#getEntry(String)
* @see org.osgi.framework.Bundle#getResource(String)
*/
public URL getURL() throws IOException {
ContextResource res = null;
URL url = null;
switch (searchType) {
// same as bundle space but with a different string
case OsgiResourceUtils.PREFIX_TYPE_NOT_SPECIFIED:
res = getResourceFromBundleSpace(pathWithoutPrefix);
break;
case OsgiResourceUtils.PREFIX_TYPE_BUNDLE_SPACE:
res = getResourceFromBundleSpace(pathWithoutPrefix);
break;
case OsgiResourceUtils.PREFIX_TYPE_BUNDLE_JAR:
url = getResourceFromBundleJar(pathWithoutPrefix);
break;
case OsgiResourceUtils.PREFIX_TYPE_CLASS_SPACE:
url = getResourceFromBundleClasspath(pathWithoutPrefix);
break;
// fallback
default:
// just try to convert it to an URL
url = new URL(path);
break;
}
if (res != null) {
url = res.getURL();
}
if (url == null) {
throw new FileNotFoundException(getDescription() + " cannot be resolved to URL because it does not exist");
}