java.lang.Object
ru.vyarus.dropwizard.guice.module.installer.util.BundleSupport

public final class BundleSupport extends Object
Utility class to work with registered ConfiguredBundle objects within dropwizard Bootstrap object.
Since:
01.08.2015
  • Method Details

    • initBundles

      public static void initBundles(ConfigurationContext context)
      Process initialization for initially registered and all transitive bundles.
      • Executing initial bundles initialization (registered in GuiceBundle and by bundle lookup)
      • During execution bundles may register other bundles (through GuiceyBootstrap)
      • Execute registered bundles and repeat from previous step until no new bundles registered
      Bundles duplicates are checked by type: only one bundle instance may be registered.
      Parameters:
      context - configuration context
    • initBundles

      public static void initBundles(ConfigurationContext context, GuiceyBootstrap bootstrap, List<Class<? extends GuiceyBundle>> path, List<GuiceyBundle> initOrder, List<GuiceyBundle> bundles)
      Point of root (registered in guice bundle) bundles installation. Also, called in guicey bootstrap for transitive bundles installation (immediate initialization).
      Parameters:
      context - configuration context
      bootstrap - guicey bootstrap object
      path - transitive bundles installation path
      initOrder - bundles initialization order (appendable)
      bundles - bundles to install
    • runBundles

      public static void runBundles(ConfigurationContext context) throws Exception
      Run all enabled bundles (and delayed configurations).
      Parameters:
      context - bundles context
      Throws:
      Exception - if something goes wrong
    • removeDuplicates

      public static <T> List<T> removeDuplicates(List<T> list)
      Remove duplicates in list by rule: only one instance of type must be present in list.
      Type Parameters:
      T - required bundle type
      Parameters:
      list - bundles list
      Returns:
      list cleared from duplicates
    • removeTypes

      public static <T> List<T> removeTypes(List<T> list, List<Class<? extends T>> filter)
      Filter list from objects of type present in filter list.
      Type Parameters:
      T - required type
      Parameters:
      list - list to filter
      filter - types to filter
      Returns:
      filtered list
    • findBundles

      public static <T> List<T> findBundles(io.dropwizard.core.setup.Bootstrap bootstrap, Class<T> type)
      Type Parameters:
      T - required bundle type
      Parameters:
      bootstrap - dropwizard bootstrap instance
      type - required bundle type (or marker interface)
      Returns:
      list of bundles of specified type