當前位置: 首頁>>代碼示例>>Java>>正文


Java ConfiguredBundle類代碼示例

本文整理匯總了Java中io.dropwizard.ConfiguredBundle的典型用法代碼示例。如果您正苦於以下問題:Java ConfiguredBundle類的具體用法?Java ConfiguredBundle怎麽用?Java ConfiguredBundle使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ConfiguredBundle類屬於io.dropwizard包,在下文中一共展示了ConfiguredBundle類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: testGetImplementingBundles

import io.dropwizard.ConfiguredBundle; //導入依賴的package包/類
@SuppressWarnings("unchecked")
@Test
public void testGetImplementingBundles() {
    Bootstrap<?>     bootstrap     = new Bootstrap<>(null);
    ConfiguredBundle hashSetBundle = (ConfiguredBundle) mock(HashSet.class, withSettings().extraInterfaces(ConfiguredBundle.class).defaultAnswer(RETURNS_DEEP_STUBS));
    ConfiguredBundle hashMapBundle = (ConfiguredBundle) mock(HashMap.class, withSettings().extraInterfaces(ConfiguredBundle.class).defaultAnswer(RETURNS_DEEP_STUBS));
    Bundle           treeSetBundle = (Bundle) mock(TreeSet.class, withSettings().extraInterfaces(Bundle.class).defaultAnswer(RETURNS_DEEP_STUBS));
    Bundle           treeMapBundle = (Bundle) mock(TreeMap.class, withSettings().extraInterfaces(Bundle.class).defaultAnswer(RETURNS_DEEP_STUBS));
    bootstrap.addBundle(hashMapBundle);
    bootstrap.addBundle(hashSetBundle);
    bootstrap.addBundle(treeMapBundle);
    bootstrap.addBundle(treeSetBundle);
    //
    List<Set> setBundles = BootstrapExtensions.getImplementingBundles(bootstrap, Set.class);
    List<Map> mapBundles = BootstrapExtensions.getImplementingBundles(bootstrap, Map.class);
    //
    assertThat(setBundles).isNotNull();
    assertThat(setBundles).containsExactlyInAnyOrder((Set) hashSetBundle, (Set) treeSetBundle);
    assertThat(mapBundles).isNotNull();
    assertThat(mapBundles).containsExactlyInAnyOrder((Map) hashMapBundle, (Map) treeMapBundle);
}
 
開發者ID:baharclerode,項目名稱:dropwizard-hk2,代碼行數:22,代碼來源:BootstrapExtensionsTest.java

示例2: getConfiguredBundles

import io.dropwizard.ConfiguredBundle; //導入依賴的package包/類
@Override
public Iterable<ConfiguredBundle<AirpalConfiguration>> getConfiguredBundles()
{
    Iterable<ConfiguredBundle<AirpalConfiguration>> bundles = super.getConfiguredBundles();
    ImmutableList.Builder<ConfiguredBundle<AirpalConfiguration>> builder = ImmutableList.builder();

    for (ConfiguredBundle<AirpalConfiguration> bundle : bundles) {
        builder.add(bundle);
    }
    builder.add(new ShiroBundle<AirpalConfiguration>() {
        @Override
        protected ShiroConfiguration narrow(AirpalConfiguration configuration)
        {
            return configuration.getShiro();
        }
    });
    return builder.build();
}
 
開發者ID:airbnb,項目名稱:airpal,代碼行數:19,代碼來源:AirpalApplication.java

示例3: initialize

