Package org.yamcs.tctm
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 aServicehandling the basic enable/disable getConfig operations
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.yamcs.tctm.Link
Link.Status
-
-
Field Summary
Fields Modifier and Type Field Description protected YConfigurationconfigprotected AtomicBooleandisabledprotected EventProducereventProducerprotected StringlinkNameprotected Loglogprotected TimeServicetimeServiceprotected StringyamcsInstance
-
Constructor Summary
Constructors Constructor Description AbstractLink()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidcollectSystemParameters(long time, List<ParameterValue> list)adds system parameters link status and data in/out to the list.protected abstract Link.StatusconnectionStatus()In case the link should be connected (i.e. is running and enabled) this method is called to return the actual connection statusvoiddisable()Disable any data I/O through this link.protected voiddoDisable()protected voiddoEnable()voidenable()Sets the disabled to false such that getNextPacket does not ignore the received datagramsYConfigurationgetConfig()protected longgetCurrentTime()StringgetDetailedStatus()protected static io.netty.channel.nio.NioEventLoopGroupgetEventLoop()Link.StatusgetLinkStatus()Returns the current link status.StringgetName()Return the name of the linkList<ParameterValue>getSystemParameters()return the next bunch of parameter values.voidinit(String instance, String name, YConfiguration config)Called at startup to initialize the link.booleanisDisabled()booleanisRunningAndEnabled()voidsetupSystemParameters(SystemParametersCollector sysParamCollector)Called by the LinkManager before startup if theSystemParametersCollectorservice is enabled, to setup necessary things for later parameter collection.-
Methods inherited from class com.google.common.util.concurrent.AbstractService
addListener, awaitRunning, awaitRunning, awaitTerminated, awaitTerminated, doStart, doStop, failureCause, isRunning, notifyFailed, notifyStarted, notifyStopped, startAsync, state, stopAsync, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.yamcs.tctm.Link
getDataInCount, getDataOutCount, getParent, getSpec, resetCounters, setParent
-
-
-
-
Field Detail
-
yamcsInstance
protected String yamcsInstance
-
linkName
protected String linkName
-
log
protected Log log
-
eventProducer
protected EventProducer eventProducer
-
config
protected YConfiguration config
-
disabled
protected AtomicBoolean disabled
-
timeService
protected TimeService timeService
-
-
Method Detail
-
init
public void init(String instance, String name, YConfiguration config) throws ConfigurationException
Description copied from interface:LinkCalled at startup to initialize the link.The config corresponds to the map that is under the link definition in yamcs.instance.yaml.
- Specified by:
initin interfaceLinkconfig- - the configuration - cannot be null (but can be empty)- Throws:
ConfigurationException
-
getConfig
public YConfiguration getConfig()
-
getLinkStatus
public Link.Status getLinkStatus()
Description copied from interface:LinkReturns the current link status.- Specified by:
getLinkStatusin interfaceLink
-
getDetailedStatus
public String getDetailedStatus()
- Specified by:
getDetailedStatusin interfaceLink- 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
-
disable
public void disable()
Description copied from interface:LinkDisable 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
-
isDisabled
public boolean isDisabled()
- Specified by:
isDisabledin interfaceLink
-
isRunningAndEnabled
public boolean isRunningAndEnabled()
-
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(SystemParametersCollector sysParamCollector)
Description copied from interface:LinkCalled by the LinkManager before startup if theSystemParametersCollectorservice is enabled, to setup necessary things for later parameter collection.The method is called only on the links that implement the
SystemParametersProducerinterface; they are also registered with theSystemParametersCollectorto be called regularly after the start.- Specified by:
setupSystemParametersin interfaceLink
-
getSystemParameters
public List<ParameterValue> getSystemParameters()
Description copied from interface:SystemParametersProducerreturn the next bunch of parameter values. The values must contain a reference to a Parameter (i.e. parameter definition) and that Parameter does not need to be coming from the XtceDB - the provider can just make it up on the fly.- Specified by:
getSystemParametersin interfaceSystemParametersProducer
-
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-
-
-