本文整理汇总了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);
}
示例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();
}
});
}
示例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/"));
}
示例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));
}
}
}
示例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());
}
示例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();
}
});
}
示例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()
);
}
示例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);
}
}
示例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());
}
示例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);
}
示例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/"));
}
示例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);
}
示例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);
}
示例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);
}
示例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));
}