Moved Netty messaging out of onos-core-dist to under onos-utils
diff --git a/core/store/dist/pom.xml b/core/store/dist/pom.xml
index 2451955..1faab74 100644
--- a/core/store/dist/pom.xml
+++ b/core/store/dist/pom.xml
@@ -33,6 +33,12 @@
             <artifactId>onlab-nio</artifactId>
             <version>${project.version}</version>
         </dependency>
+        
+        <dependency>
+            <groupId>org.onlab.onos</groupId>
+            <artifactId>onlab-netty</artifactId>
+            <version>${project.version}</version>
+        </dependency>
 
         <dependency>
             <groupId>com.fasterxml.jackson.core</groupId>
@@ -51,15 +57,6 @@
           <groupId>de.javakaffee</groupId>
           <artifactId>kryo-serializers</artifactId>
         </dependency>
-        <dependency>
-          <groupId>io.netty</groupId>
-          <artifactId>netty-all</artifactId>
-        </dependency>
-        <dependency>
-          <groupId>commons-pool</groupId>
-          <artifactId>commons-pool</artifactId>
-          <version>1.6</version>
-        </dependency>
     </dependencies>
 
     <build>
diff --git a/core/store/dist/src/main/java/org/onlab/onos/store/cluster/messaging/impl/OnosClusterCommunicationManager.java b/core/store/dist/src/main/java/org/onlab/onos/store/cluster/messaging/impl/OnosClusterCommunicationManager.java
index 9bd25b4..e6e4a4d 100644
--- a/core/store/dist/src/main/java/org/onlab/onos/store/cluster/messaging/impl/OnosClusterCommunicationManager.java
+++ b/core/store/dist/src/main/java/org/onlab/onos/store/cluster/messaging/impl/OnosClusterCommunicationManager.java
@@ -23,10 +23,10 @@
 import org.onlab.onos.store.cluster.messaging.ClusterMessage;
 import org.onlab.onos.store.cluster.messaging.ClusterMessageHandler;
 import org.onlab.onos.store.cluster.messaging.MessageSubject;
-import org.onlab.onos.store.messaging.Endpoint;
-import org.onlab.onos.store.messaging.Message;
-import org.onlab.onos.store.messaging.MessageHandler;
-import org.onlab.onos.store.messaging.MessagingService;
+import org.onlab.netty.Endpoint;
+import org.onlab.netty.Message;
+import org.onlab.netty.MessageHandler;
+import org.onlab.netty.MessagingService;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
diff --git a/core/store/dist/src/test/java/org/onlab/onos/store/cluster/impl/ClusterCommunicationManagerTest.java b/core/store/dist/src/test/java/org/onlab/onos/store/cluster/impl/ClusterCommunicationManagerTest.java
index 3d87fb1..44e5421 100644
--- a/core/store/dist/src/test/java/org/onlab/onos/store/cluster/impl/ClusterCommunicationManagerTest.java
+++ b/core/store/dist/src/test/java/org/onlab/onos/store/cluster/impl/ClusterCommunicationManagerTest.java
@@ -7,7 +7,7 @@
 import org.onlab.onos.cluster.DefaultControllerNode;
 import org.onlab.onos.cluster.NodeId;
 import org.onlab.onos.store.cluster.messaging.impl.OnosClusterCommunicationManager;
-import org.onlab.onos.store.messaging.impl.NettyMessagingService;
+import org.onlab.netty.NettyMessagingService;
 import org.onlab.packet.IpPrefix;
 
 import java.util.concurrent.CountDownLatch;
