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:
-
Properties
Cache
CacheCallback
Declarable
BeanFactory
DisposableBean
ApplicationContext
ApplicationListener
ContextRefreshedEvent
SpringContextBootstrappingInitializer
WiringDeclarableSupport
-
Field Summary
Fields inherited from class org.springframework.data.gemfire.support.WiringDeclarableSupport
TEMPLATE_BEAN_NAME_PROPERTY
-
Constructor Summary
ConstructorDescriptionConstructs a new instance of theLazyWiringDeclarableSupport
class registered with theSpringContextBootstrappingInitializer
as a SpringApplicationListener
. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
Asserts that thisDeclarable
object has been properly configured and initialized by the Spring container after has GemFire constructed thisDeclarable
object during startup.protected void
Asserts that thisDeclarable
object has not yet been used, or activated prior to being fully constructed, configured and initialized by the Spring container.void
destroy()
When thisDeclarable
object/bean gets destroyed by the Spring container,destroy()
will make sure this component gets unregistered from theSpringContextBootstrappingInitializer
properly.protected void
doPostInit
(Properties parameters) Performs any post configuration and initialization activities required by the application.final void
initialize
(org.apache.geode.cache.Cache cache, Properties parameters) Initialization method called by GemFire with the configured parameters once thisDeclarable
object has been constructed by GemFire and the <initalizer> element is parsed in GemFire's configuration meta-data during startup.protected boolean
Determines whether thisDeclarable
object has been properly configured and initialized by the Spring container.protected boolean
Determines whether thisDeclarable
object has been properly configured and initialized by the Spring container.protected Properties
Null-safe operation to return the parameters passed to thisDeclarable
object when created by GemFire from it's own configuration meta-data (e.g.final void
onApplicationEvent
(org.springframework.context.event.ContextRefreshedEvent event) Event handler method called when GemFire has created and initialized (refreshed) the SpringApplicationContext
using theSpringContextBootstrappingInitializer
.protected void
setParameters
(Properties parameters) Stores a reference to theparameters
passed to theDeclarable.init(Properties)
method.Methods inherited from class org.springframework.data.gemfire.support.WiringDeclarableSupport
configureThis, configureThis, newBeanConfigurer, newBeanConfigurer
Methods inherited from class org.springframework.data.gemfire.support.DeclarableSupport
close, getBeanFactory, getBeanFactoryKey, locateBeanFactory, locateBeanFactory, setBeanFactoryKey
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.geode.cache.Declarable
init
-
Constructor Details
-
LazyWiringDeclarableSupport
public LazyWiringDeclarableSupport()Constructs a new instance of theLazyWiringDeclarableSupport
class registered with theSpringContextBootstrappingInitializer
as a SpringApplicationListener
. ThisDeclarable
object will receive notifications from theSpringContextBootstrappingInitializer
when the Spring context is created and initialized (refreshed). The notification is necessary in order for thisDeclarable
object to be properly configured and initialized with any required, Spring-defined dependencies.
-
-
Method Details
-
assertInitialized
protected void assertInitialized()Asserts that thisDeclarable
object has been properly configured and initialized by the Spring container after has GemFire constructed thisDeclarable
object during startup. This method is recommended to be called before any of thisDeclarable
object'sCacheCallback
methods (e.g.CacheLoader.load(LoaderHelper)
are invoked in order to ensure that thisDeclarable
object was properly constructed, configured and initialized by the Spring container before hand.- Throws:
IllegalStateException
- if thisDeclarable
object was not been properly constructed, configured and initialized by the Spring container.- See Also:
-
Declarable.init(Properties)
isInitialized()
-
assertUninitialized
protected void assertUninitialized()Asserts that thisDeclarable
object 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 thisDeclarable
object has been properly configured and initialized by the Spring container.- Returns:
- a boolean value indicating whether this
Declarable
object has been properly configured and initialized by the Spring container. - See Also:
-
doInit(BeanFactory, Properties)
assertInitialized()
-
isNotInitialized
protected boolean isNotInitialized()Determines whether thisDeclarable
object has been properly configured and initialized by the Spring container.- Returns:
- a boolean value indicating whether this
Declarable
object 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 thisDeclarable
object has been constructed by GemFire and the <initalizer> element is parsed in GemFire's configuration meta-data during startup.- Specified by:
initialize
in interfaceorg.apache.geode.cache.Declarable
- Overrides:
initialize
in classWiringDeclarableSupport
- Parameters:
parameters
-Properties
containing the configured parameters parsed from GemFire's configuration meta-data (e.g. cache.xml) and passed to thisDeclarable
object.- 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
-Properties
containing the configured parameters parsed from GemFire's configuration meta-data (e.g. cache.xml) and passed to thisDeclarable
object.- See Also:
-
doInit(BeanFactory, Properties)
Properties
-
nullSafeGetParameters
Null-safe operation to return the parameters passed to thisDeclarable
object when created by GemFire from it's own configuration meta-data (e.g. cache.xml).- Returns:
- a
Properties
containing the configured parameters parsed from GemFire's configuration meta-data (e.g. cache.xml) and passed to thisDeclarable
object. - See Also:
-
setParameters
Stores a reference to theparameters
passed to theDeclarable.init(Properties)
method.- Parameters:
parameters
-Properties
containing the configured parameters parsed from GemFire's configuration meta-data (e.g. cache.xml) and passed to thisDeclarable
object.- 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 SpringApplicationContext
using theSpringContextBootstrappingInitializer
.- Specified by:
onApplicationEvent
in interfaceorg.springframework.context.ApplicationListener<org.springframework.context.event.ContextRefreshedEvent>
- Parameters:
event
-ContextRefreshedEvent
published by the SpringApplicationContext
after it is successfully created and initialized by GemFire.- See Also:
-
ContextRefreshedEvent
doInit(BeanFactory, Properties)
nullSafeGetParameters()
-
destroy
When thisDeclarable
object/bean gets destroyed by the Spring container,destroy()
will make sure this component gets unregistered from theSpringContextBootstrappingInitializer
properly.- Specified by:
destroy
in interfaceorg.springframework.beans.factory.DisposableBean
- Throws:
Exception
- if bean destruction is unsuccessful.- See Also:
-