io.dropwizard.setup.Bootstrap.addCommand()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(8.7k)|赞(0)|评价(0)|浏览(152)

本文整理了Java中io.dropwizard.setup.Bootstrap.addCommand()方法的一些代码示例,展示了Bootstrap.addCommand()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Bootstrap.addCommand()方法的具体详情如下:
包路径:io.dropwizard.setup.Bootstrap
类名称:Bootstrap
方法名:addCommand

Bootstrap.addCommand介绍

[英]Adds the given command to the bootstrap.
[中]将给定命令添加到引导。

代码示例

代码示例来源:origin: dropwizard/dropwizard

/**
 * Called by {@link #run(String...)} to add the standard "server" and "check" commands
 *
 * @param bootstrap the bootstrap instance
 */
protected void addDefaultCommands(Bootstrap<T> bootstrap) {
  bootstrap.addCommand(new ServerCommand<>(this));
  bootstrap.addCommand(new CheckCommand<>(this));
}

代码示例来源:origin: signalapp/Signal-Server

public final void initialize(Bootstrap<?> bootstrap) {
 Class klass = Generics.getTypeParameter(this.getClass(), Configuration.class);
 bootstrap.addCommand(new NameableDbCommand(name, migrations, this, klass));
}

代码示例来源:origin: signalapp/Signal-Server

@Override
public void initialize(Bootstrap<WhisperServerConfiguration> bootstrap) {
 bootstrap.addCommand(new DirectoryCommand());
 bootstrap.addCommand(new VacuumCommand());
 bootstrap.addCommand(new TrimMessagesCommand());
 bootstrap.addCommand(new PeriodicStatsCommand());
 bootstrap.addCommand(new DeleteUserCommand());
 bootstrap.addCommand(new CertificateCommand());
 bootstrap.addBundle(new NameableMigrationsBundle<WhisperServerConfiguration>("accountdb", "accountsdb.xml") {
  @Override
  public DataSourceFactory getDataSourceFactory(WhisperServerConfiguration configuration) {
   return configuration.getDataSourceFactory();
  }
 });
 bootstrap.addBundle(new NameableMigrationsBundle<WhisperServerConfiguration>("messagedb", "messagedb.xml") {
  @Override
  public DataSourceFactory getDataSourceFactory(WhisperServerConfiguration configuration) {
   return configuration.getMessageStoreConfiguration();
  }
 });
 bootstrap.addBundle(new NameableMigrationsBundle<WhisperServerConfiguration>("abusedb", "abusedb.xml") {
  @Override
  public PooledDataSourceFactory getDataSourceFactory(WhisperServerConfiguration configuration) {
   return configuration.getAbuseDatabaseConfiguration();
  }
 });
}

代码示例来源:origin: dropwizard/dropwizard

@Override
@SuppressWarnings("unchecked")
public final void initialize(Bootstrap<?> bootstrap) {
  final Class<T> klass = (Class<T>) bootstrap.getApplication().getConfigurationClass();
  bootstrap.addCommand(new DbCommand<>(name(), this, klass, getMigrationsFileName()));
}

代码示例来源:origin: graphhopper/graphhopper

@Override
public void initialize(Bootstrap<GraphHopperServerConfiguration> bootstrap) {
  bootstrap.addBundle(new GraphHopperBundle());
  bootstrap.addBundle(new ConfiguredAssetsBundle("/assets/", "/maps/", "index.html"));
  bootstrap.addCommand(new ImportCommand(bootstrap.getObjectMapper()));
}

代码示例来源:origin: dropwizard/dropwizard

@Override
public void initialize(Bootstrap<HelloWorldConfiguration> bootstrap) {
  // Enable variable substitution with environment variables
  bootstrap.setConfigurationSourceProvider(
      new SubstitutingSourceProvider(
          bootstrap.getConfigurationSourceProvider(),
          new EnvironmentVariableSubstitutor(false)
      )
  );
  bootstrap.addCommand(new RenderCommand());
  bootstrap.addBundle(new AssetsBundle());
  bootstrap.addBundle(new MigrationsBundle<HelloWorldConfiguration>() {
    @Override
    public DataSourceFactory getDataSourceFactory(HelloWorldConfiguration configuration) {
      return configuration.getDataSourceFactory();
    }
  });
  bootstrap.addBundle(hibernateBundle);
  bootstrap.addBundle(new ViewBundle<HelloWorldConfiguration>() {
    @Override
    public Map<String, Map<String, String>> getViewConfiguration(HelloWorldConfiguration configuration) {
      return configuration.getViewRendererConfiguration();
    }
  });
}

代码示例来源:origin: io.dropwizard/dropwizard-core

/**
 * Called by {@link #run(String...)} to add the standard "server" and "check" commands
 *
 * @param bootstrap the bootstrap instance
 */
protected void addDefaultCommands(Bootstrap<T> bootstrap) {
  bootstrap.addCommand(new ServerCommand<>(this));
  bootstrap.addCommand(new CheckCommand<>(this));
}

代码示例来源:origin: stanford-futuredata/macrobase

@Override
public void initialize(Bootstrap<MacroBaseConf> bootstrap) {
  bootstrap.addCommand(new MacroBasePipelineCommand());
}

代码示例来源:origin: adamkewley/jobson