import io.dropwizard.ConfiguredBundle; //導入依賴的package包/類
@Override
public void initialize(final Bootstrap<T> bootstrap) {
  if (!Strings.isNullOrEmpty(System.getProperty(SINGULARITY_DEFAULT_CONFIGURATION_PROPERTY))) {
    bootstrap.setConfigurationSourceProvider(new MergingSourceProvider(bootstrap.getConfigurationSourceProvider(), System.getProperty(SINGULARITY_DEFAULT_CONFIGURATION_PROPERTY), bootstrap.getObjectMapper(), new YAMLFactory()));
  }

  final Iterable<? extends Module> additionalModules = checkNotNull(getGuiceModules(bootstrap), "getGuiceModules() returned null");
  final Iterable<? extends Bundle> additionalBundles = checkNotNull(getDropwizardBundles(bootstrap), "getDropwizardBundles() returned null");
  final Iterable<? extends ConfiguredBundle<T>> additionalConfiguredBundles = checkNotNull(getDropwizardConfiguredBundles(bootstrap), "getDropwizardConfiguredBundles() returned null");

  final GuiceBundle<SingularityConfiguration> guiceBundle = GuiceBundle.defaultBuilder(SingularityConfiguration.class)
      .modules(new SingularityServiceModule())
      .modules(additionalModules)
      .build();
  bootstrap.addBundle(guiceBundle);

  bootstrap.addBundle(new CorsBundle());
  bootstrap.addBundle(new ViewBundle());
  bootstrap.addBundle(new AssetsBundle("/assets/static/", "/static/"));
  bootstrap.addBundle(new AssetsBundle("/assets/api-docs/", "/api-docs/", "index.html", "api-docs"));
  bootstrap.addBundle(new MigrationsBundle<SingularityConfiguration>() {
    @Override
    public DataSourceFactory getDataSourceFactory(final SingularityConfiguration configuration) {
      return configuration.getDatabaseConfiguration().get();
    }
  });

  for (Bundle bundle : additionalBundles) {
    bootstrap.addBundle(bundle);
  }

  for (ConfiguredBundle<T> configuredBundle : additionalConfiguredBundles) {
    bootstrap.addBundle(configuredBundle);
  }

  bootstrap.getObjectMapper().registerModule(new ProtobufModule());
  bootstrap.getObjectMapper().registerModule(new GuavaModule());
  bootstrap.getObjectMapper().setSerializationInclusion(Include.NON_NULL);
  bootstrap.getObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
}
 
開發者ID:PacktPublishing,項目名稱:Mastering-Mesos,代碼行數:41,代碼來源:SingularityService.java

示例4: testGetConfiguredBundles

import io.dropwizard.ConfiguredBundle; //導入依賴的package包/類
@SuppressWarnings("unchecked")
@Test
public void testGetConfiguredBundles() {
    Bootstrap<?>     bootstrap = new Bootstrap<>(null);
    ConfiguredBundle bundle    = mock(ConfiguredBundle.class);
    bootstrap.addBundle(bundle);
    //
    List<ConfiguredBundle> bundles = BootstrapExtensions.getConfiguredBundles(bootstrap);
    //
    assertThat(bundles).isNotNull();
    assertThat(bundles).containsExactly(bundle);
}
 
開發者ID:baharclerode,項目名稱:dropwizard-hk2,代碼行數:13,代碼來源:BootstrapExtensionsTest.java

示例5: initialize

import io.dropwizard.ConfiguredBundle; //導入依賴的package包/類
@Override
public void initialize(Bootstrap<?> bootstrap) {
    this.application = bootstrap.getApplication();

    listServices(Bundle.class).forEach(bootstrap::addBundle);
    listServices(ConfiguredBundle.class).forEach(bootstrap::addBundle);
    listServices(Command.class).forEach(bootstrap::addCommand);
}
 
開發者ID:alex-shpak,項目名稱:dropwizard-hk2bundle,代碼行數:9,代碼來源:HK2Bundle.java

示例6: configure

import io.dropwizard.ConfiguredBundle; //導入依賴的package包/類
@Override
protected void configure() {
    bind(HK2ValidationBundle.class)
            .to(HK2ValidationBundle.class)
            .to(Bundle.class)
            .in(Singleton.class);

    bind(HK2ConfiguredBundle.class)
            .to(HK2ConfiguredBundle.class)
            .to(ConfiguredBundle.class)
            .in(Singleton.class);
}
 
開發者ID:alex-shpak,項目名稱:dropwizard-hk2bundle,代碼行數:13,代碼來源:HK2Bundle.java

示例7: initialize

