1 /*******************************************************************************
2 * ============LICENSE_START========================================================================
3 * ONAP : ccsdk feature sdnr wt
4 * =================================================================================================
5 * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
6 * =================================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
8 * in compliance with the License. You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software distributed under the License
13 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
14 * or implied. See the License for the specific language governing permissions and limitations under
16 * ============LICENSE_END==========================================================================
17 ******************************************************************************/
18 package org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.impl;
20 import org.onap.ccsdk.features.sdnr.wt.common.configuration.Configuration;
21 import org.onap.ccsdk.features.sdnr.wt.common.configuration.ConfigurationFileRepresentation;
23 public class FaultConfig implements Configuration {
24 private static final String SECTION_MARKER = "fault";
26 private static final String PROPERTY_KEY_CONSUMER_CLASS = "faultConsumerClass";
27 private static final String DEFAULT_VALUE_CONSUMER_CLASS = "org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.impl.DMaaPFaultVESMsgConsumer";
29 public static final String PROPERTY_KEY_CONSUMER_TRANSPORTTYPE = "TransportType";
30 private static final String DEFAULT_VALUE_CONSUMER_TRANSPORTTYPE = "HTTPNOAUTH";
32 public static final String PROPERTY_KEY_CONSUMER_HOST_PORT = "host";
33 private static final String DEFAULT_VALUE_CONSUMER_HOST_PORT = "onap-dmap:3904";
35 public static final String PROPERTY_KEY_CONSUMER_TOPIC = "topic";
36 private static final String DEFAULT_VALUE_CONSUMER_TOPIC = "unauthenticated.SEC_FAULT_OUTPUT";
38 public static final String PROPERTY_KEY_CONSUMER_CONTENTTYPE = "contenttype";
39 private static final String DEFAULT_VALUE_CONSUMER_CONTENTTYPE = "application/json";
41 public static final String PROPERTY_KEY_CONSUMER_GROUP = "group";
42 private static final String DEFAULT_VALUE_CONSUMER_GROUP = "myG";
44 public static final String PROPERTY_KEY_CONSUMER_ID = "id";
45 private static final String DEFAULT_VALUE_CONSUMER_ID = "C1";
47 public static final String PROPERTY_KEY_CONSUMER_TIMEOUT = "timeout";
48 private static final String DEFAULT_VALUE_CONSUMER_TIMEOUT = "20000";
50 public static final String PROPERTY_KEY_CONSUMER_LIMIT = "limit";
51 private static final String DEFAULT_VALUE_CONSUMER_LIMIT = "10000";
53 public static final String PROPERTY_KEY_CONSUMER_FETCHPAUSE = "fetchPause";
54 private static final String DEFAULT_VALUE_CONSUMER_FETCHPAUSE = "5000";
56 private final ConfigurationFileRepresentation configuration;
58 public FaultConfig(ConfigurationFileRepresentation configuration) {
59 this.configuration = configuration;
60 this.configuration.addSection(SECTION_MARKER);
65 public String getSectionName() {
66 return SECTION_MARKER;
70 public void defaults() {
72 configuration.setPropertyIfNotAvailable(SECTION_MARKER, PROPERTY_KEY_CONSUMER_CLASS, DEFAULT_VALUE_CONSUMER_CLASS);
73 configuration.setPropertyIfNotAvailable(SECTION_MARKER, PROPERTY_KEY_CONSUMER_TRANSPORTTYPE, DEFAULT_VALUE_CONSUMER_TRANSPORTTYPE);
74 configuration.setPropertyIfNotAvailable(SECTION_MARKER, PROPERTY_KEY_CONSUMER_HOST_PORT, DEFAULT_VALUE_CONSUMER_HOST_PORT);
75 configuration.setPropertyIfNotAvailable(SECTION_MARKER, PROPERTY_KEY_CONSUMER_TOPIC, DEFAULT_VALUE_CONSUMER_TOPIC);
76 configuration.setPropertyIfNotAvailable(SECTION_MARKER, PROPERTY_KEY_CONSUMER_CONTENTTYPE, DEFAULT_VALUE_CONSUMER_CONTENTTYPE);
77 configuration.setPropertyIfNotAvailable(SECTION_MARKER, PROPERTY_KEY_CONSUMER_GROUP, DEFAULT_VALUE_CONSUMER_GROUP);
78 configuration.setPropertyIfNotAvailable(SECTION_MARKER, PROPERTY_KEY_CONSUMER_ID, DEFAULT_VALUE_CONSUMER_ID);
79 configuration.setPropertyIfNotAvailable(SECTION_MARKER, PROPERTY_KEY_CONSUMER_TIMEOUT, DEFAULT_VALUE_CONSUMER_TIMEOUT);
80 configuration.setPropertyIfNotAvailable(SECTION_MARKER, PROPERTY_KEY_CONSUMER_LIMIT, DEFAULT_VALUE_CONSUMER_LIMIT);
81 configuration.setPropertyIfNotAvailable(SECTION_MARKER, PROPERTY_KEY_CONSUMER_FETCHPAUSE, DEFAULT_VALUE_CONSUMER_FETCHPAUSE);
85 public String getConsumerClass() {
86 return configuration.getProperty(SECTION_MARKER, PROPERTY_KEY_CONSUMER_CLASS);
89 public String getHostPort() {
90 return configuration.getProperty(SECTION_MARKER, PROPERTY_KEY_CONSUMER_HOST_PORT);
93 public String getTransportType() {
94 return configuration.getProperty(SECTION_MARKER, PROPERTY_KEY_CONSUMER_TRANSPORTTYPE);
97 public String getTopic() {
98 return configuration.getProperty(SECTION_MARKER, PROPERTY_KEY_CONSUMER_TOPIC);
101 public String getConsumerGroup() {
102 return configuration.getProperty(SECTION_MARKER, PROPERTY_KEY_CONSUMER_GROUP);
105 public String getConsumerId() {
106 return configuration.getProperty(SECTION_MARKER, PROPERTY_KEY_CONSUMER_ID);
109 public String getTimeout() {
110 return configuration.getProperty(SECTION_MARKER, PROPERTY_KEY_CONSUMER_TIMEOUT);
113 public String getLimit() {
114 return configuration.getProperty(SECTION_MARKER, PROPERTY_KEY_CONSUMER_LIMIT);
117 public String getFetchPause() {
118 return configuration.getProperty(SECTION_MARKER, PROPERTY_KEY_CONSUMER_FETCHPAUSE);
121 public String getContenttype() {
122 return configuration.getProperty(SECTION_MARKER, PROPERTY_KEY_CONSUMER_CONTENTTYPE);