Class 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:
  • Constructor Details

  • Method Details

    • assertInitialized

      protected void assertInitialized()
      Asserts that this Declarable object has been properly configured and initialized by the Spring container after has GemFire constructed this Declarable object during startup. This method is recommended to be called before any of this Declarable object's CacheCallback methods (e.g. CacheLoader.load(LoaderHelper) are invoked in order to ensure that this Declarable object was properly constructed, configured and initialized by the Spring container before hand.
      Throws:
      IllegalStateException - if this Declarable object was not been properly constructed, configured and initialized by the Spring container.
      See Also:
    • assertUninitialized

      protected void assertUninitialized()
      Asserts that this Declarable 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 the Declarable.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:
    • isInitialized

      protected boolean isInitialized()
      Determines whether this Declarable 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:
    • isNotInitialized

      protected boolean isNotInitialized()
      Determines whether this Declarable 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:
    • 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 this Declarable object has been constructed by GemFire and the <initalizer> element is parsed in GemFire's configuration meta-data during startup.
      Specified by:
      initialize in interface org.apache.geode.cache.Declarable
      Overrides:
      initialize in class WiringDeclarableSupport
      Parameters:
      parameters - Properties containing the configured parameters parsed from GemFire's configuration meta-data (e.g. cache.xml) and passed to this Declarable object.
      See Also:
    • doPostInit

      protected void doPostInit(@NonNull Properties parameters)
      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 this Declarable object.
      See Also:
    • nullSafeGetParameters

      @NonNull protected Properties nullSafeGetParameters()
      Null-safe operation to return the parameters passed to this Declarable 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 this Declarable object.
      See Also:
    • setParameters

      protected void setParameters(@Nullable Properties parameters)
      Stores a reference to the parameters passed to the Declarable.init(Properties) method.
      Parameters:
      parameters - Properties containing the configured parameters parsed from GemFire's configuration meta-data (e.g. cache.xml) and passed to this Declarable 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 Spring ApplicationContext using the SpringContextBootstrappingInitializer.
      Specified by:
      onApplicationEvent in interface org.springframework.context.ApplicationListener<org.springframework.context.event.ContextRefreshedEvent>
      Parameters:
      event - ContextRefreshedEvent published by the Spring ApplicationContext after it is successfully created and initialized by GemFire.
      See Also:
    • destroy

      public void destroy() throws Exception
      When this Declarable object/bean gets destroyed by the Spring container, destroy() will make sure this component gets unregistered from the SpringContextBootstrappingInitializer properly.
      Specified by:
      destroy in interface org.springframework.beans.factory.DisposableBean
      Throws:
      Exception - if bean destruction is unsuccessful.
      See Also: