public class Context implements Provider, ValueProvider, Named, MetaID
The local environment for anything being done in DataForge framework. Contexts are organized into tree structure with class Global
at the top.
Each context has a set of named interface Value
properties which are taken from parent context in case they are not found in local context.
Context implements interface ValueProvider
interface and therefore could be uses as a value source for substitutions etc.
Context contains class PluginManager
which could be used any number of configurable named plugins.
Also Context has its own logger and class IOManager
to govern all the input and output being made inside the context.
Modifier and Type | Class and Description |
---|---|
static class |
Context.Companion |
Modifier and Type | Field and Description |
---|---|
static Context.Companion |
Companion |
BOOLEAN_TARGET, NUMBER_TARGET, STRING_TARGET, TIME_TARGET, VALUE_TARGET
Constructor and Description |
---|
Context(java.lang.String name,
Context parent,
java.lang.ClassLoader classLoader)
The local environment for anything being done in DataForge framework. Contexts are organized into tree structure with
class Global at the top.
Each context has a set of named interface Value properties which are taken from parent context in case they are not found in local context.
Context implements interface ValueProvider interface and therefore could be uses as a value source for substitutions etc.
Context contains class PluginManager which could be used any number of configurable named plugins.
Also Context has its own logger and class IOManager to govern all the input and output being made inside the context. |
Modifier and Type | Method and Description |
---|---|
void |
close()
Free up resources associated with this context
|
java.lang.String |
defaultTarget() |
<T> java.util.Optional<T> |
findService(java.lang.Class<T> serviceClass,
java.util.function.Predicate<T> predicate)
Find specific service provided by java SPI
|
<T> T |
get(java.lang.Class<T> type)
Get a plugin extending given class
|
java.lang.ClassLoader |
getClassLoader()
A class loader for this context. Parent class loader is used by default
|
java.util.concurrent.ExecutorService |
getDispatcher()
A dispatch thread executor for current context
|
ExecutorPlugin |
getExecutors() |
Chronicler |
getHistory() |
IOManager |
getIo()
Return IO manager of this context. By default parent IOManager is
returned.
|
NonExistentClass |
getLogger() |
java.lang.String |
getName()
The name of the context
|
Context |
getParent() |
PluginManager |
getPluginManager()
Plugin manager for this Context
|
java.util.Map<java.lang.String,hep.dataforge.values.Value> |
getProperties() |
boolean |
isLocked()
Find out if context is locked
|
java.util.Collection<java.lang.String> |
listPlugins() |
java.util.Collection<java.lang.String> |
listValues() |
<T extends Plugin> |
load(java.lang.Class<T> type,
Meta meta) |
<T extends Plugin> |
load(KClass<T> type,
Meta meta) |
void |
lock(java.lang.Object obj)
Lock this context by given object
|
<T> java.util.Optional<T> |
optFeature(java.lang.Class<T> type)
Opt a plugin extending given class
|
java.util.Optional<hep.dataforge.context.Plugin> |
optPlugin(java.lang.String pluginName) |
java.util.Optional<hep.dataforge.values.Value> |
optValue(java.lang.String path)
{@inheritDoc} namespace does not work
|
<T> java.util.stream.Stream<T> |
serviceStream(java.lang.Class<T> serviceClass)
Get stream of services of given class provided by Java SPI or any other service loading API.
|
void |
setLogger(NonExistentClass p) |
void |
setValue(java.lang.String name,
java.lang.Object value)
Add property to context
|
Meta |
toMeta()
Get identity for this context
|
void |
unlock(java.lang.Object obj)
Unlock the context by given object
|
defaultChainTarget, defaultTarget, listContent, provide, provide, provide
buildFrom, getBoolean, getBoolean, getBoolean, getDouble, getDouble, getDouble, getInt, getInt, getInt, getString, getString, getString, getStringArray, getStringArray, getStringArray, getValue, getValue, getValue, hasValue, optBoolean, optNumber, optString, optTime, optValue
getName, isAnonimous, nameOf
public static Context.Companion Companion
public Context(java.lang.String name, Context parent, java.lang.ClassLoader classLoader)
The local environment for anything being done in DataForge framework. Contexts are organized into tree structure with class Global
at the top.
Each context has a set of named interface Value
properties which are taken from parent context in case they are not found in local context.
Context implements interface ValueProvider
interface and therefore could be uses as a value source for substitutions etc.
Context contains class PluginManager
which could be used any number of configurable named plugins.
Also Context has its own logger and class IOManager
to govern all the input and output being made inside the context.
public java.lang.ClassLoader getClassLoader()
A class loader for this context. Parent class loader is used by default
public PluginManager getPluginManager()
Plugin manager for this Context
public NonExistentClass getLogger()
public void setLogger(NonExistentClass p)
public IOManager getIo()
Return IO manager of this context. By default parent IOManager is returned.
public java.util.concurrent.ExecutorService getDispatcher()
A dispatch thread executor for current context
public ExecutorPlugin getExecutors()
public boolean isLocked()
Find out if context is locked
public Chronicler getHistory()
public java.util.Optional<hep.dataforge.values.Value> optValue(java.lang.String path)
{@inheritDoc} namespace does not work
public java.lang.String getName()
The name of the context
public void setValue(java.lang.String name, java.lang.Object value)
Add property to context
name
- value
- public java.lang.String defaultTarget()
public java.util.Optional<hep.dataforge.context.Plugin> optPlugin(java.lang.String pluginName)
public java.util.Collection<java.lang.String> listPlugins()
public java.util.Collection<java.lang.String> listValues()
public java.util.Map<java.lang.String,hep.dataforge.values.Value> getProperties()
public <T> T get(java.lang.Class<T> type)
Get a plugin extending given class
type
- public <T> java.util.Optional<T> optFeature(java.lang.Class<T> type)
Opt a plugin extending given class
type
- public <T> java.util.stream.Stream<T> serviceStream(java.lang.Class<T> serviceClass)
Get stream of services of given class provided by Java SPI or any other service loading API.
serviceClass
- public <T> java.util.Optional<T> findService(java.lang.Class<T> serviceClass, java.util.function.Predicate<T> predicate)
Find specific service provided by java SPI
serviceClass
- predicate
- public Meta toMeta()
Get identity for this context
public void lock(java.lang.Object obj)
Lock this context by given object
obj
- public void unlock(java.lang.Object obj)
Unlock the context by given object
obj
- public void close()
Free up resources associated with this context
public Context getParent()