dd4059d88ce97490a6a81f759e9320e7b0a1599f
[cps.git] / cps-service / src / main / java / org / onap / cps / spi / CpsAdminPersistenceService.java
1 /*
2  * ============LICENSE_START=======================================================
3  *  Copyright (C) 2020 Nordix Foundation.
4  *  Modifications Copyright (C) 2020-2022 Bell Canada.
5  *  Modifications Copyright (C) 2021 Pantheon.tech
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  * SPDX-License-Identifier: Apache-2.0
20  * ============LICENSE_END=========================================================
21  */
22
23 package org.onap.cps.spi;
24
25 import java.util.Collection;
26 import org.onap.cps.spi.exceptions.AlreadyDefinedException;
27 import org.onap.cps.spi.model.Anchor;
28
29 /*
30     Service for handling CPS admin data.
31  */
32 public interface CpsAdminPersistenceService {
33
34     /**
35      * Create dataspace.
36      *
37      * @param dataspaceName dataspace name
38      * @throws AlreadyDefinedException if dataspace with same name already exists
39      */
40     void createDataspace(String dataspaceName);
41
42     /**
43      * Delete dataspace.
44      *
45      * @param dataspaceName the name of the dataspace to delete
46      */
47     void deleteDataspace(String dataspaceName);
48
49     /**
50      * Create an Anchor.
51      *
52      * @param dataspaceName dataspace name
53      * @param schemaSetName schema set name
54      * @param anchorName    anchor name
55      */
56     void createAnchor(String dataspaceName, String schemaSetName, String anchorName);
57
58     /**
59      * Read all anchors associated the given schema-set in the given dataspace.
60      *
61      * @param dataspaceName dataspace name
62      * @param schemaSetName schema-set name
63      * @return a collection of anchors
64      */
65     Collection<Anchor> getAnchors(String dataspaceName, String schemaSetName);
66
67     /**
68      * Read all anchors in the given a dataspace.
69      *
70      * @param dataspaceName dataspace name
71      * @return a collection of anchors
72      */
73     Collection<Anchor> getAnchors(String dataspaceName);
74
75     /**
76      * Query anchor names for the given module names in the provided dataspace.
77      *
78      *
79      * @param dataspaceName dataspace name
80      * @param moduleNames a collection of module names
81      * @return a collection of anchor names in the given dataspace. The schema set for each anchor must include all the
82      *         given module names
83      */
84     Collection<Anchor> queryAnchors(String dataspaceName, Collection<String> moduleNames);
85
86     /**
87      * Get an anchor in the given dataspace using the anchor name.
88      *
89      * @param dataspaceName dataspace name
90      * @param anchorName anchor name
91      * @return an anchor
92      */
93     Anchor getAnchor(String dataspaceName, String anchorName);
94
95     /**
96      * Delete anchor by name in given dataspace.
97      *
98      * @param dataspaceName dataspace name
99      * @param anchorName anchor name
100      */
101     void deleteAnchor(String dataspaceName, String anchorName);
102 }