X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fnetconf%2Fnetconf-util%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fnetconf%2Futil%2Fhandler%2FNetconfEOMAggregator.java;fp=opendaylight%2Fnetconf%2Fnetconf-util%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fnetconf%2Futil%2Fhandler%2FNetconfMessageAggregator.java;h=9435e6ff732cad7904a8fc71caf6ed9ee194225a;hp=a2486050f9368e7ff37314a1e65e38e7134406ed;hb=eac080120972a30ae37566fec20521286e87ef18;hpb=a06b268df0070f1b6502a83214b949852774fa58 diff --git a/opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/handler/NetconfMessageAggregator.java b/opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/handler/NetconfEOMAggregator.java similarity index 79% rename from opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/handler/NetconfMessageAggregator.java rename to opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/handler/NetconfEOMAggregator.java index a2486050f9..9435e6ff73 100644 --- a/opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/handler/NetconfMessageAggregator.java +++ b/opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/handler/NetconfEOMAggregator.java @@ -8,32 +8,24 @@ package org.opendaylight.controller.netconf.util.handler; -import com.google.common.base.Charsets; import io.netty.buffer.ByteBuf; import io.netty.channel.ChannelHandlerContext; import io.netty.handler.codec.ByteToMessageDecoder; -import org.opendaylight.controller.netconf.util.messages.FramingMechanism; -import org.opendaylight.controller.netconf.util.messages.NetconfMessageConstants; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import java.util.List; -public class NetconfMessageAggregator extends ByteToMessageDecoder { - - private final static Logger logger = LoggerFactory.getLogger(NetconfMessageAggregator.class); +import org.opendaylight.controller.netconf.util.messages.NetconfMessageConstants; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; - private byte[] eom = NetconfMessageConstants.endOfMessage; +import com.google.common.base.Charsets; - public NetconfMessageAggregator(FramingMechanism framingMechanism) { - if (framingMechanism == FramingMechanism.CHUNK) { - eom = NetconfMessageConstants.endOfChunk; - } - } +public class NetconfEOMAggregator extends ByteToMessageDecoder { + private final static Logger logger = LoggerFactory.getLogger(NetconfEOMAggregator.class); @Override protected void decode(ChannelHandlerContext ctx, ByteBuf in, List out) throws Exception { - int index = indexOfSequence(in, eom); + int index = indexOfSequence(in, NetconfMessageConstants.END_OF_MESSAGE); if (index == -1) { logger.debug("Message is not complete, read again."); if (logger.isTraceEnabled()) { @@ -43,7 +35,7 @@ public class NetconfMessageAggregator extends ByteToMessageDecoder { ctx.read(); } else { ByteBuf msg = in.readBytes(index); - in.readBytes(eom.length); + in.readBytes(NetconfMessageConstants.END_OF_MESSAGE.length); in.discardReadBytes(); logger.debug("Message is complete."); out.add(msg);