X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fnetconf%2Fnetconf-api%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fnetconf%2Fapi%2FNetconfSession.java;h=4770cb128fb7399f50759a2ffb599796001992b6;hb=d6bcfc09131a675cdf198a3fb9b4fac653daf19b;hp=eb7235f04490eaaef675e7f993da23455223222f;hpb=de12565a7795af98788f8150eb0072f9c985f4a1;p=controller.git diff --git a/opendaylight/netconf/netconf-api/src/main/java/org/opendaylight/controller/netconf/api/NetconfSession.java b/opendaylight/netconf/netconf-api/src/main/java/org/opendaylight/controller/netconf/api/NetconfSession.java index eb7235f044..4770cb128f 100644 --- a/opendaylight/netconf/netconf-api/src/main/java/org/opendaylight/controller/netconf/api/NetconfSession.java +++ b/opendaylight/netconf/netconf-api/src/main/java/org/opendaylight/controller/netconf/api/NetconfSession.java @@ -8,47 +8,30 @@ package org.opendaylight.controller.netconf.api; import io.netty.channel.Channel; -import io.netty.channel.ChannelHandler; +import io.netty.channel.ChannelFuture; + +import java.io.IOException; + import org.opendaylight.protocol.framework.AbstractProtocolSession; -import org.opendaylight.protocol.framework.ProtocolMessageDecoder; -import org.opendaylight.protocol.framework.ProtocolMessageEncoder; import org.opendaylight.protocol.framework.SessionListener; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.io.IOException; -import java.util.Map; - public abstract class NetconfSession extends AbstractProtocolSession { - - private ChannelHandler exiEncoder; - private String exiEncoderName; - private String removeAfterMessageSentname; - private String pmeName,pmdName; - protected final Channel channel; - private final SessionListener sessionListener; + private static final Logger logger = LoggerFactory.getLogger(NetconfSession.class); + private final SessionListener sessionListener; private final long sessionId; private boolean up = false; - private static final Logger logger = LoggerFactory.getLogger(NetconfSession.class); - protected NetconfSession(SessionListener sessionListener, Channel channel, long sessionId) { + protected final Channel channel; + + protected NetconfSession(SessionListener sessionListener, Channel channel, long sessionId) { this.sessionListener = sessionListener; this.channel = channel; this.sessionId = sessionId; logger.debug("Session {} created", toString()); - - ChannelHandler pmd = channel.pipeline().get(ProtocolMessageDecoder.class); - ChannelHandler pme = channel.pipeline().get(ProtocolMessageEncoder.class); - - for (Map.Entry entry:channel.pipeline().toMap().entrySet()){ - if (entry.getValue().equals(pmd)){ - pmdName = entry.getKey(); - } - if (entry.getValue().equals(pme)){ - pmeName = entry.getKey(); - } - } } + @Override public void close() { channel.close(); @@ -62,17 +45,8 @@ public abstract class NetconfSession extends AbstractProtocolSession T remove(Class handlerType) { - return channel.pipeline().remove(handlerType); - } - - public T getHandler(Class handlerType) { - return channel.pipeline().get(handlerType); - } - - public void addFirst(ChannelHandler handler, String name){ - channel.pipeline().addFirst(name, handler); - } - public void addLast(ChannelHandler handler, String name){ - channel.pipeline().addLast(name, handler); - } - - public void addExiDecoder(String name,ChannelHandler handler){ - if (channel.pipeline().get(name)== null){ - channel.pipeline().addBefore(pmdName, name, handler); - } - } - public void addExiEncoderAfterMessageSent(String name, ChannelHandler handler){ - this.exiEncoder = handler; - this.exiEncoderName = name; - } - - public void addExiEncoder(String name, ChannelHandler handler){ - channel.pipeline().addBefore(pmeName, name, handler); - } - - public void removeAfterMessageSent(String handlerName){ - this.removeAfterMessageSentname = handlerName; - } - }