Class AbstractLink

java.lang.Object
com.google.common.util.concurrent.AbstractService
org.yamcs.tctm.AbstractLink
All Implemented Interfaces:
com.google.common.util.concurrent.Service, SystemParametersProducer, Link, LinkActionProvider
Direct Known Subclasses:
AbstractParameterDataLink, AbstractTcDataLink, AbstractTcFrameLink, AbstractTcTmParamLink, AbstractTmDataLink, AbstractTmFrameLink, TseDataLink, YamcsEventLink, YamcsLink, YamcsParameterLink

public abstract class AbstractLink extends com.google.common.util.concurrent.AbstractService implements Link, SystemParametersProducer, LinkActionProvider
Abstract link implementation as a Service handling the basic enable/disable getConfig operations and data in/out counts
  • Field Details

  • Constructor Details

    • AbstractLink

      public AbstractLink()
  • Method Details

    • init

      public void init(String instance, String name, YConfiguration config) throws ConfigurationException
      Description copied from interface: Link
      Called at startup to initialize the link.

      The config corresponds to the map that is under the link definition in yamcs.instance.yaml.

      Specified by:
      init in interface Link
      config - - the configuration - cannot be null (but can be empty)
      Throws:
      ConfigurationException
    • getConfig

      public YConfiguration getConfig()
      Specified by:
      getConfig in interface Link
      Returns:
      the config (args) used when creating the link
    • getName

      public String getName()
      Description copied from interface: Link
      Return the name of the link
      Specified by:
      getName in interface Link
    • getLinkStatus

      public Link.Status getLinkStatus()
      Description copied from interface: Link
      Returns the current link status.
      Specified by:
      getLinkStatus in interface Link
    • getDetailedStatus

      public String getDetailedStatus()
      Description copied from interface: Link
      Returns a short detail status (one-line)
      Specified by:
      getDetailedStatus in interface Link
    • getEventLoop

      protected static io.netty.channel.nio.NioEventLoopGroup getEventLoop()
    • enable

      public void enable()
      Sets the disabled to false such that getNextPacket does not ignore the received datagrams
      Specified by:
      enable in interface Link
    • disable

      public void disable()
      Description copied from interface: Link
      Disable any data I/O through this link. Any connection to a server is closed. Can be reenabled using the enable method. Note that this method can be called before starting the service if it's configured as such in the configuration file
      Specified by:
      disable in interface Link
    • isDisabled

      public boolean isDisabled()
      Description copied from interface: Link
      return true if the link has been disabled by the user.

      See also Link.isEffectivelyDisabled()

      Specified by:
      isDisabled in interface Link
    • isRunningAndEnabled

      public boolean isRunningAndEnabled()
    • doDisable

      protected void doDisable() throws Exception
      Throws:
      Exception
    • doEnable

      protected void doEnable() throws Exception
      Throws:
      Exception
    • connectionStatus

      protected abstract Link.Status connectionStatus()
      In case the link should be connected (i.e. is running and enabled) this method is called to return the actual connection status
    • getCurrentTime

      protected long getCurrentTime()
    • setupSystemParameters

      public void setupSystemParameters(SystemParametersService sysParamService)
      Description copied from interface: Link
      Called by the LinkManager before startup if the SystemParametersService service is enabled, to setup necessary things for later parameter collection.

      The method is called only on the links that implement the SystemParametersProducer interface; they are also registered with the SystemParametersService to be called regularly after the start.

      Specified by:
      setupSystemParameters in interface Link
    • getSystemParameters

      public List<ParameterValue> getSystemParameters(long time)
      Description copied from interface: SystemParametersProducer
      return the next bunch of parameter values.

      The gentime is the mission time when the parameter collection started. The returning parameters can use this time to allow all parameters in one collection interval to be timestamped with the same time.

      Specified by:
      getSystemParameters in interface SystemParametersProducer
    • collectSystemParameters

      protected void collectSystemParameters(long time, List<ParameterValue> list)
      adds system parameters link status and data in/out to the list.

      The inheriting classes should call super.collectSystemParameters and then add their own parameters to the list

      Parameters:
      time -
      list -
    • addAction

      protected void addAction(LinkAction action)
    • getActions

      public List<LinkAction> getActions()
      Specified by:
      getActions in interface LinkActionProvider
    • getAction

      public LinkAction getAction(String actionId)
      Specified by:
      getAction in interface LinkActionProvider
    • getParent

      public AggregatedDataLink getParent()
      Description copied from interface: Link
      If this link is a sublink of an aggregated link, get the parent link.
      Specified by:
      getParent in interface Link
    • setParent

      public void setParent(AggregatedDataLink parent)
      Description copied from interface: Link
      Set the parent link if this is a sublink of an aggregated link.
      Specified by:
      setParent in interface Link
    • getYamcsInstance

      public String getYamcsInstance()
    • getDataOutCount

      public long getDataOutCount()
      Specified by:
      getDataOutCount in interface Link
    • getDataInCount

      public long getDataInCount()
      Specified by:
      getDataInCount in interface Link
    • resetCounters

      public void resetCounters()
      Specified by:
      resetCounters in interface Link
    • dataOut

      protected void dataOut(long outCount, long size)
      Update the dataOutCount with the given number of items sent

      Should be called by the inheriting classes each time data is sent out

    • dataIn

      protected void dataIn(long inCount, long size)
      Update the dataInCount with the given number of items received

      Should be called by the inheriting classes each time data is received