2 * ============LICENSE_START=======================================================
3 * Copyright (C) 2020 Nordix Foundation
4 * Modifications Copyright (C) 2020-2022 Bell Canada.
5 * ================================================================================
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
18 * SPDX-License-Identifier: Apache-2.0
19 * ============LICENSE_END=========================================================
22 package org.onap.cps.spi;
24 import java.util.Collection;
25 import java.util.List;
27 import org.onap.cps.spi.model.ModuleReference;
30 * Service to manage modules.
32 public interface CpsModulePersistenceService {
37 * @param dataspaceName dataspace name
38 * @param schemaSetName schema set name
39 * @param yangResourcesNameToContentMap YANG resources (files) map where key is a name and value is content
41 void storeSchemaSet(String dataspaceName, String schemaSetName, Map<String, String> yangResourcesNameToContentMap);
44 * Stores a schema set from new modules and existing modules.
46 * @param dataspaceName Dataspace name
47 * @param schemaSetName Schema set name
48 * @param newYangResourcesModuleNameToContentMap YANG resources map where key is a module name and value is content
49 * @param moduleReferences List of YANG resources module references
51 void storeSchemaSetFromModules(String dataspaceName, String schemaSetName,
52 Map<String, String> newYangResourcesModuleNameToContentMap, List<ModuleReference> moduleReferences);
57 * @param dataspaceName dataspace name
58 * @param schemaSetName schema set name
60 void deleteSchemaSet(String dataspaceName, String schemaSetName);
63 * Returns YANG resources per specific dataspace / schemaSetName.
65 * @param dataspaceName dataspace name
66 * @param schemaSetName schema set name
67 * @return YANG resources (files) map where key is a name and value is content
69 Map<String, String> getYangSchemaResources(String dataspaceName, String schemaSetName);
72 * Returns YANG resources per specific dataspace / anchorName.
74 * @param dataspaceName dataspace name
75 * @param anchorName anchor name
76 * @return YANG resources (files) map where key is a name and value is content
78 Map<String, String> getYangSchemaSetResources(String dataspaceName, String anchorName);
81 * Returns YANG resources module references for the given dataspace name.
83 * @param dataspaceName dataspace name
84 * @return Collection of all YANG resources module information in the database
86 Collection<ModuleReference> getYangResourceModuleReferences(String dataspaceName);
89 * Get YANG resource module references for the given anchor name and dataspace name.
91 * @param dataspaceName dataspace name
92 * @param anchorName anchor name
93 * @return a collection of module names and revisions
95 Collection<ModuleReference> getYangResourceModuleReferences(String dataspaceName, String anchorName);
98 * Remove unused Yang Resource Modules.
100 void deleteUnusedYangResourceModules();