Class SleProvider
- java.lang.Object
-
- io.netty.channel.ChannelHandlerAdapter
-
- io.netty.channel.ChannelInboundHandlerAdapter
-
- org.yamcs.sle.provider.SleProvider
-
- All Implemented Interfaces:
io.netty.channel.ChannelHandler,io.netty.channel.ChannelInboundHandler
public class SleProvider extends io.netty.channel.ChannelInboundHandlerAdapterThis class provides the common SLE functionality across all services.It implements SLE BIND and UNBIND operations and also takes over the schedule reports activation/deactivation.
When BIND is called, it relies first on the
AuthProviderto obtain user/name passwords information for the new connection and then on theServiceInitializerfor obtaining aSleService. It then it forwards all the subsequent operations to the newly obtained service.In order to use it
- create a Netty pipeline with this class at the end of the pipeline
- make an implementation for
AuthProviderthat provides authentication data - make an implementation for
ServiceInitializerwhich based on some configuration creates one of theCltuServiceProviderorRafServiceProvider(or maybe others in the future). - make an implementation of
CltuUplinkerwhich uplinks the CLTUs - make an implementation of
FrameDownlinkerwhich provides telemetry frames
See the
SleUdpBridgefor an example on how this class is used to create a SLE to UDP bridge.- Author:
- nm
-
-
Field Summary
Fields Modifier and Type Field Description protected AuthLevelauthLevelprotected io.netty.channel.ChannelHandlerContextchannelHandlerContextprotected List<SleMonitor>monitorsprotected CompletableFuture<Void>startingCf
-
Constructor Summary
Constructors Constructor Description SleProvider(AuthProvider authProvider, String responderId, ServiceInitializer serviceInitializer)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddMonitor(SleMonitor monitor)Add a monitor to be notified when events happen.protected voidchangeState(State newState)voidchannelActive(io.netty.channel.ChannelHandlerContext ctx)voidchannelInactive(io.netty.channel.ChannelHandlerContext ctx)voidchannelRead(io.netty.channel.ChannelHandlerContext ctx, Object msg)voidchannelRegistered(io.netty.channel.ChannelHandlerContext ctx)voidexceptionCaught(io.netty.channel.ChannelHandlerContext ctx, Throwable cause)AuthLevelgetAuthLevel()protected CredentialsgetBindCredentials()protected InvokeIdgetInvokeId()protected CredentialsgetNonBindCredentials()intgetVersionNumber()booleanisConnected()booleanisWritable()Checks if the netty outgoing buffer is full.protected voidnotifyDisconnected()protected voidpeerAbort()protected voidprocessBindInvocation(SleBindInvocation bindInvocation)protected voidprocessSleScheduleStatusReportInvocation(SleScheduleStatusReportInvocation sleScheduleStatusReportInvocation)protected voidprocessUnbindInvocation(SleUnbindInvocation unbindInvocation)voidremoveMonitor(SleMonitor monitor)voidsendMessage(com.beanit.jasn1.ber.types.BerType msg)voidsetAuthLevel(AuthLevel authLevel)voidsetVersionNumber(int versionNumber)voidshutdown()protected voidverifyBindCredentials(Credentials credentials)protected voidverifyNonBindCredentials(Credentials credentials)-
Methods inherited from class io.netty.channel.ChannelInboundHandlerAdapter
channelReadComplete, channelUnregistered, channelWritabilityChanged, userEventTriggered
-
Methods inherited from class io.netty.channel.ChannelHandlerAdapter
ensureNotSharable, handlerAdded, handlerRemoved, isSharable
-
-
-
-
Field Detail
-
startingCf
protected CompletableFuture<Void> startingCf
-
channelHandlerContext
protected io.netty.channel.ChannelHandlerContext channelHandlerContext
-
authLevel
protected AuthLevel authLevel
-
monitors
protected List<SleMonitor> monitors
-
-
Constructor Detail
-
SleProvider
public SleProvider(AuthProvider authProvider, String responderId, ServiceInitializer serviceInitializer)
-
-
Method Detail
-
getVersionNumber
public int getVersionNumber()
-
setVersionNumber
public void setVersionNumber(int versionNumber)
-
channelRead
public void channelRead(io.netty.channel.ChannelHandlerContext ctx, Object msg)- Specified by:
channelReadin interfaceio.netty.channel.ChannelInboundHandler- Overrides:
channelReadin classio.netty.channel.ChannelInboundHandlerAdapter
-
getAuthLevel
public AuthLevel getAuthLevel()
-
setAuthLevel
public void setAuthLevel(AuthLevel authLevel)
-
channelRegistered
public void channelRegistered(io.netty.channel.ChannelHandlerContext ctx) throws Exception- Specified by:
channelRegisteredin interfaceio.netty.channel.ChannelInboundHandler- Overrides:
channelRegisteredin classio.netty.channel.ChannelInboundHandlerAdapter- Throws:
Exception
-
channelActive
public void channelActive(io.netty.channel.ChannelHandlerContext ctx) throws Exception- Specified by:
channelActivein interfaceio.netty.channel.ChannelInboundHandler- Overrides:
channelActivein classio.netty.channel.ChannelInboundHandlerAdapter- Throws:
Exception
-
isConnected
public boolean isConnected()
-
shutdown
public void shutdown()
-
processBindInvocation
protected void processBindInvocation(SleBindInvocation bindInvocation)
-
processUnbindInvocation
protected void processUnbindInvocation(SleUnbindInvocation unbindInvocation)
-
processSleScheduleStatusReportInvocation
protected void processSleScheduleStatusReportInvocation(SleScheduleStatusReportInvocation sleScheduleStatusReportInvocation)
-
peerAbort
protected void peerAbort()
-
getNonBindCredentials
protected Credentials getNonBindCredentials()
-
getBindCredentials
protected Credentials getBindCredentials()
-
verifyNonBindCredentials
protected void verifyNonBindCredentials(Credentials credentials)
-
verifyBindCredentials
protected void verifyBindCredentials(Credentials credentials)
-
getInvokeId
protected InvokeId getInvokeId()
-
changeState
protected void changeState(State newState)
-
exceptionCaught
public void exceptionCaught(io.netty.channel.ChannelHandlerContext ctx, Throwable cause)- Specified by:
exceptionCaughtin interfaceio.netty.channel.ChannelHandler- Specified by:
exceptionCaughtin interfaceio.netty.channel.ChannelInboundHandler- Overrides:
exceptionCaughtin classio.netty.channel.ChannelInboundHandlerAdapter
-
notifyDisconnected
protected void notifyDisconnected()
-
channelInactive
public void channelInactive(io.netty.channel.ChannelHandlerContext ctx) throws Exception- Specified by:
channelInactivein interfaceio.netty.channel.ChannelInboundHandler- Overrides:
channelInactivein classio.netty.channel.ChannelInboundHandlerAdapter- Throws:
Exception
-
addMonitor
public void addMonitor(SleMonitor monitor)
Add a monitor to be notified when events happen.- Parameters:
monitor-
-
removeMonitor
public void removeMonitor(SleMonitor monitor)
-
sendMessage
public void sendMessage(com.beanit.jasn1.ber.types.BerType msg)
-
isWritable
public boolean isWritable()
Checks if the netty outgoing buffer is full.The onlineTimely RAF service should drop messages if the buffer is full.
The offline RAF service should back pressure the producer.
Note that even if the buffer is full, Netty will accept messages sent with
sendMessage(BerType).If the connection is completely stuck, the ISP1 heartbeat should detect the condition and close it.
- Returns:
-
-