当前位置: 首页>>代码示例>>Java>>正文


Java Bootstrap类代码示例

本文整理汇总了Java中com.yammer.dropwizard.config.Bootstrap的典型用法代码示例。如果您正苦于以下问题:Java Bootstrap类的具体用法?Java Bootstrap怎么用?Java Bootstrap使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Bootstrap类属于com.yammer.dropwizard.config包,在下文中一共展示了Bootstrap类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initialize

import com.yammer.dropwizard.config.Bootstrap; //导入依赖的package包/类
@Override
public void initialize(final Bootstrap<Config> bootstrap) {
    bootstrap.setName("DropwizardDemo server");

    // serve all files in src/main/resources/webroot on /
    bootstrap.addBundle(new AssetsBundle("/webroot/", "/"));

    // ViewBundle for BookViews templating
    bootstrap.addBundle(new ViewBundle());

    bootstrap.addBundle(hibernate);
}
 
开发者ID:mley,项目名称:dwdemo,代码行数:13,代码来源:DropwizardDemo.java

示例2: initialize

import com.yammer.dropwizard.config.Bootstrap; //导入依赖的package包/类
@Override
public void initialize(Bootstrap<WLCDMServerConfiguration> bootstrap) {
	bootstrap.setName("wlcdm");
    //bootstrap.addBundle(new AssetsBundle("/assets", "/"));
       bootstrap.addBundle(new ConfiguredAssetsBundle("/assets/", "/"));

       bootstrap.addBundle(hibernate);

       bootstrap.addBundle(new MigrationsBundle<WLCDMServerConfiguration>() {
           @Override
           public DatabaseConfiguration getDatabaseConfiguration(WLCDMServerConfiguration configuration) {
               return configuration.getDatabaseConfiguration();
           }
       });
   }
 
开发者ID:windbender,项目名称:wildlife-camera-machine,代码行数:16,代码来源:WLCDMServer.java

示例3: initialize

import com.yammer.dropwizard.config.Bootstrap; //导入依赖的package包/类
@Override
public void initialize(Bootstrap<ServiceConfiguration> bootstrap) {
	bootstrap.setName("zoopeeker");
	
	bootstrap.addBundle(new ViewBundle());
	bootstrap.addBundle(new ConfiguredAssetsBundle("/assets/", "/assets/"));
}
 
开发者ID:kiblerdude,项目名称:zoopeeker,代码行数:8,代码来源:ZooPeekerService.java

示例4: run

import com.yammer.dropwizard.config.Bootstrap; //导入依赖的package包/类
@Override
public void run(Bootstrap<HVDFConfiguration> configurationBootstrap,  Namespace namespace,
                HVDFConfiguration configuration ) {

    int numServers = namespace.getInt("servers");
    int numDays  = namespace.getInt("days");
    
    // Sample period 5mins by default
    long period = TimeUnit.SECONDS.toMillis(5*60);
    Integer periodCfg = namespace.getInt("period");
    if(periodCfg != null)
        period = TimeUnit.SECONDS.toMillis(periodCfg);
    
    System.out.println("Simulating " + numServers + " over " + numDays + " days");

    MongoClientURI default_uri = configuration.mongodb.default_database_uri;
    ServiceManager services = new ServiceManager(configuration.services, default_uri);
    FeedResource feedResource = new FeedResource( services.getChannelService() );
    Random rand = new Random();

    long endOfTime = (new Date()).getTime();
    long beginningOfTime = endOfTime - TimeUnit.DAYS.toMillis(numDays);

    for( long clock = beginningOfTime; clock < endOfTime; clock += period) {
        for( int serverId = 0; serverId < numServers; serverId++ ) {
        	BasicDBObject sample = new BasicDBObject();
        	sample.append(Sample.TS_KEY, clock).append(Sample.SOURCE_KEY, "server" + serverId);
        	sample.append(Sample.DATA_KEY, new BasicDBObject("load", rand.nextInt(100)));
            feedResource.pushToChannel("servers", "load", new JSONParam(sample));
        }
    }
}
 
