org.apache.struts2.osgi
Class DefaultBundleAccessor
java.lang.Object
org.apache.struts2.osgi.DefaultBundleAccessor
- All Implemented Interfaces:
- BundleAccessor
public class DefaultBundleAccessor
- extends Object
- implements BundleAccessor
Helper class that find resources and loads classes from the list of bundles
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DefaultBundleAccessor
public DefaultBundleAccessor()
getInstance
public static DefaultBundleAccessor getInstance()
getService
public Object getService(org.osgi.framework.ServiceReference ref)
- Specified by:
getService
in interface BundleAccessor
getServiceReference
public org.osgi.framework.ServiceReference getServiceReference(String className)
- Specified by:
getServiceReference
in interface BundleAccessor
getAllServiceReferences
public org.osgi.framework.ServiceReference[] getAllServiceReferences(String className)
- Specified by:
getAllServiceReferences
in interface BundleAccessor
getServiceReferences
public org.osgi.framework.ServiceReference[] getServiceReferences(String className,
String params)
throws org.osgi.framework.InvalidSyntaxException
- Specified by:
getServiceReferences
in interface BundleAccessor
- Throws:
org.osgi.framework.InvalidSyntaxException
addPackageFromBundle
public void addPackageFromBundle(org.osgi.framework.Bundle bundle,
String packageName)
- Add as Bundle -> Package mapping
- Specified by:
addPackageFromBundle
in interface BundleAccessor
- Parameters:
bundle
- the bundle where the package was loaded frompackageName
- the anme of the loaded package
loadClass
public Class<?> loadClass(String className)
throws ClassNotFoundException
- Specified by:
loadClass
in interface BundleAccessor
- Throws:
ClassNotFoundException
loadResources
public List<URL> loadResources(String name)
throws IOException
- Throws:
IOException
loadResources
public List<URL> loadResources(String name,
boolean translate)
throws IOException
- Throws:
IOException
loadResourceFromAllBundles
public URL loadResourceFromAllBundles(String name)
throws IOException
- Specified by:
loadResourceFromAllBundles
in interface BundleAccessor
- Throws:
IOException
loadResourceFromAllBundlesAsStream
public InputStream loadResourceFromAllBundlesAsStream(String name)
throws IOException
- Specified by:
loadResourceFromAllBundlesAsStream
in interface BundleAccessor
- Throws:
IOException
loadResource
public URL loadResource(String name)
loadResource
public URL loadResource(String name,
boolean translate)
getPackagesByBundle
public Set<String> getPackagesByBundle(org.osgi.framework.Bundle bundle)
- Specified by:
getPackagesByBundle
in interface BundleAccessor
loadResourceAsStream
public InputStream loadResourceAsStream(String name)
throws IOException
- Specified by:
loadResourceAsStream
in interface BundleAccessor
- Throws:
IOException
setBundleContext
public void setBundleContext(org.osgi.framework.BundleContext bundleContext)
- Specified by:
setBundleContext
in interface BundleAccessor
setOsgiHost
public void setOsgiHost(OsgiHost osgiHost)
- Specified by:
setOsgiHost
in interface BundleAccessor
Copyright © 2000–2018 Apache Software Foundation. All rights reserved.