2 * ============LICENSE_START=======================================================
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
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.openecomp.mso.properties;
24 import java.io.IOException;
25 import java.util.Properties;
27 import org.openecomp.mso.logger.MsoLogger;
29 public abstract class AbstractMsoProperties {
31 public static final int DEFAULT_RELOAD_TIME_MIN=1;
33 public static final String RELOAD_TIME_PROPERTY="mso.properties.reload.time.minutes";
35 protected static MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.GENERAL);
37 protected String propertiesFileName;
39 protected int automaticRefreshInMinutes=0;
41 public String getPropertiesFileName() {
42 return propertiesFileName;
45 public int getAutomaticRefreshInMinutes() {
46 return automaticRefreshInMinutes;
49 protected synchronized void reloadPropertiesFile() throws IOException {
50 this.loadPropertiesFile(this.propertiesFileName);
54 * This method load a properties file from a source path.
56 * @param propertiesPath The path to the file
57 * @throws IOException In case of issues during the opening
60 protected abstract void loadPropertiesFile(String propertiesPath) throws IOException;
63 protected abstract AbstractMsoProperties clone();
66 public abstract int hashCode();
69 public abstract boolean equals(Object obj);
72 public abstract String toString();