diff options
author | 2021-01-06 13:09:34 +0000 | |
---|---|---|
committer | 2021-01-15 14:32:35 +0000 | |
commit | a16c3fb5f7f0bbe7bda9e4f21f71a3e958ed523f (patch) | |
tree | b1e700f5c9915a38fc85af82df799072f3dd7035 /cps-service/src/main/java/org/onap | |
parent | 4118d94f71a4e5f5a4aef038f51c66fd2c1b8b60 (diff) |
Retrieve the SchemaSet resources for an Anchor
Issue-ID: CPS-135
Signed-off-by: Rishi.Chail <rishi.chail@est.tech>
Change-Id: Ib7c17c5180212c7dd3b96cf27797c84166041cf9
Diffstat (limited to 'cps-service/src/main/java/org/onap')
-rwxr-xr-x[-rw-r--r--] | cps-service/src/main/java/org/onap/cps/spi/CpsAdminPersistenceService.java | 12 | ||||
-rwxr-xr-x[-rw-r--r--] | cps-service/src/main/java/org/onap/cps/spi/CpsModulePersistenceService.java | 22 | ||||
-rwxr-xr-x | cps-service/src/main/java/org/onap/cps/spi/exceptions/AnchorNotFoundException.java | 38 |
3 files changed, 66 insertions, 6 deletions
diff --git a/cps-service/src/main/java/org/onap/cps/spi/CpsAdminPersistenceService.java b/cps-service/src/main/java/org/onap/cps/spi/CpsAdminPersistenceService.java index 5643aedb7..06c04ceb6 100644..100755 --- a/cps-service/src/main/java/org/onap/cps/spi/CpsAdminPersistenceService.java +++ b/cps-service/src/main/java/org/onap/cps/spi/CpsAdminPersistenceService.java @@ -57,4 +57,14 @@ public interface CpsAdminPersistenceService { */ @NonNull Collection<Anchor> getAnchors(@NonNull String dataspaceName); -} + + /** + * Get an anchor in the given dataspace using the anchor name. + * + * @param dataspaceName dataspace name + * @param anchorName anchor name + * @return an anchor + */ + @NonNull + Anchor getAnchor(@NonNull String dataspaceName, @NonNull String anchorName); +}
\ No newline at end of file diff --git a/cps-service/src/main/java/org/onap/cps/spi/CpsModulePersistenceService.java b/cps-service/src/main/java/org/onap/cps/spi/CpsModulePersistenceService.java index a82d69acb..dc4e26b91 100644..100755 --- a/cps-service/src/main/java/org/onap/cps/spi/CpsModulePersistenceService.java +++ b/cps-service/src/main/java/org/onap/cps/spi/CpsModulePersistenceService.java @@ -36,15 +36,27 @@ public interface CpsModulePersistenceService { * @param yangResourcesNameToContentMap YANG resources (files) map where key is a name and value is content */ void storeSchemaSet(@NonNull String dataspaceName, @NonNull String schemaSetName, - @NonNull Map<String, String> yangResourcesNameToContentMap); + @NonNull Map<String, String> yangResourcesNameToContentMap); /** - * Returns YANG resources per specific namespace / schemaSetName. + * Returns YANG resources per specific dataspace / schemaSetName. * - * @param namespace module namespace + * @param dataspaceName dataspace name * @param schemaSetName schema set name * @return YANG resources (files) map where key is a name and value is content */ @NonNull - Map<String, String> getYangSchemaResources(@NonNull String namespace, @NonNull String schemaSetName); -} + Map<String, String> getYangSchemaResources(@NonNull String dataspaceName, + @NonNull String schemaSetName); + + /** + * Returns YANG resources per specific dataspace / anchorName. + * + * @param dataspaceName dataspace name + * @param anchorName anchor name + * @return YANG resources (files) map where key is a name and value is content + */ + @NonNull + Map<String, String> getYangSchemaSetResources(@NonNull String dataspaceName, + @NonNull String anchorName); +}
\ No newline at end of file diff --git a/cps-service/src/main/java/org/onap/cps/spi/exceptions/AnchorNotFoundException.java b/cps-service/src/main/java/org/onap/cps/spi/exceptions/AnchorNotFoundException.java new file mode 100755 index 000000000..847959fc0 --- /dev/null +++ b/cps-service/src/main/java/org/onap/cps/spi/exceptions/AnchorNotFoundException.java @@ -0,0 +1,38 @@ +/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2021 Nordix Foundation. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.cps.spi.exceptions;
+
+public class AnchorNotFoundException extends CpsAdminException {
+
+ private static final long serialVersionUID = -1821064664642194882L;
+
+ /**
+ * Constructor.
+ *
+ * @param anchorName the name of the anchor
+ * @param dataspaceName the dataspace name
+ */
+ public AnchorNotFoundException(final String anchorName, final String dataspaceName) {
+ super("Anchor not found",
+ String.format("Anchor with name %s does not exist in dataspace %s.", anchorName,
+ dataspaceName));
+ }
+}
\ No newline at end of file |