2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright © 2017 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 * ECOMP is a trademark and service mark of AT&T Intellectual Property.
23 package org.onap.aai.setup;
25 import org.springframework.beans.factory.annotation.Value;
26 import org.springframework.context.annotation.Bean;
27 import org.springframework.context.annotation.Configuration;
28 import org.springframework.context.annotation.PropertySource;
29 import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
32 @PropertySource("classpath:schemaIngest.properties")
33 @PropertySource(value = "file:${schemaIngestPropLoc}", ignoreResourceNotFound=true)
34 public class SchemaLocationsBean {
36 * Per Spring documentation, the last PropertySource that works will
37 * be applied. Here, schemaIngestPropLoc will be an environment variable
38 * set on install that tells Spring where to look for the schema
39 * ingest properties file (and the actual filename), but the former
40 * PropertySource gives the default of looking on the classpath for
41 * schemaIngest.properties in case that second one doesn't work.
43 * The schemaIngest.properties file (or its equivalent if you choose
44 * to name it otherwise) must contain the entries the below @Value
45 * annotations are looking for.
48 @Value("${schemaConfig}")
49 private String schemaConfigLoc;
52 private String nodeDirectory;
55 private String edgeDirectory;
58 * @return the file name/location with the list of schema files to be ingested
60 public String getSchemaConfigLocation() {
61 return schemaConfigLoc;
65 * Sets the name/location of the file with the list of schema files to ingest
67 * @param String schemaConfigLoc - the file name/location
69 public void setSchemaConfigLocation(String schemaConfigLoc) {
70 this.schemaConfigLoc = schemaConfigLoc;
74 * @return the location of the OXM files
76 public String getNodeDirectory() {
81 * Sets the location of the OXM files
83 * @param String nodeDirectory - the location of the OXM files
85 public void setNodeDirectory(String nodeDirectory) {
86 this.nodeDirectory = nodeDirectory;
90 * @return the location of the edge rule json files
92 public String getEdgeDirectory() {
97 * Sets the location of the edge rule json files
99 * @param String edgeDirectory - the location of the edge rule files
101 public void setEdgeDirectory(String edgeDirectory) {
102 this.edgeDirectory = edgeDirectory;
105 //this allows the code to actually read the value from the config file
106 //without this those strings get set to literally "${edgeDir}" etc
108 public static PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() {
109 return new PropertySourcesPlaceholderConfigurer();