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=========================================================
20 package org.onap.aai.setup;
22 import org.springframework.beans.factory.annotation.Value;
23 import org.springframework.context.annotation.Bean;
24 import org.springframework.context.annotation.Configuration;
25 import org.springframework.context.annotation.PropertySource;
26 import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
29 @PropertySource(value = "classpath:schemaIngest.properties", ignoreResourceNotFound=true)
30 @PropertySource(value = "file:${schemaIngestPropLoc}", ignoreResourceNotFound=true)
31 public class SchemaLocationsBean {
33 * Per Spring documentation, the last PropertySource that works will
34 * be applied. Here, schemaIngestPropLoc will be an environment variable
35 * set on install that tells Spring where to look for the schema
36 * ingest properties file (and the actual filename), but the former
37 * PropertySource gives the default of looking on the classpath for
38 * schemaIngest.properties in case that second one doesn't work.
40 * The schemaIngest.properties file (or its equivalent if you choose
41 * to name it otherwise) must contain the entries the below @Value
42 * annotations are looking for.
45 @Value("${schemaConfig}")
46 private String schemaConfigLoc;
49 private String nodeDirectory;
52 private String edgeDirectory;
55 * @return the file name/location with the list of schema files to be ingested
57 public String getSchemaConfigLocation() {
58 return schemaConfigLoc;
62 * Sets the name/location of the file with the list of schema files to ingest
64 * @param String schemaConfigLoc - the file name/location
66 public void setSchemaConfigLocation(String schemaConfigLoc) {
67 this.schemaConfigLoc = schemaConfigLoc;
71 * @return the location of the OXM files
73 public String getNodeDirectory() {
78 * Sets the location of the OXM files
80 * @param String nodeDirectory - the location of the OXM files
82 public void setNodeDirectory(String nodeDirectory) {
83 this.nodeDirectory = nodeDirectory;
87 * @return the location of the edge rule json files
89 public String getEdgeDirectory() {
94 * Sets the location of the edge rule json files
96 * @param String edgeDirectory - the location of the edge rule files
98 public void setEdgeDirectory(String edgeDirectory) {
99 this.edgeDirectory = edgeDirectory;
102 //this allows the code to actually read the value from the config file
103 //without this those strings get set to literally "${edgeDir}" etc
105 public static PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() {
106 return new PropertySourcesPlaceholderConfigurer();