Package org.yamcs.parameter
Class ParameterRequestManager
java.lang.Object
org.yamcs.parameter.ParameterRequestManager
Distributes parameters from
ParameterProcessorManager
to ParameterConsumer
The consumers will subscribe to parameters, this class (we call it PRM) will subscribe itself to providers and send to consumers each time the providers provide some values.
-
Field Summary
-
Constructor Summary
ConstructorDescriptionCreates a new ParameterRequestManager, configured to listen to the specified XtceTmProcessor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addItemsToRequest
(int subscriptionId, List<Parameter> paraList) Called by a consumer to add parameters to an existing subscription.void
addItemsToRequest
(int subscriptionId, Parameter para) Called by a consumer to add a parameter to an existing subscription.void
addRequest
(int subscriptionId, List<Parameter> paraList, ParameterConsumer tpc) Called by a consumer to create request with a given id.int
addRequest
(Collection<Parameter> paraList, ParameterConsumer tpc) Called by a consumer to create a new subscriptionint
addRequest
(Parameter para, ParameterConsumer tpc) Called by a consumer to create a subscription with one parametergetLastValueFromCache
(Parameter param) Get the last value from cache for a specific parametersgetParameter
(String fqn) returns a parameter based on fully qualified namegetParameter
(Yamcs.NamedObjectId paraId) getValuesFromCache
(Collection<Parameter> plist) Returns the last known value for each parameter.void
removeItemsFromRequest
(int subscriptionID, List<Parameter> paraList) Called by a consumer to remove parameters from a subscription.void
removeItemsFromRequest
(int subscriptionID, Parameter param) Called by a consumer to remove a parameter from a subscription.removeRequest
(int subscriptionId) Removes all the parameters from a subscription and returns them into an List.int
subscribeAll
(ParameterConsumer consumer) called by a consumer to subscribe to all parametersvoid
subscribeToProviders
(Collection<Parameter> itemList) Called to subscribe to providers for the given parameters.toString()
boolean
unsubscribeAll
(int subscriptionId) called by a consumer to remove a "subscribe all" subscription return true of the subscription has been removed or false if it was not therevoid
update
(ParameterValueList pvlist) Called by a provider with a list of provided parameters called "current delivery".
-
Field Details
-
processor
-
-
Constructor Details
-
ParameterRequestManager
Creates a new ParameterRequestManager, configured to listen to the specified XtceTmProcessor.- Throws:
ConfigurationException
-
-
Method Details
-
subscribeAll
called by a consumer to subscribe to all parameters -
unsubscribeAll
public boolean unsubscribeAll(int subscriptionId) called by a consumer to remove a "subscribe all" subscription return true of the subscription has been removed or false if it was not there- Parameters:
subscriptionId
-- Returns:
-
addRequest
Called by a consumer to create a new subscription- Parameters:
paraList
-tpc
-- Returns:
- the newly created subscription id
-
addRequest
Called by a consumer to create a subscription with one parameter- Parameters:
para
-tpc
-- Returns:
- the newly created subscription id
-
addRequest
Called by a consumer to create request with a given id. This is called when switching processors, the id is coming from the other processor.- Parameters:
subscriptionId
- - subscription idparaList
-tpc
-
-
addItemsToRequest
public void addItemsToRequest(int subscriptionId, Parameter para) throws InvalidRequestIdentification Called by a consumer to add a parameter to an existing subscription.- Parameters:
subscriptionId
-para
-- Throws:
InvalidRequestIdentification
-
addItemsToRequest
public void addItemsToRequest(int subscriptionId, List<Parameter> paraList) throws InvalidRequestIdentification Called by a consumer to add parameters to an existing subscription.- Parameters:
subscriptionId
-paraList
- list of parameters that are added to the subscription- Throws:
InvalidRequestIdentification
-
removeItemsFromRequest
Called by a consumer to remove a parameter from a subscription.If the parameter is not part of the subscription, the operation will have no effect.
- Parameters:
subscriptionID
-param
-
-
removeItemsFromRequest
Called by a consumer to remove parameters from a subscription.Any parameter that is not in the subscription will be ignored.
- Parameters:
subscriptionID
-paraList
-
-
removeRequest
Removes all the parameters from a subscription and returns them into an List. -
subscribeToProviders
Called to subscribe to providers for the given parameters.Unless already subscribed, the PRM will start delivering from now on those parameters.
- Parameters:
itemList
-
-
getParameter
returns a parameter based on fully qualified name- Parameters:
fqn
-- Returns:
- Throws:
InvalidIdentification
-
getParameter
- Parameters:
paraId
-- Returns:
- the corresponding parameter definition for a IntemIdentification
- Throws:
InvalidIdentification
- in case no provider knows of this parameter.
-
update
Called by a provider with a list of provided parameters called "current delivery".The PRM will take ownership of the current delivery (and modify it!).
The following steps are performed (in the provider thread, possible by multiple providers in parallel!):
- Run algorithms. All results from algorithms are also added to the list.
- Check alarms.
- Distribute to subscribers.
- Add to parameter cache (if enabled).
- Add to the last value cache.
-
toString
-
getValuesFromCache
Returns the last known value for each parameter.- Parameters:
plist
-- Returns:
-
getLastValueFromCache
Get the last value from cache for a specific parameters- Parameters:
param
-- Returns:
-