From 0bdd8c23b6d17a951adcd71d91346644d81acde4 Mon Sep 17 00:00:00 2001 From: Chris Rankin Date: Tue, 31 Jan 2017 09:47:54 +0000 Subject: [PATCH] Allow services to be loaded as a resources as well as a file. --- .../net/corda/demobench/model/ServiceController.kt | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tools/demobench/src/main/kotlin/net/corda/demobench/model/ServiceController.kt b/tools/demobench/src/main/kotlin/net/corda/demobench/model/ServiceController.kt index 3271fd85ba..2804d8ea6b 100644 --- a/tools/demobench/src/main/kotlin/net/corda/demobench/model/ServiceController.kt +++ b/tools/demobench/src/main/kotlin/net/corda/demobench/model/ServiceController.kt @@ -1,7 +1,8 @@ package net.corda.demobench.model import tornadofx.Controller -import java.io.File +import java.io.InputStreamReader +import java.net.URL import java.util.* class ServiceController : Controller() { @@ -11,9 +12,9 @@ class ServiceController : Controller() { val services : List get() = serviceSet - private fun loadConf(name: String): List { + private fun loadConf(url: URL): List { val set = HashSet() - File(name).readLines().forEach { + InputStreamReader(url.openStream()).readLines().forEach { val service = it.trim() set.add(service) @@ -30,7 +31,7 @@ class ServiceController : Controller() { serviceSet = if (serviceConf == null) { emptyList() } else { - loadConf(serviceConf.file) + loadConf(serviceConf) } } } \ No newline at end of file