public void initialize(Bootstrap<ApplicationConfig> configurationBootstrap) {
  configurationBootstrap.addCommand(new NewCommand());
  configurationBootstrap.addCommand(new GenerateCommand());
  configurationBootstrap.addCommand(new UsersCommand());
  configurationBootstrap.addCommand(new ValidateCommand());
  configurationBootstrap.addCommand(new RunCommand());
}

代码示例来源:origin: bazaarvoice/emodb

@Override
public void initialize(Bootstrap<EmoConfiguration> bootstrap) {
  bootstrap.addCommand(new CreateKeyspacesCommand());
  bootstrap.addCommand(new RegisterCassandraCommand());
  bootstrap.addCommand(new ListCassandraCommand());
  bootstrap.addCommand(new UnregisterCassandraCommand());
  bootstrap.addCommand(new PurgeDatabusEventsCommand());
  bootstrap.addCommand(new AllTablesReportCommand());
  bootstrap.addCommand(new EncryptConfigurationApiKeyCommand());
  EmoServiceObjectMapperFactory.configure(bootstrap.getObjectMapper());
  bootstrap.getMetricRegistry().register("jvm.gc.totals", new EmoGarbageCollectorMetricSet());
}

代码示例来源:origin: jvelo/mayocat-shop

@Override
public final void initialize(Bootstrap<?> bootstrap)
{
  final Class<T> klass = Generics.getTypeParameter(getClass(), Configuration.class);
  bootstrap.addCommand(new FlywayMigrateCommand(this, klass));
}

代码示例来源:origin: xvik/dropwizard-guicey

@Override
@SuppressWarnings("unchecked")
public void visit(final Class<?> type) {
  if (FeatureUtils.is(type, Command.class)) {
    try {
      final Command cmd;
      if (EnvironmentCommand.class.isAssignableFrom(type)) {
        cmd = (Command) type.getConstructor(Application.class)
            .newInstance(bootstrap.getApplication());
      } else {
        cmd = (Command) type.newInstance();
      }
      commands.add((Class<Command>) type);
      commandList.add(cmd);
      bootstrap.addCommand(cmd);
      LOGGER.debug("Command registered: {}", type.getSimpleName());
    } catch (Exception e) {
      throw new IllegalStateException("Failed to instantiate command: "
          + type.getSimpleName(), e);
    }
  }
}

代码示例来源:origin: graphhopper/map-matching

@Override
public void initialize(Bootstrap<MapMatchingServerConfiguration> bootstrap) {
  bootstrap.addBundle(new GraphHopperBundle());
  bootstrap.addCommand(new ImportCommand());
  bootstrap.addCommand(new MatchCommand());
  bootstrap.addCommand(new GetBoundsCommand());
  bootstrap.addCommand(new MeasurementCommand());
  bootstrap.addBundle(new ConfiguredAssetsBundle("/assets/mapmatching-webapp/", "/app/", "index.html"));
}

代码示例来源:origin: dropwizard/dropwizard-flyway

@Override
public final void initialize(final Bootstrap<?> bootstrap) {
  final Class<T> klass = Generics.getTypeParameter(getClass(), Configuration.class);
  bootstrap.addCommand(new DbCommand<T>(name(), this, this, klass));
}

代码示例来源:origin: com.palantir.atlasdb/atlasdb-dropwizard-bundle

@Override
public void initialize(Bootstrap<?> bootstrap) {
  Class<T> configurationClass = (Class<T>) bootstrap.getApplication().getConfigurationClass();
  bootstrap.addCommand(new AtlasDbConfiguredCommand<T>(configurationClass));
}

代码示例来源:origin: org.opennms.newts/newts-rest

@Override
public void initialize(Bootstrap<NewtsConfig> bootstrap) {
  bootstrap.addCommand(new InitCommand());
  bootstrap.addBundle(new AssetsBundle("/app", UI_URL_PATH, "index.html"));
}

代码示例来源:origin: OpenNMS/newts

@Override
public void initialize(Bootstrap<NewtsConfig> bootstrap) {
  bootstrap.addCommand(new InitCommand());
  bootstrap.addBundle(new AssetsBundle("/app", UI_URL_PATH, "index.html"));
}

代码示例来源:origin: io.dropwizard/dropwizard-migrations

@Override
@SuppressWarnings("unchecked")
public final void initialize(Bootstrap<?> bootstrap) {
  final Class<T> klass = (Class<T>) bootstrap.getApplication().getConfigurationClass();
  bootstrap.addCommand(new DbCommand<>(name(), this, klass, getMigrationsFileName()));
}

代码示例来源:origin: com.graphhopper/graphhopper-web

@Override
public void initialize(Bootstrap<GraphHopperServerConfiguration> bootstrap) {
  bootstrap.addBundle(new GraphHopperBundle());
  bootstrap.addBundle(new ConfiguredAssetsBundle("/assets/", "/maps/", "index.html"));
  bootstrap.addCommand(new ImportCommand(bootstrap.getObjectMapper()));
}

代码示例来源:origin: mesosphere/dcos-commons

@Override
public void initialize(Bootstrap<KeystoreConfiguration> bootstrap) {
  // Enable variable substitution with environment variables
  bootstrap.setConfigurationSourceProvider(
      new SubstitutingSourceProvider(
          bootstrap.getConfigurationSourceProvider(),
          new EnvironmentVariableSubstitutor(false)
      )
  );
  bootstrap.addCommand(new TLSTruststoreTestCommand<>(this));
}

相关文章