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