开发者ID:mongodb-labs,项目名称:hvdf,代码行数:33,代码来源:ServerMonitoringSimulatorLoad.java

示例5: run

import com.yammer.dropwizard.config.Bootstrap; //导入依赖的package包/类
@Override
protected void run(Bootstrap<FoxtrotServerConfiguration> bootstrap,
                   Namespace namespace,
                   FoxtrotServerConfiguration configuration) throws Exception {
    ElasticsearchConfig esConfig = configuration.getElasticsearch();
    ElasticsearchConnection connection = new ElasticsearchConnection(esConfig);
    connection.start();
    ClusterHealthResponse clusterHealth = new ClusterHealthRequestBuilder(connection.getClient().admin().cluster())
            .execute()
            .get();

    int numDataNodes = clusterHealth.getNumberOfDataNodes();
    int numReplicas = (numDataNodes < 2) ? 0 : 1;

    logger.info("# data nodes: {}, Setting replica count to: {}", numDataNodes, numReplicas);

    createMetaIndex(connection, "consoles", numDataNodes - 1);
    createMetaIndex(connection, "table-meta", numDataNodes - 1);

    PutIndexTemplateResponse response = new PutIndexTemplateRequestBuilder(connection.getClient().admin().indices(), "template_foxtrot_mappings")
            .setTemplate(String.format("%s-*",configuration.getElasticsearch().getTableNamePrefix()))
            .setSettings(
                    ImmutableSettings.builder()
                            .put("number_of_shards", 10)
                            .put("number_of_replicas", numReplicas)
            )
            .addMapping("document", ElasticsearchUtils.getDocumentMapping())
            .execute()
            .get();
    logger.info("Create mapping: {}", response.isAcknowledged());

    logger.info("Creating hbase table");
    HBaseUtil.createTable(configuration.getHbase(), configuration.getHbase().getTableName());

}
 
开发者ID:Flipkart,项目名称:foxtrot,代码行数:36,代码来源:InitializerCommand.java

示例6: initialize

import com.yammer.dropwizard.config.Bootstrap; //导入依赖的package包/类
@Override
public void initialize(Bootstrap<PassbookConfiguration> bootstrap) {
    bootstrap.addBundle(hibernate);

    bootstrap.addBundle(new MigrationsBundle<PassbookConfiguration>() {
        @Override
        public DatabaseConfiguration getDatabaseConfiguration(PassbookConfiguration configuration) {
            return configuration.getDatabaseConfiguration();
        }
    });
}
 
开发者ID:JanGorman,项目名称:jersey-passbook,代码行数:12,代码来源:PassbookService.java

示例7: initialize

import com.yammer.dropwizard.config.Bootstrap; //导入依赖的package包/类
@Override
public void initialize(Bootstrap<SimulatorConfiguration> bootstrap) {
	bootstrap.setName("TR069-Simulator");
	bootstrap.addBundle(new ConfiguredAssetsBundle("/assets/", "/dashboard/") );
	bootstrap.addBundle(new ViewBundle());
	bootstrap.addBundle(GuiceBundle.newBuilder()
			.addModule(new SimulatorModule())
			.enableAutoConfig(getClass().getPackage().getName())
			.build()
			);


}
 
开发者ID:paraam,项目名称:tr069-simulator,代码行数:14,代码来源:SimulatorService.java

示例8: initialize

import com.yammer.dropwizard.config.Bootstrap; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
public final void initialize(final Bootstrap<KijiRESTConfiguration> bootstrap) {
  bootstrap.setName("kiji-rest");

  // Initialize plugins.
  for (KijiRestPlugin plugin : Lookups.get(KijiRestPlugin.class)) {
    LOG.info("Initializing plugin {}", plugin.getClass());
    plugin.initialize(bootstrap);
  }
}
 
开发者ID:kijiproject,项目名称:kiji-rest,代码行数:12,代码来源:KijiRESTService.java

示例9: initialize

