Class ParameterRequestManager

  • All Implemented Interfaces:
    com.google.common.util.concurrent.Service, ParameterListener

    public class ParameterRequestManager
    extends com.google.common.util.concurrent.AbstractService
    implements ParameterListener
    Keeps track of which parameters are part of which subscriptions. There are two types of subscriptions: - subscribe all - subscribe to a set Both types have an unique id associated but different methods work with them
    • Field Detail

      • processor

        public final Processor processor
    • Method Detail

      • addParameterProvider

        public void addParameterProvider​(ParameterProvider parameterProvider)
      • init

        public void init()
        This is called after all the parameter providers have been added but before the start.
      • subscribeAll

        public int subscribeAll​(ParameterConsumer consumer)
        subscribes to all parameters
      • unsubscribeAll

        public boolean unsubscribeAll​(int subscriptionId)
        removes the subscription to all parameters return true of the subscription has been removed or false if it was not there
        Parameters:
        subscriptionId -
        Returns:
      • addRequest

        public int addRequest​(Parameter para,
                              ParameterConsumer tpc)
        Creates a request with one parameter
        Parameters:
        para -
        tpc -
        Returns:
      • addRequest

        public int addRequest​(List<Parameter> paraList,
                              DVParameterConsumer dvtpc)
        Creates a new request with a list of parameters
        Parameters:
        paraList -
        dvtpc -
        Returns:
        subscription id
      • addRequest

        public void addRequest​(int subscriptionId,
                               List<Parameter> paraList,
                               ParameterConsumer tpc)
        Create request with a given id. This is called when switching yprocessors, the id is coming from the other channel.
        Parameters:
        subscriptionId - - subscription id
        paraList -
        tpc -
      • removeItemsFromRequest

        public void removeItemsFromRequest​(int subscriptionID,
                                           Parameter param)
        Removes a parameter from a rquest. If it is not part of the request, the operation will have no effect.
        Parameters:
        subscriptionID -
        param -
      • removeItemsFromRequest

        public void removeItemsFromRequest​(int subscriptionID,
                                           List<Parameter> paraList)
        Removes a list of parameters from a request. Any parameter specified that is not in the subscription will be ignored.
        Parameters:
        subscriptionID -
        paraList -
      • removeRequest

        public List<Parameter> removeRequest​(int subscriptionId)
        Removes all the items from this subscription and returns them into an List. The result is usually used in the TelemetryImpl to move this subscription to a different ParameterRequestManager
      • getParameter

        public Parameter getParameter​(org.yamcs.protobuf.Yamcs.NamedObjectId paraId)
                               throws InvalidIdentification
        Parameters:
        paraId -
        Returns:
        the corresponding parameter definition for a IntemIdentification
        Throws:
        InvalidIdentification - in case no provider knows of this parameter.
      • getSoftwareParameterManager

        public SoftwareParameterManager getSoftwareParameterManager​(DataSource ds)
        Returns:
        the SoftwareParameterManager associated to the DataSource or null if not configured
      • toString

        public String toString()
        Overrides:
        toString in class com.google.common.util.concurrent.AbstractService
      • hasParameterCache

        public boolean hasParameterCache()
      • getLastValueFromCache

        public ParameterValue getLastValueFromCache​(Parameter param)
        Get the last value from cache for a specific parameters
        Parameters:
        param -
        Returns:
      • getValuesFromCache

        public List<ParameterValue> getValuesFromCache​(Parameter param)
        Get all the values from cache for a specific parameters The parameter are returned in descending order (newest parameter is returned first). Note that you can only all this function if the hasParameterCache() returns true.
        Parameters:
        param -
        Returns:
      • getXtceDb

        public Object getXtceDb()
      • doStart

        protected void doStart()
        Specified by:
        doStart in class com.google.common.util.concurrent.AbstractService
      • doStop

        protected void doStop()
        Specified by:
        doStop in class com.google.common.util.concurrent.AbstractService