Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.eclipse.gemini.blueprint.extender.internal.activator
Class ContextLoaderListener

    java.lang.Object
      org.eclipse.gemini.blueprint.extender.internal.activator.ContextLoaderListener

All Implemented Interfaces:
  org.osgi.framework.BundleActivator

Direct Known Subclasses:
  BlueprintLoaderListener

    public class ContextLoaderListener

extends Object
implements org.osgi.framework.BundleActivator

Osgi Extender that bootstraps 'Spring powered bundles'.

The class listens to bundle events and manages the creation and destruction of application contexts for bundles that have one or both of:

- A manifest header entry Spring-Context
- XML files in META-INF/spring folder

The extender also discovers any Spring namespace/schema handlers in resolved bundles and makes them available through a dedicated OSGi service.

The extender behaviour can be customized by attaching fragments to the extender bundle. On startup, the extender will look for `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.

Note: The extender configuration context is created during the bundle activation (a synchronous OSGi lifecycle callback) and should contain only simple bean definitions that will not delay context initialisation.

Author:
  Bill Gallagher, Andy Piper, Hal Hildebrand, Adrian Colyer, Costin Leau

Field Summary
`protected org.apache.commons.logging.Log` | `log`

Constructor Summary
`ContextLoaderListener(ExtenderConfiguration extenderConfiguration)`

Method Summary
`protected ApplicationContextConfigurationFactory` | `createContextConfigFactory()`
`protected OsgiContextProcessor` | `createContextProcessor()`
`protected OsgiApplicationContextCreator` | `createDefaultOsgiApplicationContextCreator()`
`protected String` | `getManagedBundleExtenderVersionHeader()`
`protected OsgiApplicationContextCreator` | `getOsgiApplicationContextCreator()`
`protected TypeCompatibilityChecker` | `getTypeCompatibilityChecker()`
`org.eclipse.gemini.blueprint.extender.internal.activator.VersionMatcher` | `getVersionMatcher()`
`protected void` | `initStartedBundles(org.osgi.framework.BundleContext bundleContext)`
`protected void` | `shutdown()` Shutdown the extender and all bundled managed by it.
`void` | `start(org.osgi.framework.BundleContext extenderBundleContext)` Called by OSGi when this bundle is started.
`void` | `stop(org.osgi.framework.BundleContext context)` Called by OSGi when this bundled is stopped.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### log

    protected final org.apache.commons.logging.Log log

Constructor Detail

### ContextLoaderListener

    public ContextLoaderListener(ExtenderConfiguration extenderConfiguration)

Method Detail

### start

    public void start(org.osgi.framework.BundleContext extenderBundleContext)
               throws Exception

  Called by OSGi when this bundle is started. Finds all previously resolved bundles and adds namespace handlers for them if necessary.

  Creates application contexts for bundles started before the extender was started.

  Registers a namespace/entity resolving service for use by web app contexts.

  Specified by:
    `start` in interface `org.osgi.framework.BundleActivator`
  Throws:
    `Exception`
  See Also:
    `BundleActivator.start(org.osgi.framework.BundleContext)`

### createContextProcessor

    protected OsgiContextProcessor createContextProcessor()

### getTypeCompatibilityChecker

    protected TypeCompatibilityChecker getTypeCompatibilityChecker()

### initStartedBundles

    protected void initStartedBundles(org.osgi.framework.BundleContext bundleContext)

### stop

    public void stop(org.osgi.framework.BundleContext context)
              throws Exception

  Called by OSGi when this bundled is stopped. Unregister the namespace/entity resolving service and clear all state. No further management of application contexts created by this extender prior to stopping the bundle occurs after this point (even if the extender bundle is subsequently restarted).

  Specified by:
    `stop` in interface `org.osgi.framework.BundleActivator`
  Throws:
    `Exception`
  See Also:
    `BundleActivator.stop(org.osgi.framework.BundleContext)`

### shutdown

    protected void shutdown()

  Shutdown the extender and all bundled managed by it. Shutdown of contexts is in the topological order of the dependency graph formed by the service references.

### createContextConfigFactory

    protected ApplicationContextConfigurationFactory createContextConfigFactory()

### getVersionMatcher

    public org.eclipse.gemini.blueprint.extender.internal.activator.VersionMatcher getVersionMatcher()

### getManagedBundleExtenderVersionHeader

    protected String getManagedBundleExtenderVersionHeader()

### getOsgiApplicationContextCreator

    protected OsgiApplicationContextCreator getOsgiApplicationContextCreator()

### createDefaultOsgiApplicationContextCreator

    protected OsgiApplicationContextCreator createDefaultOsgiApplicationContextCreator()

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2006-2013. All Rights Reserved.