Bug 1324 - Buffer released correctly (even if translated dataObject is null)
[openflowjava.git] / openflow-protocol-impl / src / main / java / org / opendaylight / openflowjava / protocol / impl / util / InstructionsInitializer.java
1 /*\r
2  * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
3  *\r
4  * This program and the accompanying materials are made available under the\r
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
6  * and is available at http://www.eclipse.org/legal/epl-v10.html\r
7  */\r
8 \r
9 package org.opendaylight.openflowjava.protocol.impl.util;\r
10 \r
11 import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;\r
12 import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
13 import org.opendaylight.openflowjava.protocol.impl.serialization.instruction.ApplyActionsInstructionSerializer;\r
14 import org.opendaylight.openflowjava.protocol.impl.serialization.instruction.ClearActionsInstructionSerializer;\r
15 import org.opendaylight.openflowjava.protocol.impl.serialization.instruction.GoToTableInstructionSerializer;\r
16 import org.opendaylight.openflowjava.protocol.impl.serialization.instruction.MeterInstructionSerializer;\r
17 import org.opendaylight.openflowjava.protocol.impl.serialization.instruction.WriteActionsInstructionSerializer;\r
18 import org.opendaylight.openflowjava.protocol.impl.serialization.instruction.WriteMetadataInstructionSerializer;\r
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.ApplyActions;\r
20 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.ClearActions;\r
21 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.GotoTable;\r
22 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.Meter;\r
23 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.WriteActions;\r
24 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.WriteMetadata;\r
25 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;\r
26 \r
27 /**\r
28  * @author michal.polkorab\r
29  *\r
30  */\r
31 public class InstructionsInitializer {\r
32 \r
33     /**\r
34      * Registers instruction serializers into provided registry\r
35      * @param serializerRegistry registry to be initialized with instruction serializers\r
36      */\r
37     public static void registerInstructionSerializers(SerializerRegistry serializerRegistry) {\r
38         Class<Instruction> instructionClass = Instruction.class;\r
39         // register OF v1.3 instruction serializers\r
40         EnhancedKeyRegistryHelper<Instruction> helper =\r
41                 new EnhancedKeyRegistryHelper<>(EncodeConstants.OF13_VERSION_ID,\r
42                         instructionClass, serializerRegistry);\r
43         helper.registerSerializer(GotoTable.class, new GoToTableInstructionSerializer());\r
44         helper.registerSerializer(WriteMetadata.class, new WriteMetadataInstructionSerializer());\r
45         helper.registerSerializer(WriteActions.class, new WriteActionsInstructionSerializer());\r
46         helper.registerSerializer(ApplyActions.class, new ApplyActionsInstructionSerializer());\r
47         helper.registerSerializer(ClearActions.class, new ClearActionsInstructionSerializer());\r
48         helper.registerSerializer(Meter.class, new MeterInstructionSerializer());\r
49     }\r
50 }\r