-/* Copyright (C)2013 Pantheon Technologies, s.r.o. All rights reserved. */\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.factories;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import java.math.BigInteger;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.OFDeserializer;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ControllerRole;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.RoleRequestOutput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.RoleRequestOutputBuilder;\r
-\r
-/**\r
- * Translates RoleReply messages\r
- * @author timotej.kubas\r
- * @author michal.polkorab\r
- */\r
-public class RoleReplyMessageFactory implements OFDeserializer<RoleRequestOutput>{\r
- private static RoleReplyMessageFactory instance;\r
- private static final byte PADDING_IN_ROLE_REPLY_HEADER = 4;\r
- \r
- private RoleReplyMessageFactory() {\r
- // singleton\r
- }\r
- \r
- /**\r
- * \r
- * @return singleton factory\r
- */\r
- public static synchronized RoleReplyMessageFactory getInstance(){\r
- if(instance == null){\r
- instance = new RoleReplyMessageFactory();\r
- }\r
- return instance;\r
- }\r
-\r
- @Override\r
- public RoleRequestOutput bufferToMessage(ByteBuf rawMessage, short version) {\r
- RoleRequestOutputBuilder builder = new RoleRequestOutputBuilder();\r
- builder.setVersion(version);\r
- builder.setXid(rawMessage.readUnsignedInt());\r
- builder.setRole(ControllerRole.forValue((int) rawMessage.readUnsignedInt()));\r
- rawMessage.skipBytes(PADDING_IN_ROLE_REPLY_HEADER);\r
- byte[] generationID = new byte[8];\r
- rawMessage.readBytes(generationID);\r
- builder.setGenerationId(new BigInteger(generationID));\r
- return builder.build();\r
- }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.deserialization.factories;
+
+import io.netty.buffer.ByteBuf;
+
+import java.math.BigInteger;
+
+import org.opendaylight.openflowjava.protocol.impl.deserialization.OFDeserializer;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ControllerRole;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.RoleRequestOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.RoleRequestOutputBuilder;
+
+/**
+ * Translates RoleReply messages
+ * @author timotej.kubas
+ * @author michal.polkorab
+ */
+public class RoleReplyMessageFactory implements OFDeserializer<RoleRequestOutput>{
+ private static RoleReplyMessageFactory instance;
+ private static final byte PADDING_IN_ROLE_REPLY_HEADER = 4;
+
+ private RoleReplyMessageFactory() {
+ // singleton
+ }
+
+ /**
+ *
+ * @return singleton factory
+ */
+ public static synchronized RoleReplyMessageFactory getInstance(){
+ if(instance == null){
+ instance = new RoleReplyMessageFactory();
+ }
+ return instance;
+ }
+
+ @Override
+ public RoleRequestOutput bufferToMessage(ByteBuf rawMessage, short version) {
+ RoleRequestOutputBuilder builder = new RoleRequestOutputBuilder();
+ builder.setVersion(version);
+ builder.setXid(rawMessage.readUnsignedInt());
+ builder.setRole(ControllerRole.forValue((int) rawMessage.readUnsignedInt()));
+ rawMessage.skipBytes(PADDING_IN_ROLE_REPLY_HEADER);
+ byte[] generationID = new byte[8];
+ rawMessage.readBytes(generationID);
+ builder.setGenerationId(new BigInteger(generationID));
+ return builder.build();
+ }
+}