a9cafa5b85060ba736e7724cc5b232ab28445d23
[aai/schema-service.git] / aai-schema-service / src / main / java / org / onap / aai / schemaservice / nodeschema / validation / SchemaErrorStrategy.java
1 /**
2  * ============LICENSE_START=======================================================
3  * org.onap.aai
4  * ================================================================================
5  * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
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  * ============LICENSE_END=========================================================
19  */
20 package org.onap.aai.schemaservice.nodeschema.validation;
21
22 /**
23  * Controls response to finding problems in the schema files.
24  */
25 public interface SchemaErrorStrategy {
26   /**
27    * Gives if it is OK to proceed with whatever process
28    * invoked the validation (probably the installation of
29    * the A&AI instance).
30    *
31    * @return boolean
32    */
33   public boolean isOK();
34
35   /**
36    * Gets the error message(s) gathered in the course
37    * of validation.
38    *
39    * @return String error message or messages concatenated together
40    */
41   public String getErrorMsg();
42
43   /**
44    * Invokes the ErrorStrategy to do whatever response to
45    * an issue in the schema having been found.
46    *
47    * Options:
48    * -Throw an exception if the whole process should be
49    *  immediately aborted
50    * -Set OK status to false, store the message and allow the
51    *  validation process to continue and find any other issues
52    * -Completely ignore that something is wrong
53    * etc.
54    *
55    * @param String errorMsg - the error message from the validator module
56    */
57   public void notifyOnError(String errorMsg);
58 }