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==========================================================================
 
  21 package org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.config;
 
  23 import org.onap.ccsdk.features.sdnr.wt.common.configuration.Configuration;
 
  24 import org.onap.ccsdk.features.sdnr.wt.common.configuration.ConfigurationFileRepresentation;
 
  27 public abstract class MessageConfig implements Configuration {
 
  28     protected String sectionMarker;
 
  30     public static final String PROPERTY_KEY_CONSUMER_TOPIC = "topic";
 
  32     public static final String PROPERTY_KEY_CONSUMER_GROUP = "consumerGroup";
 
  33     private static final String DEFAULT_VALUE_CONSUMER_GROUP = "myG";
 
  35     public static final String PROPERTY_KEY_CONSUMER_ID = "consumerID";
 
  36     private static final String DEFAULT_VALUE_CONSUMER_ID = "C1";
 
  38     public static final String PROPERTY_KEY_CONSUMER_TIMEOUT = "timeout";
 
  39     private static final String DEFAULT_VALUE_CONSUMER_TIMEOUT = "20000";
 
  41     public static final String PROPERTY_KEY_CONSUMER_LIMIT = "limit";
 
  42     private static final String DEFAULT_VALUE_CONSUMER_LIMIT = "10000";
 
  44     public static final String PROPERTY_KEY_CONSUMER_FETCHPAUSE = "fetchPause";
 
  45     private static final String DEFAULT_VALUE_CONSUMER_FETCHPAUSE = "5000";
 
  47     protected ConfigurationFileRepresentation configuration;
 
  49     public MessageConfig(ConfigurationFileRepresentation configuration) {
 
  50         this.configuration = configuration;
 
  54     public String getSectionName() {
 
  59     public void defaults() {
 
  60         configuration.setPropertyIfNotAvailable(sectionMarker, PROPERTY_KEY_CONSUMER_GROUP,
 
  61                 DEFAULT_VALUE_CONSUMER_GROUP);
 
  62         configuration.setPropertyIfNotAvailable(sectionMarker, PROPERTY_KEY_CONSUMER_ID, DEFAULT_VALUE_CONSUMER_ID);
 
  63         configuration.setPropertyIfNotAvailable(sectionMarker, PROPERTY_KEY_CONSUMER_TIMEOUT,
 
  64                 DEFAULT_VALUE_CONSUMER_TIMEOUT);
 
  65         configuration.setPropertyIfNotAvailable(sectionMarker, PROPERTY_KEY_CONSUMER_LIMIT,
 
  66                 DEFAULT_VALUE_CONSUMER_LIMIT);
 
  67         configuration.setPropertyIfNotAvailable(sectionMarker, PROPERTY_KEY_CONSUMER_FETCHPAUSE,
 
  68                 DEFAULT_VALUE_CONSUMER_FETCHPAUSE);
 
  71     public String getTopic() {
 
  72         return configuration.getProperty(sectionMarker, PROPERTY_KEY_CONSUMER_TOPIC);
 
  75     public String getConsumerGroup() {
 
  76         return configuration.getProperty(sectionMarker, PROPERTY_KEY_CONSUMER_GROUP);
 
  79     public String getConsumerId() {
 
  80         return configuration.getProperty(sectionMarker, PROPERTY_KEY_CONSUMER_ID);
 
  83     public String getTimeout() {
 
  84         return configuration.getProperty(sectionMarker, PROPERTY_KEY_CONSUMER_TIMEOUT);
 
  87     public String getLimit() {
 
  88         return configuration.getProperty(sectionMarker, PROPERTY_KEY_CONSUMER_LIMIT);
 
  91     public String getFetchPause() {
 
  92         return configuration.getProperty(sectionMarker, PROPERTY_KEY_CONSUMER_FETCHPAUSE);