Package org.yamcs.sle.user
Class AbstractServiceUserHandler
- java.lang.Object
-
- io.netty.channel.ChannelHandlerAdapter
-
- io.netty.channel.ChannelInboundHandlerAdapter
-
- org.yamcs.sle.user.AbstractServiceUserHandler
-
- All Implemented Interfaces:
io.netty.channel.ChannelHandler,io.netty.channel.ChannelInboundHandler
- Direct Known Subclasses:
CltuServiceUserHandler,RacfServiceUserHandler
public abstract class AbstractServiceUserHandler extends io.netty.channel.ChannelInboundHandlerAdapterCommon class for all SLE services- Author:
- nm
-
-
Field Summary
Fields Modifier and Type Field Description protected SleAttributesattrprotected AuthLevelauthLevelprotected io.netty.channel.ChannelHandlerContextchannelHandlerContextprotected List<SleMonitor>monitorsprotected CompletableFuture<Void>startingCfprotected Statestate
-
Constructor Summary
Constructors Constructor Description AbstractServiceUserHandler(Isp1Authentication auth, SleAttributes attr)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description CompletableFuture<Void>bind()Establish an association with the providerprotected voidchangeState(State newState)voidchannelActive(io.netty.channel.ChannelHandlerContext ctx)voidchannelRead(io.netty.channel.ChannelHandlerContext ctx, Object msg)voidchannelRegistered(io.netty.channel.ChannelHandlerContext ctx)protected voidcheckUnbound()voidexceptionCaught(io.netty.channel.ChannelHandlerContext ctx, Throwable cause)protected abstract Constants.ApplicationIdentifiergetApplicationIdentifier()AuthLevelgetAuthLevel()protected <T> CompletableFuture<T>getFuture(InvokeId invokeId)protected InvokeIdgetInvokeId()protected InvokeIdgetInvokeId(CompletableFuture<?> cf)protected CredentialsgetNonBindCredentials()abstract CompletableFuture<SleParameter>getParameter(int parameterId)Get the value of an RAF parameter from the providerStategetState()intgetVersionNumber()booleanisConnected()protected voidnotifyDisconnected()protected voidpeerAbort()protected voidprocessBindInvocation(SleBindInvocation bindInvocation)protected abstract voidprocessData(com.beanit.jasn1.ber.BerTag berTag, InputStream is)protected voidprocessStopReturn(SleAcknowledgement stopReturn)protected voidprocessUnbindInvocation(SleUnbindInvocation unbindInvocation)CompletableFuture<Void>schedulePeriodicStatusReport(int intervalSec)Send a request to the server to ask for a periodic status report.voidsetAuthLevel(AuthLevel authLevel)voidsetVersionNumber(int versionNumber)voidshutdown()CompletableFuture<Void>stop()request that the SLE service provider stop service provision and production.CompletableFuture<Void>stopPeriodicStatusReport()Send a request to stop the periodic status report.CompletableFuture<Void>unbind()protected voidverifyBindCredentials(Credentials credentials)protected voidverifyNonBindCredentials(Credentials credentials)-
Methods inherited from class io.netty.channel.ChannelInboundHandlerAdapter
channelInactive, channelReadComplete, channelUnregistered, channelWritabilityChanged, userEventTriggered
-
Methods inherited from class io.netty.channel.ChannelHandlerAdapter
ensureNotSharable, handlerAdded, handlerRemoved, isSharable
-
-
-
-
Field Detail
-
startingCf
protected CompletableFuture<Void> startingCf
-
state
protected volatile State state
-
channelHandlerContext
protected io.netty.channel.ChannelHandlerContext channelHandlerContext
-
authLevel
protected AuthLevel authLevel
-
attr
protected final SleAttributes attr
-
monitors
protected List<SleMonitor> monitors
-
-
Constructor Detail
-
AbstractServiceUserHandler
public AbstractServiceUserHandler(Isp1Authentication auth, SleAttributes attr)
-
-
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
-
getParameter
public abstract CompletableFuture<SleParameter> getParameter(int parameterId)
Get the value of an RAF parameter from the provider- Parameters:
parameterId- one of the parameters defined inConstants.ParameterName. Note that not all of them make sense for the RAF, see the table 3-11 in the standard to see which ones make sense.- Returns:
-
isConnected
public boolean isConnected()
-
bind
public CompletableFuture<Void> bind()
Establish an association with the provider- Returns:
-
stop
public CompletableFuture<Void> stop()
request that the SLE service provider stop service provision and production.- Returns:
-
unbind
public CompletableFuture<Void> unbind()
-
schedulePeriodicStatusReport
public CompletableFuture<Void> schedulePeriodicStatusReport(int intervalSec)
Send a request to the server to ask for a periodic status report.- Parameters:
intervalSec- - the cycle on which the periodic report shall be sent- Returns:
-
stopPeriodicStatusReport
public CompletableFuture<Void> stopPeriodicStatusReport()
Send a request to stop the periodic status report.- Returns:
-
shutdown
public void shutdown()
-
checkUnbound
protected void checkUnbound()
-
processBindInvocation
protected void processBindInvocation(SleBindInvocation bindInvocation)
-
processUnbindInvocation
protected void processUnbindInvocation(SleUnbindInvocation unbindInvocation)
-
processStopReturn
protected void processStopReturn(SleAcknowledgement stopReturn)
-
peerAbort
protected void peerAbort()
-
getNonBindCredentials
protected Credentials getNonBindCredentials()
-
verifyNonBindCredentials
protected void verifyNonBindCredentials(Credentials credentials)
-
verifyBindCredentials
protected void verifyBindCredentials(Credentials credentials)
-
getInvokeId
protected InvokeId getInvokeId()
-
getFuture
protected <T> CompletableFuture<T> getFuture(InvokeId invokeId)
-
changeState
protected void changeState(State newState)
-
getInvokeId
protected InvokeId getInvokeId(CompletableFuture<?> cf)
-
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()
-
getState
public State getState()
-
getApplicationIdentifier
protected abstract Constants.ApplicationIdentifier getApplicationIdentifier()
-
processData
protected abstract void processData(com.beanit.jasn1.ber.BerTag berTag, InputStream is) throws IOException- Throws:
IOException
-
-