19.15. Loading Converters and SFTs at RuntimeΒΆ
If you have defined converters or SimpleFeatureTypes in Typesafe Config you can place
them on the classpath or load them with a ConverterConfigProvider
or
SimpleFeatureTypeProvider
via Java SPI loading. By default, classpath
and URL providers are provided. Placing a Typesafe Config file named
reference.conf
or application.conf
containing properly formatted converters and SFTs
(see the example application.conf
in Using SFT and Converter Definitions with Command-Line Tools) in a JAR file on the
classpath will enable the reference of the converters and SFTs using the public loader
API:
// ConverterConfigLoader.scala
// Public API
def listConverterNames: List[String] = confs.keys.toList
def getAllConfigs: Map[String, Config] = confs
def configForName(name: String) = confs.get(name)
// SimpleFeatureTypeLoader.scala
// Public API
def listTypeNames: List[String] = sfts.map(_.getTypeName)
def sftForName(n: String): Option[SimpleFeatureType] = sfts.find(_.getTypeName == n)
Note
The prepackaged SFTs and converters for public data sources provided with GeoMesa binary distributions are also available as an artifact that may be obtained via Maven or SBT. See Prepackaged Converter Definitions for more information.