Merge "Remove deprecated API elements from protocol framework"
authorEd Warnicke <eaw@cisco.com>
Tue, 11 Feb 2014 01:47:28 +0000 (01:47 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Tue, 11 Feb 2014 01:47:28 +0000 (01:47 +0000)
opendaylight/commons/opendaylight/pom.xml
opendaylight/commons/protocol-framework/pom.xml
opendaylight/commons/protocol-framework/src/main/java/org/opendaylight/protocol/framework/DeserializerException.java [deleted file]
opendaylight/commons/protocol-framework/src/main/java/org/opendaylight/protocol/framework/DocumentedException.java [deleted file]
opendaylight/commons/protocol-framework/src/main/java/org/opendaylight/protocol/framework/ProtocolHandlerFactory.java [deleted file]
opendaylight/commons/protocol-framework/src/main/java/org/opendaylight/protocol/framework/ProtocolMessageDecoder.java [deleted file]
opendaylight/commons/protocol-framework/src/main/java/org/opendaylight/protocol/framework/ProtocolMessageEncoder.java [deleted file]
opendaylight/commons/protocol-framework/src/main/java/org/opendaylight/protocol/framework/ProtocolMessageFactory.java [deleted file]
opendaylight/commons/protocol-framework/src/test/java/org/opendaylight/protocol/framework/ComplementaryTest.java [deleted file]

index 6339257..fb548d4 100644 (file)
@@ -90,7 +90,7 @@
     <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>
index b162b9c..a035182 100644 (file)
@@ -17,7 +17,7 @@
     </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>
diff --git a/opendaylight/commons/protocol-framework/src/main/java/org/opendaylight/protocol/framework/DeserializerException.java b/opendaylight/commons/protocol-framework/src/main/java/org/opendaylight/protocol/framework/DeserializerException.java
deleted file mode 100644 (file)
index 608e949..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * 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);
-    }
-}
diff --git a/opendaylight/commons/protocol-framework/src/main/java/org/opendaylight/protocol/framework/DocumentedException.java b/opendaylight/commons/protocol-framework/src/main/java/org/opendaylight/protocol/framework/DocumentedException.java
deleted file mode 100644 (file)
index 5e5f29e..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * 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);
-    }
-}
diff --git a/opendaylight/commons/protocol-framework/src/main/java/org/opendaylight/protocol/framework/ProtocolHandlerFactory.java b/opendaylight/commons/protocol-framework/src/main/java/org/opendaylight/protocol/framework/ProtocolHandlerFactory.java
deleted file mode 100644 (file)
index 5c1377d..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * 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) };
-    }
-}
diff --git a/opendaylight/commons/protocol-framework/src/main/java/org/opendaylight/protocol/framework/ProtocolMessageDecoder.java b/opendaylight/commons/protocol-framework/src/main/java/org/opendaylight/protocol/framework/ProtocolMessageDecoder.java
deleted file mode 100644 (file)
index d8ad8b6..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * 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();
-    }
-
-}
-
diff --git a/opendaylight/commons/protocol-framework/src/main/java/org/opendaylight/protocol/framework/ProtocolMessageEncoder.java b/opendaylight/commons/protocol-framework/src/main/java/org/opendaylight/protocol/framework/ProtocolMessageEncoder.java
deleted file mode 100644 (file)
index 66378e7..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * 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);
-    }
-}
diff --git a/opendaylight/commons/protocol-framework/src/main/java/org/opendaylight/protocol/framework/ProtocolMessageFactory.java b/opendaylight/commons/protocol-framework/src/main/java/org/opendaylight/protocol/framework/ProtocolMessageFactory.java
deleted file mode 100644 (file)
index 9b89dc3..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * 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);
-}
diff --git a/opendaylight/commons/protocol-framework/src/test/java/org/opendaylight/protocol/framework/ComplementaryTest.java b/opendaylight/commons/protocol-framework/src/test/java/org/opendaylight/protocol/framework/ComplementaryTest.java
deleted file mode 100644 (file)
index 80e6ad9..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * 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());
-    }
-}