Merge "Upgrade Open daylight yang tool to version 8.0.6"
[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 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 in the given a dataspace.
86      *
87      * @param dataspaceName dataspace name
88      * @return a collection of anchors
89      */
90     Collection<Anchor> getAnchors(String dataspaceName);
91
92     /**
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.
95      *
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
99      *         given module names
100      */
101     Collection<Anchor> queryAnchors(String dataspaceName, Collection<String> moduleNames);
102
103     /**
104      * Get an anchor in the given dataspace using the anchor name.
105      *
106      * @param dataspaceName dataspace name
107      * @param anchorName anchor name
108      * @return an anchor
109      */
110     Anchor getAnchor(String dataspaceName, String anchorName);
111
112     /**
113      * Delete anchor by name in given dataspace.
114      *
115      * @param dataspaceName dataspace name
116      * @param anchorName anchor name
117      */
118     void deleteAnchor(String dataspaceName, String anchorName);
119 }