@Override public Config getConfig() throws IOException { PathMatcher pathMatcher; try { pathMatcher = FileSystems.getDefault().getPathMatcher(inputFilePattern); } catch (IllegalArgumentException e) { throw new IllegalArgumentException( "Invalid input file pattern: " + inputFilePattern); } try (Stream<Path> pathStream = Files.walk(baseDirectory)) { return pathStream .filter(p -> Files.isRegularFile(p) && pathMatcher.matches(p)) .map(p -> ConfigFactory.parseFile(p.toFile())) .reduce(ConfigFactory.empty(), Config::withFallback) .resolve( ConfigResolveOptions.defaults() .setAllowUnresolved(true) .setUseSystemEnvironment(false) ); } }
@Restrict({@Group("STUDENT")}) public CompletionStage<Result> listOrganisations() throws MalformedURLException { URL url = parseUrl(); WSRequest request = wsClient.url(url.toString()); String localRef = ConfigFactory.load().getString("sitnet.integration.iop.organisationRef"); Function<WSResponse, Result> onSuccess = response -> { JsonNode root = response.asJson(); if (response.getStatus() != 200) { return internalServerError(root.get("message").asText("Connection refused")); } if (root instanceof ArrayNode) { ArrayNode node = (ArrayNode) root; for (JsonNode n : node) { ((ObjectNode) n).put("homeOrg", n.get("_id").asText().equals(localRef)); } } return ok(root); }; return request.get().thenApplyAsync(onSuccess); }
@BeforeClass public static void staticSetup() throws InterruptedException { AkkaConfigurationReader reader = ConfigFactory::load; RemoteRpcProviderConfig config1 = new RemoteRpcProviderConfig.Builder("memberA").gossipTickInterval("200ms") .withConfigReader(reader).build(); RemoteRpcProviderConfig config2 = new RemoteRpcProviderConfig.Builder("memberB").gossipTickInterval("200ms") .withConfigReader(reader).build(); RemoteRpcProviderConfig config3 = new RemoteRpcProviderConfig.Builder("memberC").gossipTickInterval("200ms") .withConfigReader(reader).build(); node1 = ActorSystem.create("opendaylight-rpc", config1.get()); node2 = ActorSystem.create("opendaylight-rpc", config2.get()); node3 = ActorSystem.create("opendaylight-rpc", config3.get()); waitForMembersUp(node1, Cluster.get(node2).selfUniqueAddress(), Cluster.get(node3).selfUniqueAddress()); waitForMembersUp(node2, Cluster.get(node1).selfUniqueAddress(), Cluster.get(node3).selfUniqueAddress()); }
public static void main(String []args) { Config config = ConfigFactory.parseFile(new File("config/model/fm.conf")); RandomParams randomParams = new RandomParams(config, ""); RandomParamsUtils randomParamsUtils = new RandomParamsUtils(randomParams); System.out.println("normal sample:"); for (int i = 0; i < 50; i++) { System.out.println(randomParamsUtils.next()); } System.out.println("uniform sample:"); for (int i = 0; i < 50000; i++) { double r = randomParamsUtils.next(); if (r < -0.01 || r > 0.01) { System.out.println("error"); break; } } }
private static Config getConfig(int index, String discoveryNode) { return ConfigFactory.empty() .withValue("peer.discovery.enabled", value(true)) .withValue("peer.discovery.external.ip", value("127.0.0.1")) .withValue("peer.discovery.bind.ip", value("127.0.0.1")) .withValue("peer.discovery.persist", value("false")) .withValue("peer.listen.port", value(20000 + index)) .withValue("peer.privateKey", value(Hex.toHexString(ECKey.fromPrivate(("" + index).getBytes()).getPrivKeyBytes()))) .withValue("peer.networkId", value(555)) .withValue("sync.enabled", value(true)) .withValue("database.incompatibleDatabaseBehavior", value("RESET")) .withValue("genesis", value("sample-genesis.json")) .withValue("database.dir", value("sampleDB-" + index)) .withValue("peer.discovery.ip.list", value(discoveryNode != null ? Arrays.asList(discoveryNode) : Arrays.asList())); }
@Test public void helper_shouldPutVersion_afterDatabaseReset() throws IOException { Config config = ConfigFactory.empty() .withValue("database.reset", ConfigValueFactory.fromAnyRef(true)); SPO systemProperties = new SPO(config); systemProperties.setDataBaseDir(databaseDir); systemProperties.setDatabaseVersion(33); final File testFile = createFile(); assertTrue(testFile.exists()); resetHelper.process(systemProperties); assertEquals(new Integer(33), resetHelper.getDatabaseVersion(versionFile)); assertFalse(testFile.exists()); // reset should have cleared file }
/** * This method will do the basic setup for actors. */ private static void startRemoteActorSystem() { ProjectLogger.log("startRemoteCreationSystem method called...."); Config con = null; String host = System.getenv(JsonKey.SUNBIRD_ACTOR_SERVICE_IP); String port = System.getenv(JsonKey.SUNBIRD_ACTOR_SERVICE_PORT); if (!ProjectUtil.isStringNullOREmpty(host) && !ProjectUtil.isStringNullOREmpty(port)) { con = ConfigFactory .parseString( "akka.remote.netty.tcp.hostname=" + host + ",akka.remote.netty.tcp.port=" + port + "") .withFallback(ConfigFactory.load().getConfig(ACTOR_CONFIG_NAME)); } else { con = ConfigFactory.load().getConfig(ACTOR_CONFIG_NAME); } system = ActorSystem.create(REMOTE_ACTOR_SYSTEM_NAME, con); ActorRef learnerActorSelectorRef = system.actorOf(Props.create(RequestRouterActor.class), RequestRouterActor.class.getSimpleName()); RequestRouterActor.setSystem(system); ProjectLogger.log("normal remote ActorSelectorRef " + learnerActorSelectorRef); ProjectLogger.log("NORMAL ACTOR REMOTE SYSTEM STARTED " + learnerActorSelectorRef, LoggerEnum.INFO.name()); checkCassandraConnection(); }
public void run() { final Config conf = parseString("akka.remote.netty.tcp.hostname=" + config.hostname()) .withFallback(parseString("akka.remote.netty.tcp.port=" + config.actorPort())) .withFallback(ConfigFactory.load("remote")); final ActorSystem system = ActorSystem.create("concierge", conf); kv = system.actorOf(LinearizableStorage.props(new Cluster(config.cluster().paths(), "kv")), "kv"); final ActorMaterializer materializer = ActorMaterializer.create(system); final Flow<HttpRequest, HttpResponse, NotUsed> theFlow = createRoute().flow(system, materializer); final ConnectHttp host = ConnectHttp.toHost(config.hostname(), config.clientPort()); Http.get(system).bindAndHandle(theFlow, host, materializer); LOG.info("Ama up"); }
private Config buildConfigIfAbsent(Config currentConfig) { if (currentConfig != null) return currentConfig; Optional<String> configurationFile = kvClient.getValueAsString(configurationFilePath).toJavaUtil(); if (configurationFile.isPresent()) { return ConfigFactory.parseString(configurationFile.get()); } logger.debug("Missing configuration file at path: {}, ignore flag set to: {}", configurationFilePath, ignoreMissingResource); if (ignoreMissingResource) { return ConfigFactory.empty(); } throw new IllegalStateException("Missing required configuration resource at path: " + configurationFilePath); }
public S2Controller relaunchIfNeeded(int baseBuild, String dataVersion) { String currentBaseBuild = cfg.getString(GAME_EXE_BUILD); String currentDataVersion = cfg.hasPath(GAME_EXE_DATA_VER) ? cfg.getString(GAME_EXE_DATA_VER) : ""; String baseBuildName = BUILD_PREFIX + baseBuild; if (!currentBaseBuild.equals(baseBuildName) || !currentDataVersion.equals(dataVersion)) { log.warn("Expected base build: {} and data version: {}. " + "Actual base build: {} and data version: {}. " + "Relaunching to expected version...", baseBuildName, dataVersion, currentBaseBuild, currentDataVersion); stopAndWait(); cfg = ConfigFactory.parseMap( Map.of(GAME_EXE_BUILD, baseBuildName, GAME_EXE_DATA_VER, dataVersion) ).withFallback(cfg); return launch(); } return this; }
private Config expectedConfiguration() { return ConfigFactory.parseMap(Map.ofEntries( entry(GAME_NET_IP, CFG_NET_IP), entry(GAME_NET_PORT, CFG_NET_PORT), entry(GAME_NET_TIMEOUT, 2000), entry(GAME_NET_RETRY_COUNT, 10), entry(GAME_EXE_PATH, gameRoot().toString()), entry(GAME_EXE_BUILD, CFG_EXE_BUILD_NEW), entry(GAME_EXE_FILE, CFG_EXE_FILE), entry(GAME_EXE_DATA_VER, CFG_EXE_DATA_VER), entry(GAME_EXE_IS_64, true), entry(GAME_WINDOW_W, CFG_WINDOW_W), entry(GAME_WINDOW_H, CFG_WINDOW_H), entry(GAME_WINDOW_X, CFG_WINDOW_X), entry(GAME_WINDOW_Y, CFG_WINDOW_Y), entry(GAME_WINDOW_MODE, 0) )).withValue(GAME_CLI_DATA_DIR, ConfigValueFactory.fromAnyRef(nothing())) .withValue(GAME_CLI_EGL_PATH, ConfigValueFactory.fromAnyRef(nothing())) .withValue(GAME_CLI_OS_MESA_PATH, ConfigValueFactory.fromAnyRef(nothing())) .withValue(GAME_CLI_DATA_DIR, ConfigValueFactory.fromAnyRef(nothing())) .withValue(GAME_CLI_TEMP_DIR, ConfigValueFactory.fromAnyRef(nothing())) .withValue(GAME_CLI_VERBOSE, ConfigValueFactory.fromAnyRef(nothing())); }
/** * Initial Setup */ @Before public void setUp() { this.activeProfile = RestUtil.getCurrentProfile(); this.conf = ConfigFactory.load("application-" + this.activeProfile); this.baseURI = conf.getString("server.baseURI"); this.port = conf.getInt("server.port"); this.timeout = conf.getInt("service.api.timeout"); final RequestSpecBuilder build = new RequestSpecBuilder().setBaseUri(baseURI).setPort(port); rspec = build.build(); RestAssured.config = new RestAssuredConfig().encoderConfig(encoderConfig().defaultContentCharset("UTF-8") .encodeContentTypeAs("application-json", ContentType.JSON)); }
public static ParamReader getParamReader() { String dbCredsFile = System.getProperty("dbCredsFile"); if (StringUtils.isEmpty(dbCredsFile)) { dbCredsFile = "oracle-creds.properties"; } return new ParamReader(ConfigFactory.parseResources(dbCredsFile), "oracle", ConfigFactory.parseMap(Maps.mutable.<String, Object>of( "sysattrs.type", "ORACLE", "logicalSchemas.schema1", "schema1", "logicalSchemas.schema2", "schema2" )) ); }
private static URL parseUrl(String orgRef, String facilityRef, String date, String start, String end, int duration) throws MalformedURLException { String url = ConfigFactory.load().getString("sitnet.integration.iop.host") + String.format("/api/organisations/%s/facilities/%s/slots", orgRef, facilityRef) + String.format("?date=%s&startAt=%s&endAt=%s&duration=%d", date, start, end, duration); return new URL(url); }
public static void createConnectionForBackgroundActors() { String path = PropertiesCache.getInstance().getProperty("background.remote.actor.path"); ActorSystem system = null; String bkghost = System.getenv(JsonKey.BKG_SUNBIRD_ACTOR_SERVICE_IP); String bkgport = System.getenv(JsonKey.BKG_SUNBIRD_ACTOR_SERVICE_PORT); Config con = null; if ("local" .equalsIgnoreCase(PropertiesCache.getInstance().getProperty("api_actor_provider"))) { con = ConfigFactory.load().getConfig(ACTOR_CONFIG_NAME); system = akka.actor.ActorSystem.create(REMOTE_ACTOR_SYSTEM_NAME, con); }else{ system = RequestRouterActor.getSystem(); } try { if (!ProjectUtil.isStringNullOREmpty(bkghost) && !ProjectUtil.isStringNullOREmpty(bkgport)) { ProjectLogger.log("value is taking from system env"); path = MessageFormat.format( PropertiesCache.getInstance().getProperty("background.remote.actor.env.path"), System.getenv(JsonKey.BKG_SUNBIRD_ACTOR_SERVICE_IP), System.getenv(JsonKey.BKG_SUNBIRD_ACTOR_SERVICE_PORT)); } ProjectLogger.log("Actor path is ==" + path, LoggerEnum.INFO.name()); } catch (Exception e) { ProjectLogger.log(e.getMessage(), e); } selection = system.actorSelection(path); ProjectLogger.log("ActorUtility selection reference : " + selection); }
@Override public Config clusterConfigFor(@NotNull final ActorKey actorKey) { return ConfigFactory.parseString("{\"" + ClusterClients.FACTORY_CLASS + "\":" + // "\"" + JgroupsClusterClientFactory.class.getName() + "\"," + // "\"" + ClusterClients.FACTORY_CONFIG + "\":" + // jgroupsFactoryConfig.root().render(ConfigRenderOptions.concise()) + "}"); }
/** * Instead of supplying properties via config file for the peer * we are substituting the corresponding bean which returns required * config for this instance. */ @Bean public SystemProperties systemProperties() { SystemProperties props = new SystemProperties(); props.overrideParams(ConfigFactory.parseResources(configPath.getValue())); if (firstRun.get() && resetDBOnFirstRun.getValue() != null) { props.setDatabaseReset(resetDBOnFirstRun.getValue()); } return props; }
@Test public void defaultFilterTest() { Config defaultCfg = ConfigFactory.load().getConfig("processor").withOnlyPath("regex-filter"); System.out.println(ModelUtils.toStr(defaultCfg)); Processor processor = Processors.create(defaultCfg); Holder fact1 = ModelUtils.createWrappedFact(kbId, "dbr:President_of_the_United_States", "rdfs:seeAlso", "dbr:Barack_Obama"); processor.run(fact1); Assert.assertTrue(fact1.isSinkable()); }
@BeforeClass public void before() throws IOException { Path root = Files.createTempFile("stargraph-", "-dataDir"); Path ntPath = createPath(root, factsId).resolve("triples.nt"); copyResource("dataSets/simple/facts/triples.nt", ntPath); System.setProperty("stargraph.data.root-dir", root.toString()); ConfigFactory.invalidateCaches(); Config config = ConfigFactory.load().getConfig("stargraph"); core = new Stargraph(config, false); core.setIndexerFactory(new NullIndexerFactory()); core.setModelFactory(new NTriplesModelFactory(core)); core.initialize(); }
@BeforeClass public static void setUpClass() throws IOException { Config config = ConfigFactory.parseMap(ImmutableMap.<String, Object>builder() .put("akka.actor.default-dispatcher.type", "akka.testkit.CallingThreadDispatcherConfigurator").build()) .withFallback(ConfigFactory.load()); system = ActorSystem.create("test", config); }
/** * First looks for the file `~/.vars/vars-annotation.conf` and, if found, * loads that file. Otherwise used the usual `reference.conf`/`application.conf` * combination for typesafe's config library. * @return */ public static Config getConfig() { if (config == null) { final Path p0 = getSettingsDirectory(); final Path path = p0.resolve("vars-annotation.conf"); if (Files.exists(path)) { config = ConfigFactory.parseFile(path.toFile()); } else { config = ConfigFactory.load(); } } return config; }
public static Config parse(File configFile) { Config config = null; if (configFile.exists() && configFile.canRead()) { config = ConfigFactory.parseFile(configFile); if (config.isEmpty()) { throw new Error("Empty configuration!"); } } else { throw new Error("Configuration file " + configFile + " does not exist or is not readable!"); } return config; }
@Test @RunAsStudent public void testCreateReservation() throws Exception { // Setup // Private exam exam.setExecutionType(Ebean.find(ExamExecutionType.class, 2)); // Add Arvo teacher to owner exam.getExamOwners().add(Ebean.find(User.class, 4)); exam.save(); DateTime start = DateTime.now().withMinuteOfHour(0).withSecondOfMinute(0).withMillisOfSecond(0).plusHours(1); DateTime end = DateTime.now().withMinuteOfHour(0).withSecondOfMinute(0).withMillisOfSecond(0).plusHours(2); // Execute Result result = request(Helpers.POST, "/app/calendar/reservation", Json.newObject().put("roomId", room.getId()) .put("examId", exam.getId()) .put("start", ISODateTimeFormat.dateTime().print(start)) .put("end", ISODateTimeFormat.dateTime().print(end))); assertThat(result.status()).isEqualTo(200); // Verify ExamEnrolment ee = Ebean.find(ExamEnrolment.class, enrolment.getId()); assertThat(ee.getReservation()).isNotNull(); assertThat(ee.getReservation().getStartAt()).isEqualTo(start); assertThat(ee.getReservation().getEndAt()).isEqualTo(end); assertThat(ee.getExam().getId()).isEqualTo(exam.getId()); assertThat(ee.getReservation().getMachine()).isIn(room.getExamMachines()); greenMail.purgeEmailFromAllMailboxes(); // Check that correct mail was sent assertThat(greenMail.waitForIncomingEmail(MAIL_TIMEOUT, 1)).isTrue(); MimeMessage[] mails = greenMail.getReceivedMessages(); assertThat(mails).hasSize(1); assertThat(mails[0].getFrom()[0].toString()).contains(ConfigFactory.load().getString("sitnet.email.system.account")); String body = GreenMailUtil.getBody(mails[0]); assertThat(body).contains("You have booked an exam time"); assertThat(body).contains("information in English here"); assertThat(body).contains(room.getName()); assertThat(GreenMailUtil.hasNonTextAttachments(mails[0])).isTrue(); }
protected Config merge() { Config config = ConfigFactory.parseMap(configHolder); if (fallback != null) { config = config.withFallback(fallback); } return config; }
@Override public Map<String, ModuleConfig.Builder> retrieveModuleConfigs(final Configuration configuration) { final File moduleShardsFile = new File(moduleShardsConfigPath); final File modulesFile = new File(modulesConfigPath); Config moduleShardsConfig = null; if (moduleShardsFile.exists()) { LOG.info("module shards config file exists - reading config from it"); moduleShardsConfig = ConfigFactory.parseFile(moduleShardsFile); } else { LOG.warn("module shards configuration read from resource"); moduleShardsConfig = ConfigFactory.load(moduleShardsConfigPath); } Config modulesConfig = null; if (modulesFile.exists()) { LOG.info("modules config file exists - reading config from it"); modulesConfig = ConfigFactory.parseFile(modulesFile); } else { LOG.warn("modules configuration read from resource"); modulesConfig = ConfigFactory.load(modulesConfigPath); } final Map<String, ModuleConfig.Builder> moduleConfigMap = readModuleShardsConfig(moduleShardsConfig); readModulesConfig(modulesConfig, moduleConfigMap, configuration); return moduleConfigMap; }
private static Map<Role, List<String>> getConfiguredRoleMapping() { Role student = Ebean.find(Role.class).where().eq("name", Role.Name.STUDENT.toString()).findUnique(); Role teacher = Ebean.find(Role.class).where().eq("name", Role.Name.TEACHER.toString()).findUnique(); Role admin = Ebean.find(Role.class).where().eq("name", Role.Name.ADMIN.toString()).findUnique(); Map<Role, List<String>> roles = new HashMap<>(); roles.put(student, ConfigFactory.load().getStringList("sitnet.roles.student")); roles.put(teacher, ConfigFactory.load().getStringList("sitnet.roles.teacher")); roles.put(admin, ConfigFactory.load().getStringList("sitnet.roles.admin")); return roles; }
@BeforeClass public static void staticSetup() { createSnapshotDir(); system = ActorSystem.create("test", ConfigFactory.load("LocalSnapshotStoreTest.conf")); snapshotStore = system.registerExtension(Persistence.lookup()).snapshotStoreFor(null); }
/** * Instead of supplying properties via config file for the peer * we are substituting the corresponding bean which returns required * config for this instance. */ @Bean public SystemProperties systemProperties() { SystemProperties props = new SystemProperties(); props.overrideParams(ConfigFactory.parseString( "peer.discovery.enabled = true\n" + "sync.enabled = true\n" + "sync.fast.enabled = true\n" + "database.dir = database-test-ptx\n" + "database.reset = false\n" )); return props; }
public static ActorRef startBackgroundLocalActorSystem() { ActorSystem system = ActorSystem.create(BKG_LOCAL_ACTOR_SYSTEM_NAME, ConfigFactory.load().getConfig(BKG_ACTOR_LOCAL_CONFIG_NAME)); ActorRef learnerActorSelectorRef = system.actorOf(Props.create(BackgroundRequestRouterActor.class), BackgroundRequestRouterActor.class.getSimpleName()); ProjectLogger.log("BACKGROUND ACTOR LOCAL SYSTEM STARTED " + learnerActorSelectorRef, LoggerEnum.INFO.name()); checkCassandraConnection(); return learnerActorSelectorRef; }
public OnlinePredictor(Reader configReader) throws Exception { config = ConfigFactory.parseReader(configReader); LOG.info("load config from reader!"); String uri = config.getString("fs_scheme"); fs = FileSystemFactory.createFileSystem(new URI(uri)); }
/** * Instead of supplying properties via config file for the peer * we are substituting the corresponding bean which returns required * config for this instance. */ @Bean public SystemProperties systemProperties() { SystemProperties props = new SystemProperties(); props.overrideParams(ConfigFactory.parseString(config.replaceAll("'", "\""))); return props; }
private static URL parseUrl(User user) throws MalformedURLException { if (user.getUserIdentifier() == null) { throw new MalformedURLException("User has no identier number!"); } String url = ConfigFactory.load().getString("sitnet.integration.enrolmentPermissionCheck.url"); if (url == null || !url.contains(USER_ID_PLACEHOLDER) || !url.contains(USER_LANG_PLACEHOLDER)) { throw new MalformedURLException("sitnet.integration.enrolmentPermissionCheck.url is malformed"); } url = url.replace(USER_ID_PLACEHOLDER, user.getUserIdentifier()).replace(USER_LANG_PLACEHOLDER, user.getLanguage().getCode()); return new URL(url); }
public void run(){ ActorSystem actorSystem = ActorSystem.create("opendaylight-cluster-data", ConfigFactory.load(memberName).getConfig("odl-cluster-data")); Configuration configuration = new Configuration(maxDelayInMillis, dropReplies, causeTrouble); actorSystem.actorOf(DummyShardManager.props(configuration, memberName, new String[] {"inventory", "default", "toaster", "topology"}, "operational"), "shardmanager-operational"); actorSystem.actorOf(DummyShardManager.props(configuration, memberName, new String[] {"inventory", "default", "toaster", "topology"}, "config"), "shardmanager-config"); }
/** * Helps me override the default system properties for the ethereum instance. */ @Bean public SystemProperties systemProperties() throws IOException { SystemProperties props = new SystemProperties(); props.overrideParams(ConfigFactory.parseString( fileReaderService.readConfigFile(NETWORK_LISTENER_CONFIG).replaceAll("'", "\""))); return props; }
@Override public void configure(Context context) { String morphlineFile = context.getString(MORPHLINE_FILE_PARAM); String morphlineId = context.getString(MORPHLINE_ID_PARAM); if (morphlineFile == null || morphlineFile.trim().length() == 0) { throw new MorphlineCompilationException("Missing parameter: " + MORPHLINE_FILE_PARAM, null); } morphlineFileAndId = morphlineFile + "@" + morphlineId; if (morphlineContext == null) { FaultTolerance faultTolerance = new FaultTolerance( context.getBoolean(FaultTolerance.IS_PRODUCTION_MODE, false), context.getBoolean(FaultTolerance.IS_IGNORING_RECOVERABLE_EXCEPTIONS, false), context.getString(FaultTolerance.RECOVERABLE_EXCEPTION_CLASSES)); morphlineContext = new MorphlineContext.Builder() .setExceptionHandler(faultTolerance) .setMetricRegistry(SharedMetricRegistries.getOrCreate(morphlineFileAndId)) .build(); } Config override = ConfigFactory.parseMap( context.getSubProperties(MORPHLINE_VARIABLE_PARAM + ".")); morphline = new Compiler().compile( new File(morphlineFile), morphlineId, morphlineContext, finalChild, override); this.mappingTimer = morphlineContext.getMetricRegistry().timer( MetricRegistry.name("morphline.app", Metrics.ELAPSED_TIME)); this.numRecords = morphlineContext.getMetricRegistry().meter( MetricRegistry.name("morphline.app", Metrics.NUM_RECORDS)); this.numFailedRecords = morphlineContext.getMetricRegistry().meter( MetricRegistry.name("morphline.app", "numFailedRecords")); this.numExceptionRecords = morphlineContext.getMetricRegistry().meter( MetricRegistry.name("morphline.app", "numExceptionRecords")); }
@Override public Config loadConfiguration(final Mode mode, final Config localConfig) throws IOException { final String configurationUrl = localConfig.getString("remote-configuration.http.url"); if (configurationUrl != null && configurationUrl.startsWith("http")) { final URL httpUrl = new URL(configurationUrl); Logger.debug("Provider {}> {}", this.getName(), httpUrl.toString()); return ConfigFactory.parseURL(httpUrl); } else { throw new RuntimeException("Bad configuration"); } }
public static void main(final String[] args) throws Exception { final Map<String, String> opts = argsToOpts(Arrays.asList(args)); applySystemProperties(opts); final String name = opts.getOrDefault("name", "guestapp"); final ActorSystem system = ActorSystem.create(String.format("%s-system", name), ConfigFactory.load("guest.conf")); final GuestApp guestApp = new GuestApp(system); guestApp.run(); }
public static void main(final String[] args) throws Exception { final Map<String, String> opts = argsToOpts(Arrays.asList(args)); applySystemProperties(opts); final String name = opts.getOrDefault("name", "coffee-house"); final ActorSystem system = ActorSystem.create(String.format("%s-system", name), ConfigFactory.load("coffeehouse.conf")); final CoffeeHouseApp coffeeHouseApp = new CoffeeHouseApp(system); coffeeHouseApp.run(); }