public class ObrURLStreamHandlerService
extends org.osgi.service.url.AbstractURLStreamHandlerService
URLStreamHandler which is able to handle
obr urls. The urls must be conform the following schema:
obr://| Modifier and Type | Class and Description |
|---|---|
(package private) static class |
ObrURLStreamHandlerService.NewestSelectionStrategy
Strategy returning the newest entry.
|
private static class |
ObrURLStreamHandlerService.ResourceSelectionStrategy
Abstract class for Resource Selection Strategies
|
(package private) static class |
ObrURLStreamHandlerService.SameSelectionStrategy
Strategy returning the current version.
|
| Modifier and Type | Field and Description |
|---|---|
private org.osgi.framework.BundleContext |
m_bundleContext
The BundleContext to search for the bundles.
|
private org.apache.felix.utils.log.Logger |
m_logger
Logger to use.
|
private RepositoryAdmin |
m_reRepositoryAdmin
The RepositoryAdmin to query for the actual url
for a bundle.
|
private java.lang.String |
m_updateStrategy
The update strategy to use.
|
static java.lang.String |
OBR_UPDATE_STRATEGY
Property defining the obr update strategy
|
private static java.lang.String |
SYNTAX
Syntax for the url; to be shown on exception messages.
|
| Constructor and Description |
|---|
ObrURLStreamHandlerService(org.osgi.framework.BundleContext context,
RepositoryAdmin admin)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
private java.net.URL |
getRemoteObrInstallUrl(java.lang.String path)
Assume the URL is a query URL and try to find a matching resource.
|
private java.net.URL |
getRemoteUrlForBundle(org.osgi.framework.Bundle bundle)
Determines the remote url for the given bundle according to
the configured
ObrURLStreamHandlerService.ResourceSelectionStrategy. |
private ObrURLStreamHandlerService.ResourceSelectionStrategy |
getStrategy(java.lang.String strategy) |
java.net.URLConnection |
openConnection(java.net.URL u)
This implementation looks up the bundle with the given
url set as location String within the current
BundleContext. |
private boolean |
validateFilter(java.lang.String filter) |
private static final java.lang.String SYNTAX
public static final java.lang.String OBR_UPDATE_STRATEGY
private final org.osgi.framework.BundleContext m_bundleContext
private final RepositoryAdmin m_reRepositoryAdmin
private final org.apache.felix.utils.log.Logger m_logger
private java.lang.String m_updateStrategy
public ObrURLStreamHandlerService(org.osgi.framework.BundleContext context,
RepositoryAdmin admin)
context - context to useadmin - admin to usepublic java.net.URLConnection openConnection(java.net.URL u)
throws java.io.IOException
BundleContext.
The real url for this bundle is determined afterwards via the
RepositoryAdmin.openConnection in interface org.osgi.service.url.URLStreamHandlerServiceopenConnection in class org.osgi.service.url.AbstractURLStreamHandlerServicejava.io.IOExceptionprivate java.net.URL getRemoteObrInstallUrl(java.lang.String path)
throws java.io.IOException,
org.osgi.framework.InvalidSyntaxException
path - the OBR url pathjava.io.IOException - if an error occursorg.osgi.framework.InvalidSyntaxExceptionprivate boolean validateFilter(java.lang.String filter)
private java.net.URL getRemoteUrlForBundle(org.osgi.framework.Bundle bundle)
throws java.io.IOException,
org.osgi.framework.InvalidSyntaxException
ObrURLStreamHandlerService.ResourceSelectionStrategy.bundle - bundlejava.io.IOException - if something went wrongorg.osgi.framework.InvalidSyntaxExceptionprivate ObrURLStreamHandlerService.ResourceSelectionStrategy getStrategy(java.lang.String strategy)