com.yammer.dropwizard.config.Bootstrap Java Examples

The following examples show how to use com.yammer.dropwizard.config.Bootstrap. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: OutputGraphCommand.java    From socialite with Apache License 2.0 6 votes vote down vote up
@Override
protected void run(Bootstrap<SocialiteConfiguration> configBootstrap, Namespace namespace, SocialiteConfiguration config) throws Exception {

    final int userCount = namespace.getInt("users");
    final int maxFollows = namespace.getInt("maxfollows");
    final String csvFile = namespace.getString("csv");
    GraphGenerator graphGenerator = new ZipZipfGraphGenerator(maxFollows);
    FileWriter file = new FileWriter(csvFile);

    try {

        for( int i = 0; i < userCount; i++ ) {
            GraphMutation mutation = graphGenerator.next();
            file.append( mutation.user.getUserId() + ";" );
            for( long follower : mutation.follows ) {
                file.append( String.valueOf(follower) + ";" );
            }
            file.append("\n");
        }
    } finally {
        file.flush();
        file.close();
    }
}
 
Example #2
Source File: RampBenchmarkBase.java    From socialite with Apache License 2.0 5 votes vote down vote up
@Override
protected void run(Bootstrap<SocialiteConfiguration> configBootstrap, 
        Namespace namespace, SocialiteConfiguration config) throws Exception {

    // Get the configured default MongoDB URI
    MongoClientURI default_uri = config.mongodb.default_database_uri;
    
    // Initialize the services as per configuration
    this.services = new ServiceManager(config.services, default_uri);
    
    setupReporter(namespace.getString("out"));
    this.runCommand( namespace );
    this.services.stop();
}
 
Example #3
Source File: SocialiteService.java    From socialite with Apache License 2.0 5 votes vote down vote up
@Override
public void initialize(Bootstrap<SocialiteConfiguration> configBootstrap) {
    configBootstrap.setName("status-feed");
    configBootstrap.addCommand( new LoadCommand() );
    configBootstrap.addCommand( new OutputGraphCommand() );
    configBootstrap.addCommand( new BenchmarkCommand() );
    configBootstrap.addCommand( new TimelineRampFollowers() );
    configBootstrap.addCommand( new SendRampFollowers() );
}
 
Example #4
Source File: ServerMonitoringSimulatorLoad.java    From hvdf with Apache License 2.0 5 votes vote down vote up
@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));
        }
    }
}
 
Example #5
Source File: SimulatorService.java    From tr069-simulator with MIT License 5 votes vote down vote up
@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()
			);


}
 
Example #6
Source File: MyAppService.java    From dropwizard-spring-di-security-onejar-example with Apache License 2.0 5 votes vote down vote up
@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/"));
}
 
Example #7
Source File: DataService.java    From cognition with Apache License 2.0 4 votes vote down vote up
/**
 * Configures aspects of the application required before the
 * application is run.
 */
@Override
public void initialize(Bootstrap<DataConfiguration> bootstrap) {
  bootstrap.setName("Lens Service");
}
 
Example #8
Source File: SampleApplication.java    From cukes with Apache License 2.0 4 votes vote down vote up
@Override
public void initialize(Bootstrap<SampleConfiguration> bootstrap) {
    overrideLogging();
    bootstrap.setName("cukes-rest-sample-app");
}
 
Example #9
Source File: PizzaService.java    From jersey-hmac-auth with Apache License 2.0 4 votes vote down vote up
@Override
public void initialize(Bootstrap<Configuration> bootstrap) {
    bootstrap.setName("pizza-application");
}
 
Example #10
Source File: HVDFService.java    From hvdf with Apache License 2.0 4 votes vote down vote up
@Override
public void initialize(Bootstrap<HVDFConfiguration> configBootstrap) {
    configBootstrap.setName("hvdf");
    configBootstrap.addCommand( new ServerMonitoringSimulatorLoad() );

}
 
Example #11
Source File: WarAssetsBundle.java    From wiztowar with MIT License 4 votes vote down vote up
@Override
public void initialize(Bootstrap<?> bootstrap) {
    // nothing doing
}
 
Example #12
Source File: ChanceryService.java    From chancery with Apache License 2.0 4 votes vote down vote up
@Override
public void initialize(Bootstrap<ChanceryConfig> bootstrap) {
    bootstrap.setName("chancery");
}
 
Example #13
Source File: ExampleService.java    From rack-servlet with Apache License 2.0 4 votes vote down vote up
@Override public void initialize(Bootstrap<Configuration> bootstrap) {
  // Nothing to do here.
}
 
Example #14
Source File: ResourceSetup.java    From osiris with Apache License 2.0 2 votes vote down vote up
public void initialize(Bootstrap<OsirisConfiguration> bootstrap) {
	
	bootstrap.setName("ResourceSetup");		
}