Merge changes I0f752636,Idd154499,Ic35fa3e8
[controller.git] / opendaylight / md-sal / sal-binding-broker / src / main / java / org / opendaylight / controller / config / yang / md / sal / binding / impl / RuntimeMappingModule.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 javassist.ClassPool;
13
14 import org.opendaylight.controller.sal.binding.dom.serializer.impl.RuntimeGeneratedMappingServiceImpl;
15 import org.osgi.framework.BundleContext;
16
17 import com.google.common.base.Preconditions;
18
19 /**
20 *
21 */
22 public final class RuntimeMappingModule extends org.opendaylight.controller.config.yang.md.sal.binding.impl.AbstractRuntimeMappingModule
23 {
24
25     private BundleContext bundleContext;
26
27     public RuntimeMappingModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
28         super(identifier, dependencyResolver);
29     }
30
31     public RuntimeMappingModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, RuntimeMappingModule oldModule, java.lang.AutoCloseable oldInstance) {
32         super(identifier, dependencyResolver, oldModule, oldInstance);
33     }
34
35     @Override
36     public void validate(){
37         super.validate();
38         Preconditions.checkNotNull(bundleContext);
39         // Add custom validation for module attributes here.
40     }
41     
42     @Override
43     public boolean canReuseInstance(AbstractRuntimeMappingModule oldModule) {
44         return true;
45     }
46
47     @Override
48     public java.lang.AutoCloseable createInstance() {
49         RuntimeGeneratedMappingServiceImpl service = new RuntimeGeneratedMappingServiceImpl();
50         ClassPool pool = new ClassPool(); // Should be default singleton
51         service.setPool(pool);
52         service.start(getBundleContext());
53         return service;
54     }
55
56     private BundleContext getBundleContext() {
57         return bundleContext;
58     }
59
60     public void setBundleContext(BundleContext bundleContext) {
61         this.bundleContext = bundleContext;
62     }
63 }