Package com.lucimber.dbus.netty
Class DBusMandatoryNameHandler
java.lang.Object
io.netty.channel.ChannelHandlerAdapter
io.netty.channel.ChannelInboundHandlerAdapter
com.lucimber.dbus.netty.DBusMandatoryNameHandler
- All Implemented Interfaces:
io.netty.channel.ChannelHandler
,io.netty.channel.ChannelInboundHandler
public final class DBusMandatoryNameHandler
extends io.netty.channel.ChannelInboundHandlerAdapter
After SASL authentication completes and the DBus message pipeline is configured, this handler
sends the mandatory org.freedesktop.DBus.Hello method call to request a unique bus name.
It listens for the reply to this specific Hello call. On success, it stores the assigned bus
name as a channel attribute and fires a DBusChannelEvent.MANDATORY_NAME_ACQUIRED
event.
On failure, it fires DBusChannelEvent.MANDATORY_NAME_ACQUISITION_FAILED
.
Regardless of success or failure of the Hello call, this handler removes itself from the pipeline after processing the reply or an error related to it.
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.netty.channel.ChannelHandler
io.netty.channel.ChannelHandler.Sharable
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
channelInactive
(io.netty.channel.ChannelHandlerContext ctx) void
channelRead
(io.netty.channel.ChannelHandlerContext ctx, Object msg) void
exceptionCaught
(io.netty.channel.ChannelHandlerContext ctx, Throwable cause) void
reset()
Resets the mandatory name handler to its initial state for reconnection.void
userEventTriggered
(io.netty.channel.ChannelHandlerContext ctx, Object evt) Methods inherited from class io.netty.channel.ChannelInboundHandlerAdapter
channelActive, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged
Methods inherited from class io.netty.channel.ChannelHandlerAdapter
ensureNotSharable, handlerAdded, handlerRemoved, isSharable
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.netty.channel.ChannelHandler
handlerAdded, handlerRemoved
-
Constructor Details
-
DBusMandatoryNameHandler
public DBusMandatoryNameHandler()
-
-
Method Details
-
userEventTriggered
- Specified by:
userEventTriggered
in interfaceio.netty.channel.ChannelInboundHandler
- Overrides:
userEventTriggered
in classio.netty.channel.ChannelInboundHandlerAdapter
-
channelRead
- Specified by:
channelRead
in interfaceio.netty.channel.ChannelInboundHandler
- Overrides:
channelRead
in classio.netty.channel.ChannelInboundHandlerAdapter
-
exceptionCaught
- Specified by:
exceptionCaught
in interfaceio.netty.channel.ChannelHandler
- Specified by:
exceptionCaught
in interfaceio.netty.channel.ChannelInboundHandler
- Overrides:
exceptionCaught
in classio.netty.channel.ChannelInboundHandlerAdapter
-
channelInactive
- Specified by:
channelInactive
in interfaceio.netty.channel.ChannelInboundHandler
- Overrides:
channelInactive
in classio.netty.channel.ChannelInboundHandlerAdapter
- Throws:
Exception
-
reset
public void reset()Resets the mandatory name handler to its initial state for reconnection. This method is called when the connection needs to be re-established.
-