diff --git a/utils/netty/pom.xml b/utils/netty/pom.xml
new file mode 100644
index 0000000..d335117
--- /dev/null
+++ b/utils/netty/pom.xml
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.onlab.onos</groupId>
+        <artifactId>onlab-utils</artifactId>
+        <version>1.0.0-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+
+    <artifactId>onlab-netty</artifactId>
+    <packaging>bundle</packaging>
+
+    <description>Network I/O using Netty framework</description>
+
+    <dependencies>
+        <dependency>
+            <groupId>com.google.guava</groupId>
+            <artifactId>guava-testlib</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.onlab.onos</groupId>
+            <artifactId>onlab-misc</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.onlab.onos</groupId>
+            <artifactId>onlab-junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>de.javakaffee</groupId>
+            <artifactId>kryo-serializers</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>io.netty</groupId>
+            <artifactId>netty-all</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>commons-pool</groupId>
+            <artifactId>commons-pool</artifactId>
+            <version>1.6</version>
+        </dependency>
+    </dependencies>
+
+</project>
diff --git a/core/store/dist/src/main/java/org/onlab/onos/store/messaging/impl/AsyncResponse.java b/utils/netty/src/main/java/org/onlab/netty/messaging/AsyncResponse.java
similarity index 95%
rename from core/store/dist/src/main/java/org/onlab/onos/store/messaging/impl/AsyncResponse.java
rename to utils/netty/src/main/java/org/onlab/netty/messaging/AsyncResponse.java
index ac2337d..b2b490e 100644
--- a/core/store/dist/src/main/java/org/onlab/onos/store/messaging/impl/AsyncResponse.java
+++ b/utils/netty/src/main/java/org/onlab/netty/messaging/AsyncResponse.java
@@ -1,10 +1,8 @@
-package org.onlab.onos.store.messaging.impl;
+package org.onlab.netty;
 
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeoutException;
 
-import org.onlab.onos.store.messaging.Response;
-
 /**
  * An asynchronous response.
  * This class provides a base implementation of Response, with methods to retrieve the
diff --git a/core/store/dist/src/main/java/org/onlab/onos/store/messaging/impl/EchoHandler.java b/utils/netty/src/main/java/org/onlab/netty/messaging/EchoHandler.java
similarity index 71%
rename from core/store/dist/src/main/java/org/onlab/onos/store/messaging/impl/EchoHandler.java
rename to utils/netty/src/main/java/org/onlab/netty/messaging/EchoHandler.java
index 7891c5c..313a448 100644
--- a/core/store/dist/src/main/java/org/onlab/onos/store/messaging/impl/EchoHandler.java
+++ b/utils/netty/src/main/java/org/onlab/netty/messaging/EchoHandler.java
@@ -1,10 +1,7 @@
-package org.onlab.onos.store.messaging.impl;
+package org.onlab.netty;
 
 import java.io.IOException;
 
-import org.onlab.onos.store.messaging.Message;
-import org.onlab.onos.store.messaging.MessageHandler;
-
 /**
  * Message handler that echos the message back to the sender.
  */
