HostTracker hosts DB key scheme implementation
[controller.git] / opendaylight / md-sal / sal-binding-broker / src / main / java / org / opendaylight / controller / config / yang / md / sal / binding / impl / BindingBrokerImplSingletonModule.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 package org.opendaylight.controller.config.yang.md.sal.binding.impl;
9
10 import org.opendaylight.controller.sal.binding.impl.BindingAwareBrokerImpl;
11 import org.osgi.framework.BundleContext;
12
13 import com.google.common.base.Preconditions;
14
15 /**
16 *
17 */
18 public final class BindingBrokerImplSingletonModule extends org.opendaylight.controller.config.yang.md.sal.binding.impl.AbstractBindingBrokerImplSingletonModule
19 {
20
21     private BundleContext bundleContext;
22
23     public BindingBrokerImplSingletonModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
24         super(identifier, dependencyResolver);
25     }
26
27     public BindingBrokerImplSingletonModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, BindingBrokerImplSingletonModule oldModule, java.lang.AutoCloseable oldInstance) {
28         super(identifier, dependencyResolver, oldModule, oldInstance);
29     }
30
31     @Override
32     public void validate() {
33         super.validate();
34         Preconditions.checkNotNull(getBundleContext());
35     }
36
37     
38     @Override
39     public boolean canReuseInstance(AbstractBindingBrokerImplSingletonModule oldModule) {
40         return true;
41     }
42     
43     
44     public java.lang.AutoCloseable createInstance() {
45         BindingAwareBrokerImpl broker = new BindingAwareBrokerImpl(getBundleContext());
46         broker.start();
47         return broker;
48     }
49
50     public BundleContext getBundleContext() {
51         return bundleContext;
52     }
53
54     public void setBundleContext(BundleContext bundleContext) {
55         this.bundleContext = bundleContext;
56     }
57 }