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 | Class and Description |
|---|---|
| private static class | |
| private class |
| Modifier and Type | Field and Description |
|---|---|
| private final BundleContext | |
| private Map | |
| private static final String | |
| private final Map | |
| private static OsgiRegistry | |
| private final ReadWriteLock | |
| private static final Logger |
| Access | Constructor and Description |
|---|---|
| private | OsgiRegistry(BundleContext
must be a non-null instance of a BundleContext bundleContext)Creates a new OsgiRegistry instance bound to a particular OSGi runtime. |
| Modifier and Type | Method and Description |
|---|---|
| public void | bundleChanged(BundleEvent
The event)BundleEvent.Implements org. Receives notification that a bundle has had a lifecycle change. |
| public Class | Returns: the Class, otherwise null if the class cannot be found.the class name. className)Get the Class from the class name. |
| public static synchronized OsgiRegistry | |
| public Enumeration | |
| public ResourceBundle | Returns: resource bundle instance if found, null otherwisename of the resource bundle to load bundleName)Tries to load resource bundle via OSGi means. |
| public void | |
| private List | |
| private void | |
| private void | |
| private void |
| bundleContext | back to summary |
|---|---|
| private final BundleContext bundleContext | |
| classToBundleMapping | back to summary |
|---|---|
| private Map<String, Bundle> classToBundleMapping | |
| CoreBundleSymbolicNAME | back to summary |
|---|---|
| private static final String CoreBundleSymbolicNAME | |
| factories | back to summary |
|---|---|
| private final Map<Long, Map<String, Callable<List<Class<?>>>>> factories | |
| instance | back to summary |
|---|---|
| private static OsgiRegistry instance | |
| lock | back to summary |
|---|---|
| private final ReadWriteLock lock | |
| LOGGER | back to summary |
|---|---|
| private static final Logger LOGGER | |
| OsgiRegistry | back to summary |
|---|---|
| private OsgiRegistry(BundleContext bundleContext) Creates a new OsgiRegistry instance bound to a particular OSGi runtime.
The only parameter must be an instance of a
| |
| bundleChanged | back to summary |
|---|---|
| public void bundleChanged(BundleEvent event) Implements org. Doc from org. Receives notification that a bundle has had a lifecycle change.
| |
| classForNameWithException | back to summary |
|---|---|
| public Class Get the Class from the class name. The context class loader will be utilized if accessible and non-null. Otherwise the defining class loader of this class will be utilized.
| |
| getInstance | back to summary |
|---|---|
| public static synchronized OsgiRegistry getInstance() Returns an
| |
| getPackageResources | back to summary |
|---|---|
public Enumeration
| |
| getResourceBundle | back to summary |
|---|---|
| public ResourceBundle getResourceBundle(final String bundleName) Tries to load resource bundle via OSGi means. No caching involved here, as localization properties are being cached in Localizer class already.
| |
| hookUp | back to summary |
|---|---|
| public void hookUp() Will hook up this instance with the OSGi runtime. This is to actually update SPI provider lookup and class loading mechanisms in Jersey to utilize OSGi features. | |
| locateAllProviders | back to summary |
|---|---|
| private List | |
| register | back to summary |
|---|---|
| private void register(final Bundle bundle) | |
| registerExistingBundles | back to summary |
|---|---|
| private void registerExistingBundles() | |
| setOSGiServiceFinderIteratorProvider | back to summary |
|---|---|
| private void setOSGiServiceFinderIteratorProvider() | |
| Modifier and Type | Field and Description |
|---|---|
| private final Bundle | |
| private final String | |
| private final URI |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public List | call()
Implements java. Computes a result, or throws an exception if unable to do so. |
| public boolean | equals(Object
the reference object with which to compare. obj)Overrides java. Indicates whether some other object is "equal to" this one. |
| public int | |
| public String |
| bundle | back to summary |
|---|---|
| private final Bundle bundle | |
| spi | back to summary |
|---|---|
| private final String spi | |
| spiRegistryUri | back to summary |
|---|---|
| private final URI spiRegistryUri | |
| BundleSpiProvidersLoader | back to summary |
|---|---|
| pack-priv BundleSpiProvidersLoader(final String spi, final URI spiRegistryUri, final Bundle bundle) | |
| call | back to summary |
|---|---|
| public List Implements java. Doc from java. Computes a result, or throws an exception if unable to do so. | |
| equals | back to summary |
|---|---|
| public boolean equals(Object obj) Overrides java. Doc from java. Indicates whether some other object is "equal to" this one.
The
An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes. | |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Doc from java. Returns a hash code value for this object. This method is
supported for the benefit of hash tables such as those provided by
The general contract of
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object.
Satisfying this method's contract implies a non- | |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv final ServiceFinder. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public <T> Iterator | createClassIterator(Class<T>
the service class. service, String the service name. serviceName, ClassLoader the class loader to utilize when loading provider
classes. loader, boolean if true ignore the provider class if
cannot be found,
otherwise throw a ignoreOnClassNotFound)ClassNotFoundException.Implements abstract org. Iterate over provider classes of a service. |
| public <T> Iterator | createIterator(final Class<T>
the service class. serviceClass, final String the service name. serviceName, ClassLoader the class loader to utilize when loading provider
classes. loader, boolean if true ignore an instance if the
corresponding provider class if cannot be found,
otherwise throw a ignoreOnClassNotFound)ClassNotFoundException.Implements abstract org. Iterate over provider instances of a service. |
| defaultIterator | back to summary |
|---|---|
| pack-priv final ServiceFinder. | |
| OsgiServiceFinder | back to summary |
|---|---|
| private OsgiServiceFinder() | |
| createClassIterator | back to summary |
|---|---|
| public <T> Iterator Implements abstract org. Doc from org. Iterate over provider classes of a service.
| |
| createIterator | back to summary |
|---|---|
| public <T> Iterator Implements abstract org. Doc from org. Iterate over provider instances of a service.
| |