public class ContextLoaderListener
extends java.lang.Object
implements org.osgi.framework.BundleActivator
META-INF/spring/*.xml files and merge them into an application context. From the resulting
context, the context will look for beans with predefined names to determine its configuration. The current version
recognises the following bean names:
| Bean Name | Bean Type | Description |
|---|---|---|
taskExecutor | org.springframework.core.task.TaskExecutor | Task executor used for creating the discovered application contexts. |
shutdownTaskExecutor |
org.springframework.core.task.TaskExecutor | Task executor used for shutting down various application contexts. |
extenderProperties |
java.util.Properties | Various properties for configuring the extender behaviour (see below) |
extenderProperties recognises the following properties:
| Name | Type | Description |
|---|---|---|
shutdown.wait.time | Number | The amount of time the extender will wait for each application context to shutdown gracefully. Expressed in milliseconds. |
process.annotations | Boolean | Whether or not, the extender will process SpringOSGi annotations. |
| Modifier and Type | Class and Description |
|---|---|
private class |
ContextLoaderListener.BaseListener
Common base class for
ContextLoaderListener listeners. |
private class |
ContextLoaderListener.ContextBundleListener
Bundle listener used for context creation/destruction.
|
private class |
ContextLoaderListener.NamespaceBundleLister
Bundle listener used for detecting namespace handler/resolvers.
|
| Modifier and Type | Field and Description |
|---|---|
private org.osgi.framework.BundleContext |
bundleContext
The bundle's context
|
private long |
bundleId
extender bundle id
|
private org.osgi.framework.SynchronousBundleListener |
contextListener
Bundle listener interested in context creation
|
private ExtenderConfiguration |
extenderConfiguration
extender configuration
|
private org.osgi.framework.Version |
extenderVersion
This extender version
|
private boolean |
isClosed
flag indicating whether the context is down or not - useful during shutdown
|
private LifecycleManager |
lifecycleManager |
protected org.apache.commons.logging.Log |
log |
private java.lang.Object |
monitor
Monitor used for dealing with the bundle activator and synchronous bundle threads
|
private OsgiBundleApplicationContextEventMulticaster |
multicaster |
private org.osgi.framework.SynchronousBundleListener |
nsListener
Bundle listener interested in namespace resolvers/parsers discovery
|
private NamespaceManager |
nsManager
Spring namespace/resolver manager
|
private ListListenerAdapter |
osgiListeners |
private OsgiContextProcessor |
processor |
private VersionMatcher |
versionMatcher |
| Constructor and Description |
|---|
ContextLoaderListener() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addApplicationListener(OsgiBundleApplicationContextEventMulticaster multicaster) |
protected ApplicationContextConfigurationFactory |
createContextConfigFactory() |
protected OsgiContextProcessor |
createContextProcessor() |
private void |
destroyJavaBeansCache() |
protected java.lang.String |
getManagedBundleExtenderVersionHeader() |
protected TypeCompatibilityChecker |
getTypeCompatibilityChecker() |
private boolean |
handlerBundleMatchesExtenderVersion(org.osgi.framework.Bundle bundle)
Utility method that does extender range versioning and approapriate
logging.
|
protected ExtenderConfiguration |
initExtenderConfiguration(org.osgi.framework.BundleContext bundleContext) |
private void |
initJavaBeansCache() |
protected void |
initListenerService() |
protected void |
initNamespaceHandlers(org.osgi.framework.BundleContext context) |
protected void |
initStartedBundles(org.osgi.framework.BundleContext bundleContext) |
protected void |
maybeAddNamespaceHandlerFor(org.osgi.framework.Bundle bundle,
boolean isLazy) |
protected void |
maybeRemoveNameSpaceHandlerFor(org.osgi.framework.Bundle bundle) |
protected void |
shutdown()
Shutdown the extender and all bundled managed by it.
|
void |
start(org.osgi.framework.BundleContext context)
Called by OSGi when this bundle is started.
|
void |
stop(org.osgi.framework.BundleContext context)
Called by OSGi when this bundled is stopped.
|
protected final org.apache.commons.logging.Log log
private long bundleId
private ExtenderConfiguration extenderConfiguration
private NamespaceManager nsManager
private org.osgi.framework.BundleContext bundleContext
private org.osgi.framework.SynchronousBundleListener contextListener
private org.osgi.framework.SynchronousBundleListener nsListener
private final java.lang.Object monitor
private volatile boolean isClosed
private org.osgi.framework.Version extenderVersion
private volatile OsgiBundleApplicationContextEventMulticaster multicaster
private volatile LifecycleManager lifecycleManager
private volatile VersionMatcher versionMatcher
private volatile OsgiContextProcessor processor
private volatile ListListenerAdapter osgiListeners
public void start(org.osgi.framework.BundleContext context)
throws java.lang.Exception
start in interface org.osgi.framework.BundleActivatorjava.lang.ExceptionBundleActivator.start(org.osgi.framework.BundleContext)protected ExtenderConfiguration initExtenderConfiguration(org.osgi.framework.BundleContext bundleContext)
protected OsgiContextProcessor createContextProcessor()
protected TypeCompatibilityChecker getTypeCompatibilityChecker()
protected java.lang.String getManagedBundleExtenderVersionHeader()
protected void initNamespaceHandlers(org.osgi.framework.BundleContext context)
protected void initStartedBundles(org.osgi.framework.BundleContext bundleContext)
public void stop(org.osgi.framework.BundleContext context)
throws java.lang.Exception
stop in interface org.osgi.framework.BundleActivatorjava.lang.ExceptionBundleActivator.stop(org.osgi.framework.BundleContext)protected void shutdown()
private void initJavaBeansCache()
private void destroyJavaBeansCache()
protected void maybeAddNamespaceHandlerFor(org.osgi.framework.Bundle bundle,
boolean isLazy)
protected void maybeRemoveNameSpaceHandlerFor(org.osgi.framework.Bundle bundle)
private boolean handlerBundleMatchesExtenderVersion(org.osgi.framework.Bundle bundle)
bundle - protected ApplicationContextConfigurationFactory createContextConfigFactory()
protected void initListenerService()
protected void addApplicationListener(OsgiBundleApplicationContextEventMulticaster multicaster)