1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.springframework.osgi.extender;
18
19 import org.osgi.framework.BundleContext;
20 import org.osgi.framework.BundleException;
21 import org.osgi.framework.InvalidSyntaxException;
22 import org.springframework.beans.BeansException;
23 import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
24
25 /**
26 * Extender hook that allows custom modification of an application context's
27 * bean definitions. New beans can be created, removed or existing definitions
28 * modified.
29 *
30 * <p/> Similar in functionality with Spring's BeanFactoryPostProcessor, this
31 * interface also considers the BundleContext in which the beanFactory runs.
32 *
33 * <p/>Just like the BeanFactoryPostProcessor, the post processing happens
34 * during the creation of the bean factory but before any beans (including
35 * declared BeanFactoryPostProcessors) are initialized.
36 *
37 * @see org.springframework.beans.factory.config.BeanFactoryPostProcessor
38 * @see BundleContext
39 *
40 * @author Costin Leau
41 */
42 public interface OsgiBeanFactoryPostProcessor {
43
44 /**
45 *
46 * Modifies the application context's internal bean factory after its
47 * standard initialization. All bean definitions will have been loaded, but
48 * no beans will have been instantiated yet. This allows for overriding or
49 * adding properties even to eager-initializing beans.
50 *
51 * @param bundleContext bundle
52 * @param beanFactory the bean factory used by the application context
53 * @throws BeansException in case of factory errors
54 * @throws InvalidSyntaxException in case of OSGi filters errors
55 * @throws BundleException in case of OSGi bundle errors
56 */
57 void postProcessBeanFactory(BundleContext bundleContext, ConfigurableListableBeanFactory beanFactory)
58 throws BeansException, InvalidSyntaxException, BundleException;
59 }