2 * Copyright (c) 2015, 2017 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 final ConfigRegistryClient cfgRegClient;
23 private final ConfigRegistryJMXClient cfgRegClientNoNotifications;
24 private final YangStoreService yangStoreService;
26 public ConfigSubsystemFacadeFactory(final ConfigRegistryClient cfgRegClient,
27 final ConfigRegistryJMXClient jmxClientNoNotifications, final YangStoreService yangStoreService) {
28 this.cfgRegClient = cfgRegClient;
29 this.cfgRegClientNoNotifications = jmxClientNoNotifications;
30 this.yangStoreService = yangStoreService;
34 * Create new instance of ConfigSubsystemFacade. Each instance works with a
35 * dedicated transaction provider, making the instances suitable for
36 * facade-per-client use.
38 public ConfigSubsystemFacade createFacade(final String id) {
39 return new ConfigSubsystemFacade(cfgRegClient, cfgRegClientNoNotifications, yangStoreService, id);
42 public YangStoreService getYangStoreService() {
43 return yangStoreService;
46 public Set<Capability> getCurrentCapabilities() {
47 Set<Module> modules = yangStoreService.getModules();
48 final Set<Capability> capabilities = Sets.newHashSet();
49 for (Module module : modules) {
50 capabilities.add(new YangModuleCapability(module, yangStoreService.getModuleSource(module)));