summaryrefslogtreecommitdiffstats
path: root/dcae-analytics/dcae-analytics-model/src/main/java/org/onap/dcae/analytics/model/configbindingservice
diff options
context:
space:
mode:
Diffstat (limited to 'dcae-analytics/dcae-analytics-model/src/main/java/org/onap/dcae/analytics/model/configbindingservice')
-rw-r--r--dcae-analytics/dcae-analytics-model/src/main/java/org/onap/dcae/analytics/model/configbindingservice/BaseConfigBindingServiceProperties.java152
-rw-r--r--dcae-analytics/dcae-analytics-model/src/main/java/org/onap/dcae/analytics/model/configbindingservice/ConfigBindingServiceConstants.java68
-rw-r--r--dcae-analytics/dcae-analytics-model/src/main/java/org/onap/dcae/analytics/model/configbindingservice/ConfigBindingServiceModel.java30
-rw-r--r--dcae-analytics/dcae-analytics-model/src/main/java/org/onap/dcae/analytics/model/configbindingservice/ConsulConfigBindingServiceQueryResponse.java55
4 files changed, 305 insertions, 0 deletions
diff --git a/dcae-analytics/dcae-analytics-model/src/main/java/org/onap/dcae/analytics/model/configbindingservice/BaseConfigBindingServiceProperties.java b/dcae-analytics/dcae-analytics-model/src/main/java/org/onap/dcae/analytics/model/configbindingservice/BaseConfigBindingServiceProperties.java
new file mode 100644
index 0000000..7158b2e
--- /dev/null
+++ b/dcae-analytics/dcae-analytics-model/src/main/java/org/onap/dcae/analytics/model/configbindingservice/BaseConfigBindingServiceProperties.java
@@ -0,0 +1,152 @@
+/*
+ * ================================================================================
+ * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ */
+
+package org.onap.dcae.analytics.model.configbindingservice;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
+import lombok.RequiredArgsConstructor;
+import lombok.Setter;
+import lombok.ToString;
+
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Base call for Controller Config Binding Service Properties. Other analytics components
+ * must extend this base class and add properties specific to their requirements
+ * <p>NOTE: The base class supports all standard config binding service properties and additional custom properties</p>
+ *
+ * @author Rajiv Singla
+ */
+@Data
+public abstract class BaseConfigBindingServiceProperties implements ConfigBindingServiceModel {
+
+ private static final long serialVersionUID = 1L;
+
+ protected Map<String, List<String>> servicesCalls = new LinkedHashMap<>();
+ protected Map<String, PublisherDetails> streamsPublishes = new LinkedHashMap<>();
+ protected Map<String, SubscriberDetails> streamsSubscribes = new LinkedHashMap<>();
+
+ /**
+ * Publisher and Subscriber common properties
+ */
+ @Data
+ @ToString(exclude = "aafPassword")
+ public static class PubSubCommonDetails implements ConfigBindingServiceModel {
+
+ private static final long serialVersionUID = 1L;
+
+ private String type;
+ private String aafUsername;
+ private String aafPassword;
+ private DmaapInfo dmaapInfo;
+
+ // custom additional properties
+ private String proxyUrl;
+ private Boolean ignoreSSLValidation;
+
+ }
+
+ /**
+ * Publisher Details
+ */
+ @Getter
+ @Setter
+ @RequiredArgsConstructor
+ @ToString(callSuper = true)
+ @EqualsAndHashCode(callSuper = true)
+ public static class PublisherDetails extends PubSubCommonDetails {
+
+ private static final long serialVersionUID = 1L;
+
+ }
+
+
+ /**
+ * Subscriber Details
+ */
+ @Getter
+ @Setter
+ @RequiredArgsConstructor
+ @ToString(callSuper = true)
+ @EqualsAndHashCode(callSuper = true)
+ public static class SubscriberDetails extends PubSubCommonDetails {
+
+ private static final long serialVersionUID = 1L;
+
+ // custom subscriber properties
+ private String consumerGroup;
+ private List<String> consumerIds;
+ private Integer messageLimit;
+ private Integer timeout;
+
+ // custom polling configuration
+ private Polling polling;
+ }
+
+ /**
+ * DMaaP Info
+ */
+ @Data
+ public static class DmaapInfo implements ConfigBindingServiceModel {
+
+ private static final long serialVersionUID = 1L;
+
+ private String clientRole;
+ private String clientId;
+ private String location;
+ private String topicUrl;
+
+ }
+
+
+ /**
+ * Polling Details
+ */
+ @Data
+ public static class Polling implements ConfigBindingServiceModel {
+
+ private static final long serialVersionUID = 1L;
+
+ private Integer fixedRate;
+ private AutoAdjusting autoAdjusting;
+
+ }
+
+
+ /**
+ * Auto Adjusting Polling Details
+ */
+ @Data
+ public static class AutoAdjusting implements ConfigBindingServiceModel {
+
+ private static final long serialVersionUID = 1L;
+
+ private Integer min;
+ private Integer stepUp;
+ private Integer max;
+ private Integer stepDown;
+
+ }
+
+
+}
diff --git a/dcae-analytics/dcae-analytics-model/src/main/java/org/onap/dcae/analytics/model/configbindingservice/ConfigBindingServiceConstants.java b/dcae-analytics/dcae-analytics-model/src/main/java/org/onap/dcae/analytics/model/configbindingservice/ConfigBindingServiceConstants.java
new file mode 100644
index 0000000..196b791
--- /dev/null
+++ b/dcae-analytics/dcae-analytics-model/src/main/java/org/onap/dcae/analytics/model/configbindingservice/ConfigBindingServiceConstants.java
@@ -0,0 +1,68 @@
+/*
+ * ================================================================================
+ * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ */
+
+package org.onap.dcae.analytics.model.configbindingservice;
+
+import java.util.Map;
+import java.util.Set;
+import java.util.function.Predicate;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+import org.onap.dcae.analytics.model.configbindingservice.BaseConfigBindingServiceProperties.PubSubCommonDetails;
+
+/**
+ * @author Rajiv Singla
+ */
+public abstract class ConfigBindingServiceConstants {
+
+ // ================== CONFIG SERVICE CONSTANTS ============================== //
+ public static final String CONSUL_HOST_ENV_VARIABLE_KEY = "CONSUL_HOST";
+ public static final String CONSUL_HOST_ENV_VARIABLE_VALUE = System.getenv(CONSUL_HOST_ENV_VARIABLE_KEY);
+ public static final String CONFIG_BINDING_SERVICE_ENV_VARIABLE_KEY = "CONFIG_BINDING_SERVICE";
+ public static final String CONFIG_BINDING_SERVICE_ENV_VARIABLE_VALUE =
+ System.getenv(CONFIG_BINDING_SERVICE_ENV_VARIABLE_KEY);
+ public static final String SERVICE_NAME_ENV_VARIABLE_KEY = "SERVICE_NAME";
+ public static final String SERVICE_NAME_ENV_VARIABLE_VALUE = System.getenv(SERVICE_NAME_ENV_VARIABLE_KEY);
+ public static final String CONSUL_QUERY_URL_STRING = String.format("http://%s:8500/v1/catalog/service/%s",
+ CONSUL_HOST_ENV_VARIABLE_VALUE, CONFIG_BINDING_SERVICE_ENV_VARIABLE_VALUE);
+ public static final String CONFIG_SERVICE_QUERY_URL_STRING = "http://%s:%s/service_component/%s";
+
+
+ public static final String CONFIG_BINDING_SERVICE_PROPERTIES_KEY = "config-binding-service";
+
+
+ public static final Set<String> SPRING_RESERVED_PROPERTIES_KEY_PREFIXES =
+ Stream.of("spring", "endpoints", "server", "logging", "management").collect(Collectors.toSet());
+ public static final String CONFIG_SERVICE_MESSAGE_ROUTER_VALUE = "message_router";
+ // CONVERT JSON TO MAP
+ public static final String KEY_SEPARATOR = ".";
+
+ // ============== CONFIG BINDING SERVICE UTILS ========================= //
+ /**
+ * Predicate which can be used to filter message router publisher or subscriber details
+ */
+ public static final Predicate<Map.Entry<String, ? extends PubSubCommonDetails>> MESSAGE_ROUTER_PREDICATE =
+ e -> e.getValue().getType() != null &&
+ e.getValue().getType().equalsIgnoreCase(CONFIG_SERVICE_MESSAGE_ROUTER_VALUE);
+
+ private ConfigBindingServiceConstants() {
+ // private constructor
+ }
+}
diff --git a/dcae-analytics/dcae-analytics-model/src/main/java/org/onap/dcae/analytics/model/configbindingservice/ConfigBindingServiceModel.java b/dcae-analytics/dcae-analytics-model/src/main/java/org/onap/dcae/analytics/model/configbindingservice/ConfigBindingServiceModel.java
new file mode 100644
index 0000000..902dded
--- /dev/null
+++ b/dcae-analytics/dcae-analytics-model/src/main/java/org/onap/dcae/analytics/model/configbindingservice/ConfigBindingServiceModel.java
@@ -0,0 +1,30 @@
+/*
+ * ================================================================================
+ * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ */
+
+package org.onap.dcae.analytics.model.configbindingservice;
+
+import org.onap.dcae.analytics.model.AnalyticsModel;
+
+/**
+ * Marker Interface for all Config Binding Service Model Objects
+ *
+ * @author Rajiv Singla
+ */
+public interface ConfigBindingServiceModel extends AnalyticsModel {
+}
diff --git a/dcae-analytics/dcae-analytics-model/src/main/java/org/onap/dcae/analytics/model/configbindingservice/ConsulConfigBindingServiceQueryResponse.java b/dcae-analytics/dcae-analytics-model/src/main/java/org/onap/dcae/analytics/model/configbindingservice/ConsulConfigBindingServiceQueryResponse.java
new file mode 100644
index 0000000..fed262e
--- /dev/null
+++ b/dcae-analytics/dcae-analytics-model/src/main/java/org/onap/dcae/analytics/model/configbindingservice/ConsulConfigBindingServiceQueryResponse.java
@@ -0,0 +1,55 @@
+/*
+ * ================================================================================
+ * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ */
+
+package org.onap.dcae.analytics.model.configbindingservice;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.util.List;
+import java.util.Map;
+
+import org.onap.dcae.analytics.model.common.BaseDynamicPropertiesProvider;
+
+/**
+ * @author Rajiv Singla
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class ConsulConfigBindingServiceQueryResponse extends BaseDynamicPropertiesProvider implements
+ ConfigBindingServiceModel {
+
+ private static final long serialVersionUID = 1L;
+
+ private String id;
+ private String node;
+ private String address;
+ private String dataCenter;
+ private Map<String, String> taggedAddresses;
+ private Map<String, String> nodeMeta;
+ private String serviceId;
+ private String serviceName;
+ private List<String> serviceTags;
+ private String serviceAddress;
+ private Integer servicePort;
+ private Boolean serviceEnableTagOverride;
+ private long createIndex;
+ private long modifyIndex;
+
+}