2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
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
9 package org.opendaylight.controller.config.yang.md.sal.binding.impl;
11 import java.util.Collections;
14 import org.opendaylight.controller.config.api.DependencyResolver;
15 import org.opendaylight.controller.config.api.DependencyResolverFactory;
16 import org.opendaylight.controller.config.api.DynamicMBeanWithInstance;
17 import org.opendaylight.controller.config.api.ModuleIdentifier;
18 import org.opendaylight.controller.config.spi.Module;
19 import org.osgi.framework.BundleContext;
24 public class BindingBrokerImplSingletonModuleFactory extends
25 org.opendaylight.controller.config.yang.md.sal.binding.impl.AbstractBindingBrokerImplSingletonModuleFactory {
27 private static final String SINGLETON_NAME = "binding-broker-singleton";
28 public static BindingBrokerImplSingletonModule SINGLETON;
29 public static ModuleIdentifier SINGLETON_IDENTIFIER = new ModuleIdentifier(NAME, SINGLETON_NAME);
32 public Module createModule(String instanceName, DependencyResolver dependencyResolver, BundleContext bundleContext) {
33 throw new UnsupportedOperationException("Only default instance supported.");
37 public Module createModule(String instanceName, DependencyResolver dependencyResolver,
38 DynamicMBeanWithInstance old, BundleContext bundleContext) throws Exception {
43 public Set<BindingBrokerImplSingletonModule> getDefaultModules(DependencyResolverFactory dependencyResolverFactory,
44 BundleContext bundleContext) {
45 if (SINGLETON == null) {
47 DependencyResolver dependencyResolver = dependencyResolverFactory
48 .createDependencyResolver(SINGLETON_IDENTIFIER);
49 SINGLETON = new BindingBrokerImplSingletonModule(SINGLETON_IDENTIFIER, dependencyResolver);
50 SINGLETON.setBundleContext(bundleContext);
53 return Collections.singleton(SINGLETON);