Change the header to SO
[so.git] / common / src / main / java / org / openecomp / mso / properties / AbstractMsoProperties.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP - SO
4  * ================================================================================
5  * Copyright (C) 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
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.openecomp.mso.properties;
22
23
24 import java.io.IOException;
25 import java.util.Properties;
26
27 import org.openecomp.mso.logger.MsoLogger;
28
29 public abstract class AbstractMsoProperties {
30
31         public static final int DEFAULT_RELOAD_TIME_MIN=1;
32         
33         public static final String RELOAD_TIME_PROPERTY="mso.properties.reload.time.minutes";
34         
35         protected static MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.GENERAL);
36
37         protected String propertiesFileName;
38
39         protected int automaticRefreshInMinutes=0;
40
41         public String getPropertiesFileName() {
42                 return propertiesFileName;
43         }
44
45         public int getAutomaticRefreshInMinutes() {
46                 return automaticRefreshInMinutes;
47         }
48         
49         protected synchronized void reloadPropertiesFile() throws IOException {
50                 this.loadPropertiesFile(this.propertiesFileName);
51         }
52         
53         /**
54          * This method load a properties file from a source path.
55          *
56          * @param propertiesPath The path to the file
57          * @throws IOException In case of issues during the opening
58          */
59         
60         protected abstract void loadPropertiesFile(String propertiesPath) throws IOException;
61         
62         @Override
63         protected abstract AbstractMsoProperties clone();
64         
65         @Override
66         public abstract int hashCode();
67         
68         @Override
69         public abstract boolean equals(Object obj);
70         
71         @Override
72         public abstract String toString();
73         
74         
75 }