Java 类io.dropwizard.setup.Bootstrap 实例源码

项目:minebox    文件:MinebdApplication.java   
@Override
public void initialize(Bootstrap<ApiConfig> bootstrap) {

    guiceBundle = GuiceBundle.<ApiConfig>newBuilder()
            .setConfigClass(ApiConfig.class)
            .addModule(new MineBdModule())
            .build();

    bootstrap.addBundle(guiceBundle);
    SwaggerBundle<ApiConfig> swagger = new SwaggerBundle<ApiConfig>() {
        @Override
        protected SwaggerBundleConfiguration getSwaggerBundleConfiguration(ApiConfig configuration) {
            return configuration.swagger;
        }
    };
    bootstrap.addBundle(swagger);
}
项目:continuous-performance-testing    文件:EndpointApplication.java   
@Override
public void initialize(final Bootstrap<EndpointConfiguration> bootstrap) {
  bootstrap.getObjectMapper().configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);

  bootstrap.addBundle(new SwaggerBundle<EndpointConfiguration>() {
    @Override
    protected SwaggerBundleConfiguration getSwaggerBundleConfiguration(
        EndpointConfiguration configuration) {
      return configuration.swagger;
    }
  });
}
项目:verify-hub    文件:StubEventSinkApplication.java   
@Override
public final void initialize(Bootstrap<StubEventSinkConfiguration> bootstrap) {
    // Enable variable substitution with environment variables
    bootstrap.setConfigurationSourceProvider(
            new SubstitutingSourceProvider(bootstrap.getConfigurationSourceProvider(),
                    new EnvironmentVariableSubstitutor(false)
            )
    );

    GuiceBundle<StubEventSinkConfiguration> guiceBundle = defaultBuilder(StubEventSinkConfiguration.class)
            .modules(new StubEventSinkModule())
            .build();
    bootstrap.addBundle(guiceBundle);
    bootstrap.addBundle(new ServiceStatusBundle());
    bootstrap.addBundle(new MonitoringBundle());
    bootstrap.addBundle(new LoggingBundle());
}
项目:verify-hub    文件:SamlProxyApplication.java   
@Override
public final void initialize(Bootstrap<SamlProxyConfiguration> bootstrap) {
    // Enable variable substitution with environment variables
    bootstrap.setConfigurationSourceProvider(
            new SubstitutingSourceProvider(bootstrap.getConfigurationSourceProvider(),
                    new EnvironmentVariableSubstitutor(false)
            )
    );

    guiceBundle = defaultBuilder(SamlProxyConfiguration.class)
            .modules(new SamlProxyModule())
            .build();
    bootstrap.addBundle(guiceBundle);
    bootstrap.addBundle(new ServiceStatusBundle());
    bootstrap.addBundle(new MonitoringBundle());
    bootstrap.addBundle(new LoggingBundle());
}
项目:verify-hub    文件:PolicyApplication.java   
@Override
public final void initialize(Bootstrap<PolicyConfiguration> bootstrap) {
    // Enable variable substitution with environment variables
    bootstrap.setConfigurationSourceProvider(
            new SubstitutingSourceProvider(bootstrap.getConfigurationSourceProvider(),
                    new EnvironmentVariableSubstitutor(false)
            )
    );

    bootstrap.addBundle(new ServiceStatusBundle());
    bootstrap.addBundle(new MonitoringBundle());
    bootstrap.addBundle(new LoggingBundle());
    bootstrap.addBundle(new IdaJsonProcessingExceptionMapperBundle());
    final InfinispanBundle infinispanBundle = new InfinispanBundle();
    // the infinispan cache manager needs to be lazy loaded because it is not initialized at this point.
    bootstrap.addBundle(infinispanBundle);
    guiceBundle = GuiceBundle.defaultBuilder(PolicyConfiguration.class)
            .modules(getPolicyModule(), bindInfinispan(infinispanBundle.getInfinispanCacheManagerProvider()))
            .build();
    bootstrap.addBundle(guiceBundle);
}
项目:verify-hub    文件:SamlEngineApplication.java   
@Override
public final void initialize(Bootstrap<SamlEngineConfiguration> bootstrap) {
    // Enable variable substitution with environment variables
    bootstrap.setConfigurationSourceProvider(
            new SubstitutingSourceProvider(bootstrap.getConfigurationSourceProvider(),
                    new EnvironmentVariableSubstitutor(false)
            )
    );

    MDC.clear();
    bootstrap.addBundle(new ServiceStatusBundle());
    bootstrap.addBundle(new MonitoringBundle());
    bootstrap.addBundle(new LoggingBundle());
    bootstrap.addBundle(new IdaJsonProcessingExceptionMapperBundle());
    final InfinispanBundle infinispanBundle = new InfinispanBundle();
    bootstrap.addBundle(infinispanBundle);
    guiceBundle = defaultBuilder(SamlEngineConfiguration.class)
            .modules(new SamlEngineModule(), new CryptoModule(), bindInfinispan(infinispanBundle.getInfinispanCacheManagerProvider()))
            .build();
    bootstrap.addBundle(guiceBundle);
}
项目:verify-hub    文件:SamlSoapProxyApplication.java   
@Override
public final void initialize(Bootstrap<SamlSoapProxyConfiguration> bootstrap) {
    // Enable variable substitution with environment variables
    bootstrap.setConfigurationSourceProvider(
            new SubstitutingSourceProvider(bootstrap.getConfigurationSourceProvider(),
                    new EnvironmentVariableSubstitutor(false)
            )
    );

    bootstrap.addBundle(new IdaJsonProcessingExceptionMapperBundle());
    guiceBundle = defaultBuilder(SamlSoapProxyConfiguration.class)
            .modules(new SamlSoapProxyModule())
            .build();
    bootstrap.addBundle(guiceBundle);
    bootstrap.addBundle(new ServiceStatusBundle());
    bootstrap.addBundle(new MonitoringBundle());
    bootstrap.addBundle(new LoggingBundle());
}
项目:verify-hub    文件:ConfigApplication.java   
@Override
public void initialize(Bootstrap<ConfigConfiguration> bootstrap) {
    // Enable variable substitution with environment variables
    bootstrap.setConfigurationSourceProvider(
            new SubstitutingSourceProvider(bootstrap.getConfigurationSourceProvider(),
                    new EnvironmentVariableSubstitutor(false)
            )
    );

    guiceBundle = GuiceBundle.defaultBuilder(ConfigConfiguration.class)
            .modules(new ConfigModule())
            .build();
    bootstrap.addBundle(guiceBundle);
    bootstrap.addBundle(new ServiceStatusBundle());
    bootstrap.addBundle(new MonitoringBundle());
    bootstrap.addBundle(new LoggingBundle());
}
项目:crnk-framework    文件:DropwizardService.java   
@Override
public void initialize(Bootstrap<DropwizardConfiguration> bootstrap) {
    guiceBundle = GuiceBundle.<DropwizardConfiguration>newBuilder()
            .addModule(new AbstractModule() {

                @Provides
                public MongoManaged mongoManaged(DropwizardConfiguration configuration) throws Exception {
                    return new MongoManaged(configuration.mongo);
                }

                @Override
                protected void configure() {
                    bind(ProjectRepository.class);
                    bind(TaskRepository.class);
                    bind(TaskToProjectRepository.class);
                }

            })
            .setConfigClass(DropwizardConfiguration.class)
            .build();

    bootstrap.addBundle(guiceBundle);
}
项目:jobson    文件:ValidateSpecCommand.java   
@Override
protected void run(Bootstrap<ApplicationConfig> bootstrap, Namespace namespace, ApplicationConfig applicationConfig) throws Exception {
    final Path jobSpecsDir = Paths.get(applicationConfig.getJobSpecConfiguration().getDir());

    final ArrayList<String> specIds = namespace.get(JOB_SPEC_IDS_ARGNAME);

    final Map<JobSpecId, List<String>> allErrors =
            specIds.stream()
                    .map(specId -> getSpecErrors(jobSpecsDir, specId))
                    .filter(entry -> entry.getValue().size() > 0)
                    .collect(toMap(e -> e.getKey(), e -> e.getValue()));

    if (allErrors.size() > 0) {
        allErrors.forEach(this::printErrors);
        System.exit(1);
    } else System.exit(0);
}
项目:jobson    文件:GenerateRequestCommand.java   
@Override
protected void run(Bootstrap<ApplicationConfig> bootstrap, Namespace namespace, ApplicationConfig applicationConfig) throws Exception {
    final String specId = namespace.get(SPEC_NAME_ARG);
    final Path specsDir = Paths.get(applicationConfig.getJobSpecConfiguration().getDir());
    final Path specFile = specsDir.resolve(specId).resolve(SPEC_DIR_SPEC_FILENAME);

    if (specFile.toFile().exists()) {
        final JobSpec jobSpec = readYAML(specFile, JobSpec.class);
        final JobSpecId jobSpecId = new JobSpecId(specId);
        final String jobName = new Faker().lorem().sentence(5);
        final Map<JobExpectedInputId, JsonNode> generatedInputs = generateInputs(jobSpec);
        final APIJobRequest jobRequest =
                new APIJobRequest(jobSpecId, jobName, generatedInputs);

        System.out.println(toJSON(jobRequest));
        System.exit(0);
    } else {
        System.err.println(specFile + ": No such file");
        System.exit(1);
    }
}
项目:SECP    文件:SECPService.java   
@Override
public void initialize(Bootstrap<SECPConfiguration> bootstrap) {
    bootstrap.addBundle(new AssetsBundle("/assets/app/", "/", "index.html"));
    bootstrap.addBundle(new AssetsBundle("/assets/app", "/login", "index.html", "login"));
    bootstrap.addBundle(new AssetsBundle("/assets/app", "/login/authenticate", "index.html", "authenticate"));
    bootstrap.addBundle(new AssetsBundle("/assets/app", "/login/forgot-password", "index.html", "forgot-password"));
    bootstrap.addBundle(new AssetsBundle("/assets/app", "/chats", "index.html", "chats"));
    bootstrap.addBundle(new AssetsBundle("/assets/app", "/portal", "index.html", "portal"));
    bootstrap.addBundle(new AssetsBundle("/assets/app", "/portal/user-profile", "index.html", "user-profile"));
    bootstrap.addBundle(new AssetsBundle("/assets/app", "/portal/user-profile/change-password", "index.html", "change-password"));
    bootstrap.addBundle(new AssetsBundle("/assets/app", "/portal/group-profile", "index.html", "group-profile"));
    bootstrap.addBundle(new AssetsBundle("/assets/app", "/portal/audit", "index.html", "audit"));
    bootstrap.addBundle(new AssetsBundle("/assets/app", "/portal/audit/user", "index.html", "audit-user"));
    bootstrap.addBundle(new AssetsBundle("/assets/app", "/portal/audit/group", "index.html", "audit-group"));
    bootstrap.addBundle(new AssetsBundle("/assets/app", "/portal/manage", "index.html", "manage"));
    bootstrap.addBundle(new AssetsBundle("/assets/app", "/portal/manage/user", "index.html", "manage-user"));
    bootstrap.addBundle(new AssetsBundle("/assets/app", "/portal/manage/group", "index.html", "manage-group"));
    bootstrap.addBundle(new AssetsBundle("/assets/app", "/portal/configure", "index.html", "configure"));
    bootstrap.addBundle(new AssetsBundle("/assets/app", "/portal/configure/filter", "index.html", "tags"));
    bootstrap.addBundle(new AssetsBundle("/assets/app", "/portal/configure/tags", "index.html", "filter"));
    bootstrap.addBundle(new AssetsBundle("/assets/app", "/error/404", "index.html", "404"));

    bootstrap.addBundle(hibernateBundle);
    ObjectMapper mapper = bootstrap.getObjectMapper();
    mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
}
项目:etomica    文件:EtomicaServer.java   
@Override
public void initialize(Bootstrap<EtomicaServerConfig> bootstrap) {
    bootstrap.setObjectMapper(mapper);

    bootstrap.addBundle(GuiceBundle.builder()
            .enableAutoConfig(getClass().getPackage().getName())
            .modules(new WebSocketModule(), new EtomicaServerModule(bootstrap.getObjectMapper()))
            .build()
    );

    WSConfigurator wsConfigurator = new WSConfigurator();
    WebsocketBundle wsBundle = new WebsocketBundle(wsConfigurator);
    wsBundle.addEndpoint(EchoServer.class);
    wsBundle.addEndpoint(ConfigurationWebsocket.class);
    wsBundle.addEndpoint(DataStreamWebsocket.class);

    bootstrap.addBundle(wsBundle);

    super.initialize(bootstrap);
}
项目:verify-matching-service-adapter    文件:MatchingServiceAdapterApplication.java   
@Override
public final void initialize(Bootstrap<MatchingServiceAdapterConfiguration> bootstrap) {
    // Enable variable substitution with environment variables
    bootstrap.setConfigurationSourceProvider(
            new SubstitutingSourceProvider(bootstrap.getConfigurationSourceProvider(),
                    new EnvironmentVariableSubstitutor(false)
            )
    );

    // Built in Stage.DEVELOPMENT for lazy loading of Singleton objects,
    // this is required as we have Singletons which require the jersey
    // Environment (not available at initialize)
    //
    // See this issue for updates on a lazy Singleton scope
    //
    // https://github.com/google/guice/issues/357
    GuiceBundle<MatchingServiceAdapterConfiguration> guiceBundle = defaultBuilder(MatchingServiceAdapterConfiguration.class)
            .modules(new MatchingServiceAdapterModule())
            .build();
    bootstrap.addBundle(guiceBundle);
    bootstrap.addBundle(new LoggingBundle());
    bootstrap.addBundle(new MonitoringBundle());
    bootstrap.addBundle(new ServiceStatusBundle());
}
项目:tools    文件:MinebdApplication.java   
@Override
public void initialize(Bootstrap<ApiConfig> bootstrap) {

    guiceBundle = GuiceBundle.<ApiConfig>newBuilder()
            .setConfigClass(ApiConfig.class)
            .addModule(new MineBdModule())
            .build();

    bootstrap.addBundle(guiceBundle);
    SwaggerBundle<ApiConfig> swagger = new SwaggerBundle<ApiConfig>() {
        @Override
        protected SwaggerBundleConfiguration getSwaggerBundleConfiguration(ApiConfig configuration) {
            return configuration.swagger;
        }
    };
    bootstrap.addBundle(swagger);
}
项目:StopCozi-api    文件:Server.java   
@Override
public void initialize(Bootstrap<ServerConfiguration> bootstrap) {
    bootstrap.addBundle(hibernateBundle);

    bootstrap.addBundle(new AssetsBundle("/swagger-spec", "/api-spec", null));

    bootstrap.addBundle(GuiceBundle.<ServerConfiguration>newBuilder()
        .addModule(new AbstractModule(){
            @Override protected void configure() {}
            @Provides SessionFactory sessionFactoryProvider() { return hibernateBundle.getSessionFactory();}
        })
        .setConfigClass(ServerConfiguration.class)
        .enableAutoConfig(getClass().getPackage().getName())
        .build(Stage.DEVELOPMENT)
    );

    bootstrap.addBundle(new Java8Bundle());

    // Enable variable substitution with environment variables
    bootstrap.setConfigurationSourceProvider(
        new SubstitutingSourceProvider(bootstrap.getConfigurationSourceProvider(),
            new EnvironmentVariableSubstitutor(false)
        )
    );
}
项目:-deprecated-hlp-candidate    文件:BlockExplorerApp.java   
@Override
public void initialize(Bootstrap<BlockExplorerConfiguration> bootstrap) {
    bootstrap.setConfigurationSourceProvider(
            new SubstitutingSourceProvider(bootstrap.getConfigurationSourceProvider(),
                    new EnvironmentVariableSubstitutor()
            )
    );
    hyperLedgerBundle = new HyperLedgerBundle<BlockExplorerConfiguration>() {
        @Override
        protected HyperLedgerConfiguration getSupernodeConfiguration(BlockExplorerConfiguration configuration) {
            return configuration.getHyperLedger();
        }
    };
    bootstrap.addBundle(hyperLedgerBundle);
    bootstrap.getObjectMapper().registerModule(new JSR310Module());
}
项目:WebCrawler    文件:CliApp.java   
@Override
public void run(final String... arguments) throws Exception {
    final Bootstrap<AppConfiguration> bootstrap = new Bootstrap<>(this);
    bootstrap.addCommand(command);
    initialize(bootstrap);

    ObjectMapper objectMapper = bootstrap.getObjectMapper();
    bootstrap.getObjectMapper()
            .setVisibilityChecker(objectMapper.getSerializationConfig().getDefaultVisibilityChecker()
            .withFieldVisibility(JsonAutoDetect.Visibility.ANY)
            .withGetterVisibility(JsonAutoDetect.Visibility.NONE)
            .withSetterVisibility(JsonAutoDetect.Visibility.NONE)
            .withCreatorVisibility(JsonAutoDetect.Visibility.NONE));

    final Cli cli = new Cli(new JarLocation(getClass()), bootstrap, System.out, System.err);
    if (!cli.run(arguments)) {
        System.exit(1);
    }
}
项目:pay-adminusers    文件:AdminUsersApp.java   
@Override
public void initialize(Bootstrap<AdminUsersConfig> bootstrap) {
    bootstrap.setConfigurationSourceProvider(
            new SubstitutingSourceProvider(bootstrap.getConfigurationSourceProvider(),
                    new EnvironmentVariableSubstitutor(NON_STRICT_VARIABLE_SUBSTITUTOR)
            )
    );

    bootstrap.addBundle(new MigrationsBundle<AdminUsersConfig>() {
        @Override
        public DataSourceFactory getDataSourceFactory(AdminUsersConfig configuration) {
            return configuration.getDataSourceFactory();
        }
    });

    bootstrap.addCommand(new DependentResourceWaitCommand());
    bootstrap.addCommand(new MigrateToInitialDbState());
}
项目:fabric-api    文件:BlockExplorerApp.java   
@Override
    public void initialize(Bootstrap<BlockExplorerConfiguration> bootstrap) {
        bootstrap.setConfigurationSourceProvider(
                new SubstitutingSourceProvider(bootstrap.getConfigurationSourceProvider(),
                        new EnvironmentVariableSubstitutor()
                )
        );
        hyperLedgerBundle = new HyperLedgerBundle<BlockExplorerConfiguration>() {
            @Override
            protected HyperLedgerConfiguration getSupernodeConfiguration(BlockExplorerConfiguration configuration) {
                return configuration.getHyperLedger();
//                return configuration.getGRPCConnectedHyperLedger();
            }
        };
        bootstrap.addBundle(hyperLedgerBundle);
        bootstrap.getObjectMapper().registerModule(new JSR310Module());
    }
