5aa8d6880496f96f6dd6dc00f2b96c8823ee2fcf
[aai/aai-common.git] / aai-schema-abstraction / src / main / java / org / onap / aai / schemaif / SchemaProvider.java
1 /**
2  * ============LICENSE_START=======================================================
3  * org.onap.aai
4  * ================================================================================
5  * Copyright © 2019 AT&T Intellectual Property. All rights reserved.
6  * Copyright © 2019 Amdocs
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  * ============LICENSE_END=========================================================
20  */
21
22 package org.onap.aai.schemaif;
23
24 import org.onap.aai.schemaif.definitions.EdgeSchema;
25 import org.onap.aai.schemaif.definitions.VertexSchema;
26
27 import java.util.Map;
28 import java.util.Set;
29
30 public interface SchemaProvider {
31
32     /**
33      * Load the schema into memory
34      */
35     void loadSchema() throws SchemaProviderException;
36
37     /**
38      * Get the identifier for the more recent version of the schema
39      *
40      * @return The schema version identifier
41      */
42     String getLatestSchemaVersion() throws SchemaProviderException;
43
44     /**
45      * Get the schema definition for a vertex
46      *
47      * @param vertexName - Name of the vertex
48      * @param schemaVersion - Version of the schema to use
49      *
50      * @return The vertex schema definition
51      */
52     VertexSchema getVertexSchema(String vertexName, String schemaVersion) throws SchemaProviderException;
53
54     /**
55      * Get the schema definition for an edge
56      *
57      * @param edgeType - Type of the edge
58      * @param sourceVertex - The source vertex for the edge
59      * @param targetVertex - The target vertex for the edge
60      * @param version - Version of the schema to use
61      *
62      * @return The edge schema definition
63      */
64     EdgeSchema getEdgeSchema(String edgeType, String sourceVertex, String targetVertex, String version) throws SchemaProviderException;
65
66     /**
67      * Get the list of edge definitions which are adjacent to the given vertex
68      *
69      * @param vertexType - Type of the vertex
70      * @param version - Version of the schema to use
71      *
72      * @return The list of edge schema definitions
73      */
74     Set<EdgeSchema> getAdjacentEdgeSchema(String vertexType, String version) throws SchemaProviderException;
75
76     /**
77      * Get the list of edge definitions which are valid for the given source and target
78      *
79      * @param sourceType - Type of the source vertex
80      * @param targetType - Type of the target vertex
81      * @param version - Version of the schema to use
82      *
83      * @return The list of edge schema definitions
84      */
85     Set<EdgeSchema> getEdgeSchemaForSourceTarget(String sourceType, String targetType, String version) throws SchemaProviderException;
86
87     /**
88      * Get vertex map for a schema version
89      *
90      * @param schemaVersion - Version of the schema to use
91      *
92      * @return The list of vertex types
93      */
94     Map<String, VertexSchema> getVertexMap(String schemaVersion) throws SchemaProviderException;
95  }