multipart request message updated
[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  * @author timotej.kubas
12  * @author michal.polkorab
13  */
14 public class GetQueueConfigInputMessageFactory implements OFSerializer<GetQueueConfigInput> {
15
16     private static final byte MESSAGE_TYPE = 22;
17     private static final byte PADDING_IN_GET_QUEUE_CONFIG_MESSAGE = 4;
18     private static final int MESSAGE_LENGTH = 16;
19     
20     private static GetQueueConfigInputMessageFactory instance;
21     
22  
23     private GetQueueConfigInputMessageFactory() {
24         // singleton
25     }
26     
27     
28     /**
29      * @return singleton factory
30      */
31     public static synchronized GetQueueConfigInputMessageFactory getInstance(){
32         if(instance == null){
33             instance = new GetQueueConfigInputMessageFactory();
34         }
35         return instance;
36     }
37     
38     @Override
39     public void messageToBuffer(short version, ByteBuf out, GetQueueConfigInput message){
40         ByteBufUtils.writeOFHeader(instance, message, out);
41         out.writeInt(message.getPort().getValue().intValue());
42         ByteBufUtils.padBuffer(PADDING_IN_GET_QUEUE_CONFIG_MESSAGE, out);
43     }
44
45     @Override
46     public int computeLength(){
47         return MESSAGE_LENGTH;
48     }
49
50     @Override
51     public byte getMessageType() {
52         return MESSAGE_TYPE;
53     }
54 }