Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Created the LayerType type and added the optional layerType parameter…
… to the LayerHeaders Signed-off-by: Jacob Bouffard <jbouffard@azavea.com> Added the layerType parameter to the rest of the LayerHeaders Signed-off-by: Jacob Bouffard <jbouffard@azavea.com> Fixed bug in HBaseLayerHeader Signed-off-by: Jacob Bouffard <jbouffard@azavea.com> Created the LayerType Json format Signed-off-by: Jacob Bouffard <jbouffard@azavea.com> Improved the toString method for LayerType objects Signed-off-by: Jacob Bouffard <jbouffard@azavea.com> Fixed bug where the old LayerHeaders could not be read Signed-off-by: Jacob Bouffard <jbouffard@azavea.com> Cleaned up the code Signed-off-by: Jacob Bouffard <jbouffard@azavea.com> Cleaned up the code some more Signed-off-by: Jacob Bouffard <jbouffard@azavea.com>
- Loading branch information
Jacob Bouffard
committed
May 1, 2018
1 parent
71bfb89
commit 29b3903
Showing
9 changed files
with
146 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package geotrellis.spark.io | ||
|
||
import spray.json._ | ||
|
||
|
||
trait LayerType { | ||
lazy val name = this.getClass.getName.split("\\$").last.split("\\.").last | ||
override def toString = name | ||
} | ||
|
||
object LayerType { | ||
def fromString(str: String): LayerType = | ||
str match { | ||
case AvroLayerType.name => AvroLayerType | ||
case COGLayerType.name => COGLayerType | ||
case _ => throw new Exception(s"Could not derive LayerType from given string: $str") | ||
} | ||
|
||
implicit object LayerTypeFormat extends RootJsonFormat[LayerType] { | ||
def write(layerType: LayerType) = JsString(layerType.name) | ||
|
||
def read(value: JsValue): LayerType = | ||
value match { | ||
case JsString(layerType) => | ||
LayerType.fromString(layerType) | ||
case v => | ||
throw new DeserializationException(s"LayerType expected, got $v") | ||
} | ||
} | ||
} | ||
|
||
case object AvroLayerType extends LayerType | ||
case object COGLayerType extends LayerType |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters