Bug 5540 - PortConvertor, MatchConvertor
[openflowplugin.git] / openflowplugin / src / main / java / org / opendaylight / openflowplugin / openflow / md / core / sal / convertor / action / ActionSetNwSrcReactor.java
1 /**
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8
9 package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action;
10
11 import java.util.Map;
12
13 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertReactor;
14 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.Convertor;
15 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.InjectionKey;
16 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.InjectionResultTargetKey;
17 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ResultInjector;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwSrcActionCase;
19
20 /**
21  *
22  */
23 public class ActionSetNwSrcReactor extends ConvertReactor<SetNwSrcActionCase> {
24
25     private static ActionSetNwSrcReactor INSTANCE = new ActionSetNwSrcReactor();
26
27     private ActionSetNwSrcReactor() {
28         //NOOP
29     }
30
31     /**
32      * @return singleton
33      */
34     public static ActionSetNwSrcReactor getInstance() {
35         return INSTANCE;
36     }
37
38     @Override
39     protected void initMappings(final Map<Short, Convertor<SetNwSrcActionCase,?>> conversions,
40             final Map<InjectionKey, ResultInjector<?,?>> injections) {
41         ActionSetNwSrcReactorMappingFactory.addSetNwSrcConvertors(conversions);
42         ActionSetNwSrcReactorMappingFactory.addSetNwSrcInjectors(injections);
43     }
44
45     @Override
46     protected InjectionKey buildInjectionKey(final short version,
47             final Object convertedItem, final Object target) {
48         InjectionResultTargetKey key = null;
49         if (convertedItem != null) {
50              key = new InjectionResultTargetKey(version, target.getClass(), convertedItem.getClass());
51         }
52         return key;
53     }
54
55 }