import com.yammer.dropwizard.config.Bootstrap; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
public void initialize(Bootstrap<KijiRESTConfiguration> bootstrap) {
  // To include static assets put them in src/main/resources/assets and uncomment the
  // following line:
  //bootstrap.addBundle(new AssetsBundle());
}
 
开发者ID:kijiproject,项目名称:kiji-rest,代码行数:8,代码来源:ExampleKijiRestPlugin.java

示例10: initialize

import com.yammer.dropwizard.config.Bootstrap; //导入依赖的package包/类
@Override
public void initialize(Bootstrap<TeamsServiceConfiguration> bootstrap) {
	bootstrap.setName("dropwizard-jedis-example");
	bootstrap.addBundle(new AssetsBundle("/assets/", "/"));
	bootstrap.addBundle(new ViewBundle());
	bootstrap.addBundle(jedisBundle);
}
 
开发者ID:anastasop,项目名称:dropwizard-jedis,代码行数:8,代码来源:TeamsService.java

示例11: initialize

import com.yammer.dropwizard.config.Bootstrap; //导入依赖的package包/类
@Override
public void initialize(Bootstrap<MyAppConfiguration> bootstrap) {
    bootstrap.setName("my-app-service");
    bootstrap.getObjectMapperFactory().setSerializationInclusion(JsonInclude.Include.NON_NULL);

    //serve some HTML resources
    bootstrap.addBundle(new AssetsBundle("/assets/", "/myapp/"));
}
 
开发者ID:jacek99,项目名称:dropwizard-spring-di-security-onejar-example,代码行数:9,代码来源:MyAppService.java

示例12: run

import com.yammer.dropwizard.config.Bootstrap; //导入依赖的package包/类
public void run(String[] arguments) throws Exception {
    final Bootstrap<T> bootstrap = new Bootstrap<>(serviceUnderTest);
    bootstrap.addCommand(testServerCommand);
    serviceUnderTest.initialize(bootstrap);
    final Cli cli = new Cli(serviceUnderTest.getClass(), bootstrap);
    cli.run(arguments);
}
 
开发者ID:yammer,项目名称:dropwizard-testing-integration,代码行数:8,代码来源:LifecycleService.java

示例13: initialize

import com.yammer.dropwizard.config.Bootstrap; //导入依赖的package包/类
@Override
public void initialize(Bootstrap<ExampleConfiguration> bootstrap) {
    bootstrap.setName("example");

    final SLF4JSpanSink loggingSink = new SLF4JSpanSink();
    final TelemetryServiceSpanSink serviceSink = new TelemetryServiceSpanSink();

    SpanSinkRegistry.register(loggingSink);
    SpanSinkRegistry.register(serviceSink);
}
 
开发者ID:ryankennedy,项目名称:telemetry,代码行数:11,代码来源:ExampleService.java

示例14: initialize

import com.yammer.dropwizard.config.Bootstrap; //导入依赖的package包/类
@Override
public void initialize(Bootstrap<GuiceBundleConfiguration> bootstrap)
{
    GuiceBundle<GuiceBundleConfiguration> guiceBundle =
            new GuiceBundle.Builder().withModules(new GuiceBundleModule()).build();
    bootstrap.addBundle(guiceBundle);
}
 
开发者ID:fizmo,项目名称:dropwizard-bundle-guice,代码行数:8,代码来源:GuiceBundleService.java

示例15: run

import com.yammer.dropwizard.config.Bootstrap; //导入依赖的package包/类
@Override
protected void run(Bootstrap<T> bootstrap, Namespace namespace, T configuration) throws Exception {
    DbDeployDatabaseConfiguration dbConfig = strategy.getDatabaseConfiguration(configuration);
    dbConfig.setMaxSize(1);
    dbConfig.setMinSize(1);

    ClasspathDbDeploy dbdeploy = getDbDeploy(dbConfig);

    run(namespace, dbdeploy, strategy.getDatabaseConfiguration(configuration));
}
 
开发者ID:plasma147,项目名称:dropwizard-dbdeploy,代码行数:11,代码来源:AbstractDbDeployCommand.java


注:本文中的com.yammer.dropwizard.config.Bootstrap类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。