Aharoni, Pavel (pa0916) | ca3cb01 | 2018-10-22 15:29:57 +0300 | [diff] [blame] | 1 | /*-
|
| 2 | * ============LICENSE_START=======================================================
|
| 3 | * OSAM
|
| 4 | * ================================================================================
|
| 5 | * Copyright (C) 2018 AT&T
|
| 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 |
|
| 22 |
|
| 23 | package org.onap.osam.properties;
|
| 24 |
|
| 25 | import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
|
| 26 | import org.onap.portalsdk.core.util.SystemProperties;
|
| 27 | import org.onap.osam.model.ModelConstants;
|
| 28 |
|
| 29 | import java.text.DateFormat;
|
| 30 | import java.text.SimpleDateFormat;
|
| 31 | import java.util.Date;
|
| 32 | public class VidProperties extends SystemProperties {
|
| 33 |
|
| 34 | //VID General Properties
|
| 35 | public static final String MSO_DISPLAY_TEST_API_ON_SCREEN="mso.displayTestAPIOnScreen";
|
| 36 | public static final String MSO_DEFAULT_TEST_API="mso.defaultTestAPI";
|
| 37 | public static final String MSO_MAX_OPENED_INSTANTIATION_REQUESTS="mso.maxOpenedInstantiationRequests";
|
| 38 | public static final String MSO_ASYNC_POLLING_INTERVAL_SECONDS="mso.asyncPollingIntervalSeconds";
|
| 39 |
|
| 40 | public static final String VID_TRUSTSTORE_FILENAME = "vid.truststore.filename";
|
| 41 |
|
| 42 | /** The Constant VID_TRUSTSTORE_PASSWD_X. */
|
| 43 | public static final String VID_TRUSTSTORE_PASSWD_X = "vid.truststore.passwd.x";
|
| 44 |
|
| 45 | /** The Constant FILESEPARATOR. */
|
| 46 | public static final String FILESEPARATOR = (System.getProperty("file.separator") == null) ? "/" : System.getProperty("file.separator");
|
| 47 |
|
| 48 | /** The Constant LOG. */
|
| 49 | private static final EELFLoggerDelegate LOG = EELFLoggerDelegate.getLogger(VidProperties.class);
|
| 50 |
|
| 51 | /** The Constant dateFormat. */
|
| 52 | final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS");
|
| 53 | /**
|
| 54 | * Gets the asdc model namespace prefix property
|
| 55 | *
|
| 56 | * @return the property value or a default value
|
| 57 | */
|
| 58 | public static String getAsdcModelNamespace() {
|
| 59 | String methodName = "getAsdcModelNamespace ";
|
| 60 | String asdcModelNamespace = ModelConstants.DEFAULT_ASDC_MODEL_NAMESPACE;
|
| 61 | try {
|
| 62 | asdcModelNamespace = SystemProperties.getProperty(ModelConstants.ASDC_MODEL_NAMESPACE);
|
| 63 | if ( asdcModelNamespace == null || asdcModelNamespace.isEmpty()) {
|
| 64 | asdcModelNamespace = ModelConstants.DEFAULT_ASDC_MODEL_NAMESPACE;
|
| 65 | }
|
| 66 | }
|
| 67 | catch ( Exception e ) {
|
| 68 | LOG.error (EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + methodName + "unable to find the value, using the default "
|
| 69 | + ModelConstants.DEFAULT_ASDC_MODEL_NAMESPACE);
|
| 70 | asdcModelNamespace = ModelConstants.DEFAULT_ASDC_MODEL_NAMESPACE;
|
| 71 | }
|
| 72 | return (asdcModelNamespace);
|
| 73 | }
|
| 74 | /**
|
| 75 | * Gets the specified property value. If the property is not defined, returns a default value.
|
| 76 | *
|
| 77 | * @return the property value or a default value
|
| 78 | */
|
| 79 | public static String getPropertyWithDefault ( String propName, String defaultValue ) {
|
| 80 | String methodName = "getPropertyWithDefault ";
|
| 81 | String propValue = defaultValue;
|
| 82 | try {
|
| 83 | propValue = SystemProperties.getProperty(propName);
|
| 84 | if ( propValue == null || propValue.isEmpty()) {
|
| 85 | propValue = defaultValue;
|
| 86 | }
|
| 87 | }
|
| 88 | catch ( Exception e ) {
|
| 89 | LOG.error (EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + methodName + "unable to find the value, using the default "
|
| 90 | + defaultValue);
|
| 91 | propValue = defaultValue;
|
| 92 | }
|
| 93 | return (propValue);
|
| 94 | }
|
| 95 | }
|