项目:dropwizard-microservices-example    文件:ProductCatalogApplication.java   
@Override
public void initialize(final Bootstrap<ProductCatalogConfiguration> bootstrap) {
    bootstrap.addBundle(discoveryBundle);
    bootstrap.addBundle(new MigrationsBundle<ProductCatalogConfiguration>() {

        @Override
        public PooledDataSourceFactory getDataSourceFactory(ProductCatalogConfiguration configuration) {
            return configuration.getDataSourceFactory();
        }
    });
    guiceBundle = GuiceBundle.<ProductCatalogConfiguration> newBuilder().addModule(new ProductCatalogModule())
            .enableAutoConfig(getClass().getPackage().getName()).setConfigClass(ProductCatalogConfiguration.class)
            .build(Stage.PRODUCTION);
    bootstrap.addBundle(guiceBundle);
    // Uncomment below to read the yaml file from Jar
    // bootstrap.setConfigurationSourceProvider(new
    // ResourceConfigurationSourceProvider());
}
项目:openregister-java    文件:RegisterApplication.java   
@Override
public void initialize(Bootstrap<RegisterConfiguration> bootstrap) {
    bootstrap.addBundle(new ViewBundle<>(ImmutableList.of(new ThymeleafViewRenderer("HTML5", "/templates/", ".html", false))));

    if (isRunningOnCloudFoundry()) {
        bootstrap.setConfigurationSourceProvider(new UrlConfigurationSourceProvider());
    }

    bootstrap.setConfigurationSourceProvider(
            new SubstitutingSourceProvider(bootstrap.getConfigurationSourceProvider(),
                    new EnvironmentVariableSubstitutor(false)
            ));
    bootstrap.addBundle(new AssetsBundle("/assets"));
    bootstrap.addBundle(new CorsBundle());
    bootstrap.addBundle(new LogstashBundle());

    System.setProperty("java.protocol.handler.pkgs", "uk.gov.register.protocols");
}
项目:emodb    文件:CreateKeyspacesCommand.java   
@Override
protected void run(Bootstrap<EmoConfiguration> bootstrap, Namespace namespace, EmoConfiguration emoConfiguration)
        throws Exception {
    _outputOnly = namespace.getBoolean("output_only");

    DdlConfiguration ddlConfiguration = parseDdlConfiguration(toFile(namespace.getString("config-ddl")));
    CuratorFramework curator = null;
    if (!_outputOnly) {
        curator = emoConfiguration.getZooKeeperConfiguration().newCurator();
        curator.start();
    }
    try {
        createKeyspacesIfNecessary(emoConfiguration, ddlConfiguration, curator, bootstrap.getMetricRegistry());

    } finally {
        Closeables.close(curator, true);
    }
}
项目:WebCrawler    文件:WebApp.java   
@Override
public void initialize(Bootstrap<AppConfiguration> bootstrap) {
    bootstrap.setConfigurationSourceProvider(
            new SubstitutingSourceProvider(bootstrap.getConfigurationSourceProvider(),
                    new EnvironmentVariableSubstitutor()
            )
    );

    /* Configure objectMapper to instantiate immutable configuration correctly */
    ObjectMapper objectMapper = bootstrap.getObjectMapper();
    objectMapper.registerModule(new JSR310Module());
    bootstrap.getObjectMapper()
            .setVisibilityChecker(objectMapper.getSerializationConfig().getDefaultVisibilityChecker()
                    .withFieldVisibility(JsonAutoDetect.Visibility.ANY)
                    .withGetterVisibility(JsonAutoDetect.Visibility.NONE)
                    .withSetterVisibility(JsonAutoDetect.Visibility.NONE)
                    .withCreatorVisibility(JsonAutoDetect.Visibility.NONE));

    /* Host static resources */
    bootstrap.addBundle((new AssetsBundle("/assets", "/", "index.html", "static")));

    /* Enable WebSockets support */
    bootstrap.addBundle(websocketBundle = new WebsocketBundle<>());
}
项目:dropwizard-hk2    文件:BootstrapExtensionsTest.java   
@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);
}
项目:bitshadow    文件:BitShadowWebService.java   
@Override
public void initialize(Bootstrap<BitShadowConfiguration> bootstrap) {
    bootstrap.addBundle(GuiceBundle.builder()
            .modules(new BitShadowWebModule())
            .build()
    );
    bootstrap.addBundle(new SwaggerBundle<BitShadowConfiguration>() {
        @Override
        protected SwaggerBundleConfiguration getSwaggerBundleConfiguration(BitShadowConfiguration configuration) {
            return configuration.swaggerBundleConfiguration;
        }
    });

    bootstrap.getObjectMapper()
            .configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false)
            .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
            .setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.NONE)
            .setVisibility(PropertyAccessor.FIELD, JsonAutoDetect.Visibility.ANY)
            .findAndRegisterModules();
}
项目:sam    文件:Main.java   
@Override
public void initialize(Bootstrap<SamConfiguration> bootstrap) {

  final List<ViewRenderer> renderers = Arrays.asList(new MarkdownViewRenderer(), new HtmlViewRenderer(), new MustacheViewRenderer());
  bootstrap.addBundle(new ViewBundle<SamConfiguration>(renderers));
  bootstrap.addBundle(new AssetsBundle("/static", "/static", "index.mustache", "static"));
  bootstrap.addBundle(new AssetsBundle("/docs", "/docs", "index.html", "docs"));

  bootstrap.setConfigurationSourceProvider(
    new SubstitutingSourceProvider(
      bootstrap.getConfigurationSourceProvider(),
      new EnvironmentVariableSubstitutor()
    )
  );

  bootstrap.addCommand(new OAuth2Command());
  bootstrap.addCommand(new CreateDatabaseCommand(this));
  bootstrap.addCommand(new AddTestdataCommand(this));
}
项目:sam    文件:OAuth2Command.java   
@Override
protected void run(Bootstrap<SamConfiguration> bootstrap, Namespace namespace, SamConfiguration configuration) throws Exception {

  final OAuth2Service service = new OAuth2Service(configuration.getOAuthConfiguration());
  final Command command = namespace.get("subcommand");
  switch (command) {
    case create:
      create(namespace.getString("subject"), service, configuration);
      break;
    case verify:
      verify(namespace.getString("jwt"), service, configuration);
      break;
    case sign:
      sign(namespace.getString("claims"), service, configuration);
      break;
    default:
      throw new IllegalStateException("Unknown command");
  }
}
项目:fabric-api-archive    文件:BlockExplorerApp.java   
@Override
    public void initialize(Bootstrap<BlockExplorerConfiguration> bootstrap) {
        bootstrap.setConfigurationSourceProvider(
                new SubstitutingSourceProvider(bootstrap.getConfigurationSourceProvider(),
                        new EnvironmentVariableSubstitutor()
                )
        );
        hyperLedgerBundle = new HyperLedgerBundle<BlockExplorerConfiguration>() {
            @Override
            protected HyperLedgerConfiguration getSupernodeConfiguration(BlockExplorerConfiguration configuration) {
                return configuration.getHyperLedger();
//                return configuration.getGRPCConnectedHyperLedger();
            }
        };
        bootstrap.addBundle(hyperLedgerBundle);
        bootstrap.getObjectMapper().registerModule(new JSR310Module());
    }
