2 * ============LICENSE_START=======================================================
\r
4 * ================================================================================
\r
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
\r
6 * ================================================================================
\r
7 * Licensed under the Apache License, Version 2.0 (the "License");
\r
8 * you may not use this file except in compliance with the License.
\r
9 * You may obtain a copy of the License at
\r
11 * http://www.apache.org/licenses/LICENSE-2.0
\r
13 * Unless required by applicable law or agreed to in writing, software
\r
14 * distributed under the License is distributed on an "AS IS" BASIS,
\r
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
16 * See the License for the specific language governing permissions and
\r
17 * limitations under the License.
\r
18 * ============LICENSE_END=========================================================
\r
21 package org.openecomp.vid.properties;
\r
22 import java.text.DateFormat;
\r
23 import java.text.SimpleDateFormat;
\r
24 import java.util.Date;
\r
25 import org.openecomp.vid.model.ModelConstants;
\r
26 import org.openecomp.portalsdk.core.util.SystemProperties;
\r
27 import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
\r
29 import org.openecomp.vid.controller.VidController;
\r
31 * The Class VidProperties.
\r
33 public class VidProperties extends SystemProperties {
\r
35 //VID General Properties
\r
37 /** The Constant VID_TRUSTSTORE_FILENAME. */
\r
38 public static final String VID_TRUSTSTORE_FILENAME = "vid.truststore.filename";
\r
40 /** The Constant VID_TRUSTSTORE_PASSWD_X. */
\r
41 public static final String VID_TRUSTSTORE_PASSWD_X = "vid.truststore.passwd.x";
\r
43 /** The Constant FILESEPARATOR. */
\r
44 public static final String FILESEPARATOR = (System.getProperty("file.separator") == null) ? "/" : System.getProperty("file.separator");
\r
46 /** The Constant LOG. */
\r
47 private static final EELFLoggerDelegate LOG = EELFLoggerDelegate.getLogger(VidController.class);
\r
49 /** The Constant dateFormat. */
\r
50 final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS");
\r
52 * Gets the asdc model namespace prefix property
\r
54 * @return the property value or a default value
\r
56 public static String getAsdcModelNamespace() {
\r
57 String methodName = "getAsdcModelNamespace ";
\r
58 String asdcModelNamespace = ModelConstants.DEFAULT_ASDC_MODEL_NAMESPACE;
\r
60 asdcModelNamespace = SystemProperties.getProperty(ModelConstants.ASDC_MODEL_NAMESPACE);
\r
61 if ( asdcModelNamespace == null || asdcModelNamespace.isEmpty()) {
\r
62 asdcModelNamespace = ModelConstants.DEFAULT_ASDC_MODEL_NAMESPACE;
\r
65 catch ( Exception e ) {
\r
66 LOG.error (EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + methodName + "unable to find the value, using the default "
\r
67 + ModelConstants.DEFAULT_ASDC_MODEL_NAMESPACE);
\r
68 asdcModelNamespace = ModelConstants.DEFAULT_ASDC_MODEL_NAMESPACE;
\r
70 return (asdcModelNamespace);
\r
73 * Gets the specified property value. If the property is not defined, returns a default value.
\r
75 * @return the property value or a default value
\r
77 public static String getPropertyWithDefault ( String propName, String defaultValue ) {
\r
78 String methodName = "getPropertyWithDefault ";
\r
79 String propValue = defaultValue;
\r
81 propValue = SystemProperties.getProperty(propName);
\r
82 if ( propValue == null || propValue.isEmpty()) {
\r
83 propValue = defaultValue;
\r
86 catch ( Exception e ) {
\r
87 LOG.error (EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + methodName + "unable to find the value, using the default "
\r
89 propValue = defaultValue;
\r