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(YangStoreSnapshotImpl yangStoreSnapshot) {
33 this.moduleMXBeanEntryMap = yangStoreSnapshot.moduleMXBeanEntryMap;
34 this.moduleMap = yangStoreSnapshot.moduleMap;
38 public Map<String, Map<String, ModuleMXBeanEntry>> getModuleMXBeanEntryMap() {
39 return moduleMXBeanEntryMap;
43 public Map<String, Entry<Module, String>> getModuleMap() {
48 public int countModuleMXBeanEntries() {
50 for (Map<String, ModuleMXBeanEntry> value : moduleMXBeanEntryMap
52 i += value.keySet().size();
59 // TODO: reference counting