|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.eclipse.gemini.blueprint.extender.support.ConditionalApplicationContextCreator
public class ConditionalApplicationContextCreator
Useful OsgiApplicationContextCreator implementation that dictates
whether the default application context used by the Spring-DM extender should
be created (or not) based on a boolean value. This allows
clients to handle only the bundleContext filtering while being decoupled from
the context creation process:
ConditionalApplicationContextCreator creator = new ConditionalApplicationContextCreator();
creator.setFilter(new ConditionalApplicationContextCreator.BundleContextFilter() {
// filter bundles with no copyright
public boolean matches(BundleContext bundleContext) {
return bundleContext.getBundle().getHeaders().get(Constants.BUNDLE_COPYRIGHT) != null)
}
}
creator.createApplicationContext(bundleContext);
OsgiApplicationContextCreator| Nested Class Summary | |
|---|---|
static interface |
ConditionalApplicationContextCreator.BundleContextFilter
Callback used to filter the bundle contexts for which the default application contexts are created. |
| Constructor Summary | |
|---|---|
ConditionalApplicationContextCreator()
|
|
| Method Summary | |
|---|---|
void |
afterPropertiesSet()
|
DelegatedExecutionOsgiBundleApplicationContext |
createApplicationContext(BundleContext bundleContext)
Creates an application context for the given bundle context. |
void |
setDelegatedApplicationContextCreator(OsgiApplicationContextCreator delegatedContextCreator)
Sets the OsgiApplicationContextCreator used by this context
creator for the actual creation. |
void |
setFilter(ConditionalApplicationContextCreator.BundleContextFilter filter)
Sets the ConditionalApplicationContextCreator.BundleContextFilter used by this context creator. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ConditionalApplicationContextCreator()
| Method Detail |
|---|
public void afterPropertiesSet()
throws Exception
afterPropertiesSet in interface InitializingBeanException
public DelegatedExecutionOsgiBundleApplicationContext createApplicationContext(BundleContext bundleContext)
throws Exception
OsgiApplicationContextCreatornull should be
returned. Exceptions will be caught and logged but will not prevent the
creation of other application contexts.
createApplicationContext in interface OsgiApplicationContextCreatorbundleContext - OSGi bundle context determining the context creation
null if no context should be created, non-
null otherwise
Exception - if something goes wrongpublic void setFilter(ConditionalApplicationContextCreator.BundleContextFilter filter)
ConditionalApplicationContextCreator.BundleContextFilter used by this context creator.
filter - The bundle context filter to set.public void setDelegatedApplicationContextCreator(OsgiApplicationContextCreator delegatedContextCreator)
OsgiApplicationContextCreator used by this context
creator for the actual creation. If none is specified,
DefaultOsgiApplicationContextCreator is used.
delegatedContextCreator - the instance used for creating the
application context
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||