2 * ============LICENSE_START========================================================================
3 * ONAP : ccsdk feature sdnr wt mountpoint-registrar
4 * =================================================================================================
5 * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
6 * Copyright (C) 2021 Samsung Electronics Intellectual Property. All rights reserved.
7 * =================================================================================================
8 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
9 * in compliance with the License. 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 distributed under the License
14 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
15 * or implied. See the License for the specific language governing permissions and limitations under
17 * ============LICENSE_END==========================================================================
20 package org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.config;
22 import org.onap.ccsdk.features.sdnr.wt.common.configuration.Configuration;
23 import org.onap.ccsdk.features.sdnr.wt.common.configuration.ConfigurationFileRepresentation;
26 public abstract class MessageConfig implements Configuration {
27 protected String sectionMarker;
29 public static final String PROPERTY_KEY_CONSUMER_TOPIC = "topic";
31 public static final String PROPERTY_KEY_CONSUMER_GROUP = "consumerGroup";
32 private static final String DEFAULT_VALUE_CONSUMER_GROUP = "myG";
34 public static final String PROPERTY_KEY_CONSUMER_ID = "consumerID";
35 private static final String DEFAULT_VALUE_CONSUMER_ID = "C1";
37 public static final String PROPERTY_KEY_CONSUMER_TIMEOUT = "timeout";
38 private static final String DEFAULT_VALUE_CONSUMER_TIMEOUT = "2000";
40 public static final String PROPERTY_KEY_CONSUMER_LIMIT = "limit";
41 private static final String DEFAULT_VALUE_CONSUMER_LIMIT = "1000";
43 public static final String PROPERTY_KEY_CONSUMER_FETCHPAUSE = "fetchPause";
44 private static final String DEFAULT_VALUE_CONSUMER_FETCHPAUSE = "5000";
46 protected ConfigurationFileRepresentation configuration;
48 public MessageConfig(ConfigurationFileRepresentation configuration) {
49 this.configuration = configuration;
53 public String getSectionName() {
58 public void defaults() {
59 configuration.setPropertyIfNotAvailable(sectionMarker, PROPERTY_KEY_CONSUMER_GROUP,
60 DEFAULT_VALUE_CONSUMER_GROUP);
61 configuration.setPropertyIfNotAvailable(sectionMarker, PROPERTY_KEY_CONSUMER_ID, DEFAULT_VALUE_CONSUMER_ID);
62 configuration.setPropertyIfNotAvailable(sectionMarker, PROPERTY_KEY_CONSUMER_TIMEOUT,
63 DEFAULT_VALUE_CONSUMER_TIMEOUT);
64 configuration.setPropertyIfNotAvailable(sectionMarker, PROPERTY_KEY_CONSUMER_LIMIT,
65 DEFAULT_VALUE_CONSUMER_LIMIT);
66 configuration.setPropertyIfNotAvailable(sectionMarker, PROPERTY_KEY_CONSUMER_FETCHPAUSE,
67 DEFAULT_VALUE_CONSUMER_FETCHPAUSE);
70 public String getTopic() {
71 return configuration.getProperty(sectionMarker, PROPERTY_KEY_CONSUMER_TOPIC);
74 public String getConsumerGroup() {
75 return configuration.getProperty(sectionMarker, PROPERTY_KEY_CONSUMER_GROUP);
78 public String getConsumerId() {
79 return configuration.getProperty(sectionMarker, PROPERTY_KEY_CONSUMER_ID);
82 public String getTimeout() {
83 return configuration.getProperty(sectionMarker, PROPERTY_KEY_CONSUMER_TIMEOUT);
86 public String getLimit() {
87 return configuration.getProperty(sectionMarker, PROPERTY_KEY_CONSUMER_LIMIT);
90 public String getFetchPause() {
91 return configuration.getProperty(sectionMarker, PROPERTY_KEY_CONSUMER_FETCHPAUSE);