Merge "Fix for Bug 3"
[controller.git] / opendaylight / config / shutdown-impl / src / main / java / org / opendaylight / controller / config / yang / shutdown / impl / ShutdownModuleFactory.java
1 /**
2  * Generated file
3
4  * Generated from: yang module name: shutdown-impl  yang module local name: shutdown
5  * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
6  * Generated at: Wed Dec 18 14:02:06 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.shutdown.impl;
11
12 import org.opendaylight.controller.config.api.DependencyResolver;
13 import org.opendaylight.controller.config.api.ModuleIdentifier;
14 import org.osgi.framework.Bundle;
15 import org.osgi.framework.BundleContext;
16
17 public class ShutdownModuleFactory extends AbstractShutdownModuleFactory {
18
19     @Override
20     public org.opendaylight.controller.config.spi.Module createModule(String instanceName, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, org.opendaylight.controller.config.api.DynamicMBeanWithInstance old, org.osgi.framework.BundleContext bundleContext) throws Exception {
21         org.opendaylight.controller.config.yang.shutdown.impl.ShutdownModule oldModule = null;
22         try {
23             oldModule = (org.opendaylight.controller.config.yang.shutdown.impl.ShutdownModule) old.getModule();
24         } catch(Exception e) {
25             return handleChangedClass(old);
26         }
27         org.opendaylight.controller.config.yang.shutdown.impl.ShutdownModule module = instantiateModule(instanceName, dependencyResolver, oldModule, old.getInstance(), bundleContext);
28
29         module.setOldSecret(oldModule.getActualOldSecret());
30         module.setSecret(oldModule.getActualSecret());
31
32         return module;
33     }
34
35
36     public ShutdownModule instantiateModule(String instanceName, DependencyResolver dependencyResolver,
37                                             ShutdownModule oldModule, AutoCloseable oldInstance,
38                                             BundleContext bundleContext) {
39         Bundle systemBundle = bundleContext.getBundle(0);
40         return new ShutdownModule(new ModuleIdentifier(NAME, instanceName), oldModule, oldInstance, systemBundle);
41     }
42
43
44     public ShutdownModule instantiateModule(String instanceName, DependencyResolver dependencyResolver,
45                                             BundleContext bundleContext) {
46         Bundle systemBundle = bundleContext.getBundle(0);
47         return new ShutdownModule(new ModuleIdentifier(NAME, instanceName), systemBundle);
48     }
49 }