2 * ============LICENSE_START=======================================================
3 * Copyright (C) 2020-2022 Nordix Foundation.
4 * Modifications Copyright (C) 2020-2022 Bell Canada.
5 * Modifications Copyright (C) 2021 Pantheon.tech
6 * Modifications Copyright (C) 2022 TechMahindra Ltd.
7 * ================================================================================
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
20 * SPDX-License-Identifier: Apache-2.0
21 * ============LICENSE_END=========================================================
24 package org.onap.cps.spi;
26 import java.util.Collection;
27 import org.onap.cps.spi.exceptions.AlreadyDefinedException;
28 import org.onap.cps.spi.model.Anchor;
29 import org.onap.cps.spi.model.Dataspace;
32 Service for handling CPS admin data.
34 public interface CpsAdminPersistenceService {
39 * @param dataspaceName dataspace name
40 * @throws AlreadyDefinedException if dataspace with same name already exists
42 void createDataspace(String dataspaceName);
47 * @param dataspaceName the name of the dataspace to delete
49 void deleteDataspace(String dataspaceName);
54 * @param dataspaceName dataspace name
57 Dataspace getDataspace(String dataspaceName);
62 * @return a collection of dataspaces.
64 Collection<Dataspace> getAllDataspaces();
69 * @param dataspaceName dataspace name
70 * @param schemaSetName schema set name
71 * @param anchorName anchor name
73 void createAnchor(String dataspaceName, String schemaSetName, String anchorName);
76 * Read all anchors associated the given schema-set in the given dataspace.
78 * @param dataspaceName dataspace name
79 * @param schemaSetName schema-set name
80 * @return a collection of anchors
82 Collection<Anchor> getAnchors(String dataspaceName, String schemaSetName);
85 * Read all anchors in the given a dataspace.
87 * @param dataspaceName dataspace name
88 * @return a collection of anchors
90 Collection<Anchor> getAnchors(String dataspaceName);
93 * Query anchor names for the given module names in the provided dataspace.
94 * If dataspace or one of the given module names does not exists, return with an empty collection.
96 * @param dataspaceName dataspace name
97 * @param moduleNames a collection of module names
98 * @return a collection of anchor names in the given dataspace. The schema set for each anchor must include all the
101 Collection<Anchor> queryAnchors(String dataspaceName, Collection<String> moduleNames);
104 * Get an anchor in the given dataspace using the anchor name.
106 * @param dataspaceName dataspace name
107 * @param anchorName anchor name
110 Anchor getAnchor(String dataspaceName, String anchorName);
113 * Delete anchor by name in given dataspace.
115 * @param dataspaceName dataspace name
116 * @param anchorName anchor name
118 void deleteAnchor(String dataspaceName, String anchorName);