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
8 package org.opendaylight.controller.config.yang.store.impl;
10 import org.opendaylight.controller.config.yang.store.api.YangStoreSnapshot;
11 import org.opendaylight.controller.config.yangjmxgenerator.ModuleMXBeanEntry;
12 import org.opendaylight.yangtools.yang.model.api.Module;
14 import java.util.Collections;
16 import java.util.Map.Entry;
18 public class YangStoreSnapshotImpl implements YangStoreSnapshot {
20 private final Map<String /* Namespace from yang file */,
21 Map<String /* Name of module entry from yang file */, ModuleMXBeanEntry>> moduleMXBeanEntryMap;
23 private final Map<String, Entry<Module, String>> moduleMap;
25 public YangStoreSnapshotImpl(
26 Map<String, Map<String, ModuleMXBeanEntry>> moduleMXBeanEntryMap,
27 Map<String, Entry<Module, String>> moduleMap) {
28 this.moduleMXBeanEntryMap = Collections.unmodifiableMap(moduleMXBeanEntryMap);
29 this.moduleMap = Collections.unmodifiableMap(moduleMap);
32 public YangStoreSnapshotImpl(YangStoreSnapshot yangStoreSnapshot) {
33 this.moduleMXBeanEntryMap = yangStoreSnapshot.getModuleMXBeanEntryMap();
34 this.moduleMap = yangStoreSnapshot.getModuleMap();
38 * @return all loaded config modules. Key of outer map is namespace of yang file.
39 * Key of inner map is name of module entry. Value is module entry.
42 public Map<String, Map<String, ModuleMXBeanEntry>> getModuleMXBeanEntryMap() {
43 return moduleMXBeanEntryMap;
47 public Map<String, Entry<Module, String>> getModuleMap() {
52 public int countModuleMXBeanEntries() {
54 for (Map<String, ModuleMXBeanEntry> value : moduleMXBeanEntryMap
56 i += value.keySet().size();
63 // TODO: reference counting