Spring Data for VMware GemFire
Class LazyWiringDeclarableSupport
java.lang.Object
org.springframework.data.gemfire.support.DeclarableSupport
org.springframework.data.gemfire.support.WiringDeclarableSupport
org.springframework.data.gemfire.support.LazyWiringDeclarableSupport
- All Implemented Interfaces:
EventListener,org.apache.geode.cache.CacheCallback,org.apache.geode.cache.Declarable,org.springframework.beans.factory.DisposableBean,org.springframework.context.ApplicationListener<org.springframework.context.event.ContextRefreshedEvent>
public abstract class LazyWiringDeclarableSupport
extends WiringDeclarableSupport
implements org.springframework.context.ApplicationListener<org.springframework.context.event.ContextRefreshedEvent>, org.springframework.beans.factory.DisposableBean
Implementation of Apache Geode's
Declarable interface that enables support for wiring Apache Geode components
with Spring bean dependencies defined in a Spring ApplicationContext.- Since:
- 1.3.4
- See Also:
-
PropertiesCacheCacheCallbackDeclarableBeanFactoryDisposableBeanApplicationContextApplicationListenerContextRefreshedEventSpringContextBootstrappingInitializerWiringDeclarableSupport
-
Field Summary
Fields inherited from class org.springframework.data.gemfire.support.WiringDeclarableSupport
TEMPLATE_BEAN_NAME_PROPERTY -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new instance of theLazyWiringDeclarableSupportclass registered with theSpringContextBootstrappingInitializeras a SpringApplicationListener. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidAsserts that thisDeclarableobject has been properly configured and initialized by the Spring container after has GemFire constructed thisDeclarableobject during startup.protected voidAsserts that thisDeclarableobject has not yet been used, or activated prior to being fully constructed, configured and initialized by the Spring container.voiddestroy()When thisDeclarableobject/bean gets destroyed by the Spring container,destroy()will make sure this component gets unregistered from theSpringContextBootstrappingInitializerproperly.protected voiddoPostInit(Properties parameters) Performs any post configuration and initialization activities required by the application.final voidinitialize(org.apache.geode.cache.Cache cache, Properties parameters) Initialization method called by GemFire with the configured parameters once thisDeclarableobject has been constructed by GemFire and the <initalizer> element is parsed in GemFire's configuration meta-data during startup.protected booleanDetermines whether thisDeclarableobject has been properly configured and initialized by the Spring container.protected booleanDetermines whether thisDeclarableobject has been properly configured and initialized by the Spring container.protected PropertiesNull-safe operation to return the parameters passed to thisDeclarableobject when created by GemFire from it's own configuration meta-data (e.g.final voidonApplicationEvent(org.springframework.context.event.ContextRefreshedEvent event) Event handler method called when GemFire has created and initialized (refreshed) the SpringApplicationContextusing theSpringContextBootstrappingInitializer.protected voidsetParameters(Properties parameters) Stores a reference to theparameterspassed to theDeclarable.init(Properties)method.Methods inherited from class org.springframework.data.gemfire.support.WiringDeclarableSupport
configureThis, configureThis, newBeanConfigurer, newBeanConfigurerMethods inherited from class org.springframework.data.gemfire.support.DeclarableSupport
close, getBeanFactory, getBeanFactoryKey, locateBeanFactory, locateBeanFactory, setBeanFactoryKeyMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.geode.cache.Declarable
init
-
Constructor Details
-
LazyWiringDeclarableSupport
public LazyWiringDeclarableSupport()Constructs a new instance of theLazyWiringDeclarableSupportclass registered with theSpringContextBootstrappingInitializeras a SpringApplicationListener. ThisDeclarableobject will receive notifications from theSpringContextBootstrappingInitializerwhen the Spring context is created and initialized (refreshed). The notification is necessary in order for thisDeclarableobject to be properly configured and initialized with any required, Spring-defined dependencies.
-
-
Method Details
-
assertInitialized
protected void assertInitialized()Asserts that thisDeclarableobject has been properly configured and initialized by the Spring container after has GemFire constructed thisDeclarableobject during startup. This method is recommended to be called before any of thisDeclarableobject'sCacheCallbackmethods (e.g.CacheLoader.load(LoaderHelper)are invoked in order to ensure that thisDeclarableobject was properly constructed, configured and initialized by the Spring container before hand.- Throws:
IllegalStateException- if thisDeclarableobject was not been properly constructed, configured and initialized by the Spring container.- See Also:
-
Declarable.init(Properties)isInitialized()
-
assertUninitialized
protected void assertUninitialized()Asserts that thisDeclarableobject has not yet been used, or activated prior to being fully constructed, configured and initialized by the Spring container. It is possible, though rare, that theDeclarable.init(Properties)method might be called multiple times by GemFire before the Spring container constructs, configures, initializes and generally puts this component to use.- Throws:
IllegalStateException- if the Declarable object has already been configured and initialized by the Spring container.- See Also:
-
Declarable.init(Properties)isNotInitialized()
-
isInitialized
protected boolean isInitialized()Determines whether thisDeclarableobject has been properly configured and initialized by the Spring container.- Returns:
- a boolean value indicating whether this
Declarableobject has been properly configured and initialized by the Spring container. - See Also:
-
doInit(BeanFactory, Properties)assertInitialized()
-
isNotInitialized
protected boolean isNotInitialized()Determines whether thisDeclarableobject has been properly configured and initialized by the Spring container.- Returns:
- a boolean value indicating whether this
Declarableobject has been properly configured and initialized by the Spring container. - See Also:
-
doInit(BeanFactory, Properties)isInitialized()
-
initialize
public final void initialize(@Nullable org.apache.geode.cache.Cache cache, @NonNull Properties parameters) Initialization method called by GemFire with the configured parameters once thisDeclarableobject has been constructed by GemFire and the <initalizer> element is parsed in GemFire's configuration meta-data during startup.- Specified by:
initializein interfaceorg.apache.geode.cache.Declarable- Overrides:
initializein classWiringDeclarableSupport- Parameters:
parameters-Propertiescontaining the configured parameters parsed from GemFire's configuration meta-data (e.g. cache.xml) and passed to thisDeclarableobject.- See Also:
-
doInit(BeanFactory, Properties)Properties
-
doPostInit
Performs any post configuration and initialization activities required by the application. By default, this method does nothing.- Parameters:
parameters-Propertiescontaining the configured parameters parsed from GemFire's configuration meta-data (e.g. cache.xml) and passed to thisDeclarableobject.- See Also:
-
doInit(BeanFactory, Properties)Properties
-
nullSafeGetParameters
Null-safe operation to return the parameters passed to thisDeclarableobject when created by GemFire from it's own configuration meta-data (e.g. cache.xml).- Returns:
- a
Propertiescontaining the configured parameters parsed from GemFire's configuration meta-data (e.g. cache.xml) and passed to thisDeclarableobject. - See Also:
-
setParameters
Stores a reference to theparameterspassed to theDeclarable.init(Properties)method.- Parameters:
parameters-Propertiescontaining the configured parameters parsed from GemFire's configuration meta-data (e.g. cache.xml) and passed to thisDeclarableobject.- See Also:
-
onApplicationEvent
public final void onApplicationEvent(@NonNull org.springframework.context.event.ContextRefreshedEvent event) Event handler method called when GemFire has created and initialized (refreshed) the SpringApplicationContextusing theSpringContextBootstrappingInitializer.- Specified by:
onApplicationEventin interfaceorg.springframework.context.ApplicationListener<org.springframework.context.event.ContextRefreshedEvent>- Parameters:
event-ContextRefreshedEventpublished by the SpringApplicationContextafter it is successfully created and initialized by GemFire.- See Also:
-
ContextRefreshedEventdoInit(BeanFactory, Properties)nullSafeGetParameters()
-
destroy
When thisDeclarableobject/bean gets destroyed by the Spring container,destroy()will make sure this component gets unregistered from theSpringContextBootstrappingInitializerproperly.- Specified by:
destroyin interfaceorg.springframework.beans.factory.DisposableBean- Throws:
Exception- if bean destruction is unsuccessful.- See Also:
-