2 * ============LICENSE_START=======================================================
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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=========================================================
21 package org.onap.aai.schemaservice.config;
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;
34 public class SchemaConfiguration {
36 @Bean(name = "nodeIngestor")
37 public NodeIngestor nodeIngestor(ConfigTranslator configTranslator) {
38 return new NodeIngestor(configTranslator);
41 @Bean(name = "configTranslator")
42 public ConfigTranslator configTranslator(SchemaLocationsBean schemaLocationsBean,
43 SchemaVersions schemaVersions) {
44 return new AAIConfigTranslator(schemaLocationsBean, schemaVersions);
48 public SchemaErrorStrategy schemaErrorStrategy() {
49 return new CheckEverythingStrategy();
53 public DuplicateNodeDefinitionValidationModule duplicateNodeDefinitionValidationModule() {
54 return new DefaultDuplicateNodeDefinitionValidationModule();
58 public NodeValidator nodeValidator(ConfigTranslator configTranslator,
59 SchemaErrorStrategy schemaErrorStrategy,
60 DuplicateNodeDefinitionValidationModule duplicateNodeDefinitionValidationModule) {
61 return new NodeValidator(configTranslator, schemaErrorStrategy,
62 duplicateNodeDefinitionValidationModule);
66 public SchemaLocationsBean schemaLocationsBean() {
67 return new SchemaLocationsBean();
71 public SchemaVersions schemaVersions() {
72 return new SchemaVersions();