Merge "Remove unnecessary warn log from config subsystem"
[controller.git] / opendaylight / config / shutdown-impl / src / main / java / org / opendaylight / controller / config / yang / shutdown / impl / ShutdownModuleFactory.java
1 /*
2  * Copyright (c) 2014 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  * Generated file
10
11  * Generated from: yang module name: shutdown-impl  yang module local name: shutdown
12  * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
13  * Generated at: Wed Dec 18 14:02:06 CET 2013
14  *
15  * Do not modify this file unless it is present under src/main directory
16  */
17 package org.opendaylight.controller.config.yang.shutdown.impl;
18
19 import org.opendaylight.controller.config.api.DependencyResolver;
20 import org.opendaylight.controller.config.api.DependencyResolverFactory;
21 import org.opendaylight.controller.config.api.ModuleIdentifier;
22 import org.osgi.framework.Bundle;
23 import org.osgi.framework.BundleContext;
24
25 import java.util.Arrays;
26 import java.util.Set;
27
28 public class ShutdownModuleFactory extends AbstractShutdownModuleFactory {
29
30     public ShutdownModule instantiateModule(String instanceName, DependencyResolver dependencyResolver,
31                                             ShutdownModule oldModule, AutoCloseable oldInstance,
32                                             BundleContext bundleContext) {
33         Bundle systemBundle = bundleContext.getBundle(0);
34         return new ShutdownModule(new ModuleIdentifier(NAME, instanceName), oldModule, oldInstance, systemBundle);
35     }
36
37
38     public ShutdownModule instantiateModule(String instanceName, DependencyResolver dependencyResolver,
39                                             BundleContext bundleContext) {
40         Bundle systemBundle = bundleContext.getBundle(0);
41         return new ShutdownModule(new ModuleIdentifier(NAME, instanceName), systemBundle);
42     }
43
44     @Override
45     public Set<ShutdownModule> getDefaultModules(DependencyResolverFactory dependencyResolverFactory, BundleContext bundleContext) {
46         ModuleIdentifier id = new ModuleIdentifier(NAME, NAME);
47         DependencyResolver dependencyResolver = dependencyResolverFactory.createDependencyResolver(id);
48         ShutdownModule shutdownModule = instantiateModule(NAME, dependencyResolver, bundleContext);
49         return new java.util.HashSet<>(Arrays.asList(shutdownModule));
50     }
51 }