@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); }
@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; } }); }
@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()); }
@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()); }
@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); }
@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); }
@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()); }
@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()); }
@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); }
@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); }
@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); } }
@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); }
@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); }
@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()); }
@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) ) ); }
@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()); }
@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); } }
@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()); }
@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()); }
@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()); }
@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"); }
@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); } }
@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<>()); }
@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); }
@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(); }
@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)); }
@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"); } }
@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); }
@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); }
@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>()); }
@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); }
@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; } });*/ }
@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")); }
@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); }
@Override public void initialize(final Bootstrap<BenchConfiguration> bootstrap) { bootstrap.setConfigurationSourceProvider( new SubstitutingSourceProvider(bootstrap.getConfigurationSourceProvider(), new EnvironmentVariableSubstitutor(true) ) ); }
@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); } }
@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); } }