Extensibility support (deserialization part)
[openflowjava.git] / openflow-protocol-impl / src / main / java / org / opendaylight / openflowjava / protocol / impl / deserialization / factories / OF10PortStatusMessageFactory.java
index 5d6036ad228f9c13ec815b7b20f5ec774ee48cb6..3d0489a8659955d3adec406a815bcf866e3ef313 100644 (file)
@@ -10,7 +10,7 @@ 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.ByteBufUtils;
 import org.opendaylight.openflowjava.protocol.impl.util.EncodeConstants;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;
@@ -29,26 +29,10 @@ public class OF10PortStatusMessageFactory implements OFDeserializer<PortStatusMe
 
     private static final byte PADDING_IN_PORT_STATUS_HEADER = 7;
 
-    private static OF10PortStatusMessageFactory instance;
-    
-    private OF10PortStatusMessageFactory() {
-        // Singleton
-    }
-    
-    /**
-     * @return singleton factory
-     */
-    public static synchronized OF10PortStatusMessageFactory getInstance(){
-        if(instance == null){
-            instance = new OF10PortStatusMessageFactory();
-        }
-        return instance;
-    }
-    
     @Override
-    public PortStatusMessage bufferToMessage(ByteBuf rawMessage, short version) {
+    public PortStatusMessage deserialize(ByteBuf rawMessage) {
         PortStatusMessageBuilder builder = new PortStatusMessageBuilder(); 
-        builder.setVersion(version);
+        builder.setVersion((short) EncodeConstants.OF10_VERSION_ID);
         builder.setXid(rawMessage.readUnsignedInt());
         builder.setReason(PortReason.forValue(rawMessage.readUnsignedByte()));
         rawMessage.skipBytes(PADDING_IN_PORT_STATUS_HEADER);