Bmp pipeline factory implementation

Bmp pipeline factory will connect message decoder and bmp message handler

Change-Id: I98e82a9fd9263da657692cea6c6f7235ccae1eed
diff --git a/apps/bgpmonitoring/app/src/main/java/org/onosproject/bgpmonitoring/impl/BmpPipelineFactory.java b/apps/bgpmonitoring/app/src/main/java/org/onosproject/bgpmonitoring/impl/BmpPipelineFactory.java
new file mode 100644
index 0000000..a0f0709
--- /dev/null
+++ b/apps/bgpmonitoring/app/src/main/java/org/onosproject/bgpmonitoring/impl/BmpPipelineFactory.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2024-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.bgpmonitoring.impl;
+
+import org.jboss.netty.channel.ChannelPipeline;
+import org.jboss.netty.channel.ChannelPipelineFactory;
+import org.jboss.netty.channel.Channels;
+import org.jboss.netty.util.ExternalResourceReleasable;
+import org.onosproject.bgpmonitoring.BmpController;
+import org.onosproject.bgpmonitoring.type.BmpMessageDecoder;
+
+/**
+ * Creates a ChannelPipeline for a server-side bmp channel.
+ */
+public class BmpPipelineFactory implements ChannelPipelineFactory, ExternalResourceReleasable {
+
+    private BmpController bmpController;
+
+    /**
+     * Constructor to initialize the values.
+     *
+     * @param bmpController bmp controller
+     */
+    public BmpPipelineFactory(BmpController bmpController) {
+        super();
+        this.bmpController = bmpController;
+    }
+
+    /**
+     * Get server-side pipe line channel.
+     *
+     * @return ChannelPipeline server-side pipe line channel
+     * @throws Exception on while getting pipe line
+     */
+    @Override
+    public ChannelPipeline getPipeline() throws Exception {
+
+        BmpChannelHandler handler = new BmpChannelHandler(bmpController);
+
+        ChannelPipeline pipeline = Channels.pipeline();
+        pipeline.addLast("bmpmessagedecoder", new BmpMessageDecoder());
+        pipeline.addLast("ActiveHandler", handler);
+        return pipeline;
+    }
+
+    @Override
+    public void releaseExternalResources() {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+}
diff --git a/apps/bgpmonitoring/app/src/main/java/org/onosproject/bgpmonitoring/impl/Controller.java b/apps/bgpmonitoring/app/src/main/java/org/onosproject/bgpmonitoring/impl/Controller.java
index df7b90b..a9688cd 100644
--- a/apps/bgpmonitoring/app/src/main/java/org/onosproject/bgpmonitoring/impl/Controller.java
+++ b/apps/bgpmonitoring/app/src/main/java/org/onosproject/bgpmonitoring/impl/Controller.java
@@ -130,7 +130,7 @@
                             Controller.SEND_BUFFER_SIZE));
             bootstrap.setOption("child.reuseAddress", true);
 
-            ChannelPipelineFactory pfact = null;
+            ChannelPipelineFactory pfact = new BmpPipelineFactory(bmpController);
 
             bootstrap.setPipelineFactory(pfact);
             InetSocketAddress inetSocketAddress = new InetSocketAddress(BMP_PORT_NUM);