diff --git a/core/store/dist/src/main/java/org/onlab/onos/store/messaging/Endpoint.java b/utils/netty/src/main/java/org/onlab/netty/messaging/Endpoint.java
similarity index 96%
rename from core/store/dist/src/main/java/org/onlab/onos/store/messaging/Endpoint.java
rename to utils/netty/src/main/java/org/onlab/netty/messaging/Endpoint.java
index bd6d45f..8681093 100644
--- a/core/store/dist/src/main/java/org/onlab/onos/store/messaging/Endpoint.java
+++ b/utils/netty/src/main/java/org/onlab/netty/messaging/Endpoint.java
@@ -1,4 +1,4 @@
-package org.onlab.onos.store.messaging;
+package org.onlab.netty;
 
 /**
  * Representation of a TCP/UDP communication end point.
diff --git a/core/store/dist/src/main/java/org/onlab/onos/store/messaging/impl/InternalMessage.java b/utils/netty/src/main/java/org/onlab/netty/messaging/InternalMessage.java
similarity index 93%
rename from core/store/dist/src/main/java/org/onlab/onos/store/messaging/impl/InternalMessage.java
rename to utils/netty/src/main/java/org/onlab/netty/messaging/InternalMessage.java
index 8a87a3e..bcf6f52 100644
--- a/core/store/dist/src/main/java/org/onlab/onos/store/messaging/impl/InternalMessage.java
+++ b/utils/netty/src/main/java/org/onlab/netty/messaging/InternalMessage.java
@@ -1,10 +1,7 @@
-package org.onlab.onos.store.messaging.impl;
+package org.onlab.netty;
 
 import java.io.IOException;
 
-import org.onlab.onos.store.messaging.Endpoint;
-import org.onlab.onos.store.messaging.Message;
-
 /**
  * Internal message representation with additional attributes
  * for supporting, synchronous request/reply behavior.
diff --git a/core/store/dist/src/main/java/org/onlab/onos/store/messaging/impl/KryoSerializer.java b/utils/netty/src/main/java/org/onlab/netty/messaging/KryoSerializer.java
similarity index 95%
rename from core/store/dist/src/main/java/org/onlab/onos/store/messaging/impl/KryoSerializer.java
rename to utils/netty/src/main/java/org/onlab/netty/messaging/KryoSerializer.java
index 5d809a4..73c01a0 100644
--- a/core/store/dist/src/main/java/org/onlab/onos/store/messaging/impl/KryoSerializer.java
+++ b/utils/netty/src/main/java/org/onlab/netty/messaging/KryoSerializer.java
@@ -1,4 +1,4 @@
-package org.onlab.onos.store.messaging.impl;
+package org.onlab.netty;
 
 import org.onlab.util.KryoPool;
 import org.slf4j.Logger;
diff --git a/core/store/dist/src/main/java/org/onlab/onos/store/messaging/impl/LoggingHandler.java b/utils/netty/src/main/java/org/onlab/netty/messaging/LoggingHandler.java
similarity index 62%
rename from core/store/dist/src/main/java/org/onlab/onos/store/messaging/impl/LoggingHandler.java
rename to utils/netty/src/main/java/org/onlab/netty/messaging/LoggingHandler.java
index bf871f8..ed6cdb4 100644
--- a/core/store/dist/src/main/java/org/onlab/onos/store/messaging/impl/LoggingHandler.java
+++ b/utils/netty/src/main/java/org/onlab/netty/messaging/LoggingHandler.java
@@ -1,7 +1,4 @@
-package org.onlab.onos.store.messaging.impl;
-
-import org.onlab.onos.store.messaging.Message;
-import org.onlab.onos.store.messaging.MessageHandler;
+package org.onlab.netty;
 
 /**
  * A MessageHandler that simply logs the information.
@@ -12,4 +9,4 @@
     public void handle(Message message) {
         System.out.println("Received: " + message.payload());
     }
-}
\ No newline at end of file
+}
diff --git a/core/store/dist/src/main/java/org/onlab/onos/store/messaging/Message.java b/utils/netty/src/main/java/org/onlab/netty/messaging/Message.java
similarity index 92%
rename from core/store/dist/src/main/java/org/onlab/onos/store/messaging/Message.java
rename to utils/netty/src/main/java/org/onlab/netty/messaging/Message.java
index d814927..54b9526 100644
--- a/core/store/dist/src/main/java/org/onlab/onos/store/messaging/Message.java
+++ b/utils/netty/src/main/java/org/onlab/netty/messaging/Message.java
@@ -1,4 +1,4 @@
-package org.onlab.onos.store.messaging;
+package org.onlab.netty;
 
 import java.io.IOException;
 
diff --git a/core/store/dist/src/main/java/org/onlab/onos/store/messaging/impl/MessageDecoder.java b/utils/netty/src/main/java/org/onlab/netty/messaging/MessageDecoder.java
similarity index 92%
rename from core/store/dist/src/main/java/org/onlab/onos/store/messaging/impl/MessageDecoder.java
rename to utils/netty/src/main/java/org/onlab/netty/messaging/MessageDecoder.java
index 59790f6..ecf2d62 100644
--- a/core/store/dist/src/main/java/org/onlab/onos/store/messaging/impl/MessageDecoder.java
+++ b/utils/netty/src/main/java/org/onlab/netty/messaging/MessageDecoder.java
@@ -1,18 +1,16 @@
-package org.onlab.onos.store.messaging.impl;
+package org.onlab.netty;
 
 import java.util.Arrays;
 import java.util.List;
 
 import static com.google.common.base.Preconditions.checkState;
 
-import org.onlab.onos.store.messaging.Endpoint;
-
 import io.netty.buffer.ByteBuf;
 import io.netty.channel.ChannelHandlerContext;
 import io.netty.handler.codec.ByteToMessageDecoder;
 
 /**
- * Decode bytes into a InrenalMessage.
+ * Decode bytes into a InternalMessage.
  */
 public class MessageDecoder extends ByteToMessageDecoder {
 
diff --git a/core/store/dist/src/main/java/org/onlab/onos/store/messaging/impl/MessageEncoder.java b/utils/netty/src/main/java/org/onlab/netty/messaging/MessageEncoder.java
similarity index 96%
rename from core/store/dist/src/main/java/org/onlab/onos/store/messaging/impl/MessageEncoder.java
rename to utils/netty/src/main/java/org/onlab/netty/messaging/MessageEncoder.java
index 501b70c..1b52a0f 100644
--- a/core/store/dist/src/main/java/org/onlab/onos/store/messaging/impl/MessageEncoder.java
+++ b/utils/netty/src/main/java/org/onlab/netty/messaging/MessageEncoder.java
@@ -1,4 +1,4 @@
-package org.onlab.onos.store.messaging.impl;
+package org.onlab.netty;
 
 import io.netty.buffer.ByteBuf;
 import io.netty.channel.ChannelHandlerContext;
diff --git a/core/store/dist/src/main/java/org/onlab/onos/store/messaging/MessageHandler.java b/utils/netty/src/main/java/org/onlab/netty/messaging/MessageHandler.java
similarity index 86%
rename from core/store/dist/src/main/java/org/onlab/onos/store/messaging/MessageHandler.java
rename to utils/netty/src/main/java/org/onlab/netty/messaging/MessageHandler.java
index 8eaef1e..7bd5a7f 100644
--- a/core/store/dist/src/main/java/org/onlab/onos/store/messaging/MessageHandler.java
+++ b/utils/netty/src/main/java/org/onlab/netty/messaging/MessageHandler.java
@@ -1,4 +1,4 @@
-package org.onlab.onos.store.messaging;
+package org.onlab.netty;
 
 import java.io.IOException;
 
diff --git a/core/store/dist/src/main/java/org/onlab/onos/store/messaging/MessagingService.java b/utils/netty/src/main/java/org/onlab/netty/messaging/MessagingService.java
similarity index 96%
rename from core/store/dist/src/main/java/org/onlab/onos/store/messaging/MessagingService.java
rename to utils/netty/src/main/java/org/onlab/netty/messaging/MessagingService.java
index 4aa32cb..ebad442 100644
--- a/core/store/dist/src/main/java/org/onlab/onos/store/messaging/MessagingService.java
+++ b/utils/netty/src/main/java/org/onlab/netty/messaging/MessagingService.java
@@ -1,4 +1,4 @@
-package org.onlab.onos.store.messaging;
+package org.onlab.netty;
 
 import java.io.IOException;
 
diff --git a/core/store/dist/src/main/java/org/onlab/onos/store/messaging/impl/NettyMessagingService.java b/utils/netty/src/main/java/org/onlab/netty/messaging/NettyMessagingService.java
similarity index 92%
rename from core/store/dist/src/main/java/org/onlab/onos/store/messaging/impl/NettyMessagingService.java
rename to utils/netty/src/main/java/org/onlab/netty/messaging/NettyMessagingService.java
index 321e0ef..54da8cc 100644
--- a/core/store/dist/src/main/java/org/onlab/onos/store/messaging/impl/NettyMessagingService.java
+++ b/utils/netty/src/main/java/org/onlab/netty/messaging/NettyMessagingService.java
@@ -1,4 +1,4 @@
-package org.onlab.onos.store.messaging.impl;
+package org.onlab.netty;
 
 import java.io.IOException;
 import java.net.UnknownHostException;
@@ -25,16 +25,6 @@
 import org.apache.commons.pool.KeyedObjectPool;
 import org.apache.commons.pool.KeyedPoolableObjectFactory;
 import org.apache.commons.pool.impl.GenericKeyedObjectPool;
-import org.apache.felix.scr.annotations.Activate;
-import org.apache.felix.scr.annotations.Component;
-import org.apache.felix.scr.annotations.Deactivate;
-import org.apache.felix.scr.annotations.Reference;
-import org.apache.felix.scr.annotations.ReferenceCardinality;
-import org.apache.felix.scr.annotations.Service;
-import org.onlab.onos.store.messaging.Endpoint;
-import org.onlab.onos.store.messaging.MessageHandler;
-import org.onlab.onos.store.messaging.MessagingService;
-import org.onlab.onos.store.messaging.Response;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -44,8 +34,6 @@
 /**
  * A Netty based implementation of MessagingService.
  */
-@Component(immediate = true)
-@Service
 public class NettyMessagingService implements MessagingService {
 
     private final Logger log = LoggerFactory.getLogger(getClass());
@@ -59,7 +47,6 @@
     private Cache<Long, AsyncResponse<?>> responseFutures;
     private final Endpoint localEp;
 
-    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
     protected Serializer serializer;
 
     public NettyMessagingService() {
@@ -78,7 +65,6 @@
         }
     }
 
-    @Activate
     public void activate() throws Exception {
         responseFutures = CacheBuilder.newBuilder()
                 .maximumSize(100000)
@@ -89,7 +75,6 @@
         startAcceptingConnections();
     }
 
-    @Deactivate
     public void deactivate() throws Exception {
         channels.close();
         bossGroup.shutdownGracefully();
diff --git a/core/store/dist/src/main/java/org/onlab/onos/store/messaging/Response.java b/utils/netty/src/main/java/org/onlab/netty/messaging/Response.java
similarity index 96%
rename from core/store/dist/src/main/java/org/onlab/onos/store/messaging/Response.java
rename to utils/netty/src/main/java/org/onlab/netty/messaging/Response.java
index ff0d84f..04675ce 100644
--- a/core/store/dist/src/main/java/org/onlab/onos/store/messaging/Response.java
+++ b/utils/netty/src/main/java/org/onlab/netty/messaging/Response.java
@@ -1,4 +1,4 @@
-package org.onlab.onos.store.messaging;
+package org.onlab.netty;
 
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeoutException;
diff --git a/core/store/dist/src/main/java/org/onlab/onos/store/messaging/impl/Serializer.java b/utils/netty/src/main/java/org/onlab/netty/messaging/Serializer.java
similarity index 90%
rename from core/store/dist/src/main/java/org/onlab/onos/store/messaging/impl/Serializer.java
rename to utils/netty/src/main/java/org/onlab/netty/messaging/Serializer.java
index d2da7cf..ac55f5a 100644
--- a/core/store/dist/src/main/java/org/onlab/onos/store/messaging/impl/Serializer.java
+++ b/utils/netty/src/main/java/org/onlab/netty/messaging/Serializer.java
@@ -1,4 +1,4 @@
-package org.onlab.onos.store.messaging.impl;
+package org.onlab.netty;
 
 /**
  * Interface for encoding/decoding message payloads.
diff --git a/core/store/dist/src/main/java/org/onlab/onos/store/messaging/impl/SimpleClient.java b/utils/netty/src/main/java/org/onlab/netty/messaging/SimpleClient.java
similarity index 85%
rename from core/store/dist/src/main/java/org/onlab/onos/store/messaging/impl/SimpleClient.java
rename to utils/netty/src/main/java/org/onlab/netty/messaging/SimpleClient.java
index 746ecb2..1573780 100644
--- a/core/store/dist/src/main/java/org/onlab/onos/store/messaging/impl/SimpleClient.java
+++ b/utils/netty/src/main/java/org/onlab/netty/messaging/SimpleClient.java
@@ -1,10 +1,7 @@
-package org.onlab.onos.store.messaging.impl;
+package org.onlab.netty;
 
 import java.util.concurrent.TimeUnit;
 
-import org.onlab.onos.store.messaging.Endpoint;
-import org.onlab.onos.store.messaging.Response;
-
 public final class SimpleClient {
     private SimpleClient() {}
 
diff --git a/core/store/dist/src/main/java/org/onlab/onos/store/messaging/impl/SimpleServer.java b/utils/netty/src/main/java/org/onlab/netty/messaging/SimpleServer.java
similarity index 92%
rename from core/store/dist/src/main/java/org/onlab/onos/store/messaging/impl/SimpleServer.java
rename to utils/netty/src/main/java/org/onlab/netty/messaging/SimpleServer.java
index 96094b7..12fa025 100644
--- a/core/store/dist/src/main/java/org/onlab/onos/store/messaging/impl/SimpleServer.java
+++ b/utils/netty/src/main/java/org/onlab/netty/messaging/SimpleServer.java
@@ -1,4 +1,4 @@
-package org.onlab.onos.store.messaging.impl;
+package org.onlab.netty;
 
 public final class SimpleServer {
     private SimpleServer() {}
diff --git a/utils/pom.xml b/utils/pom.xml
index 2beeba8..feb60e9 100644
--- a/utils/pom.xml
+++ b/utils/pom.xml
@@ -19,6 +19,7 @@
     <modules>
         <module>junit</module>
         <module>misc</module>
+        <module>netty</module>
         <module>nio</module>
         <module>osgi</module>
         <module>rest</module>