aboutsummaryrefslogtreecommitdiff
path: root/src/main/scala/xyz/driver/common/resources/ResourcesStorage.scala
diff options
context:
space:
mode:
authorvlad <vlad@driver.xyz>2017-06-13 16:12:20 -0700
committervlad <vlad@driver.xyz>2017-06-13 16:12:20 -0700
commitcd1b635b2ae90d9ac2d8b1779183a1fbd8c5fd5c (patch)
tree062e8dad1a1513e26b0fd08b1742d6ff2ee874f7 /src/main/scala/xyz/driver/common/resources/ResourcesStorage.scala
parent0000a65ab4479a2a40e2d6468036438e9705b4aa (diff)
downloadrest-query-cd1b635b2ae90d9ac2d8b1779183a1fbd8c5fd5c.tar.gz
rest-query-cd1b635b2ae90d9ac2d8b1779183a1fbd8c5fd5c.tar.bz2
rest-query-cd1b635b2ae90d9ac2d8b1779183a1fbd8c5fd5c.zip
Adding domain entitiesv0.1.0
Diffstat (limited to 'src/main/scala/xyz/driver/common/resources/ResourcesStorage.scala')
-rw-r--r--src/main/scala/xyz/driver/common/resources/ResourcesStorage.scala39
1 files changed, 0 insertions, 39 deletions
diff --git a/src/main/scala/xyz/driver/common/resources/ResourcesStorage.scala b/src/main/scala/xyz/driver/common/resources/ResourcesStorage.scala
deleted file mode 100644
index f52d992..0000000
--- a/src/main/scala/xyz/driver/common/resources/ResourcesStorage.scala
+++ /dev/null
@@ -1,39 +0,0 @@
-package xyz.driver.common.resources
-
-import scala.io.{Codec, Source}
-
-trait ResourcesStorage {
-
- /**
- * @param resourcePath Don't forget / at start
- */
- def getFirstLine(resourcePath: String): String
-
-}
-
-object RealResourcesStorage extends ResourcesStorage {
-
- def getFirstLine(resourcePath: String): String = {
- val resourceUrl = getClass.getResource(resourcePath)
- Option(resourceUrl) match {
- case Some(url) =>
- val source = Source.fromURL(resourceUrl)(Codec.UTF8)
- try {
- val lines = source.getLines()
- if (lines.isEmpty) throw new RuntimeException(s"'$resourcePath' is empty")
- else lines.next()
- } finally {
- source.close()
- }
- case None =>
- throw new RuntimeException(s"Can not find the '$resourcePath'!")
- }
- }
-
-}
-
-object FakeResourcesStorage extends ResourcesStorage {
-
- def getFirstLine(resourcePath: String): String = ""
-
-}