Class 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
Service
handling the basic enable/disable getConfig operations and data
in/out counts-
Nested Class Summary
Nested classes/interfaces inherited from interface org.yamcs.tctm.Link
Link.Status
Nested classes/interfaces inherited from interface com.google.common.util.concurrent.Service
com.google.common.util.concurrent.Service.Listener, com.google.common.util.concurrent.Service.State
-
Field Summary
Modifier and TypeFieldDescriptionprotected YConfiguration
protected AtomicLong
protected AtomicLong
protected AtomicBoolean
protected EventProducer
static String
protected String
protected Log
protected TimeService
protected String
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
addAction
(LinkAction action) protected void
collectSystemParameters
(long time, List<ParameterValue> list) adds system parameters link status and data in/out to the list.protected abstract Link.Status
In case the link should be connected (i.e. is running and enabled) this method is called to return the actual connection statusprotected void
dataIn
(long inCount, long size) Update the dataInCount with the given number of items receivedprotected void
dataOut
(long outCount, long size) Update the dataOutCount with the given number of items sentvoid
disable()
Disable any data I/O through this link.protected void
protected void
doEnable()
void
enable()
Sets the disabled to false such that getNextPacket does not ignore the received datagramsprotected long
long
long
Returns a short detail status (one-line)protected static io.netty.channel.nio.NioEventLoopGroup
Returns the current link status.getName()
Return the name of the linkIf this link is a sublink of an aggregated link, get the parent link.getSystemParameters
(long time) return the next bunch of parameter values.void
init
(String instance, String name, YConfiguration config) Called at startup to initialize the link.boolean
return true if the link has been disabled by the user.boolean
void
void
setParent
(AggregatedDataLink parent) Set the parent link if this is a sublink of an aggregated link.void
setupSystemParameters
(SystemParametersService sysParamService) Called by the LinkManager before startup if theSystemParametersService
service is enabled, to setup necessary things for later parameter collection.Methods inherited from class com.google.common.util.concurrent.AbstractService
addListener, awaitRunning, awaitRunning, awaitRunning, awaitTerminated, awaitTerminated, awaitTerminated, doCancelStart, 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
getDefaultSpec, getExtraInfo, getSpec, isEffectivelyDisabled
Methods inherited from interface org.yamcs.parameter.SystemParametersProducer
getFrequency
-
Field Details
-
LINK_NAMESPACE
-
yamcsInstance
-
linkName
-
log
-
eventProducer
-
config
-
disabled
-
timeService
-
dataOutCount
-
dataInCount
-
-
Constructor Details
-
AbstractLink
public AbstractLink()
-
-
Method Details
-
init
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 interfaceLink
config
- - the configuration - cannot be null (but can be empty)- Throws:
ConfigurationException
-
getConfig
-
getName
Description copied from interface:Link
Return the name of the link -
getLinkStatus
Description copied from interface:Link
Returns the current link status.- Specified by:
getLinkStatus
in interfaceLink
-
getDetailedStatus
Description copied from interface:Link
Returns a short detail status (one-line)- Specified by:
getDetailedStatus
in interfaceLink
-
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: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 -
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 interfaceLink
-
isRunningAndEnabled
public boolean isRunningAndEnabled() -
doDisable
- Throws:
Exception
-
doEnable
- Throws:
Exception
-
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
Description copied from interface:Link
Called by the LinkManager before startup if theSystemParametersService
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 theSystemParametersService
to be called regularly after the start.- Specified by:
setupSystemParameters
in interfaceLink
-
getSystemParameters
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 interfaceSystemParametersProducer
-
collectSystemParameters
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
-
getActions
- Specified by:
getActions
in interfaceLinkActionProvider
-
getAction
- Specified by:
getAction
in interfaceLinkActionProvider
-
getParent
Description copied from interface:Link
If this link is a sublink of an aggregated link, get the parent link. -
setParent
Description copied from interface:Link
Set the parent link if this is a sublink of an aggregated link. -
getYamcsInstance
-
getDataOutCount
public long getDataOutCount()- Specified by:
getDataOutCount
in interfaceLink
-
getDataInCount
public long getDataInCount()- Specified by:
getDataInCount
in interfaceLink
-
resetCounters
public void resetCounters()- Specified by:
resetCounters
in interfaceLink
-
dataOut
protected void dataOut(long outCount, long size) Update the dataOutCount with the given number of items sentShould 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 receivedShould be called by the inheriting classes each time data is received
-