All Downloads are FREE. Search and download functionalities are using the official Maven repository.

jvmTest.utility.StartablePlugin.kt Maven / Gradle / Ivy

There is a newer version: 0.27.0
Show newest version
package tests

import io.fluidsonic.raptor.*
import io.fluidsonic.raptor.lifecycle.*


private val startableComponentKey = RaptorComponentKey("startable")


object StartablePlugin : RaptorPlugin {

	override fun RaptorPluginInstallationScope.install() {
		componentRegistry.register(startableComponentKey, StartableComponent())

		lifecycle.onStart {
			context[Startable.propertyKey]!!.start()
		}

		lifecycle.onStop {
			context[Startable.propertyKey]!!.stop()
		}
	}
}


@RaptorDsl
val RaptorAssemblyInstallationScope.startable
	get() = componentRegistry.oneOrNull(startableComponentKey) ?: throw RaptorPluginNotInstalledException(StartablePlugin)




© 2015 - 2024 Weber Informatics LLC | Privacy Policy