1 /* Copyright (C)2013 Pantheon Technologies, s.r.o. All rights reserved. */
\r
2 package org.opendaylight.openflowjava.protocol.impl.serialization.factories;
\r
4 import io.netty.buffer.ByteBuf;
\r
6 import org.opendaylight.openflowjava.protocol.impl.serialization.OFSerializer;
\r
7 import org.opendaylight.openflowjava.protocol.impl.util.ByteBufUtils;
\r
8 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierInput;
\r
11 * Translates BarrierRequest messages
\r
12 * @author michal.polkorab
\r
13 * @author timotej.kubas
\r
15 public class BarrierInputMessageFactory implements OFSerializer<BarrierInput> {
\r
17 /** Code type of BarrierRequest message */
\r
18 public static final byte MESSAGE_TYPE = 20;
\r
19 private static BarrierInputMessageFactory instance;
\r
20 private static final int MESSAGE_LENGTH = 8;
\r
22 private BarrierInputMessageFactory() {
\r
23 // do nothing, just singleton
\r
27 * @return singleton factory
\r
29 public static synchronized BarrierInputMessageFactory getInstance() {
\r
30 if (instance == null) {
\r
31 instance = new BarrierInputMessageFactory();
\r
37 public void messageToBuffer(short version, ByteBuf out, BarrierInput message) {
\r
38 ByteBufUtils.writeOFHeader(instance, message, out);
\r
42 public int computeLength(BarrierInput message) {
\r
43 return MESSAGE_LENGTH;
\r
47 public byte getMessageType() {
\r
48 return MESSAGE_TYPE;
\r