/*
* ============LICENSE_START=======================================================
- * Copyright (C) 2020-2022 Nordix Foundation
+ * Copyright (C) 2020-2023 Nordix Foundation
* Modifications Copyright (C) 2020-2022 Bell Canada.
+ * Modifications Copyright (C) 2022 TechMahindra Ltd.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
import java.util.Collection;
import java.util.Map;
+import org.onap.cps.spi.model.ModuleDefinition;
import org.onap.cps.spi.model.ModuleReference;
+import org.onap.cps.spi.model.SchemaSet;
/**
* Service to manage modules.
void storeSchemaSet(String dataspaceName, String schemaSetName, Map<String, String> yangResourcesNameToContentMap);
/**
- * Stores a schema set from new modules and existing modules.
+ * Stores a new schema set from new modules and existing modules.
*
- * @param dataspaceName Dataspace name
- * @param schemaSetName Schema set name
+ * @param dataspaceName Dataspace name
+ * @param schemaSetName Schema set name
* @param newModuleNameToContentMap YANG resources map where key is a module name and value is content
- * @param moduleReferences List of YANG resources module references
+ * @param allModuleReferences All YANG resources module references
*/
void storeSchemaSetFromModules(String dataspaceName, String schemaSetName,
- Map<String, String> newModuleNameToContentMap, Collection<ModuleReference> moduleReferences);
+ Map<String, String> newModuleNameToContentMap, Collection<ModuleReference> allModuleReferences);
+
+ /**
+ * Update an existing schema set from new modules and existing modules.
+ *
+ * @param dataspaceName Dataspace name
+ * @param schemaSetName Schema set name
+ * @param newModuleNameToContentMap YANG resources map where key is a module name and value is content
+ * @param allModuleReferences All YANG resources module references
+ */
+ void updateSchemaSetFromModules(final String dataspaceName, final String schemaSetName,
+ final Map<String, String> newModuleNameToContentMap,
+ final Collection<ModuleReference> allModuleReferences);
+
+
+ /**
+ * Get all schema sets for a given dataspace.
+ *
+ * @param dataspaceName dataspace name.
+ * @return List of schema sets
+ */
+ Collection<SchemaSet> getSchemaSetsByDataspaceName(String dataspaceName);
/**
* Deletes Schema Set.
void deleteSchemaSet(String dataspaceName, String schemaSetName);
/**
- * Returns YANG resources per specific dataspace / schemaSetName.
+ * Deletes Schema Sets.
*
- * @param dataspaceName dataspace name
- * @param schemaSetName schema set name
- * @return YANG resources (files) map where key is a name and value is content
+ * @param dataspaceName dataspace name
+ * @param schemaSetNames schema set names
*/
- Map<String, String> getYangSchemaResources(String dataspaceName, String schemaSetName);
+ void deleteSchemaSets(String dataspaceName, Collection<String> schemaSetNames);
/**
- * Returns YANG resources per specific dataspace / anchorName.
+ * Returns YANG resources per specific dataspace / schemaSetName.
*
* @param dataspaceName dataspace name
- * @param anchorName anchor name
+ * @param schemaSetName schema set name
* @return YANG resources (files) map where key is a name and value is content
*/
- Map<String, String> getYangSchemaSetResources(String dataspaceName, String anchorName);
+ Map<String, String> getYangSchemaResources(String dataspaceName, String schemaSetName);
/**
* Returns YANG resources module references for the given dataspace name.
*
* @param dataspaceName dataspace name
* @param anchorName anchor name
- * @return a collection of module names and revisions
+ * @return a collection of module reference (moduleName and revision)
*/
Collection<ModuleReference> getYangResourceModuleReferences(String dataspaceName, String anchorName);
+ /**
+ * Get YANG resource definitions for the given anchor name and dataspace name.
+ *
+ * @param dataspaceName dataspace name
+ * @param anchorName anchor name
+ * @return a collection of module definitions (moduleName, revision and yang resource content)
+ */
+ Collection<ModuleDefinition> getYangResourceDefinitions(String dataspaceName, String anchorName);
+
/**
* Remove unused Yang Resource Modules.
*/
/**
* Identify new module references from those returned by a node compared to what is in CPS already.
+ * The system will ignore the namespace of all module references.
*
* @param moduleReferencesToCheck the module references ot check
- * @returns Collection of {@link ModuleReference} of previously unknown module references
+ * @returns Collection of {@link ModuleReference} (namespace will be always blank)
+ *
*/
Collection<ModuleReference> identifyNewModuleReferences(
Collection<ModuleReference> moduleReferencesToCheck);