Class GuiceyConfigurationInfo
- java.lang.Object
-
- ru.vyarus.dropwizard.guice.module.GuiceyConfigurationInfo
-
public class GuiceyConfigurationInfo extends java.lang.Object
Public api for internal guicey configuration info and startup statistics. Provides information about time spent for configurations and configuration details like registered bundle types, installers, extensions, disabled installers etc. Registered as guice bean and could be directly injected.Could be used for configuration diagnostics or unit test checks.
- Since:
- 21.06.2016
-
-
Constructor Summary
Constructors Constructor Description GuiceyConfigurationInfo(ConfigurationInfo context, StatsInfo stats, OptionsInfo options, ExtensionsHolder holder, ConfigurationTree configurationTree)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Set<ItemId>
getActiveScopes()
java.util.Set<ItemId>
getActiveScopes(boolean countDisables)
java.util.List<java.lang.Class<java.lang.Object>>
getBundlesDisabled()
Note that the same type may appear in both enabled and disabled lists if it is instance item and only some instances were disabled.java.util.List<java.lang.Class<GuiceyBundle>>
getBundlesFromLookup()
Bundles lookup mechanism could register only one instance of bundle type, but other instances may be registered directly (anyway, it is correct that only one bundle instance belongs to lookup scope).java.util.List<java.lang.Class<io.dropwizard.core.cli.Command>>
getCommands()
Note: only commands installed after classpath scan are tracked and so there might be only one instance for each command type (in spite of the fact that commands descriptors are instance based).ConfigurationTree
getConfigurationTree()
Note that object is also available for direct injection because, in contrast to other guicey-related data, configuration properties tree could be used directly in business logic.ConfigurationInfo
getData()
Use to perform custom configuration items data lookups (e.g. for additional logging, diagnostics or consistency checks).java.util.List<java.lang.Class<java.lang.Object>>
getDirectBundles()
java.util.List<ItemId<io.dropwizard.core.ConfiguredBundle>>
getDropwizardBundleIds()
Note that this list could be larger thengetDropwizardBundles()
because multiple bundle instances of the same class could be registered.java.util.List<java.lang.Class<io.dropwizard.core.ConfiguredBundle>>
getDropwizardBundles()
Note that multiple instances could be installed for some bundles, but returned list will contain just bundle type (no matter how many instances were actually installed).java.util.List<java.lang.Class<java.lang.Object>>
getExtensions()
java.util.List<java.lang.Class<java.lang.Object>>
getExtensions(java.lang.Class<? extends FeatureInstaller> installer)
java.util.List<java.lang.Class<java.lang.Object>>
getExtensionsDisabled()
java.util.List<java.lang.Class<java.lang.Object>>
getExtensionsFromBindings()
java.util.List<java.lang.Class<java.lang.Object>>
getExtensionsFromScan()
java.util.List<java.lang.Class<java.lang.Object>>
getExtensionsOrdered(java.lang.Class<? extends FeatureInstaller> installer)
Returned installers are ordered by execution order according toOrder
annotation.java.util.List<java.lang.Class<java.lang.Object>>
getExtensionsRegisteredManauallyOnly()
One extension could be installed manually then found by classpath scan and then found from guice binding.java.util.List<java.lang.Class<java.lang.Object>>
getExtensionsRegisteredManually()
Returned extensions may be also found by classpath scan or in guice bindings.java.util.List<ItemId<GuiceyBundle>>
getGuiceyBundleIds()
Note that this list could be larger thengetGuiceyBundles()
because multiple bundle instances of the same class could be registered.java.util.List<java.lang.Class<GuiceyBundle>>
getGuiceyBundles()
Note that multiple instances could be installed for some bundles, but returned list will contain just bundle type (no matter how many instances were actually installed).<T extends ItemInfo>
TgetInfo(java.lang.Class<?> type)
Shortcut forConfigurationInfo.getInfos(Class)
which always returns one configuration info object per class.<T extends ItemInfo>
java.util.List<T>getInfos(java.lang.Class<?> type)
Shortcut forConfigurationInfo.getInfos(Class)
.java.util.List<java.lang.Class<FeatureInstaller>>
getInstallers()
java.util.List<java.lang.Class<FeatureInstaller>>
getInstallersDisabled()
java.util.List<java.lang.Class<FeatureInstaller>>
getInstallersFromScan()
java.util.List<java.lang.Class<FeatureInstaller>>
getInstallersOrdered()
Returned installers are ordered not by execution order (according toOrder
annotations).java.util.List<ItemId<java.lang.Object>>
getItemsByScope(java.lang.Class<?> scope)
Shortcut forgetItemsByScope(ItemId)
.java.util.List<ItemId<java.lang.Object>>
getItemsByScope(ConfigScope specialScope)
Shortcut forgetItemsByScope(Class)
for special scopes (like classpath scan, bundles lookup etc).java.util.List<ItemId<java.lang.Object>>
getItemsByScope(ItemId scope)
NOTE: single item may be registered from multiple scopes!java.util.List<ItemId<com.google.inject.Module>>
getModuleIds()
Note that this list could be larger thengetModules()
because multiple module instances of the same class could be registered.java.util.List<java.lang.Class<com.google.inject.Module>>
getModules()
Note that multiple instances could be installed for some modules, but returned list will contain just module type (no matter how many instances were actually installed).java.util.List<java.lang.Class<com.google.inject.Module>>
getModulesDisabled()
java.util.List<ItemId<com.google.inject.Module>>
getNormalModuleIds()
Note that this list could be larger thengetNormalModules()
because multiple module instances of the same class could be registered.java.util.List<java.lang.Class<com.google.inject.Module>>
getNormalModules()
OptionsInfo
getOptions()
java.util.List<ItemId<com.google.inject.Module>>
getOverridingModuleIds()
Note that this list could be larger thengetOverridingModules()
because multiple module instances of the same class could be registered.java.util.List<java.lang.Class<com.google.inject.Module>>
getOverridingModules()
java.util.List<java.lang.Class<java.lang.Object>>
getRelativelyInstalledBundles(java.lang.Class<?> bundle)
StatsInfo
getStats()
Timers and counters collected at startup.
-
-
-
Constructor Detail
-
GuiceyConfigurationInfo
@Inject public GuiceyConfigurationInfo(ConfigurationInfo context, StatsInfo stats, OptionsInfo options, ExtensionsHolder holder, ConfigurationTree configurationTree)
-
-
Method Detail
-
getData
public ConfigurationInfo getData()
Use to perform custom configuration items data lookups (e.g. for additional logging, diagnostics or consistency checks).- Returns:
- raw configuration info object
-
getStats
public StatsInfo getStats()
Timers and counters collected at startup.- Returns:
- startup statistics object
- See Also:
for available stats
-
getOptions
public OptionsInfo getOptions()
- Returns:
- configuration options
- See Also:
for more info
,for options example
-
getConfigurationTree
public ConfigurationTree getConfigurationTree()
Note that object is also available for direct injection because, in contrast to other guicey-related data, configuration properties tree could be used directly in business logic.- Returns:
- dropwizard configuration introspection result
-
getItemsByScope
public java.util.List<ItemId<java.lang.Object>> getItemsByScope(ConfigScope specialScope)
Shortcut forgetItemsByScope(Class)
for special scopes (like classpath scan, bundles lookup etc).- Parameters:
specialScope
- special scope- Returns:
- all enabled items registered in specified scope or empty list
-
getItemsByScope
public java.util.List<ItemId<java.lang.Object>> getItemsByScope(ItemId scope)
NOTE: single item may be registered from multiple scopes! This method will return entity by all it's registered scopes and not just by first registration. It makes it usable, for example, for configuration tree building. If you need exact registration scope useFilters.registrationScope(Class)
filter.- Parameters:
scope
- required scope- Returns:
- all enabled items registered in specified scope or empty list
- See Also:
for more info about scopes
,for the list of all special scopes
-
getItemsByScope
public java.util.List<ItemId<java.lang.Object>> getItemsByScope(java.lang.Class<?> scope)
Shortcut forgetItemsByScope(ItemId)
. Note that bundle of the same type may be registered multiple times and querying by such bundle type will return registrations from all bundle instances.- Parameters:
scope
- scope class- Returns:
- all enabled items registered in specified scope or empty list
-
getActiveScopes
public java.util.Set<ItemId> getActiveScopes()
- Returns:
- all active scopes including disable only scopes
- See Also:
getActiveScopes(boolean)
,for the list of all special scopes
-
getActiveScopes
public java.util.Set<ItemId> getActiveScopes(boolean countDisables)
- Parameters:
countDisables
- include scopes with disables only- Returns:
- all active scopes or empty collection
- See Also:
for more info about scopes
-
getInfo
public <T extends ItemInfo> T getInfo(java.lang.Class<?> type)
Shortcut forConfigurationInfo.getInfos(Class)
which always returns one configuration info object per class. It is generally not correct for instance types (where multiple instances of the same type could be registered), but enough for general reporting needs (showing general info on class level).- Type Parameters:
T
- required info object type- Parameters:
type
- item type- Returns:
- configuration item object for provided class (first one for multiple instances) or empty list if not found
-
getInfos
public <T extends ItemInfo> java.util.List<T> getInfos(java.lang.Class<?> type)
Shortcut forConfigurationInfo.getInfos(Class)
. Added to avoid confusion withgetInfo(Class)
.- Type Parameters:
T
- required info object type- Parameters:
type
- item type- Returns:
- all configuration object registered with required class (could be multiple for instance types and always one element for class types).
- See Also:
shortcut method
-
getCommands
public java.util.List<java.lang.Class<io.dropwizard.core.cli.Command>> getCommands()
Note: only commands installed after classpath scan are tracked and so there might be only one instance for each command type (in spite of the fact that commands descriptors are instance based).- Returns:
- types of all installed commands or empty list
- See Also:
GuiceBundle.Builder.searchCommands()
-
getGuiceyBundles
public java.util.List<java.lang.Class<GuiceyBundle>> getGuiceyBundles()
Note that multiple instances could be installed for some bundles, but returned list will contain just bundle type (no matter how many instances were actually installed).- Returns:
- types of all installed and enabled bundles (including lookup bundles) or empty list
-
getGuiceyBundleIds
public java.util.List<ItemId<GuiceyBundle>> getGuiceyBundleIds()
Note that this list could be larger thengetGuiceyBundles()
because multiple bundle instances of the same class could be registered.- Returns:
- types of all enabled normal guice modules or empty list
- See Also:
GuiceBundle.Builder.bundles(GuiceyBundle...)
,for loaded model object for id
-
getDropwizardBundles
public java.util.List<java.lang.Class<io.dropwizard.core.ConfiguredBundle>> getDropwizardBundles()
Note that multiple instances could be installed for some bundles, but returned list will contain just bundle type (no matter how many instances were actually installed).- Returns:
- types of all installed and enabled dropwizard bundles or empty list
-
getDropwizardBundleIds
public java.util.List<ItemId<io.dropwizard.core.ConfiguredBundle>> getDropwizardBundleIds()
Note that this list could be larger thengetDropwizardBundles()
because multiple bundle instances of the same class could be registered.- Returns:
- types of all enabled normal guice modules or empty list
- See Also:
GuiceBundle.Builder.bundles(GuiceyBundle...)
,for loaded model object for id
-
getBundlesFromLookup
public java.util.List<java.lang.Class<GuiceyBundle>> getBundlesFromLookup()
Bundles lookup mechanism could register only one instance of bundle type, but other instances may be registered directly (anyway, it is correct that only one bundle instance belongs to lookup scope).- Returns:
- types of bundles resolved by bundle lookup mechanism or empty list
- See Also:
GuiceyBundleLookup
-
getDirectBundles
public java.util.List<java.lang.Class<java.lang.Object>> getDirectBundles()
- Returns:
- all (guicey and dropwizard) enabled top-level bundles (without transitives)
-
getBundlesDisabled
public java.util.List<java.lang.Class<java.lang.Object>> getBundlesDisabled()
Note that the same type may appear in both enabled and disabled lists if it is instance item and only some instances were disabled.- Returns:
- types of manually disabled bundles or empty list
-
getRelativelyInstalledBundles
public java.util.List<java.lang.Class<java.lang.Object>> getRelativelyInstalledBundles(java.lang.Class<?> bundle)
- Parameters:
bundle
- bundle- Returns:
- types of bundles (guicey and dropwizard) registered from provided bundle avoiding disabled bundles or empty list
-
getModules
public java.util.List<java.lang.Class<com.google.inject.Module>> getModules()
Note that multiple instances could be installed for some modules, but returned list will contain just module type (no matter how many instances were actually installed).- Returns:
- types of all registered and enabled guice modules (including normal and overriding) or empty list
-
getModuleIds
public java.util.List<ItemId<com.google.inject.Module>> getModuleIds()
Note that this list could be larger thengetModules()
because multiple module instances of the same class could be registered.- Returns:
- ids of all registered and enabled guice modules (including normal and overriding) or empty list
- See Also:
for loaded model object for id
-
getNormalModules
public java.util.List<java.lang.Class<com.google.inject.Module>> getNormalModules()
- Returns:
- types of all enabled normal guice modules or empty list
- See Also:
GuiceBundle.Builder.modules(Module...)
-
getNormalModuleIds
public java.util.List<ItemId<com.google.inject.Module>> getNormalModuleIds()
Note that this list could be larger thengetNormalModules()
because multiple module instances of the same class could be registered.- Returns:
- types of all enabled normal guice modules or empty list
- See Also:
GuiceBundle.Builder.modules(Module...)
,for loaded model object for id
-
getOverridingModules
public java.util.List<java.lang.Class<com.google.inject.Module>> getOverridingModules()
- Returns:
- types of all enabled overriding guice modules or empty list
- See Also:
GuiceBundle.Builder.modulesOverride(Module...)
-
getOverridingModuleIds
public java.util.List<ItemId<com.google.inject.Module>> getOverridingModuleIds()
Note that this list could be larger thengetOverridingModules()
because multiple module instances of the same class could be registered.- Returns:
- types of all enabled normal guice modules or empty list
- See Also:
GuiceBundle.Builder.modulesOverride(Module...)
,for loaded model object for id
-
getModulesDisabled
public java.util.List<java.lang.Class<com.google.inject.Module>> getModulesDisabled()
- Returns:
- types of manually disabled modules or empty list
-
getInstallers
public java.util.List<java.lang.Class<FeatureInstaller>> getInstallers()
- Returns:
- types of all registered installers (without disabled) or empty list
-
getInstallersFromScan
public java.util.List<java.lang.Class<FeatureInstaller>> getInstallersFromScan()
- Returns:
- installer types, resolved by classpath scan (without disabled) or empty list
-
getInstallersDisabled
public java.util.List<java.lang.Class<FeatureInstaller>> getInstallersDisabled()
- Returns:
- types of manually disabled installers or empty list
-
getInstallersOrdered
public java.util.List<java.lang.Class<FeatureInstaller>> getInstallersOrdered()
Returned installers are ordered not by execution order (according toOrder
annotations).- Returns:
- ordered list of installers or empty list
-
getExtensions
public java.util.List<java.lang.Class<java.lang.Object>> getExtensions()
- Returns:
- all registered and enabled extension types (including resolved with classpath scan) or empty list
-
getExtensions
public java.util.List<java.lang.Class<java.lang.Object>> getExtensions(java.lang.Class<? extends FeatureInstaller> installer)
- Parameters:
installer
- installer type- Returns:
- list of extensions installed by provided installer or empty list
-
getExtensionsFromScan
public java.util.List<java.lang.Class<java.lang.Object>> getExtensionsFromScan()
- Returns:
- enabled extension types, resolved by classpath scan or empty list
-
getExtensionsFromBindings
public java.util.List<java.lang.Class<java.lang.Object>> getExtensionsFromBindings()
- Returns:
- enabled extension types, resolved by guice bindings scan or empty list
-
getExtensionsRegisteredManually
public java.util.List<java.lang.Class<java.lang.Object>> getExtensionsRegisteredManually()
Returned extensions may be also found by classpath scan or in guice bindings.- Returns:
- enabled extensions which was registered manually or empty list
-
getExtensionsRegisteredManauallyOnly
public java.util.List<java.lang.Class<java.lang.Object>> getExtensionsRegisteredManauallyOnly()
One extension could be installed manually then found by classpath scan and then found from guice binding. This method returns only extensions configured manually and never detected by other methods.- Returns:
- list of enabled extensions, registered only manually or empty list
-
getExtensionsOrdered
public java.util.List<java.lang.Class<java.lang.Object>> getExtensionsOrdered(java.lang.Class<? extends FeatureInstaller> installer)
Returned installers are ordered by execution order according toOrder
annotation. Note: not all installers supports ordering (in any case returned order is the same order as extensions were processed by installer).- Parameters:
installer
- installer type- Returns:
- ordered list of extensions installed by provided installer or empty list
-
getExtensionsDisabled
public java.util.List<java.lang.Class<java.lang.Object>> getExtensionsDisabled()
- Returns:
- types of manually disabled extensions or empty list
-
-