Extensibility support (deserialization part)
[openflowjava.git] / openflow-protocol-impl / src / main / java / org / opendaylight / openflowjava / protocol / impl / deserialization / factories / EchoReplyMessageFactory.java
index c5d5ab799e5615957f16f153aea55c1ae42dd649..5aca519fd62fd85acc88d55ed73adb5d6bec31cb 100644 (file)
@@ -10,7 +10,8 @@ package org.opendaylight.openflowjava.protocol.impl.deserialization.factories;
 
 import io.netty.buffer.ByteBuf;
 
-import org.opendaylight.openflowjava.protocol.impl.deserialization.OFDeserializer;
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.util.EncodeConstants;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.EchoOutput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.EchoOutputBuilder;
 
@@ -21,26 +22,10 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731
  */
 public class EchoReplyMessageFactory implements OFDeserializer<EchoOutput> {
 
-    private static EchoReplyMessageFactory instance;
-
-    private EchoReplyMessageFactory() {
-        // do nothing, just singleton
-    }
-    
-    /**
-     * @return singleton factory
-     */
-    public static synchronized EchoReplyMessageFactory getInstance() {
-        if (instance == null) {
-            instance = new EchoReplyMessageFactory();
-        }
-        return instance;
-    }
-    
     @Override
-    public EchoOutput bufferToMessage(ByteBuf rawMessage, short version) {
+    public EchoOutput deserialize(ByteBuf rawMessage) {
         EchoOutputBuilder builder = new EchoOutputBuilder();
-        builder.setVersion(version);
+        builder.setVersion((short) EncodeConstants.OF13_VERSION_ID);
         builder.setXid(rawMessage.readUnsignedInt());
         int remainingBytes = rawMessage.readableBytes();
         if (remainingBytes > 0) {