Commit b08d3ddb authored by Ricki Hirner's avatar Ricki Hirner

Make PropertyFactory registration public; update okhttp/kotlin

parent 64cacb2b
Pipeline #83303754 passed with stages
in 3 minutes and 10 seconds
......@@ -4,14 +4,14 @@ object Libs {
// We'll use 3.12 for now, but this branch won't receive feature updates anymore. Security
// updates are limited to Dec 2020, so we'll have to update to 3.13 until then. On Android,
// using 3.13 will raise the required SDK level to Android 5.
const val okhttpVersion = "3.12.3"
const val okhttpVersion = "3.12.5"
// XmlPullParser library
const val xpp3Version = "1.1.6"
}
plugins {
kotlin("jvm") version "1.3.41"
kotlin("jvm") version "1.3.50"
id("com.github.kukuhyoniatmoko.buildconfigkotlin") version "1.0.5"
id("org.jetbrains.dokka") version "0.9.18"
......
......@@ -17,17 +17,33 @@ object PropertyRegistry {
init {
Constants.log.info("Registering DAV property factories")
for (factory in ServiceLoader.load(PropertyFactory::class.java)) {
Constants.log.fine("Registering ${factory::class.java.name} for ${factory.getName()}")
register(factory)
}
register(ServiceLoader.load(PropertyFactory::class.java))
}
private fun register(factory: PropertyFactory) {
/**
* Registers a property factory, so that objects for all WebDAV properties which are handled
* by this factory can be created.
*
* @param factory property factory to be registered
*/
fun register(factory: PropertyFactory) {
Constants.log.fine("Registering ${factory::class.java.name} for ${factory.getName()}")
factories[factory.getName()] = factory
}
/**
* Registers some property factories, so that objects for all WebDAV properties which are handled
* by these factories can be created.
* @param factories property factories to be registered
*/
fun register(factories: Iterable<PropertyFactory>) {
factories.forEach {
register(it)
}
}
fun create(name: Property.Name, parser: XmlPullParser) =
try {
factories[name]?.create(parser)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment