2 * Copyright (c) 2015 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.facade.xml;
11 import com.google.common.collect.Sets;
13 import org.opendaylight.controller.config.facade.xml.osgi.YangStoreService;
14 import org.opendaylight.controller.config.util.ConfigRegistryClient;
15 import org.opendaylight.controller.config.util.ConfigRegistryJMXClient;
16 import org.opendaylight.controller.config.util.capability.Capability;
17 import org.opendaylight.controller.config.util.capability.YangModuleCapability;
18 import org.opendaylight.yangtools.yang.model.api.Module;
20 public class ConfigSubsystemFacadeFactory {
22 private ConfigRegistryClient cfgRegClient;
23 private ConfigRegistryJMXClient cfgRegClientNoNotifications;
24 private YangStoreService yangStoreService;
26 public ConfigSubsystemFacadeFactory(final ConfigRegistryClient cfgRegClient, final ConfigRegistryJMXClient jmxClientNoNotifications, final YangStoreService yangStoreService) {
27 this.cfgRegClient = cfgRegClient;
28 this.cfgRegClientNoNotifications = jmxClientNoNotifications;
29 this.yangStoreService = yangStoreService;
33 * Create new instance of ConfigSubsystemFacade. Each instance works with a dedicated transaction provider, making
34 * the instances suitable for facade-per-client use.
36 public ConfigSubsystemFacade createFacade(final String id) {
37 return new ConfigSubsystemFacade(cfgRegClient, cfgRegClientNoNotifications, yangStoreService, id);
40 public YangStoreService getYangStoreService() {
41 return yangStoreService;
44 public Set<Capability> getCurrentCapabilities() {
45 Set<Module> modules = yangStoreService.getModules();
46 final Set<Capability> capabilities = Sets.newHashSet();
47 for (Module module : modules) {
48 capabilities.add(new YangModuleCapability(module, yangStoreService.getModuleSource(module)));