summaryrefslogtreecommitdiffstats
path: root/cps-service/src/main/java/org
diff options
context:
space:
mode:
authorniamhcore <niamh.core@est.tech>2021-02-11 14:49:11 +0000
committerniamhcore <niamh.core@est.tech>2021-02-19 10:22:59 +0000
commit760e597acc7854a736363a0136343b5a77462cfb (patch)
treebe65c9cd513bfe306ac1352c9bf9b2a230e7844d /cps-service/src/main/java/org
parent55c4135bff02800659ddc4d2de15222ba229ac51 (diff)
Persistence layer - Query Datanodes using cpsPath that contains contains a leaf name and a leaf value
Issue-ID: CPS-231 Signed-off-by: niamhcore <niamh.core@est.tech> Change-Id: I9bd483a4b76e233ab6c64b3ef8aacb593e4e9da0
Diffstat (limited to 'cps-service/src/main/java/org')
-rw-r--r--cps-service/src/main/java/org/onap/cps/spi/CpsDataPersistenceService.java12
-rw-r--r--cps-service/src/main/java/org/onap/cps/spi/exceptions/CpsPathException.java35
2 files changed, 47 insertions, 0 deletions
diff --git a/cps-service/src/main/java/org/onap/cps/spi/CpsDataPersistenceService.java b/cps-service/src/main/java/org/onap/cps/spi/CpsDataPersistenceService.java
index 9a0c180a8f..d2b6d45d66 100644
--- a/cps-service/src/main/java/org/onap/cps/spi/CpsDataPersistenceService.java
+++ b/cps-service/src/main/java/org/onap/cps/spi/CpsDataPersistenceService.java
@@ -21,6 +21,7 @@
package org.onap.cps.spi;
+import java.util.Collection;
import java.util.Map;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.onap.cps.spi.model.DataNode;
@@ -86,4 +87,15 @@ public interface CpsDataPersistenceService {
* @param dataNode data node
*/
void replaceDataNodeTree(@NonNull String dataspaceName, @NonNull String anchorName, @NonNull DataNode dataNode);
+
+ /**
+ * Get a datanode by cps path.
+ *
+ * @param dataspaceName dataspace name
+ * @param anchorName anchor name
+ * @param cpsPath cps path
+ * @return the data nodes found i.e. 0 or more data nodes
+ */
+ Collection<DataNode> queryDataNodes(@NonNull String dataspaceName, @NonNull String anchorName,
+ @NonNull String cpsPath);
}
diff --git a/cps-service/src/main/java/org/onap/cps/spi/exceptions/CpsPathException.java b/cps-service/src/main/java/org/onap/cps/spi/exceptions/CpsPathException.java
new file mode 100644
index 0000000000..fde5566b14
--- /dev/null
+++ b/cps-service/src/main/java/org/onap/cps/spi/exceptions/CpsPathException.java
@@ -0,0 +1,35 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2021 Nordix Foundation
+ * ================================================================================
+ * 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 CpsPathException extends CpsException {
+
+ private static final long serialVersionUID = 1006899957127327791L;
+
+ /**
+ * Constructor.
+ *
+ * @param message the error message
+ * @param details the error details
+ */
+ public CpsPathException(final String message, final String details) {
+ super(message, details);
+ }
+}