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-
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 AtomicBooleanprotected EventProducerprotected Stringprotected Logprotected TimeServiceprotected String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected 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 statusvoiddisable()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 longprotected static io.netty.channel.nio.NioEventLoopGroupReturns the current link status.getName()Return the name of the linkvoidinit(String instance, String name, YConfiguration config) Called at startup to initialize the link.booleanreturn true if the link has been disabled by the user.booleanvoidsetupSystemParameters(SystemParametersService sysParamCollector) 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
getDataInCount, getDataOutCount, getParent, getSpec, isEffectivelyDisabled, resetCounters, setParentMethods inherited from interface org.yamcs.parameter.SystemParametersProducer
getFrequency, getSystemParameters
-
Field Details
-
yamcsInstance
-
linkName
-
log
-
eventProducer
-
config
-
disabled
-
timeService
-
-
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
- 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()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
- 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-
-