Class GuiceyConfigurationInfo
java.lang.Object
ru.vyarus.dropwizard.guice.module.GuiceyConfigurationInfo
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
ConstructorsConstructorDescriptionGuiceyConfigurationInfo(ConfigurationInfo context, StatsInfo stats, OptionsInfo options, ExtensionsHolder holder, ConfigurationTree configurationTree) Create configuration info. -
Method Summary
Modifier and TypeMethodDescriptiongetActiveScopes(boolean countDisables) Note that the same type may appear in both enabled and disabled lists if it is instance item and only some instances were disabled.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).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).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.getData()Use to perform custom configuration items data lookups (e.g. for additional logging, diagnostics or consistency checks).Note that this list could be larger thengetDropwizardBundles()because multiple bundle instances of the same class could be registered.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).getExtensions(Class<? extends FeatureInstaller> installer) getExtensionsOrdered(Class<? extends FeatureInstaller> installer) Returned installers are ordered by execution order according toOrderannotation.One extension could be installed manually then found by classpath scan and then found from guice binding.Returned extensions may be also found by classpath scan or in guice bindings.Note that this list could be larger thengetGuiceyBundles()because multiple bundle instances of the same class could be registered.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).List<Class<? extends GuiceyBundle>>Guicey bundle could register another guicey bundle then this transitive bundle would be initialized before the root bundle.<T extends ItemInfo>
TShortcut forConfigurationInfo.getInfos(Class)which always returns one configuration info object per class.Shortcut forConfigurationInfo.getInfos(Class).Returned installers are ordered not by execution order (according toOrderannotations).getItemsByScope(Class<?> scope) Shortcut forgetItemsByScope(ItemId).getItemsByScope(ConfigScope specialScope) Shortcut forgetItemsByScope(Class)for special scopes (like classpath scan, bundles lookup etc).getItemsByScope(ItemId scope) NOTE: single item may be registered from multiple scopes!Note that this list could be larger thengetModules()because multiple module instances of the same class could be registered.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).Note that this list could be larger thengetNormalModules()because multiple module instances of the same class could be registered.Note that this list could be larger thengetOverridingModules()because multiple module instances of the same class could be registered.getRelativelyInstalledBundles(Class<?> bundle) getStats()Timers and counters collected at startup.
-
Constructor Details
-
GuiceyConfigurationInfo
@Inject public GuiceyConfigurationInfo(ConfigurationInfo context, StatsInfo stats, OptionsInfo options, ExtensionsHolder holder, ConfigurationTree configurationTree) Create configuration info.- Parameters:
context- configuration contextstats- stat trackersoptions- optionsholder- extensions holderconfigurationTree- parsed configuration
-
-
Method Details
-
getData
Use to perform custom configuration items data lookups (e.g. for additional logging, diagnostics or consistency checks).- Returns:
- raw configuration info object
-
getStats
Timers and counters collected at startup.- Returns:
- startup statistics object
- See Also:
-
getOptions
- Returns:
- configuration options
- See Also:
-
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
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
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:
-
getItemsByScope
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
- Returns:
- all active scopes including disable only scopes
- See Also:
-
getActiveScopes
- Parameters:
countDisables- include scopes with disables only- Returns:
- all active scopes or empty collection
- See Also:
-
getInfo
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
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:
-
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:
-
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).Important: bundles returned in the registration order; if initialization order is required see
getGuiceyBundlesInInitOrder()(different because of transitive bundles).- Returns:
- types of all installed and enabled bundles (including lookup bundles) or empty list
-
getGuiceyBundlesInInitOrder
Guicey bundle could register another guicey bundle then this transitive bundle would be initialized before the root bundle. This method sorts registered bundles according to actual initialization order (not by when init started, but when init finished - the same order as for transitive dropwizard bundles).- Returns:
- applied guicey bundles in initialization order.
-
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:
-
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
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:
-
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:
-
getDirectBundles
- Returns:
- all (guicey and dropwizard) enabled top-level bundles (without transitives)
-
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
- Parameters:
bundle- bundle- Returns:
- types of bundles (guicey and dropwizard) registered from provided bundle avoiding disabled bundles or empty list
-
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
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:
-
getNormalModules
- Returns:
- types of all enabled normal guice modules or empty list
- See Also:
-
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:
-
getOverridingModules
- Returns:
- types of all enabled overriding guice modules or empty list
- See Also:
-
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:
-
getModulesDisabled
- Returns:
- types of manually disabled modules or empty list
-
getInstallers
- Returns:
- types of all registered installers (without disabled) or empty list
-
getInstallersFromScan
- Returns:
- installer types, resolved by classpath scan (without disabled) or empty list
-
getInstallersDisabled
- Returns:
- types of manually disabled installers or empty list
-
getInstallersOrdered
Returned installers are ordered not by execution order (according toOrderannotations).- Returns:
- ordered list of installers or empty list
-
getExtensions
- Returns:
- all registered and enabled extension types (including resolved with classpath scan) or empty list
-
getExtensions
- Parameters:
installer- installer type- Returns:
- list of extensions installed by provided installer or empty list
-
getExtensionsFromScan
- Returns:
- enabled extension types, resolved by classpath scan or empty list
-
getExtensionsFromBindings
- Returns:
- enabled extension types, resolved by guice bindings scan or empty list
-
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
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
Returned installers are ordered by execution order according toOrderannotation. 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
- Returns:
- types of manually disabled extensions or empty list
-