Class 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
    • 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
      • 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 for getItemsByScope(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 use Filters.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 for getItemsByScope(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​(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 for ConfigurationInfo.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 for ConfigurationInfo.getInfos(Class). Added to avoid confusion with getInfo(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.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
      • getDropwizardBundles

        public java.util.List<java.lang.Class<io.dropwizard.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
      • 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 then getModules() 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...)
      • 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...)
      • 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 to Order 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 to Order 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