public class AlgorithmManager extends com.google.common.util.concurrent.AbstractService implements ParameterProvider, DVParameterConsumer
Upon initialization it will scan all algorithms, and schedule any that are to be triggered periodically. OutputParameters of all algorithms will be indexed, so that AlgorithmManager knows what parameters it can provide to the ParameterRequestManager.
Algorithms and any needed algorithms that require earlier execution, will be activated as soon as a request for one of its output parameters is registered.
Algorithms default to JavaScript, but this can be overridden to other scripting languages as long as they are included in the classpath. As a design choice all algorithms within the same AlgorithmManager, share the same language.
| Constructor and Description |
|---|
AlgorithmManager(String yamcsInstance) |
AlgorithmManager(String yamcsInstance,
Map<String,Object> config) |
AlgorithmManager(String yamcsInstance,
Map<String,Object> config,
Yamcs.ReplayRequest rr) |
AlgorithmManager(String yamcsInstance,
Yamcs.ReplayRequest rr) |
| Modifier and Type | Method and Description |
|---|---|
void |
activateAlgorithm(Algorithm algorithm,
AlgorithmExecutionContext execCtx,
AlgorithmExecListener listener)
Activate an algorithm in a context if not already active.
|
boolean |
canProvide(Parameter p) |
boolean |
canProvide(Yamcs.NamedObjectId itemId)
Returns whether or not a given parameter can be provided by this provider
|
AlgorithmExecutionContext |
createContext(String name)
Create a new algorithm execution context.
|
void |
deactivateAlgorithm(Algorithm algorithm,
AlgorithmExecutionContext execCtx) |
protected void |
doStart() |
protected void |
doStop() |
Parameter |
getParameter(Yamcs.NamedObjectId paraId)
Returns the parameterDefinition corresponding to the parameter id
|
int |
getSubscriptionId() |
void |
init(YProcessor yproc)
Called before the startup to pass on the processor and initialize whatever needed
|
void |
setParameterListener(ParameterRequestManager parameterRequestManager)
Send parameters to this listener.
|
void |
startProviding(Parameter paramDef)
Adds a new parameter to the list of parameters that have to provided
|
void |
startProvidingAll()
start providing all known parameters
|
void |
stopProviding(Parameter paramDef)
Removes a parameter from the list of parameters that have to be provided
|
ArrayList<ParameterValue> |
updateParameters(int subscriptionId,
ArrayList<ParameterValue> items) |
ArrayList<ParameterValue> |
updateParameters(List<ParameterValue> items,
AlgorithmExecutionContext ctx)
Update parameters in context and run the affected algorithms
|
addListener, awaitRunning, awaitRunning, awaitTerminated, awaitTerminated, failureCause, isRunning, notifyFailed, notifyStarted, notifyStopped, startAsync, state, stopAsync, toStringpublic AlgorithmManager(String yamcsInstance) throws ConfigurationException
ConfigurationExceptionpublic AlgorithmManager(String yamcsInstance, Map<String,Object> config) throws ConfigurationException
ConfigurationExceptionpublic AlgorithmManager(String yamcsInstance, Yamcs.ReplayRequest rr) throws ConfigurationException
ConfigurationExceptionpublic AlgorithmManager(String yamcsInstance, Map<String,Object> config, Yamcs.ReplayRequest rr) throws ConfigurationException
ConfigurationExceptionpublic void init(YProcessor yproc)
ParameterProviderinit in interface ParameterProviderpublic int getSubscriptionId()
public void startProviding(Parameter paramDef)
ParameterProviderstartProviding in interface ParameterProviderpublic AlgorithmExecutionContext createContext(String name)
name - - name of the contextpublic void activateAlgorithm(Algorithm algorithm, AlgorithmExecutionContext execCtx, AlgorithmExecListener listener)
algorithm - execCtx - listener - public void deactivateAlgorithm(Algorithm algorithm, AlgorithmExecutionContext execCtx)
public void startProvidingAll()
ParameterProviderstartProvidingAll in interface ParameterProviderpublic void stopProviding(Parameter paramDef)
ParameterProviderstopProviding in interface ParameterProviderpublic boolean canProvide(Parameter p)
canProvide in interface ParameterProviderpublic boolean canProvide(Yamcs.NamedObjectId itemId)
ParameterProvidercanProvide in interface ParameterProviderpublic Parameter getParameter(Yamcs.NamedObjectId paraId) throws InvalidIdentification
ParameterProvidergetParameter in interface ParameterProviderparaId - - id of the parameter that is returnedInvalidIdentificationpublic ArrayList<ParameterValue> updateParameters(int subscriptionId, ArrayList<ParameterValue> items)
updateParameters in interface DVParameterConsumerpublic ArrayList<ParameterValue> updateParameters(List<ParameterValue> items, AlgorithmExecutionContext ctx)
items - ctx - public void setParameterListener(ParameterRequestManager parameterRequestManager)
ParameterProvidersetParameterListener in interface ParameterProviderprotected void doStart()
doStart in class com.google.common.util.concurrent.AbstractServiceprotected void doStop()
doStop in class com.google.common.util.concurrent.AbstractServiceCopyright © 2017 Space Applications Services. All rights reserved.