项目:katharsis-framework    文件:DropwizardService.java   
@Override
public void initialize(Bootstrap<DropwizardConfiguration> bootstrap) {

    guiceBundle = GuiceBundle.<DropwizardConfiguration>newBuilder()
            .addModule(new AbstractModule() {

                @Override
                protected void configure() {
                    bind(ProjectRepository.class);
                    bind(TaskRepository.class);
                    bind(TaskToProjectRepository.class);
                }

                @Provides
                public MongoManaged mongoManaged(DropwizardConfiguration configuration) throws Exception {
                    return new MongoManaged(configuration.mongo);
                }
            })
            .setConfigClass(DropwizardConfiguration.class)
            .build();

    bootstrap.addBundle(guiceBundle);
}
项目:dropwizard-graphql    文件:HelloWorldApplication.java   
@Override
public void initialize(Bootstrap<HelloWorldConfiguration> bootstrap) {
    final GraphQLBundle<HelloWorldConfiguration> bundle = new GraphQLBundle<HelloWorldConfiguration>() {
        @Override
        public GraphQLFactory getGraphQLFactory(
                HelloWorldConfiguration configuration) {

            final GraphQLFactory factory = configuration
                    .getGraphQLFactory();
            // the RuntimeWiring must be configured prior to the run()
            // methods being called so the schema is connected properly.
            factory.setRuntimeWiring(buildWiring(configuration));
            return factory;
        }
    };
    bootstrap.addBundle(bundle);
}
项目:SAPNetworkMonitor    文件:NiPingMonitorApplication.java   
@Override
public void initialize(Bootstrap<ServerConfiguration> bootstrap) {

    bootstrap.addBundle(new MigrationsBundle<ServerConfiguration>() {
        @Override
        public DataSourceFactory getDataSourceFactory(ServerConfiguration configuration) {
            return configuration.getDataSourceFactory();
        }
    });

    bootstrap.addBundle(new AssetsBundle("/com/cloudwise/sap/niping/view/static", "/static", null, "static"));
    bootstrap.addBundle(new AssetsBundle("/com/cloudwise/sap/niping/view/vendor", "/vendor", null, "vendor"));
    bootstrap.addBundle(new ViewBundle<ServerConfiguration>());
}
项目:stroom-stats    文件:App.java   
@Override
public void initialize(Bootstrap<Config> bootstrap) {
    // This allows us to use templating in the YAML configuration.
    bootstrap.setConfigurationSourceProvider(new SubstitutingSourceProvider(
        bootstrap.getConfigurationSourceProvider(),
        new EnvironmentVariableSubstitutor(false)));

    bootstrap.addBundle(hibernateBundle);
}
项目:stroom-stats    文件:HeadlessTestApp.java   
@Override
public void initialize(Bootstrap<Config> bootstrap) {
    // This allows us to use templating in the YAML configuration.
    bootstrap.setConfigurationSourceProvider(new SubstitutingSourceProvider(
        bootstrap.getConfigurationSourceProvider(),
        new EnvironmentVariableSubstitutor(false)));

    bootstrap.addBundle(hibernateBundle);
}
项目:amigo-chatbot    文件:UserServiceApplication.java   
@Override
public void initialize(final Bootstrap<UserServiceConfiguration> bootstrap) {
    /*
     * Register the static html contents to be served from /assets directory and accessible from browser from
     * http://<host>:<port>/openstack
     */
    //bootstrap.addBundle(new AssetsBundle("/assets", "/openstack", "index.html"));
    /*bootstrap.addBundle(new SwaggerBundle<UserServiceConfiguration>() {
        @Override
        protected SwaggerBundleConfiguration getSwaggerBundleConfiguration(UserServiceConfiguration userServiceConfiguration) {
            return userServiceConfiguration.swaggerBundleConfiguration;
        }
    });*/
}
项目:amigo-chatbot    文件:CommandProcessorApplication.java   
@Override
public void initialize(final Bootstrap<CommandProcessorConfiguration> bootstrap) {
    /*
     * Register the static html contents to be served from /assets directory and accessible from browser from
     * http://<host>:<port>/openstack
     */
    //bootstrap.addBundle(new AssetsBundle("/assets", "/openstack", "index.html"));

}
项目:outland    文件:ServerMain.java   
@Override
public void initialize(Bootstrap<ServerConfiguration> bootstrap) {
  final boolean strict = false;
  bootstrap.setConfigurationSourceProvider(
      new SubstitutingSourceProvider(
          bootstrap.getConfigurationSourceProvider(),
          new EnvironmentVariableSubstitutor(strict)));
  bootstrap.addBundle(new Java8Bundle());
  bootstrap.addBundle(new Protobuf3Bundle());
  super.initialize(bootstrap);
}
项目:dropwizard-hikaricp-benchmark    文件:BenchApplication.java   
@Override
public void initialize(final Bootstrap<BenchConfiguration> bootstrap) {
    bootstrap.setConfigurationSourceProvider(
            new SubstitutingSourceProvider(bootstrap.getConfigurationSourceProvider(),
                    new EnvironmentVariableSubstitutor(true)
            )
    );
}
项目:jobson    文件:UseraddCommand.java   
@Override
protected void run(Bootstrap<ApplicationConfig> bootstrap, Namespace namespace, ApplicationConfig applicationConfig) throws Exception {
    final UserId login = new UserId(namespace.get(LOGIN_ARG));
    final File userFile = new File(applicationConfig.getUsersConfiguration().getFile());
    final FilesystemUserDAO dao = new FilesystemUserDAO(userFile);

    final boolean userExists = dao.getUserCredentialsById(login).isPresent();

    if (!userExists) {
        addNewUser(namespace, dao, login);
    } else {
        System.err.println(format("user '%s' already exists, you can set this user's password with `passwd`.", login));
        System.exit(1);
    }
}
项目:jobson    文件:PasswdCommand.java   
@Override
protected void run(Bootstrap<ApplicationConfig> bootstrap, Namespace namespace, ApplicationConfig applicationConfig) throws Exception {
    final UserId login = new UserId(namespace.get(LOGIN_ARG));
    final File userFile = new File(applicationConfig.getUsersConfiguration().getFile());
    final FilesystemUserDAO dao = new FilesystemUserDAO(userFile);

    final boolean userExists = dao.getUserCredentialsById(login).isPresent();

    if (userExists) {
        System.err.println(format("Changing password for %s.", login));
        System.err.print("Enter new Jobson password: ");
        System.err.flush();
        final String pw = new String(System.console().readPassword());
        System.err.print("Retype new Jobson password: ");
        System.err.flush();
        final String retry = new String(System.console().readPassword());

        if (pw.equals(retry)) {
            dao.updateUserAuth(login, BASIC_AUTH_NAME, BasicAuthenticator.createAuthField(pw));
        } else {
            System.err.println("Sorry, passwords do not match");
            System.err.println("password unchanged");
            System.exit(1);
        }
    } else {
        System.err.println(format("user '%s' does not exist", login));
        System.exit(1);
    }
}