Integration test, SimpleClient bundle
[openflowjava.git] / openflow-protocol-impl / src / main / java / org / opendaylight / openflowjava / protocol / impl / deserialization / factories / BarrierReplyMessageFactory.java
1 /* Copyright (C)2013 Pantheon Technologies, s.r.o. All rights reserved. */
2 package org.opendaylight.openflowjava.protocol.impl.deserialization.factories;
3
4 import io.netty.buffer.ByteBuf;
5
6 import org.opendaylight.openflowjava.protocol.impl.deserialization.OFDeserializer;
7 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierOutput;
8 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierOutputBuilder;
9
10 /**
11  * @author michal.polkorab
12  * @author timotej.kubas
13  * 
14  */
15 public class BarrierReplyMessageFactory implements
16         OFDeserializer<BarrierOutput> {
17
18     private static BarrierReplyMessageFactory instance;
19
20     private BarrierReplyMessageFactory() {
21         // do nothing, just singleton
22     }
23
24     /**
25      * @return singleton factory
26      */
27     public static synchronized BarrierReplyMessageFactory getInstance() {
28         if (instance == null) {
29             instance = new BarrierReplyMessageFactory();
30         }
31         return instance;
32     }
33
34     @Override
35     public BarrierOutput bufferToMessage(ByteBuf rawMessage, short version) {
36         BarrierOutputBuilder builder = new BarrierOutputBuilder();
37         builder.setVersion(version);
38         builder.setXid(rawMessage.readUnsignedInt());
39         return builder.build();
40     }
41
42 }