Bug 2245 - Fixed Avoid cycle between java packages
[openflowjava.git] / openflow-protocol-impl / src / main / java / org / opendaylight / openflowjava / protocol / impl / core / connection / UdpMessageListenerWrapper.java
diff --git a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/connection/UdpMessageListenerWrapper.java b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/connection/UdpMessageListenerWrapper.java
new file mode 100644 (file)
index 0000000..56d004b
--- /dev/null
@@ -0,0 +1,45 @@
+/*\r
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
+ *\r
+ * This program and the accompanying materials are made available under the\r
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
+ * and is available at http://www.eclipse.org/legal/epl-v10.html\r
+ */\r
+\r
+package org.opendaylight.openflowjava.protocol.impl.core.connection;\r
+\r
+import io.netty.util.concurrent.Future;\r
+import io.netty.util.concurrent.GenericFutureListener;\r
+\r
+import java.net.InetSocketAddress;\r
+\r
+/**\r
+ * Wraps outgoing message and includes listener attached to this message. This object\r
+ * is sent to OFEncoder. When OFEncoder fails to serialize the message,\r
+ * listener is filled with exception. The exception is then delegated to upper ODL layers.\r
+ * This object is used for UDP communication - it also carries recipient address\r
\r
+ * @author michal.polkorab\r
+ */\r
+public class UdpMessageListenerWrapper extends MessageListenerWrapper {\r
+\r
+    private InetSocketAddress address;\r
+\r
+    /**\r
+     * @param msg message to be sent\r
+     * @param listener listener attached to channel.write(msg) Future\r
+     * @param address recipient's address\r
+     */\r
+    public UdpMessageListenerWrapper(Object msg, GenericFutureListener<Future<Void>> listener,\r
+            InetSocketAddress address) {\r
+        super(msg, listener);\r
+        this.address = address;\r
+    }\r
+\r
+    /**\r
+     * @return recipient address\r
+     */\r
+    public InetSocketAddress getAddress() {\r
+        return address;\r
+    }\r
+}
\ No newline at end of file