Package space.kscience.dataforge.context

Types

AbstractPlugin
Link copied to clipboard
common
abstract class AbstractPlugin(meta: Meta) : Plugin
ClassLoaderPlugin
Link copied to clipboard
class ClassLoaderPlugin(classLoader: ClassLoader) : AbstractPlugin
ConsoleLogManager
Link copied to clipboard
js
class ConsoleLogManager : AbstractPlugin, LogManager
Context
Link copied to clipboard
common
open class Context : Named, MetaRepr, Provider, CoroutineScope

The local environment for anything being done in DataForge framework. Contexts are organized into tree structure with Global at the top. Context has properties - equivalent for system environment values, but grouped into a tree and inherited from parent context.

ContextAware
Link copied to clipboard
common
interface ContextAware

The interface for something that encapsulated in context

ContextBuilder
Link copied to clipboard
common
class ContextBuilder

A convenience builder for context

DefaultLogManager
Link copied to clipboard
common
class DefaultLogManager : AbstractPlugin, LogManager
Factory
Link copied to clipboard
common
interface Factory<out T : Any>
Logger
Link copied to clipboard
common
fun interface Logger
LogManager
Link copied to clipboard
common
interface LogManager : Plugin, Logger
Plugin
Link copied to clipboard
common
@Type(id = "plugin")
interface Plugin : Named, ContextAware, Provider, MetaRepr

The interface to define a Context plugin. A plugin stores all runtime features of a context. The plugin is by default configurable and a Provider (both features could be ignored). The plugin must in most cases have an empty constructor in order to be able to load it from library.

PluginFactory
Link copied to clipboard
common
@Type(id = "pluginFactory")
interface PluginFactory<T : Plugin> : Factory<T>
PluginManager
Link copied to clipboard
common
class PluginManager : ContextAware, Iterable<Plugin>

The manager for plugin system. Should monitor plugin dependencies and locks.

PluginTag
Link copied to clipboard
common
data class PluginTag(name: String, group: String, version: String) : MetaRepr

The tag which contains information about name, group and version of some object. It also could contain any complex rule to define version ranges

SlfLogManager
Link copied to clipboard
class SlfLogManager : AbstractPlugin, LogManager

Functions

Context
Link copied to clipboard
common
fun Context(name: String? = null, block: ContextBuilder.() -> Unit = {}): Context
debug
Link copied to clipboard
common
fun Logger.debug(body: () -> String)
error
Link copied to clipboard
common
fun Logger.error(body: () -> String)
fun Logger.error(throwable: Throwable?, body: () -> String)
fetch
Link copied to clipboard
common
inline fun <T : Plugin> Context.fetch(factory: PluginFactory<T>, meta: Meta = Meta.EMPTY): T

Fetch a plugin with given meta from the context. If the plugin (with given meta) is already registered, it is returned. Otherwise, new child context with the plugin is created. In the later case the context could be retrieved from the plugin.

gather
Link copied to clipboard
common
inline fun <T : Any> Context.gather(target: String, inherit: Boolean = true): Map<Name, T>
fun <T : Any> Context.gather(target: String, type: KClass<out T>, inherit: Boolean = true): Map<Name, T>

Gather a map of all top-level objects with given target from context plugins. Content from plugins is prefixed by plugin name so name conflicts are impossible This operation could be slow in case of large number of plugins

gatherInSequence
Link copied to clipboard
common
inline fun <T : Any> Context.gatherInSequence(target: String, inherit: Boolean = true): Sequence<Map.Entry<Name, T>>
fun <T : Any> Context.gatherInSequence(target: String, type: KClass<out T>, inherit: Boolean = true): Sequence<Map.Entry<Name, T>>

Gather all content from context itself and its plugins in a form of sequence of name-value pairs. Ignores name conflicts.

info
Link copied to clipboard
common
fun Logger.info(body: () -> String)
modify
Link copied to clipboard
common
fun Context.modify(block: ContextBuilder.() -> Unit): Context

Check if current context contains all plugins required by the builder and return it does or forks to a new context if it does not.

resolve
Link copied to clipboard
common
inline fun <T : Any> Context.resolve(target: String, name: Name): T?
fun <T : Any> Context.resolve(target: String, name: Name, type: KClass<out T>): T?

Resolve a top level object with given target and name in a Context own scope or its plugins.

services
Link copied to clipboard
inline fun <T : Any> Context.services(): Sequence<T>
toMap
Link copied to clipboard
common
fun <T : Named> Collection<T>.toMap(): Map<Name, T>
trace
Link copied to clipboard
common
fun Logger.trace(body: () -> String)
warn
Link copied to clipboard
common
fun Logger.warn(body: () -> String)

Properties

classLoaderPlugin
Link copied to clipboard
val Context.classLoaderPlugin: ClassLoaderPlugin
Global
Link copied to clipboard
common
val Global: Context
logger
Link copied to clipboard
common
val Context.logger: LogManager

Context log manager inherited from parent

logger
Link copied to clipboard
common
val ContextAware.logger: Logger

The named proxy logger for a context member

values
Link copied to clipboard
common
val <T> Sequence<Map.Entry<Name, T>>.values: Sequence<T>