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
Direct Known Subclasses:
AbstractTcDataLink, AbstractTcFrameLink, AbstractTmDataLink, AbstractTmFrameLink

public abstract class AbstractLink extends com.google.common.util.concurrent.AbstractService implements Link, SystemParametersProducer
Abstract link implementation as a Service handling the basic enable/disable getConfig operations
  • 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()
      Specified by:
      getDetailedStatus in interface Link
      Returns:
      more detailed status information
    • 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 sysParamCollector)
      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()
      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 -