Add instructions to invoke the linter and code formatter plugins to the README and...
[aai/schema-service.git] / aai-schema-service / src / main / java / org / onap / aai / schemaservice / config / SchemaConfiguration.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
21 package org.onap.aai.schemaservice.config;
22
23 import org.onap.aai.schemaservice.nodeschema.NodeIngestor;
24 import org.onap.aai.schemaservice.nodeschema.SchemaVersions;
25 import org.onap.aai.schemaservice.nodeschema.validation.CheckEverythingStrategy;
26 import org.onap.aai.schemaservice.nodeschema.validation.DefaultDuplicateNodeDefinitionValidationModule;
27 import org.onap.aai.schemaservice.nodeschema.validation.DuplicateNodeDefinitionValidationModule;
28 import org.onap.aai.schemaservice.nodeschema.validation.NodeValidator;
29 import org.onap.aai.schemaservice.nodeschema.validation.SchemaErrorStrategy;
30 import org.springframework.context.annotation.Bean;
31 import org.springframework.context.annotation.Configuration;
32
33 @Configuration
34 public class SchemaConfiguration {
35
36     @Bean(name = "nodeIngestor")
37     public NodeIngestor nodeIngestor(ConfigTranslator configTranslator) {
38         return new NodeIngestor(configTranslator);
39     }
40
41     @Bean(name = "configTranslator")
42     public ConfigTranslator configTranslator(SchemaLocationsBean schemaLocationsBean,
43         SchemaVersions schemaVersions) {
44         return new AAIConfigTranslator(schemaLocationsBean, schemaVersions);
45     }
46
47     @Bean
48     public SchemaErrorStrategy schemaErrorStrategy() {
49         return new CheckEverythingStrategy();
50     }
51
52     @Bean
53     public DuplicateNodeDefinitionValidationModule duplicateNodeDefinitionValidationModule() {
54         return new DefaultDuplicateNodeDefinitionValidationModule();
55     }
56
57     @Bean
58     public NodeValidator nodeValidator(ConfigTranslator configTranslator,
59         SchemaErrorStrategy schemaErrorStrategy,
60         DuplicateNodeDefinitionValidationModule duplicateNodeDefinitionValidationModule) {
61         return new NodeValidator(configTranslator, schemaErrorStrategy,
62             duplicateNodeDefinitionValidationModule);
63     }
64
65     @Bean
66     public SchemaLocationsBean schemaLocationsBean() {
67         return new SchemaLocationsBean();
68     }
69
70     @Bean
71     public SchemaVersions schemaVersions() {
72         return new SchemaVersions();
73     }
74 }