2 * ============LICENSE_START=======================================================
3 * Copyright (C) 2023 Nordix Foundation
4 * ================================================================================
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
17 * SPDX-License-Identifier: Apache-2.0
18 * ============LICENSE_END=========================================================
21 package org.onap.cps.api;
23 import java.util.Collection;
24 import org.onap.cps.spi.exceptions.CpsException;
25 import org.onap.cps.spi.model.Anchor;
27 public interface CpsAnchorService {
32 * @param dataspaceName dataspace name
33 * @param schemaSetName schema set name
34 * @param anchorName anchor name
35 * @throws CpsException if input data is invalid.
37 void createAnchor(String dataspaceName, String schemaSetName, String anchorName);
40 * Read all anchors in the given dataspace.
42 * @param dataspaceName dataspace name
43 * @return a collection of anchors
45 Collection<Anchor> getAnchors(String dataspaceName);
48 * Read all anchors associated with the given schema-set in the given dataspace.
50 * @param dataspaceName dataspace name
51 * @param schemaSetName schema-set name
52 * @return a collection of anchors
54 Collection<Anchor> getAnchors(String dataspaceName, String schemaSetName);
57 * Read all anchors associated with the given schema-sets in the given dataspace.
59 * @param dataspaceName dataspace name
60 * @param schemaSetNames schema-set names
61 * @return a collection of anchors
63 Collection<Anchor> getAnchors(String dataspaceName, Collection<String> schemaSetNames);
66 * Get an anchor in the given dataspace using the anchor name.
68 * @param dataspaceName dataspace name
69 * @param anchorName anchor name
72 Anchor getAnchor(String dataspaceName, String anchorName);
75 * Delete anchor by name in given dataspace.
77 * @param dataspaceName dataspace name
78 * @param anchorName anchor name
80 void deleteAnchor(String dataspaceName, String anchorName);
83 * Delete anchors by name in given dataspace.
85 * @param dataspaceName dataspace name
86 * @param anchorNames anchor names
88 void deleteAnchors(String dataspaceName, Collection<String> anchorNames);
91 * Query anchor names for the given module names in the provided dataspace.
93 * @param dataspaceName dataspace name
94 * @param moduleNames a collection of module names
95 * @return a collection of anchor names in the given dataspace. The schema set for each anchor must include all the
98 Collection<String> queryAnchorNames(String dataspaceName, Collection<String> moduleNames);
101 * Update schema set of an anchor.
103 * @param dataspaceName dataspace name
104 * @param anchorName anchor name
105 * @param schemaSetName schema set name
107 void updateAnchorSchemaSet(String dataspaceName, String anchorName, String schemaSetName);