import io.dropwizard.ConfiguredBundle; //導入依賴的package包/類
@Override
public void initialize(Bootstrap<T> bootstrap)
{
    for (ConfiguredBundle<T> configuredBundle : getConfiguredBundles()) {
        bootstrap.addBundle(configuredBundle);
    }
    for (Bundle bundle : getBundles()) {
        bootstrap.addBundle(bundle);
    }
}
 
開發者ID:airbnb,項目名稱:airpal,代碼行數:11,代碼來源:AirpalApplicationBase.java

示例8: getDropwizardConfiguredBundles

import io.dropwizard.ConfiguredBundle; //導入依賴的package包/類
@Override
public Iterable<? extends ConfiguredBundle<SingularityConfiguration>> getDropwizardConfiguredBundles(final Bootstrap<SingularityConfiguration> bootstrap) {
  return ImmutableSet.of();
}
 
開發者ID:PacktPublishing,項目名稱:Mastering-Mesos,代碼行數:5,代碼來源:EmbeddedSingularityExample.java

示例9: getDropwizardConfiguredBundles

import io.dropwizard.ConfiguredBundle; //導入依賴的package包/類
public Iterable<? extends ConfiguredBundle<T>> getDropwizardConfiguredBundles(Bootstrap<T> bootstrap) {
  return ImmutableList.of();
}
 
開發者ID:PacktPublishing,項目名稱:Mastering-Mesos,代碼行數:4,代碼來源:SingularityService.java

示例10: initialize

import io.dropwizard.ConfiguredBundle; //導入依賴的package包/類
@Override
@SuppressWarnings("unchecked")
public void initialize(Bootstrap<?> bootstrap) {
    //shardBundles.forEach(shardBundle -> bootstrap.addBundle((ConfiguredBundle)shardBundle));
    shardBundles.forEach(hibernateBundle -> bootstrap.addBundle((ConfiguredBundle) hibernateBundle));
}
 
開發者ID:santanusinha,項目名稱:dropwizard-db-sharding-bundle,代碼行數:7,代碼來源:DBShardingBundle.java

示例11: websocketBundleImplementsConfiguredBundleInterface

import io.dropwizard.ConfiguredBundle; //導入依賴的package包/類
@Test
public void websocketBundleImplementsConfiguredBundleInterface() {
    assertTrue(ConfiguredBundle.class.isAssignableFrom(WebsocketBundle.class));
}
 
開發者ID:TomCools,項目名稱:dropwizard-websocket-jee7-bundle,代碼行數:5,代碼來源:WebsocketBundleTest.java

示例12: registerBundle

import io.dropwizard.ConfiguredBundle; //導入依賴的package包/類
private <T extends ConfiguredBundle<FiazardConfig>> T registerBundle(Bootstrap<FiazardConfig> bootstrap, T bundle) {
       bootstrap.addBundle(bundle);
	return bundle;
}
 
開發者ID:SoftwareSandbox,項目名稱:Fiazard,代碼行數:5,代碼來源:FiazardApp.java

示例13: BundleSpec

import io.dropwizard.ConfiguredBundle; //導入依賴的package包/類
public BundleSpec(ConfiguredBundle<T> configuredBundle, Phase phase)
{
    this.bundle = null;
    this.configuredBundle = configuredBundle;
    this.phase = phase;
}
 
開發者ID:soabase,項目名稱:soabase,代碼行數:7,代碼來源:BundleSpec.java

示例14: getConfiguredBundle

import io.dropwizard.ConfiguredBundle; //導入依賴的package包/類
public ConfiguredBundle<T> getConfiguredBundle()
{
    return configuredBundle;
}
 
開發者ID:soabase,項目名稱:soabase,代碼行數:5,代碼來源:BundleSpec.java

示例15: addConfiguredBundle

import io.dropwizard.ConfiguredBundle; //導入依賴的package包/類
protected void addConfiguredBundle(@SuppressWarnings("rawtypes") Class<? extends ConfiguredBundle> bundleClass) {
    configuredBundles.add(bundleClass);
}
 
開發者ID:jclawson,項目名稱:dropwizardry,代碼行數:4,代碼來源:AbstractDropwizardModule.java


注:本文中的io.dropwizard.ConfiguredBundle類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。