T - the concrete RuntimePlatform subclass type containing the providerpublic abstract class RuntimeEventProvider<T extends RuntimePlatform> extends Object implements Runnable
Concrete implementations of this class are dynamically instantiated by the XatkitCore component, and use
it to notify the engine about new messages to handle. Note that RuntimeEventProvider instances are
started in a dedicated Thread.
Instances of this class can be configured using the Configuration-based constructor, that enable to pass
additional parameters to the constructor.
| Modifier and Type | Field and Description |
|---|---|
protected T |
runtimePlatform
The
RuntimePlatform subclass containing this action. |
protected XatkitCore |
xatkitCore
The
XatkitCore instance used to handle events. |
| Constructor and Description |
|---|
RuntimeEventProvider(T runtimePlatform)
Constructs a new
RuntimeEventProvider with the provided runtimePlatform. |
RuntimeEventProvider(T runtimePlatform,
Configuration configuration)
|
| Modifier and Type | Method and Description |
|---|---|
void |
broadcastEventInstance(com.xatkit.intent.EventInstance eventInstance) |
void |
close()
Closes the
RuntimeEventProvider and releases internal resources. |
T |
getRuntimePlatform()
Returns the
RuntimePlatform containing this RuntimeEventProvider. |
void |
sendEventInstance(com.xatkit.intent.EventInstance eventInstance,
XatkitSession session)
Sends the provided
eventInstance and session for computation to the Xatkit core component. |
protected XatkitCore xatkitCore
XatkitCore instance used to handle events.
This attribute is a shortcut for runtimePlatform.getXatkitCore().
protected T extends RuntimePlatform runtimePlatform
RuntimePlatform subclass containing this action.public RuntimeEventProvider(T runtimePlatform)
RuntimeEventProvider with the provided runtimePlatform.
Note: this constructor should be used by RuntimeEventProviders that do not require additional
parameters to be initialized. In that case see RuntimeEventProvider(RuntimePlatform, Configuration).
runtimePlatform - the RuntimePlatform containing this RuntimeEventProviderNullPointerException - if the provided runtimePlatform is nullpublic RuntimeEventProvider(T runtimePlatform, Configuration configuration)
RuntimeEventProvider with the provided runtimePlatform and configuration.
Note: this constructor will be called by xatkit internal engine when initializing the
XatkitCore component. Subclasses implementing this constructor typically
need additional parameters to be initialized, that can be provided in the configuration.
runtimePlatform - the RuntimePlatform containing this RuntimeEventProviderconfiguration - the Configuration used to initialize the RuntimeEventProviderNullPointerException - if the provided runtimePlatform is nullpublic T getRuntimePlatform()
RuntimePlatform containing this RuntimeEventProvider.RuntimePlatform containing this RuntimeEventProviderpublic void sendEventInstance(com.xatkit.intent.EventInstance eventInstance,
XatkitSession session)
eventInstance and session for computation to the Xatkit core component.
This method sets the triggeredBy field of the provided eventInstance with the name of the
containing platform of this provider.
This method can be extended to perform specific checks before triggering actions (e.g. ensure that a specific context variable has been set).
eventInstance - the EventInstance to send to the Xatkit core componentsession - the XatkitSession associated to the provided eventInstancepublic void broadcastEventInstance(com.xatkit.intent.EventInstance eventInstance)
public void close()
RuntimeEventProvider and releases internal resources.
This method should be overridden by concrete subclasses that manipulate internal resources that require to be explicitly closed.
Copyright © 2020 SOM Research Lab. All rights reserved.