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.StatusNested 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
FieldsModifier and TypeFieldDescriptionprotected YConfigurationprotected AtomicLongprotected AtomicLongprotected AtomicBooleanprotected EventProducerstatic Stringprotected Stringprotected Logprotected TimeServiceprotected String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddAction(LinkAction action) protected voidcollectSystemParameters(long time, List<ParameterValue> list) adds system parameters link status and data in/out to the list.protected abstract Link.StatusIn case the link should be connected (i.e. is running and enabled) this method is called to return the actual connection statusprotected voiddataIn(long inCount, long size) Update the dataInCount with the given number of items receivedprotected voiddataOut(long outCount, long size) Update the dataOutCount with the given number of items sentvoiddisable()Disable any data I/O through this link.protected voidprotected voiddoEnable()voidenable()Sets the disabled to false such that getNextPacket does not ignore the received datagramsprotected longlonglongReturns a short detail status (one-line)protected static io.netty.channel.nio.NioEventLoopGroupReturns 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.voidinit(String instance, String name, YConfiguration config) Called at startup to initialize the link.booleanreturn true if the link has been disabled by the user.booleanvoidvoidsetParent(AggregatedDataLink parent) Set the parent link if this is a sublink of an aggregated link.voidsetupSystemParameters(SystemParametersService sysParamService) Called by the LinkManager before startup if theSystemParametersServiceservice 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, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.yamcs.tctm.Link
getDefaultSpec, getExtraInfo, getSpec, isEffectivelyDisabledMethods 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: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
-
getName
Description copied from interface:LinkReturn the name of the link -
getLinkStatus
Description copied from interface:LinkReturns the current link status.- Specified by:
getLinkStatusin interfaceLink
-
getDetailedStatus
Description copied from interface:LinkReturns a short detail status (one-line)- Specified by:
getDetailedStatusin 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: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()Description copied from interface:Linkreturn true if the link has been disabled by the user.See also
Link.isEffectivelyDisabled()- Specified by:
isDisabledin 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:LinkCalled by the LinkManager before startup if theSystemParametersServiceservice 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 theSystemParametersServiceto be called regularly after the start.- Specified by:
setupSystemParametersin interfaceLink
-
getSystemParameters
Description copied from interface:SystemParametersProducerreturn 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:
getSystemParametersin 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:
getActionsin interfaceLinkActionProvider
-
getAction
- Specified by:
getActionin interfaceLinkActionProvider
-
getParent
Description copied from interface:LinkIf this link is a sublink of an aggregated link, get the parent link. -
setParent
Description copied from interface:LinkSet the parent link if this is a sublink of an aggregated link. -
getYamcsInstance
-
getDataOutCount
public long getDataOutCount()- Specified by:
getDataOutCountin interfaceLink
-
getDataInCount
public long getDataInCount()- Specified by:
getDataInCountin interfaceLink
-
resetCounters
public void resetCounters()- Specified by:
resetCountersin 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
-