Javadoc update
[openflowjava.git] / openflow-protocol-impl / src / main / java / org / opendaylight / openflowjava / protocol / impl / serialization / factories / GetQueueConfigInputMessageFactory.java
1 /* Copyright (C)2013 Pantheon Technologies, s.r.o. All rights reserved. */
2 package org.opendaylight.openflowjava.protocol.impl.serialization.factories;
3
4 import io.netty.buffer.ByteBuf;
5
6 import org.opendaylight.openflowjava.protocol.impl.serialization.OFSerializer;
7 import org.opendaylight.openflowjava.protocol.impl.util.ByteBufUtils;
8 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetQueueConfigInput;
9
10 /**
11  * Translates QueueGetConfigRequest messages
12  * @author timotej.kubas
13  * @author michal.polkorab
14  */
15 public class GetQueueConfigInputMessageFactory implements OFSerializer<GetQueueConfigInput> {
16
17     private static final byte MESSAGE_TYPE = 22;
18     private static final byte PADDING_IN_GET_QUEUE_CONFIG_MESSAGE = 4;
19     private static final int MESSAGE_LENGTH = 16;
20     
21     private static GetQueueConfigInputMessageFactory instance;
22     
23  
24     private GetQueueConfigInputMessageFactory() {
25         // singleton
26     }
27     
28     
29     /**
30      * @return singleton factory
31      */
32     public static synchronized GetQueueConfigInputMessageFactory getInstance(){
33         if(instance == null){
34             instance = new GetQueueConfigInputMessageFactory();
35         }
36         return instance;
37     }
38     
39     @Override
40     public void messageToBuffer(short version, ByteBuf out, GetQueueConfigInput message){
41         ByteBufUtils.writeOFHeader(instance, message, out);
42         out.writeInt(message.getPort().getValue().intValue());
43         ByteBufUtils.padBuffer(PADDING_IN_GET_QUEUE_CONFIG_MESSAGE, out);
44     }
45
46     @Override
47     public int computeLength(GetQueueConfigInput message){
48         return MESSAGE_LENGTH;
49     }
50
51     @Override
52     public byte getMessageType() {
53         return MESSAGE_TYPE;
54     }
55 }