public class DefaultBundleAccessor extends Object implements BundleAccessor
CURRENT_BUNDLE_NAME
Constructor and Description |
---|
DefaultBundleAccessor() |
Modifier and Type | Method and Description |
---|---|
void |
addPackageFromBundle(org.osgi.framework.Bundle bundle,
String packageName)
Add as Bundle -> Package mapping
|
org.osgi.framework.ServiceReference[] |
getAllServiceReferences(String className) |
static DefaultBundleAccessor |
getInstance() |
Set<String> |
getPackagesByBundle(org.osgi.framework.Bundle bundle) |
Object |
getService(org.osgi.framework.ServiceReference ref) |
org.osgi.framework.ServiceReference |
getServiceReference(String className) |
org.osgi.framework.ServiceReference[] |
getServiceReferences(String className,
String params) |
Class<?> |
loadClass(String className) |
URL |
loadResource(String name) |
URL |
loadResource(String name,
boolean translate) |
InputStream |
loadResourceAsStream(String name) |
URL |
loadResourceFromAllBundles(String name) |
InputStream |
loadResourceFromAllBundlesAsStream(String name) |
List<URL> |
loadResources(String name) |
List<URL> |
loadResources(String name,
boolean translate) |
void |
setBundleContext(org.osgi.framework.BundleContext bundleContext) |
void |
setOsgiHost(OsgiHost osgiHost) |
public static DefaultBundleAccessor getInstance()
public Object getService(org.osgi.framework.ServiceReference ref)
getService
in interface BundleAccessor
public org.osgi.framework.ServiceReference getServiceReference(String className)
getServiceReference
in interface BundleAccessor
public org.osgi.framework.ServiceReference[] getAllServiceReferences(String className)
getAllServiceReferences
in interface BundleAccessor
public org.osgi.framework.ServiceReference[] getServiceReferences(String className, String params) throws org.osgi.framework.InvalidSyntaxException
getServiceReferences
in interface BundleAccessor
org.osgi.framework.InvalidSyntaxException
public void addPackageFromBundle(org.osgi.framework.Bundle bundle, String packageName)
addPackageFromBundle
in interface BundleAccessor
bundle
- the bundle where the package was loaded frompackageName
- the anme of the loaded packagepublic Class<?> loadClass(String className) throws ClassNotFoundException
loadClass
in interface BundleAccessor
ClassNotFoundException
public List<URL> loadResources(String name) throws IOException
IOException
public List<URL> loadResources(String name, boolean translate) throws IOException
IOException
public URL loadResourceFromAllBundles(String name) throws IOException
loadResourceFromAllBundles
in interface BundleAccessor
IOException
public InputStream loadResourceFromAllBundlesAsStream(String name) throws IOException
loadResourceFromAllBundlesAsStream
in interface BundleAccessor
IOException
public Set<String> getPackagesByBundle(org.osgi.framework.Bundle bundle)
getPackagesByBundle
in interface BundleAccessor
public InputStream loadResourceAsStream(String name) throws IOException
loadResourceAsStream
in interface BundleAccessor
IOException
public void setBundleContext(org.osgi.framework.BundleContext bundleContext)
setBundleContext
in interface BundleAccessor
public void setOsgiHost(OsgiHost osgiHost)
setOsgiHost
in interface BundleAccessor
Copyright © 2000–2020 Apache Software Foundation. All rights reserved.