|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.springframework.data.gemfire.support.SpringContextBootstrappingInitializer
public class SpringContextBootstrappingInitializer
The SpringContextBootstrappingInitializer class is a GemFire configuration initializer used to bootstrap a Spring ApplicationContext inside a GemFire Server JVM-based process. This enables a GemFire Cache Server resources to be mostly configured with Spring Data GemFire's XML namespace. The Cache itself is the only resource that cannot be configured and initialized in a Spring context since the initializer is not invoked until after GemFire creates and initializes the Cache for use.
Properties,
ApplicationContext,
ApplicationListener,
ConfigurableApplicationContext,
AnnotationConfigApplicationContext,
ApplicationEventMulticaster,
ContextRefreshedEvent,
SimpleApplicationEventMulticaster,
ClassPathXmlApplicationContext,
Declarable,
Setting Cache Initializer,
SGF-248| Field Summary | |
|---|---|
static String |
BASE_PACKAGES_PARAMETER
|
protected static String |
CHARS_TO_DELETE
|
protected static String |
COMMA_DELIMITER
|
static String |
CONTEXT_CONFIG_LOCATIONS_PARAMETER
|
| Constructor Summary | |
|---|---|
SpringContextBootstrappingInitializer()
|
|
| Method Summary | ||
|---|---|---|
protected ConfigurableApplicationContext |
createApplicationContext(String[] configLocations)
Creates (constructs and configures) a ConfigurableApplicationContext instance based on the specified locations of the context configuration meta-data files. |
|
protected ConfigurableApplicationContext |
createApplicationContext(String[] basePackages,
String[] configLocations)
Creates (constructs and configures) an instance of the ConfigurableApplicationContext based on either the specified base packages containing @Configuration, @Component or JSR 330 annotated classes to scan, or the specified locations of context configuration meta-data files used to configure the context. |
|
static ConfigurableApplicationContext |
getApplicationContext()
Gets a reference to the Spring ApplicationContext constructed, configured and initialized inside the GemFire Server-based JVM process. |
|
void |
init(Properties parameters)
Initializes a Spring ApplicationContext with the given parameters from a GemFire Initializer in GemFire native configuration meta-data (e.g. cache.xml). |
|
protected static void |
notifyListenerOfExistingContextRefreshedEvent(ApplicationListener<ContextRefreshedEvent> listener)
Notifies any Spring ApplicationListeners of a current and existing ContextRefreshedEvent if the ApplicationContext was previously created, initialized and refreshed before any ApplicationListeners interested in ContextRefreshedEvents get registered so that application components (such as LazyWiringDeclarableSupport objects) arriving late to the game that also require configuration (auto-wiring) get wired accordingly too. |
|
protected String |
nullSafeGetApplicationContextId(ApplicationContext applicationContext)
Gets the the ID of the Spring ApplicationContext in a null-safe manner. |
|
void |
onApplicationEvent(ContextRefreshedEvent event)
Gets notified when the Spring ApplicationContext gets created and refreshed by GemFire. |
|
static
|
register(T listener)
Registers a Spring ApplicationListener to be notified when the Spring ApplicationContext is created by GemFire when instantiating and initializing declared Initializers from the GemFire native configuration file (e.g. cache.xml). |
|
static
|
unregister(T listener)
Unregisters the Spring ApplicationListener from this SpringContextBootstrappingInitializer in order to stop receiving ApplicationEvents on Spring context refreshes. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String BASE_PACKAGES_PARAMETER
public static final String CONTEXT_CONFIG_LOCATIONS_PARAMETER
protected static final String CHARS_TO_DELETE
protected static final String COMMA_DELIMITER
| Constructor Detail |
|---|
public SpringContextBootstrappingInitializer()
| Method Detail |
|---|
public static ConfigurableApplicationContext getApplicationContext()
ConfigurableApplicationContextpublic static <T extends ApplicationListener<ContextRefreshedEvent>> T register(T listener)
T - the Class type of the Spring ApplicationListener.listener - the ApplicationListener to register for ContextRefreshedEvents by this
SpringContextBootstrappingInitializer.
unregister(org.springframework.context.ApplicationListener),
ApplicationListener,
ContextRefreshedEvent,
#addApplicationListener(org.springframework.context.ApplicationListener)protected static void notifyListenerOfExistingContextRefreshedEvent(ApplicationListener<ContextRefreshedEvent> listener)
listener - a Spring ApplicationListener requiring notification of any ContextRefreshedEvents after the
ApplicationContext has already been created, initialized and/or refreshed.ApplicationListener.onApplicationEvent(org.springframework.context.ApplicationEvent),
ContextRefreshedEventpublic static <T extends ApplicationListener<ContextRefreshedEvent>> T unregister(T listener)
T - the Class type of the Spring ApplicationListener.listener - the ApplicationListener to unregister from receiving ContextRefreshedEvents by this
SpringContextBootstrappingInitializer.
register(org.springframework.context.ApplicationListener),
ApplicationListener,
ContextRefreshedEvent,
#removeApplicationListener(org.springframework.context.ApplicationListener)protected ConfigurableApplicationContext createApplicationContext(String[] configLocations)
configLocations - a String array indicating the locations of the context configuration meta-data files
used to configure the ConfigurableApplicationContext instance.
IllegalArgumentException - if the configLocations parameter argument is null or empty.createApplicationContext(String[], String[]),
ClassPathXmlApplicationContext
protected ConfigurableApplicationContext createApplicationContext(String[] basePackages,
String[] configLocations)
basePackages - the base application packages to scan for application @Components and @Configuration classes. *configLocations - a String array indicating the locations of the context configuration meta-data files
used to configure the ConfigurableApplicationContext instance.
IllegalArgumentException - if both the basePackages and configLocation parameter arguments
are null or empty.createApplicationContext(String[]),
AnnotationConfigApplicationContext,
AnnotationConfigApplicationContext.scan(String...),
ClassPathXmlApplicationContextpublic void init(Properties parameters)
init in interface com.gemstone.gemfire.cache.Declarableparameters - a Properties object containing the configuration parameters and settings defined in the
GemFire cache.xml >initializer/< element.createApplicationContext(java.lang.String[]),
Propertiesprotected String nullSafeGetApplicationContextId(ApplicationContext applicationContext)
applicationContext - the Spring ApplicationContext to retrieve the ID for.
ApplicationContext.getId()public void onApplicationEvent(ContextRefreshedEvent event)
onApplicationEvent in interface ApplicationListener<ContextRefreshedEvent>event - the ContextRefreshedEvent signaling that the Spring ApplicationContext has been created
and refreshed by GemFire.ContextRefreshedEvent,
#multicastEvent(org.springframework.context.ApplicationEvent)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||