Merge "Queue yang model"
[controller.git] / opendaylight / md-sal / sal-binding-broker / src / main / java / org / opendaylight / controller / config / yang / md / sal / binding / impl / RuntimeMappingModuleFactory.java
1 /**
2 * Generated file
3
4 * Generated from: yang module name: opendaylight-sal-binding-broker-impl  yang module local name: runtime-generated-mapping
5 * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
6 * Generated at: Wed Nov 20 18:20:19 CET 2013
7 *
8 * Do not modify this file unless it is present under src/main directory
9 */
10 package org.opendaylight.controller.config.yang.md.sal.binding.impl;
11
12 import java.util.Collections;
13 import java.util.Set;
14
15 import org.opendaylight.controller.config.api.DependencyResolver;
16 import org.opendaylight.controller.config.api.DependencyResolverFactory;
17 import org.opendaylight.controller.config.api.DynamicMBeanWithInstance;
18 import org.opendaylight.controller.config.api.ModuleIdentifier;
19 import org.opendaylight.controller.config.spi.Module;
20 import org.osgi.framework.BundleContext;
21
22 /**
23 *
24 */
25 public class RuntimeMappingModuleFactory extends org.opendaylight.controller.config.yang.md.sal.binding.impl.AbstractRuntimeMappingModuleFactory
26 {
27
28     
29     private static  RuntimeMappingModule SINGLETON = null;
30     private static ModuleIdentifier IDENTIFIER = new ModuleIdentifier(NAME, "runtime-mapping-singleton");
31
32     @Override
33     public Module createModule(String instanceName, DependencyResolver dependencyResolver, BundleContext bundleContext) {
34         throw new UnsupportedOperationException("Only default instance supported");
35     }
36     
37     @Override
38     public Module createModule(String instanceName, DependencyResolver dependencyResolver,
39             DynamicMBeanWithInstance old, BundleContext bundleContext) throws Exception {
40         RuntimeMappingModule module = (RuntimeMappingModule) super.createModule(instanceName, dependencyResolver, old, bundleContext);
41         module.setBundleContext(bundleContext);
42         return module;
43     }
44     
45     @Override
46     public Set<RuntimeMappingModule> getDefaultModules(DependencyResolverFactory dependencyResolverFactory,
47             BundleContext bundleContext) {
48         if(SINGLETON == null) {
49             DependencyResolver dependencyResolver = dependencyResolverFactory.createDependencyResolver(IDENTIFIER);
50             SINGLETON = new RuntimeMappingModule(IDENTIFIER , dependencyResolver);
51             SINGLETON.setBundleContext(bundleContext);
52         }
53         
54         
55         return Collections.singleton(SINGLETON);
56     }
57
58 }