Bump versions by x.y.(z+1)
[bgpcep.git] / bgp / rib-impl / src / main / java / org / opendaylight / protocol / bgp / rib / impl / BGPHandlerFactory.java
index d931fa56ae3569c3e9dbb9a2df504ae90defa058..a59033a8951ac3f5ede826659ad5bd8133f7df57 100644 (file)
@@ -7,35 +7,30 @@
  */
 package org.opendaylight.protocol.bgp.rib.impl;
 
+import com.google.common.base.Preconditions;
+
 import io.netty.channel.ChannelHandler;
 import io.netty.channel.ChannelOutboundHandler;
 
-import org.opendaylight.protocol.bgp.parser.BGPMessageFactory;
-
-import com.google.common.base.Preconditions;
+import org.opendaylight.protocol.bgp.parser.spi.MessageRegistry;
 
 /**
  * BGP specific factory for protocol inbound/outbound handlers.
  */
-public class BGPHandlerFactory  {
-       private final ChannelOutboundHandler encoder;
-       private final BGPMessageFactory msgFactory;
+public class BGPHandlerFactory {
+    private final ChannelOutboundHandler encoder;
+    private final MessageRegistry registry;
 
-       public BGPHandlerFactory(final BGPMessageFactory msgFactory) {
-               this.msgFactory = Preconditions.checkNotNull(msgFactory);
-               this.encoder = new BGPMessageToByteEncoder(msgFactory);
-       }
+    public BGPHandlerFactory(final MessageRegistry registry) {
+        this.registry = Preconditions.checkNotNull(registry);
+        this.encoder = new BGPMessageToByteEncoder(registry);
+    }
 
-       public ChannelHandler[] getEncoders() {
-               return new ChannelHandler[] {
-                               this.encoder,
-               };
-       }
+    public ChannelHandler[] getEncoders() {
+        return new ChannelHandler[] { this.encoder, };
+    }
 
-       public ChannelHandler[] getDecoders() {
-               return new ChannelHandler[] {
-                               new BGPMessageHeaderDecoder(),
-                               new BGPByteToMessageDecoder(this.msgFactory),
-               };
-       }
+    public ChannelHandler[] getDecoders() {
+        return new ChannelHandler[] { BGPMessageHeaderDecoder.getBGPMessageHeaderDecoder(), new BGPByteToMessageDecoder(this.registry), };
+    }
 }