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.onap.vid.properties;
23 import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
24 import org.onap.portalsdk.core.util.SystemProperties;
25 import org.onap.vid.model.ModelConstants;
27 import java.text.DateFormat;
28 import java.text.SimpleDateFormat;
29 import java.util.Date;
31 * The Class VidProperties.
33 public class VidProperties extends SystemProperties {
35 //VID General Properties
37 /** The Constant VID_TRUSTSTORE_FILENAME. */
38 public static final String VID_TRUSTSTORE_FILENAME = "vid.truststore.filename";
40 /** The Constant VID_TRUSTSTORE_PASSWD_X. */
41 public static final String VID_TRUSTSTORE_PASSWD_X = "vid.truststore.passwd.x";
43 /** The Constant FILESEPARATOR. */
44 public static final String FILESEPARATOR = (System.getProperty("file.separator") == null) ? "/" : System.getProperty("file.separator");
46 /** The Constant LOG. */
47 private static final EELFLoggerDelegate LOG = EELFLoggerDelegate.getLogger(VidProperties.class);
49 /** The Constant dateFormat. */
50 final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS");
52 * Gets the asdc model namespace prefix property
54 * @return the property value or a default value
56 public static String getAsdcModelNamespace() {
57 String methodName = "getAsdcModelNamespace ";
58 String asdcModelNamespace = ModelConstants.DEFAULT_ASDC_MODEL_NAMESPACE;
60 asdcModelNamespace = SystemProperties.getProperty(ModelConstants.ASDC_MODEL_NAMESPACE);
61 if ( asdcModelNamespace == null || asdcModelNamespace.isEmpty()) {
62 asdcModelNamespace = ModelConstants.DEFAULT_ASDC_MODEL_NAMESPACE;
65 catch ( Exception e ) {
66 LOG.error (EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + methodName + "unable to find the value, using the default "
67 + ModelConstants.DEFAULT_ASDC_MODEL_NAMESPACE);
68 asdcModelNamespace = ModelConstants.DEFAULT_ASDC_MODEL_NAMESPACE;
70 return (asdcModelNamespace);
73 * Gets the specified property value. If the property is not defined, returns a default value.
75 * @return the property value or a default value
77 public static String getPropertyWithDefault ( String propName, String defaultValue ) {
78 String methodName = "getPropertyWithDefault ";
79 String propValue = defaultValue;
81 propValue = SystemProperties.getProperty(propName);
82 if ( propValue == null || propValue.isEmpty()) {
83 propValue = defaultValue;
86 catch ( Exception e ) {
87 LOG.error (EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + methodName + "unable to find the value, using the default "
89 propValue = defaultValue;