@ChannelHandler.Sharable
public class NettyInboundHandler
extends io.netty.channel.ChannelInboundHandlerAdapter
| Modifier and Type | Field and Description |
|---|---|
protected io.netty.handler.codec.http.websocketx.WebSocketServerHandshaker |
handshaker |
protected NettyHttpFileHandler |
httpFileHandler |
protected de.tum.ei.lkn.eces.dnm.mappers.NCRequestDataMapper |
ncRequestDataMapper |
protected de.tum.ei.lkn.eces.routing.mappers.RequestNameMapper |
requestNameMapper |
protected de.tum.ei.lkn.eces.routing.mappers.SelectedRoutingAlgorithmMapper |
selectedRoutingAlgorithmMapper |
protected de.tum.ei.lkn.eces.routing.mappers.UnicastRequestMapper |
unicastRequestMapper |
| Constructor and Description |
|---|
NettyInboundHandler(de.tum.ei.lkn.eces.core.Controller controller) |
NettyInboundHandler(de.tum.ei.lkn.eces.core.Controller controller,
ColoringSystem passedColSys) |
| Modifier and Type | Method and Description |
|---|---|
void |
addGraph(de.tum.ei.lkn.eces.graph.Graph newGraph) |
void |
channelActive(io.netty.channel.ChannelHandlerContext ctx) |
void |
channelRead(io.netty.channel.ChannelHandlerContext ctx,
Object msg) |
void |
componentStateEdge(de.tum.ei.lkn.eces.graph.Edge newEdge,
String newStatus) |
void |
componentStateNode(de.tum.ei.lkn.eces.graph.Node newNode,
String newStatus) |
void |
exceptionCaught(io.netty.channel.ChannelHandlerContext ctx,
Throwable cause) |
protected void |
handleHttpRequest(io.netty.channel.ChannelHandlerContext ctx,
io.netty.handler.codec.http.FullHttpRequest req) |
protected void |
handleMessageCompleted(io.netty.channel.ChannelHandlerContext ctx,
String frameText)
Executed when websocket message completely received
If the WEbGraphGui frontend sends other websocket messages, process them here.
|
protected boolean |
handleREST(io.netty.channel.ChannelHandlerContext ctx,
io.netty.handler.codec.http.FullHttpRequest req) |
protected void |
handleWebSocketFrame(io.netty.channel.ChannelHandlerContext ctx,
io.netty.handler.codec.http.websocketx.WebSocketFrame frame) |
protected void |
sendAllColors(ChannelStateful channelStateful,
long activeGraphId)
Send Color Information of all edges in one graph to one specific frontend
Used if a Color Scheme is clicked in the dropdown of the frontend
|
void |
sendColorOfEdge(de.tum.ei.lkn.eces.graph.Edge edge)
Send Color of one specific edge to all active frontends, taking into account the respective active ColoringScheme
Used if the Entity of an edge is updated, possibly changing the color value
|
protected void |
sendCurrentEntityObject(ChannelStateful channelStateful)
Executed when message of type "nodeClicked" received
|
protected void |
sendError(io.netty.channel.Channel channel,
String errorTypeString,
String errorMsg)
Can be used to send arbitrary error Message
|
protected void |
sendInitial(io.netty.channel.ChannelHandlerContext ctx)
Executed on established websocket connection: go through all registered graphs and send nodes + edges;
Send all existing ColorScheme Names
|
void |
sendWebsocketFrameToAll(String frameText)
Send a arbitrary text message as Websocket frame to all established websocket connections (connected frontends)
Mainly used if all frontends need to be updated (e.g.
|
protected void |
startColorDaemon(ChannelStateful channelStateful,
long activeGraphId) |
void |
updatedActiveEntity(long updatedEntityId) |
channelInactive, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, userEventTriggeredhandlerAdded, handlerRemoved, isSharableprotected NettyHttpFileHandler httpFileHandler
protected io.netty.handler.codec.http.websocketx.WebSocketServerHandshaker handshaker
protected de.tum.ei.lkn.eces.dnm.mappers.NCRequestDataMapper ncRequestDataMapper
protected de.tum.ei.lkn.eces.routing.mappers.SelectedRoutingAlgorithmMapper selectedRoutingAlgorithmMapper
protected de.tum.ei.lkn.eces.routing.mappers.UnicastRequestMapper unicastRequestMapper
protected de.tum.ei.lkn.eces.routing.mappers.RequestNameMapper requestNameMapper
public NettyInboundHandler(de.tum.ei.lkn.eces.core.Controller controller)
public NettyInboundHandler(de.tum.ei.lkn.eces.core.Controller controller,
ColoringSystem passedColSys)
public void channelActive(io.netty.channel.ChannelHandlerContext ctx)
throws Exception
channelActive in interface io.netty.channel.ChannelInboundHandlerchannelActive in class io.netty.channel.ChannelInboundHandlerAdapterExceptionpublic void channelRead(io.netty.channel.ChannelHandlerContext ctx,
Object msg)
throws Exception
channelRead in interface io.netty.channel.ChannelInboundHandlerchannelRead in class io.netty.channel.ChannelInboundHandlerAdapterExceptionprotected boolean handleREST(io.netty.channel.ChannelHandlerContext ctx,
io.netty.handler.codec.http.FullHttpRequest req)
protected void handleHttpRequest(io.netty.channel.ChannelHandlerContext ctx,
io.netty.handler.codec.http.FullHttpRequest req)
throws Exception
Exceptionprotected void handleMessageCompleted(io.netty.channel.ChannelHandlerContext ctx,
String frameText)
ctx - ChannelHandlerContext that recieved message, used for sending answersframeText - should be message in JSON Format with type and possible additional Informationprotected void sendInitial(io.netty.channel.ChannelHandlerContext ctx)
ctx - ChannelHandlerContext of new connectionprotected void sendCurrentEntityObject(ChannelStateful channelStateful)
channelStateful - Needed because several instances of the frontend can be open with different activeEntitysprotected void sendError(io.netty.channel.Channel channel,
String errorTypeString,
String errorMsg)
channel - channel to which to send the errorerrorTypeString - Name of ErrorerrorMsg - additional Informationprotected void sendAllColors(ChannelStateful channelStateful, long activeGraphId)
channelStateful - channel to which to send the color valuesactiveGraphId - limits messages to only the currently active graph of that specific frontendpublic void sendColorOfEdge(de.tum.ei.lkn.eces.graph.Edge edge)
edge - edge that should be coloredpublic void sendWebsocketFrameToAll(String frameText)
frameText - complete Message text, should be JSON (mostly)protected void handleWebSocketFrame(io.netty.channel.ChannelHandlerContext ctx,
io.netty.handler.codec.http.websocketx.WebSocketFrame frame)
public void exceptionCaught(io.netty.channel.ChannelHandlerContext ctx,
Throwable cause)
exceptionCaught in interface io.netty.channel.ChannelHandlerexceptionCaught in interface io.netty.channel.ChannelInboundHandlerexceptionCaught in class io.netty.channel.ChannelInboundHandlerAdapterpublic void componentStateNode(de.tum.ei.lkn.eces.graph.Node newNode,
String newStatus)
public void componentStateEdge(de.tum.ei.lkn.eces.graph.Edge newEdge,
String newStatus)
public void addGraph(de.tum.ei.lkn.eces.graph.Graph newGraph)
public void updatedActiveEntity(long updatedEntityId)
protected void startColorDaemon(ChannelStateful channelStateful, long activeGraphId)
Copyright © 2021. All rights reserved.