Enum GuiceyLifecycle
- java.lang.Object
-
- java.lang.Enum<GuiceyLifecycle>
-
- ru.vyarus.dropwizard.guice.module.lifecycle.GuiceyLifecycle
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Comparable<GuiceyLifecycle>
public enum GuiceyLifecycle extends java.lang.Enum<GuiceyLifecycle>
Guicey lifecycle events. Enum should be used for differentiation of events inGuiceyLifecycleListener:GuiceyLifecycleEvent.getType().Events specified in execution order.
- Since:
- 19.04.2018
-
-
Enum Constant Summary
Enum Constants Enum Constant Description ApplicationRunCalled afterGuiceBundle.run( io.dropwizard.core.Configuration, io.dropwizard.core.setup.Environment)when guicey context is started, extensions installed (but not hk extensions, because neither jersey nor jetty is't start yet).ApplicationShutdownCalled on application shutdown start.ApplicationStartedCalled after complete dropwizard startup.ApplicationStoppedCalled after application shutdown.BeforeInitSpecial meta event, called before allGuiceBundleconfiguration phase logic.BeforeRunSpecial meta event, called before allGuiceBundlerun phase logic (when configuration and environment are already available).BundlesFromLookupResolvedCalled if at least one bundle recognized using bundles lookup.BundlesInitializedCalled after bundles processing.BundlesResolvedCalled afterGuiceyBundleLookupmechanisms when all top-level bundles are resolved.BundlesStartedCalled after bundles started (run method call).ClasspathExtensionsResolvedCalled when classes from classpath scan analyzed and all extensions detected.CommandsResolvedCalled if commands search is enabled (GuiceBundle.Builder.searchCommands()) and at least one command found (and installed).ConfigurationHooksProcessedCalled after all registeredGuiceyConfigurationHookprocessing.DropwizardBundlesInitializedCalled after dropwizard bundles initialization (for dropwizard bundles registered through guicey api).ExtensionsInstalledCalled after all installers install related extensions.ExtensionsInstalledByCalled when installer installed all related extensions and only for installers actually performed installations (extensions list never empty).ExtensionsResolvedCalled when all extensions detected (from classpath scan and guice modules).InitializedCalled after guicey initialization (includes bundles lookup and initialization, installers and extensions resolution).InjectorCreationCalled just before guice injector creation.InstallersResolvedCalled when installers resolved (from classpath scan, if enabled) and initialized.JerseyConfigurationJersey context starting.JerseyExtensionsInstalledCalled after allJerseyInstallerinstallers install related extensions and only when at least one extension was installed.JerseyExtensionsInstalledByCalled whenJerseyInstallerinstaller installed all related extensions and only for installers actually performed installations (extensions list never empty).ManualExtensionsValidatedCalled when all manually registered extension classes are recognized by installers (validated).ModulesAnalyzedCalled after guice modules analysis and repackaging.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Class<? extends GuiceyLifecycleEvent>getType()static GuiceyLifecyclevalueOf(java.lang.String name)Returns the enum constant of this type with the specified name.static GuiceyLifecycle[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
ConfigurationHooksProcessed
public static final GuiceyLifecycle ConfigurationHooksProcessed
Called after all registeredGuiceyConfigurationHookprocessing. Provides all instances of executed hooks. Not called if no hooks used.
-
BeforeInit
public static final GuiceyLifecycle BeforeInit
Special meta event, called before allGuiceBundleconfiguration phase logic.Bootstrapobject is available, but dropwizard bundles (registered through guicey) are not yet registered (note thatGuiceBundleis not yet added to bootstrap also because dropwizard calls bundle initialization before registering bundle (and so all dropwizard bundles, registered by guicey, will run beforeGuiceBundlerun).
-
DropwizardBundlesInitialized
public static final GuiceyLifecycle DropwizardBundlesInitialized
Called after dropwizard bundles initialization (for dropwizard bundles registered through guicey api). Not called if no bundles were registered.
-
BundlesFromLookupResolved
public static final GuiceyLifecycle BundlesFromLookupResolved
Called if at least one bundle recognized using bundles lookup. Provides list of recognized bundles (note: some of these bundles could be disabled and not used further).
-
BundlesResolved
public static final GuiceyLifecycle BundlesResolved
Called afterGuiceyBundleLookupmechanisms when all top-level bundles are resolved. Provides a list of all enabled and list of disabled bundles. Called even if no bundles registered to indicate configuration state.
-
BundlesInitialized
public static final GuiceyLifecycle BundlesInitialized
Called after bundles processing. Note that bundles could register other bundles and so resulted list of installed bundles could be bigger (than in resolution event). Provides a list of all used and all disabled bundles. Not called even if no bundles were used at all (no initialization - no event).
-
CommandsResolved
public static final GuiceyLifecycle CommandsResolved
Called if commands search is enabled (GuiceBundle.Builder.searchCommands()) and at least one command found (and installed). Not called otherwise.
-
InstallersResolved
public static final GuiceyLifecycle InstallersResolved
Called when installers resolved (from classpath scan, if enabled) and initialized. Provides list of all enabled and list of all disabled installers (which will be used for extensions recognition and installation). Called even if no installers are resolved to indicate configuration state.
-
ClasspathExtensionsResolved
public static final GuiceyLifecycle ClasspathExtensionsResolved
Called when classes from classpath scan analyzed and all extensions detected. Called only if classpath scan is enabled and at least one extension detected.
-
Initialized
public static final GuiceyLifecycle Initialized
Called after guicey initialization (includes bundles lookup and initialization, installers and extensions resolution). Pure marker event, indicating guicey work finished under dropwizard configuration phase.Note: dropwizard bundles, registered after
GuiceBundlewill be initialized after this point.
-
BeforeRun
public static final GuiceyLifecycle BeforeRun
Special meta event, called before allGuiceBundlerun phase logic (when configuration and environment are already available). Could be used to print some diagnostic info before guicey initialization (for example, available configuration bindings to debug guice injector creation failure due to missed bindings).
-
BundlesStarted
public static final GuiceyLifecycle BundlesStarted
Called after bundles started (run method call). Not called if no bundles were used at all. Note that dropwizard bundles are not yet started because dropwizard will call it's run method after guice bundle processing.
-
ManualExtensionsValidated
public static final GuiceyLifecycle ManualExtensionsValidated
Called when all manually registered extension classes are recognized by installers (validated). But only extensions, known to be enabled at that time are actually validated (this way it is possible to exclude extensions for non existing installers). Called only if at least one manual extension registered.Performed in run phase because extensions could be registered in both phases.
-
ModulesAnalyzed
public static final GuiceyLifecycle ModulesAnalyzed
Called after guice modules analysis and repackaging. Reveals all detected extensions and removed bindings info. Called only if bindings analysis is enabled.
-
ExtensionsResolved
public static final GuiceyLifecycle ExtensionsResolved
Called when all extensions detected (from classpath scan and guice modules). Provides list of all enabled and list of disabled extension types (instances are not available yet). Called even if no extensions configured to indicate configuration state.
-
InjectorCreation
public static final GuiceyLifecycle InjectorCreation
Called just before guice injector creation. Provides all configured modules (main and override) and all disabled modules. Note that provided configured module instances were already processed (during bindings analysis) and so it makes no sense to modify them (only overriding modules will be actually used because they are not used during bindings analysis). Called even when no modules registered to indicate configuration state.
-
ExtensionsInstalledBy
public static final GuiceyLifecycle ExtensionsInstalledBy
Called when installer installed all related extensions and only for installers actually performed installations (extensions list never empty). Provides installer and installed extensions types.NOTE:
JerseyInstallerinstallers will not be notified here, even if they participate in installation it is considered as incomplete at that point.Extension instance could be obtained manually from injector. Injector is available because it's already constructed.
-
ExtensionsInstalled
public static final GuiceyLifecycle ExtensionsInstalled
Called after all installers install related extensions. Provides list of all used (enabled) extensions. Not called when no extensions installed.Extension instance could be obtained manually from injector. Injector is available because it's already constructed.
-
ApplicationRun
public static final GuiceyLifecycle ApplicationRun
Called afterGuiceBundle.run( io.dropwizard.core.Configuration, io.dropwizard.core.setup.Environment)when guicey context is started, extensions installed (but not hk extensions, because neither jersey nor jetty is't start yet).At this point injection to registered commands is performed (this may be important if custom command run application instead of "server"). Injector itself is completely initialized - all singletons started.
This point is before
Application.run( io.dropwizard.core.Configuration, io.dropwizard.core.setup.Environment). Ideal point for jersey and jetty listeners installation (with shortcut event methods).
-
JerseyConfiguration
public static final GuiceyLifecycle JerseyConfiguration
Jersey context starting. At this point jersey is starting and jetty is only initializing. Since that point jerseyInjectionManageris accessible.
-
JerseyExtensionsInstalledBy
public static final GuiceyLifecycle JerseyExtensionsInstalledBy
Called whenJerseyInstallerinstaller installed all related extensions and only for installers actually performed installations (extensions list never empty). Provides installer and installed extensions types.At this point jersey is not completely started and so jersey managed extensions (
JerseyManaged) couldn't be obtained yet (even though you have access to root service locator). But extensions managed by guice could be obtained from guice context.
-
JerseyExtensionsInstalled
public static final GuiceyLifecycle JerseyExtensionsInstalled
Called after allJerseyInstallerinstallers install related extensions and only when at least one extension was installed. Provides list of all used (enabled) extensions.At this point jersey is not completely started and so jersey managed extensions (
JerseyManaged) couldn't be obtained yet (even though you have access to root service locator). But extensions managed by guice could be obtained from guice context.To listen jersey lifecycle further use jersey events (like in
LifecycleDiagnostic).
-
ApplicationStarted
public static final GuiceyLifecycle ApplicationStarted
Called after complete dropwizard startup. Actually the same as jetty lifecycle started event (LifeCycle.Listener.lifeCycleStarted( org.eclipse.jetty.util.component.LifeCycle)), which is called after complete jetty startup.May be used as assured "started" point (after all initializations). For example, to report something. This event also will be fired in guicey tests (
TestGuiceyApp) which does not start the web part).
-
ApplicationShutdown
public static final GuiceyLifecycle ApplicationShutdown
Called on application shutdown start. Triggered by jetty lifecycle stopping event (LifeCycle.Listener.lifeCycleStopping( org.eclipse.jetty.util.component.LifeCycle)).May be used to perform some shutdown logic.
-
ApplicationStopped
public static final GuiceyLifecycle ApplicationStopped
Called after application shutdown. Triggered by jetty lifecycle stopping event (LifeCycle.Listener.lifeCycleStopped( org.eclipse.jetty.util.component.LifeCycle)).Supposed to be used to cleanup some resources after complete shutdown (very specific cases).
-
-
Method Detail
-
values
public static GuiceyLifecycle[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (GuiceyLifecycle c : GuiceyLifecycle.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static GuiceyLifecycle valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
java.lang.IllegalArgumentException- if this enum type has no constant with the specified namejava.lang.NullPointerException- if the argument is null
-
getType
public java.lang.Class<? extends GuiceyLifecycleEvent> getType()
- Returns:
- type of related event
-
-