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%2FNetconfHelloMessageToXMLEncoder.java;fp=opendaylight%2Fnetconf%2Fnetconf-util%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fnetconf%2Futil%2Fhandler%2FNetconfHelloMessageToXMLEncoder.java;h=0000000000000000000000000000000000000000;hp=65d5b270254dcbd9503a98791c4c9f878d3442f9;hb=c3108b4e80ec9f6ee6c8cf96df3009bb91dc8bc0;hpb=04a788d2df5303c60cdbcff02254291f411566bd diff --git a/opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/handler/NetconfHelloMessageToXMLEncoder.java b/opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/handler/NetconfHelloMessageToXMLEncoder.java deleted file mode 100644 index 65d5b27025..0000000000 --- a/opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/handler/NetconfHelloMessageToXMLEncoder.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ -package org.opendaylight.controller.netconf.util.handler; - -import io.netty.buffer.ByteBuf; -import io.netty.channel.ChannelHandlerContext; - -import java.io.IOException; - -import javax.xml.transform.TransformerException; - -import org.opendaylight.controller.netconf.api.NetconfMessage; -import org.opendaylight.controller.netconf.util.messages.NetconfHelloMessage; -import org.opendaylight.controller.netconf.util.messages.NetconfHelloMessageAdditionalHeader; - -import com.google.common.annotations.VisibleForTesting; -import com.google.common.base.Charsets; -import com.google.common.base.Optional; -import com.google.common.base.Preconditions; - -/** - * Customized NetconfMessageToXMLEncoder that serializes additional header with - * session metadata along with - * {@link org.opendaylight.controller.netconf.util.messages.NetconfHelloMessage} - * . Used by netconf clients to send information about the user, ip address, - * protocol etc. - *

- * Hello message with header example: - *

- * - *

- * {@code
- * [tomas;10.0.0.0/10000;tcp;1000;1000;;/home/tomas;;]
- * 
- * 
- * urn:ietf:params:netconf:base:1.0
- * 
- * 
- * }
- * 
- */ -public final class NetconfHelloMessageToXMLEncoder extends NetconfMessageToXMLEncoder { - @Override - @VisibleForTesting - public void encode(ChannelHandlerContext ctx, NetconfMessage msg, ByteBuf out) throws IOException, TransformerException { - Preconditions.checkState(msg instanceof NetconfHelloMessage, "Netconf message of type %s expected, was %s", - NetconfHelloMessage.class, msg.getClass()); - Optional headerOptional = ((NetconfHelloMessage) msg) - .getAdditionalHeader(); - - // If additional header present, serialize it along with netconf hello - // message - if (headerOptional.isPresent()) { - out.writeBytes(headerOptional.get().toFormattedString().getBytes(Charsets.UTF_8)); - } - - super.encode(ctx, msg, out); - } -}