<networkconfig.bridgedomain.northbound.version>0.0.3-SNAPSHOT</networkconfig.bridgedomain.northbound.version>
<commons.httpclient.version>0.1.2-SNAPSHOT</commons.httpclient.version>
<concepts.version>0.5.2-SNAPSHOT</concepts.version>
- <protocol-framework.version>0.4.1-SNAPSHOT</protocol-framework.version>
+ <protocol-framework.version>0.5.0-SNAPSHOT</protocol-framework.version>
<netty.version>4.0.10.Final</netty.version>
<commons.io.version>2.4</commons.io.version>
<bundlescanner.version>0.4.2-SNAPSHOT</bundlescanner.version>
</scm>
<artifactId>protocol-framework</artifactId>
- <version>0.4.1-SNAPSHOT</version>
+ <version>0.5.0-SNAPSHOT</version>
<description>Common protocol framework</description>
<packaging>bundle</packaging>
<name>${project.artifactId}</name>
+++ /dev/null
-/*
- * Copyright (c) 2013 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.protocol.framework;
-
-/**
- * Used when something occurs during parsing bytes to java objects.
- *
- * @deprecated This exception no longer carries any special meaning. Users
- * are advised to stop using it and define their own replacement.
- */
-@Deprecated
-public class DeserializerException extends Exception {
-
- private static final long serialVersionUID = -2247000673438452870L;
-
- /**
- * Creates a deserializer exception.
- * @param err string
- */
- public DeserializerException(final String err) {
- super(err);
- }
-
- /**
- * Creates a deserializer exception.
- * @param err string
- * @param e underlying exception
- */
- public DeserializerException(final String err, final Throwable e) {
- super(err, e);
- }
-}
+++ /dev/null
-/*
- * Copyright (c) 2013 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.protocol.framework;
-
-/**
- * Documented exception occurrs when an error is thrown that is documented
- * in any RFC or draft for the specific protocol.
- *
- * @deprecated This exception no longer carries any special meaning. Users
- * are advised to stop using it and define their own replacement.
- */
-@Deprecated
-public class DocumentedException extends Exception {
-
- private static final long serialVersionUID = -3727963789710833704L;
-
- /**
- * Creates a documented exception
- * @param message string
- */
- public DocumentedException(final String message) {
- super(message);
- }
-
- /**
- * Creates a documented exception
- * @param err string
- * @param cause the cause (which is saved for later retrieval by the
- * Throwable.getCause() method). (A null value is permitted, and indicates
- * that the cause is nonexistent or unknown.)
- */
- public DocumentedException(final String err, final Exception cause) {
- super(err, cause);
- }
-}
+++ /dev/null
-/*
- * Copyright (c) 2013 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.protocol.framework;
-
-import io.netty.channel.ChannelHandler;
-
-import com.google.common.base.Preconditions;
-
-/**
- * @deprecated This is an adaptor class for turning ProtocolMessageFactory into
- * Netty encoder/decoder. Use Netty-provided classes directly, by subclassing
- * {@link io.netty.handler.codec.ByteToMessageDecoder} or similar instead.
- */
-@Deprecated
-public class ProtocolHandlerFactory<T> {
- private final ProtocolMessageEncoder<T> encoder;
- protected final ProtocolMessageFactory<T> msgFactory;
-
- public ProtocolHandlerFactory(final ProtocolMessageFactory<T> msgFactory) {
- this.msgFactory = Preconditions.checkNotNull(msgFactory);
- this.encoder = new ProtocolMessageEncoder<T>(msgFactory);
- }
-
- public ChannelHandler[] getEncoders() {
- return new ChannelHandler[] { this.encoder };
- }
-
- public ChannelHandler[] getDecoders() {
- return new ChannelHandler[] { new ProtocolMessageDecoder<T>(this.msgFactory) };
- }
-}
+++ /dev/null
-/*
- * Copyright (c) 2013 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.protocol.framework;
-
-import io.netty.buffer.ByteBuf;
-import io.netty.buffer.ByteBufUtil;
-import io.netty.channel.ChannelHandlerContext;
-import io.netty.handler.codec.ByteToMessageDecoder;
-
-import java.util.List;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.base.Preconditions;
-
-/**
- * @deprecated This is an adaptor class for turning ProtocolMessageFactory into Netty decoder. Use Netty-provided
- * classes directly, by subclassing {@link io.netty.handler.codec.ByteToMessageDecoder} or similar instead.
- */
-@Deprecated
-public final class ProtocolMessageDecoder<T> extends ByteToMessageDecoder {
-
- private static final Logger LOG = LoggerFactory.getLogger(ProtocolMessageDecoder.class);
-
- private final ProtocolMessageFactory<T> factory;
-
- public ProtocolMessageDecoder(final ProtocolMessageFactory<T> factory) {
- this.factory = Preconditions.checkNotNull(factory);
- }
-
- @Override
- protected void decode(final ChannelHandlerContext ctx, final ByteBuf in, final List<Object> out) throws Exception {
- if (in.readableBytes() == 0) {
- LOG.debug("No more content in incoming buffer.");
- return;
- }
- in.markReaderIndex();
- try {
- LOG.trace("Received to decode: {}", ByteBufUtil.hexDump(in));
- final byte[] bytes = new byte[in.readableBytes()];
- in.readBytes(bytes);
- out.add(this.factory.parse(bytes));
- } catch (DeserializerException | DocumentedException e) {
- LOG.debug("Failed to decode protocol message", e);
- this.exceptionCaught(ctx, e);
- }
- in.discardReadBytes();
- }
-
-}
-
+++ /dev/null
-/*
- * Copyright (c) 2013 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.protocol.framework;
-
-import io.netty.buffer.ByteBuf;
-import io.netty.channel.ChannelHandler.Sharable;
-import io.netty.channel.ChannelHandlerContext;
-import io.netty.handler.codec.MessageToByteEncoder;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * @deprecated This is an adaptor class for turning ProtocolMessageFactory into Netty encoder. Use Netty-provided
- * classes directly, by subclassing {@link io.netty.handler.codec.MessageToByteDecoder} or similar instead.
- */
-@Deprecated
-@Sharable
-public final class ProtocolMessageEncoder<T> extends MessageToByteEncoder<Object> {
-
- private static final Logger LOG = LoggerFactory.getLogger(ProtocolMessageEncoder.class);
-
- private final ProtocolMessageFactory<T> factory;
-
- public ProtocolMessageEncoder(final ProtocolMessageFactory<T> factory) {
- this.factory = factory;
- }
-
- @Override
- protected void encode(final ChannelHandlerContext ctx, final Object msg, final ByteBuf out) throws Exception {
- LOG.debug("Sent to encode : {}", msg);
- final byte[] bytes = this.factory.put((T) msg);
- out.writeBytes(bytes);
- }
-}
+++ /dev/null
-/*
- * Copyright (c) 2013 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.protocol.framework;
-
-
-/**
- * Interface for factory for parsing and serializing protocol specific messages. Needs to be implemented by a protocol
- * specific message factory. The methods put/parse should delegate parsing to specific message parsers, e.g.
- * OpenMessageParser etc.
- *
- * @param <T> type of messages created by this factory
- *
- * @deprecated Interact with Netty 4.0 directly, by subclassing {@link io.netty.handler.codec.ByteToMessageCodec} or
- * similar.
- */
-@Deprecated
-public interface ProtocolMessageFactory<T> {
-
- /**
- * Parses message from byte array. Requires specific protocol message header object to parse the header.
- *
- * @param bytes byte array from which the message will be parsed
- * @return List of specific protocol messages
- * @throws DeserializerException if some parsing error occurs
- * @throws DocumentedException if some documented error occurs
- */
- T parse(byte[] bytes) throws DeserializerException, DocumentedException;
-
- /**
- * Serializes protocol specific message to byte array.
- *
- * @param msg message to be serialized.
- * @return byte array resulting message
- */
- byte[] put(T msg);
-}
+++ /dev/null
-/*
- * Copyright (c) 2013 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.protocol.framework;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-
-@Deprecated
-public class ComplementaryTest {
-
- @Test
- public void testExceptions() {
- final DeserializerException de = new DeserializerException("some error");
- final DocumentedException ee = new DocumentedException("some error");
-
- assertEquals(de.getMessage(), ee.getMessage());
- }
-}