Merge "Schedule response to client"
[cps.git] / cps-service / src / main / java / org / onap / cps / spi / CpsAdminPersistenceService.java
1 /*
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
11  *
12  *      http://www.apache.org/licenses/LICENSE-2.0
13  *
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.
19  *
20  * SPDX-License-Identifier: Apache-2.0
21  * ============LICENSE_END=========================================================
22  */
23
24 package org.onap.cps.spi;
25
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;
30
31 /*
32     Service for handling CPS admin data.
33  */
34 public interface CpsAdminPersistenceService {
35
36     /**
37      * Create dataspace.
38      *
39      * @param dataspaceName dataspace name
40      * @throws AlreadyDefinedException if dataspace with same name already exists
41      */
42     void createDataspace(String dataspaceName);
43
44     /**
45      * Delete dataspace.
46      *
47      * @param dataspaceName the name of the dataspace to delete
48      */
49     void deleteDataspace(String dataspaceName);
50
51     /**
52      * Get dataspace.
53      *
54      * @param dataspaceName dataspace name
55      * @return a dataspace
56      */
57     Dataspace getDataspace(String dataspaceName);
58
59     /**
60      * Get all dataspaces.
61      *
62      * @return a collection of dataspaces.
63      */
64     Collection<Dataspace> getAllDataspaces();
65
66     /**
67      * Create an Anchor.
68      *
69      * @param dataspaceName dataspace name
70      * @param schemaSetName schema set name
71      * @param anchorName    anchor name
72      */
73     void createAnchor(String dataspaceName, String schemaSetName, String anchorName);
74
75     /**
76      * Read all anchors associated with the given schema-set in the given dataspace.
77      *
78      * @param dataspaceName dataspace name
79      * @param schemaSetName schema-set name
80      * @return a collection of anchors
81      */
82     Collection<Anchor> getAnchors(String dataspaceName, String schemaSetName);
83
84     /**
85      * Read all anchors associated with multiple schema-sets in the given dataspace.
86      *
87      * @param dataspaceName  dataspace name
88      * @param schemaSetNames schema-set names
89      * @return a collection of anchors
90      */
91     Collection<Anchor> getAnchors(String dataspaceName, Collection<String> schemaSetNames);
92
93     /**
94      * Read all anchors in the given a dataspace.
95      *
96      * @param dataspaceName dataspace name
97      * @return a collection of anchors
98      */
99     Collection<Anchor> getAnchors(String dataspaceName);
100
101     /**
102      * Query anchor names for the given module names in the provided dataspace.
103      * If dataspace or one of the given module names does not exists, return with an empty collection.
104      *
105      * @param dataspaceName dataspace name
106      * @param moduleNames a collection of module names
107      * @return a collection of anchor names in the given dataspace. The schema set for each anchor must include all the
108      *         given module names
109      */
110     Collection<String> queryAnchorNames(String dataspaceName, Collection<String> moduleNames);
111
112     /**
113      * Get an anchor in the given dataspace using the anchor name.
114      *
115      * @param dataspaceName dataspace name
116      * @param anchorName anchor name
117      * @return an anchor
118      */
119     Anchor getAnchor(String dataspaceName, String anchorName);
120
121     /**
122      * Delete anchor by name in given dataspace.
123      *
124      * @param dataspaceName dataspace name
125      * @param anchorName anchor name
126      */
127     void deleteAnchor(String dataspaceName, String anchorName);
128
129     /**
130      * Delete anchors by name in given dataspace.
131      *
132      * @param dataspaceName dataspace name
133      * @param anchorNames   anchor names
134      */
135     void deleteAnchors(String dataspaceName, Collection<String> anchorNames);
136
137     /**
138      * Delete anchors by name in given dataspace.
139      *
140      * @param dataspaceName dataspace name
141      * @param anchorName    anchor name
142      * @param schemaSetName schema set name
143      */
144     void updateAnchorSchemaSet(String dataspaceName, String anchorName, String schemaSetName);
145 }