public final class OsgiRegistry
extends java.lang.Object
implements org.osgi.framework.SynchronousBundleListener
 When OSGi runtime is detected by the ServiceFinder class,
 an instance of OsgiRegistry is created and associated with given
 OSGi BundleContext. META-INF/services entries are then being accessed
 via the OSGi Bundle API as direct ClassLoader#getResource() method invocation
 does not work in this case within OSGi.
| Modifier and Type | Method and Description | 
|---|---|
| void | bundleChanged(org.osgi.framework.BundleEvent event) | 
| java.lang.Class<?> | classForNameWithException(java.lang.String className)Get the Class from the class name. | 
| static OsgiRegistry | getInstance()Returns an  OsgiRegistryinstance. | 
| java.util.Enumeration<java.net.URL> | getPackageResources(java.lang.String packagePath,
                   java.lang.ClassLoader classLoader) | 
| java.util.ResourceBundle | getResourceBundle(java.lang.String bundleName)Tries to load resource bundle via OSGi means. | 
| void | hookUp()Will hook up this instance with the OSGi runtime. | 
public static OsgiRegistry getInstance()
OsgiRegistry instance. Call this method only if sure that the application is running in OSGi
 environment, otherwise a call to this method can lead to an ClassNotFoundException.OsgiRegistry instance.public void bundleChanged(org.osgi.framework.BundleEvent event)
bundleChanged in interface org.osgi.framework.BundleListenerpublic java.util.Enumeration<java.net.URL> getPackageResources(java.lang.String packagePath,
                                                               java.lang.ClassLoader classLoader)
public java.lang.Class<?> classForNameWithException(java.lang.String className)
                                             throws java.lang.ClassNotFoundException
The context class loader will be utilized if accessible and non-null. Otherwise the defining class loader of this class will be utilized.
className - the class name.java.lang.ClassNotFoundException - if the class cannot be found.public java.util.ResourceBundle getResourceBundle(java.lang.String bundleName)
bundleName - name of the resource bundle to loadpublic void hookUp()
Copyright © 2012–2020 Oracle Corporation. All rights reserved.