2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
\r
4 * This program and the accompanying materials are made available under the
\r
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
\r
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
\r
8 package org.opendaylight.controller.netconf.impl.mapping;
\r
10 import io.netty.buffer.ByteBuf;
\r
11 import io.netty.channel.ChannelHandlerContext;
\r
12 import io.netty.handler.codec.MessageToByteEncoder;
\r
14 import org.opendaylight.controller.netconf.util.xml.ExiParameters;
\r
15 import org.opendaylight.controller.netconf.util.xml.ExiUtil;
\r
17 public class ExiEncoderHandler extends MessageToByteEncoder<Object> {
\r
19 public static final String HANDLER_NAME;
\r
21 HANDLER_NAME = "exiEncoder";
\r
24 private ExiParameters parameters;
\r
26 public ExiEncoderHandler(ExiParameters parameters) {
\r
27 this.parameters = parameters;
\r
31 protected void encode(ChannelHandlerContext ctx, Object msg, ByteBuf out)
\r
34 ExiUtil.encode(msg, out, this.parameters);
\r
35 } catch (Exception e) {
\r
36 throw new IllegalStateException("Unable to encode exi message.");
\r