X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fconfig%2Fyang-store-impl%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fconfig%2Fyang%2Fstore%2Fimpl%2FYangStoreSnapshotImpl.java;fp=opendaylight%2Fconfig%2Fyang-store-impl%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fconfig%2Fyang%2Fstore%2Fimpl%2FYangStoreSnapshotImpl.java;h=0000000000000000000000000000000000000000;hp=474d7547984b73f0670d02e816a5a3309be2b079;hb=c99a5bb839b67beefc5a339e60438894ab4037c2;hpb=a8ceea323c972b086d3c9e6817dce53659ce8343 diff --git a/opendaylight/config/yang-store-impl/src/main/java/org/opendaylight/controller/config/yang/store/impl/YangStoreSnapshotImpl.java b/opendaylight/config/yang-store-impl/src/main/java/org/opendaylight/controller/config/yang/store/impl/YangStoreSnapshotImpl.java deleted file mode 100644 index 474d754798..0000000000 --- a/opendaylight/config/yang-store-impl/src/main/java/org/opendaylight/controller/config/yang/store/impl/YangStoreSnapshotImpl.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ -package org.opendaylight.controller.config.yang.store.impl; - -import org.opendaylight.controller.config.yang.store.api.YangStoreSnapshot; -import org.opendaylight.controller.config.yangjmxgenerator.ModuleMXBeanEntry; -import org.opendaylight.yangtools.yang.common.QName; -import org.opendaylight.yangtools.yang.model.api.Module; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.Collections; -import java.util.Map; -import java.util.Set; - -public class YangStoreSnapshotImpl implements YangStoreSnapshot { - private static final Logger logger = LoggerFactory.getLogger(YangStoreSnapshotImpl.class); - - @Deprecated - private final Map> moduleMXBeanEntryMap; - - private final Map modulesToSources; - private final Map> qNamesToIdentitiesToModuleMXBeanEntries; - - public YangStoreSnapshotImpl(Map> moduleMXBeanEntryMap, - Map modulesToSources, - Map> qNamesToIdentitiesToModuleMXBeanEntries) { - - this.moduleMXBeanEntryMap = Collections.unmodifiableMap(moduleMXBeanEntryMap); - this.modulesToSources = Collections.unmodifiableMap(modulesToSources); - this.qNamesToIdentitiesToModuleMXBeanEntries = Collections.unmodifiableMap(qNamesToIdentitiesToModuleMXBeanEntries); - } - - public static YangStoreSnapshotImpl copy(YangStoreSnapshot yangStoreSnapshot) { - return new YangStoreSnapshotImpl( - yangStoreSnapshot.getModuleMXBeanEntryMap(), - yangStoreSnapshot.getModulesToSources(), - yangStoreSnapshot.getQNamesToIdentitiesToModuleMXBeanEntries()); - } - - /** - * @return all loaded config modules. Key of outer map is namespace of yang file. - * Key of inner map is name of module entry. Value is module entry. - */ - @Override - public Map> getModuleMXBeanEntryMap() { - return moduleMXBeanEntryMap; - } - - @Override - public Map> getQNamesToIdentitiesToModuleMXBeanEntries() { - return qNamesToIdentitiesToModuleMXBeanEntries; - } - - @Override - public Set getModules() { - return modulesToSources.keySet(); - } - - @Override - public String getModuleSource(Module module) { - String result = modulesToSources.get(module); - if (result == null) { - logger.trace("Cannot find module {} in {}", module, modulesToSources); - throw new IllegalArgumentException("Module not found in this snapshot:" + module); - } - return result; - } - - @Override - public Map getModulesToSources() { - return modulesToSources; - } - - @Override - public int countModuleMXBeanEntries() { - int i = 0; - for (Map value : moduleMXBeanEntryMap - .values()) { - i += value.keySet().size(); - } - return i; - } - - @Override - public void close() { - // TODO: reference counting - } - -}