Catalog alignment
[sdc.git] / asdctool / src / main / java / org / openecomp / sdc / asdctool / impl / validator / config / ValidationConfigManager.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * SDC
4  * ================================================================================
5  * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
6  * Modifications Copyright (c) 2019 Samsung
7  * ================================================================================
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  * 
12  *      http://www.apache.org/licenses/LICENSE-2.0
13  *
14  *
15  *      http://www.apache.org/licenses/LICENSE-2.0
16  *
17  * Unless required by applicable law or agreed to in writing, software
18  * distributed under the License is distributed on an "AS IS" BASIS,
19  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20  * See the License for the specific language governing permissions and
21  * limitations under the License.
22  * ============LICENSE_END=========================================================
23  */
24
25 package org.openecomp.sdc.asdctool.impl.validator.config;
26
27 import org.slf4j.Logger;
28 import org.slf4j.LoggerFactory;
29
30 import java.io.FileInputStream;
31 import java.io.IOException;
32 import java.io.InputStream;
33 import java.util.Properties;
34
35 /**
36  * Created by chaya on 7/4/2017.
37  */
38 public class ValidationConfigManager {
39
40     private static Logger log = LoggerFactory.getLogger(ValidationConfigManager.class);
41
42     private static Properties prop = new Properties();
43     private static String outputFullFilePath;
44     private static String outputFilePath;
45
46     private ValidationConfigManager() {
47     }
48
49     public static String getOutputFullFilePath() {
50         return outputFullFilePath;
51     }
52
53     public static String getOutputFilePath() {
54         return outputFilePath;
55     }
56
57     public static void setOutputFullFilePath(String outputPath) {
58         ValidationConfigManager.outputFilePath = outputPath;
59         ValidationConfigManager.outputFullFilePath = outputPath + "/reportOutput.txt";
60     }
61
62     public static String getCsvReportFilePath() {
63         return csvReportFilePath;
64     }
65
66     public static void setCsvReportFilePath(String outputPath) {
67         ValidationConfigManager.csvReportFilePath =
68             outputPath + "/csvSummary_" + System.currentTimeMillis() + ".csv";
69     }
70
71     private static String csvReportFilePath = "summary.csv";
72
73     public static Properties setValidationConfiguration(String path) {
74         InputStream input;
75         try {
76             input = new FileInputStream(path);
77             prop.load(input);
78         } catch (IOException ex) {
79             ex.printStackTrace();
80             log.info("FileInputStream failed - {}", ex);
81         }
82         return prop;
83     }
84
85     public static Properties getValidationConfiguration() {
86         return prop;
87     }
88 }