diff options
Diffstat (limited to 'dcae-analytics-dmaap/src/main/java/org/openecomp/dcae/apod/analytics/dmaap/domain')
9 files changed, 1042 insertions, 1042 deletions
diff --git a/dcae-analytics-dmaap/src/main/java/org/openecomp/dcae/apod/analytics/dmaap/domain/config/DMaaPMRBaseConfig.java b/dcae-analytics-dmaap/src/main/java/org/openecomp/dcae/apod/analytics/dmaap/domain/config/DMaaPMRBaseConfig.java index d732c9f..32a4357 100644 --- a/dcae-analytics-dmaap/src/main/java/org/openecomp/dcae/apod/analytics/dmaap/domain/config/DMaaPMRBaseConfig.java +++ b/dcae-analytics-dmaap/src/main/java/org/openecomp/dcae/apod/analytics/dmaap/domain/config/DMaaPMRBaseConfig.java @@ -1,193 +1,193 @@ -/* - * ===============================LICENSE_START====================================== - * dcae-analytics - * ================================================================================ - * Copyright © 2017 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.openecomp.dcae.apod.analytics.dmaap.domain.config; - -import com.google.common.base.Objects; -import org.openecomp.dcae.apod.analytics.common.exception.DCAEAnalyticsRuntimeException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.Locale; - -import static org.openecomp.dcae.apod.analytics.common.utils.HTTPUtils.JSON_APPLICATION_TYPE; - -/** - * <p> - * Contains common parameters for both DMaaP Message Router Publisher and Subscriber Configs - * <p> - * @author Rajiv Singla . Creation Date: 10/12/2016. - */ -public abstract class DMaaPMRBaseConfig implements DMaaPMRConfig { - - protected static final Logger LOG = LoggerFactory.getLogger(DMaaPMRBaseConfig.class); - - protected String hostName; - protected Integer portNumber; - protected String topicName; - protected String protocol; - protected String userName; - protected String userPassword; - protected String contentType; - - /** - * Provides host name e.g. mrlocal-mtnjftle01.homer.com - * - * @return host name - */ - public String getHostName() { - return hostName; - } - - - /** - * Provides Port Number of DMaaP MR Topic Host. Defaults to 80 - * - * @return host port number - */ - public Integer getPortNumber() { - return portNumber; - } - - /** - * Provides topic name e.g. com.dcae.dmaap.mtnje2.DcaeTestVES - * - * @return topic name - */ - public String getTopicName() { - return topicName; - } - - /** - * Provides protocol type e.g. http or https - * - * @return protocol type - */ - public String getProtocol() { - return protocol; - } - - /** - * Provides content type e.g. application/json - * - * @return content type - */ - public String getContentType() { - return contentType; - } - - - /** - * Provides User name for the DMaaP MR Topic authentication - * - * @return user name - */ - public String getUserName() { - return userName; - } - - /** - * Provides User password for the DMaaP MR Topic authentication - * - * @return user Password - */ - public String getUserPassword() { - return userPassword; - } - - - /** - * Trims, adjusts casing and validates user input String for protocol selection - * - * @param protocol - User input for protocol String - * @return - network protocol e.g http or https - */ - protected static String normalizeValidateProtocol(final String protocol) { - // validate that only http and https are supported protocols are Supported for DMaaP MR - String normalizedProtocolString = protocol.trim().toLowerCase(Locale.ENGLISH); - if (normalizedProtocolString.isEmpty() || - !("http".equals(normalizedProtocolString) || "https".equals(normalizedProtocolString))) { - - final String errorMessage = - "Unsupported protocol selection. Only HTTPS and HTTPS are currently supported for DMaaP MR"; - - throw new DCAEAnalyticsRuntimeException(errorMessage, LOG, new IllegalArgumentException(errorMessage)); - } - return normalizedProtocolString; - } - - - /** - * Trims, adjust casing and validates content type is supported by DMaaP. - * - * NOTE: DMaaP currently only support application/json content type - * - * @param contentType content type that needs to checked for DMaaP MR support - * @return true if content type is supported by DMaaP MR - */ - protected static String normalizeValidateContentType(final String contentType) { - // Current DMaaP MR is only supporting "application/json" content type - String normalizedContentType = contentType.trim().toLowerCase(Locale.ENGLISH); - final boolean isSupported = contentType.equals(JSON_APPLICATION_TYPE); - if (!isSupported) { - final String errorMessage = - "Unsupported content type selection. Only application/json is currently supported for DMaaP MR"; - - throw new DCAEAnalyticsRuntimeException(errorMessage, LOG, new IllegalArgumentException(errorMessage)); - } - return normalizedContentType; - } - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (!(o instanceof DMaaPMRBaseConfig)) { - return false; - } - DMaaPMRBaseConfig that = (DMaaPMRBaseConfig) o; - return Objects.equal(hostName, that.hostName) && - Objects.equal(portNumber, that.portNumber) && - Objects.equal(topicName, that.topicName) && - Objects.equal(protocol, that.protocol) && - Objects.equal(userName, that.userName) && - Objects.equal(userPassword, that.userPassword) && - Objects.equal(contentType, that.contentType); - } - - @Override - public int hashCode() { - return Objects.hashCode(hostName, portNumber, topicName, protocol, userName, userPassword, contentType); - } - - @Override - public String toString() { - return Objects.toStringHelper(this) - .add("hostName", hostName) - .add("portNumber", portNumber) - .add("topicName", topicName) - .add("protocol", protocol) - .add("userName", userName) - .add("contentType", contentType) - .toString(); - } -} +/*
+ * ===============================LICENSE_START======================================
+ * dcae-analytics
+ * ================================================================================
+ * Copyright © 2017 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.openecomp.dcae.apod.analytics.dmaap.domain.config;
+
+import com.google.common.base.Objects;
+import org.openecomp.dcae.apod.analytics.common.exception.DCAEAnalyticsRuntimeException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Locale;
+
+import static org.openecomp.dcae.apod.analytics.common.utils.HTTPUtils.JSON_APPLICATION_TYPE;
+
+/**
+ * <p>
+ * Contains common parameters for both DMaaP Message Router Publisher and Subscriber Configs
+ * <p>
+ * @author Rajiv Singla . Creation Date: 10/12/2016.
+ */
+public abstract class DMaaPMRBaseConfig implements DMaaPMRConfig {
+
+ protected static final Logger LOG = LoggerFactory.getLogger(DMaaPMRBaseConfig.class);
+
+ protected String hostName;
+ protected Integer portNumber;
+ protected String topicName;
+ protected String protocol;
+ protected String userName;
+ protected String userPassword;
+ protected String contentType;
+
+ /**
+ * Provides host name e.g. mrlocal-mtnjftle01.homer.com
+ *
+ * @return host name
+ */
+ public String getHostName() {
+ return hostName;
+ }
+
+
+ /**
+ * Provides Port Number of DMaaP MR Topic Host. Defaults to 80
+ *
+ * @return host port number
+ */
+ public Integer getPortNumber() {
+ return portNumber;
+ }
+
+ /**
+ * Provides topic name e.g. com.dcae.dmaap.mtnje2.DcaeTestVES
+ *
+ * @return topic name
+ */
+ public String getTopicName() {
+ return topicName;
+ }
+
+ /**
+ * Provides protocol type e.g. http or https
+ *
+ * @return protocol type
+ */
+ public String getProtocol() {
+ return protocol;
+ }
+
+ /**
+ * Provides content type e.g. application/json
+ *
+ * @return content type
+ */
+ public String getContentType() {
+ return contentType;
+ }
+
+
+ /**
+ * Provides User name for the DMaaP MR Topic authentication
+ *
+ * @return user name
+ */
+ public String getUserName() {
+ return userName;
+ }
+
+ /**
+ * Provides User password for the DMaaP MR Topic authentication
+ *
+ * @return user Password
+ */
+ public String getUserPassword() {
+ return userPassword;
+ }
+
+
+ /**
+ * Trims, adjusts casing and validates user input String for protocol selection
+ *
+ * @param protocol - User input for protocol String
+ * @return - network protocol e.g http or https
+ */
+ protected static String normalizeValidateProtocol(final String protocol) {
+ // validate that only http and https are supported protocols are Supported for DMaaP MR
+ String normalizedProtocolString = protocol.trim().toLowerCase(Locale.ENGLISH);
+ if (normalizedProtocolString.isEmpty() ||
+ !("http".equals(normalizedProtocolString) || "https".equals(normalizedProtocolString))) {
+
+ final String errorMessage =
+ "Unsupported protocol selection. Only HTTPS and HTTPS are currently supported for DMaaP MR";
+
+ throw new DCAEAnalyticsRuntimeException(errorMessage, LOG, new IllegalArgumentException(errorMessage));
+ }
+ return normalizedProtocolString;
+ }
+
+
+ /**
+ * Trims, adjust casing and validates content type is supported by DMaaP.
+ *
+ * NOTE: DMaaP currently only support application/json content type
+ *
+ * @param contentType content type that needs to checked for DMaaP MR support
+ * @return true if content type is supported by DMaaP MR
+ */
+ protected static String normalizeValidateContentType(final String contentType) {
+ // Current DMaaP MR is only supporting "application/json" content type
+ String normalizedContentType = contentType.trim().toLowerCase(Locale.ENGLISH);
+ final boolean isSupported = contentType.equals(JSON_APPLICATION_TYPE);
+ if (!isSupported) {
+ final String errorMessage =
+ "Unsupported content type selection. Only application/json is currently supported for DMaaP MR";
+
+ throw new DCAEAnalyticsRuntimeException(errorMessage, LOG, new IllegalArgumentException(errorMessage));
+ }
+ return normalizedContentType;
+ }
+
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (!(o instanceof DMaaPMRBaseConfig)) {
+ return false;
+ }
+ DMaaPMRBaseConfig that = (DMaaPMRBaseConfig) o;
+ return Objects.equal(hostName, that.hostName) &&
+ Objects.equal(portNumber, that.portNumber) &&
+ Objects.equal(topicName, that.topicName) &&
+ Objects.equal(protocol, that.protocol) &&
+ Objects.equal(userName, that.userName) &&
+ Objects.equal(userPassword, that.userPassword) &&
+ Objects.equal(contentType, that.contentType);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(hostName, portNumber, topicName, protocol, userName, userPassword, contentType);
+ }
+
+ @Override
+ public String toString() {
+ return Objects.toStringHelper(this)
+ .add("hostName", hostName)
+ .add("portNumber", portNumber)
+ .add("topicName", topicName)
+ .add("protocol", protocol)
+ .add("userName", userName)
+ .add("contentType", contentType)
+ .toString();
+ }
+}
diff --git a/dcae-analytics-dmaap/src/main/java/org/openecomp/dcae/apod/analytics/dmaap/domain/config/DMaaPMRConfig.java b/dcae-analytics-dmaap/src/main/java/org/openecomp/dcae/apod/analytics/dmaap/domain/config/DMaaPMRConfig.java index 93bc38a..687d489 100644 --- a/dcae-analytics-dmaap/src/main/java/org/openecomp/dcae/apod/analytics/dmaap/domain/config/DMaaPMRConfig.java +++ b/dcae-analytics-dmaap/src/main/java/org/openecomp/dcae/apod/analytics/dmaap/domain/config/DMaaPMRConfig.java @@ -1,32 +1,32 @@ -/* - * ===============================LICENSE_START====================================== - * dcae-analytics - * ================================================================================ - * Copyright © 2017 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.openecomp.dcae.apod.analytics.dmaap.domain.config; - -/** - * <p> - * Marker Interface for all DMaaP MR Configs. - * Holds Default configuration parameters for all Configs - * <p> - * @author Rajiv Singla . Creation Date: 10/12/2016. - */ -public interface DMaaPMRConfig { - -} +/*
+ * ===============================LICENSE_START======================================
+ * dcae-analytics
+ * ================================================================================
+ * Copyright © 2017 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.openecomp.dcae.apod.analytics.dmaap.domain.config;
+
+/**
+ * <p>
+ * Marker Interface for all DMaaP MR Configs.
+ * Holds Default configuration parameters for all Configs
+ * <p>
+ * @author Rajiv Singla . Creation Date: 10/12/2016.
+ */
+public interface DMaaPMRConfig {
+
+}
diff --git a/dcae-analytics-dmaap/src/main/java/org/openecomp/dcae/apod/analytics/dmaap/domain/config/DMaaPMRPublisherConfig.java b/dcae-analytics-dmaap/src/main/java/org/openecomp/dcae/apod/analytics/dmaap/domain/config/DMaaPMRPublisherConfig.java index 96577c6..6fbebf2 100644 --- a/dcae-analytics-dmaap/src/main/java/org/openecomp/dcae/apod/analytics/dmaap/domain/config/DMaaPMRPublisherConfig.java +++ b/dcae-analytics-dmaap/src/main/java/org/openecomp/dcae/apod/analytics/dmaap/domain/config/DMaaPMRPublisherConfig.java @@ -1,248 +1,248 @@ -/* - * ===============================LICENSE_START====================================== - * dcae-analytics - * ================================================================================ - * Copyright © 2017 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.openecomp.dcae.apod.analytics.dmaap.domain.config; - -import com.google.common.base.Objects; -import org.openecomp.dcae.apod.analytics.common.AnalyticsConstants; - -import javax.annotation.Nonnull; - -/** - * <p> - * Immutable DMaaP MR Configuration for DMaaP MR Publisher. - * <p> - * Use {@link DMaaPMRPublisherConfig.Builder} to construct Subscriber Configuration - * </p> - * <p> - * @author Rajiv Singla . Creation Date: 10/12/2016. - */ -public class DMaaPMRPublisherConfig extends DMaaPMRBaseConfig { - - /** - * Publisher batching queue size - */ - private int maxBatchSize; - - /** - * Publisher Recovery Queue Size - */ - private int maxRecoveryQueueSize; - - - private DMaaPMRPublisherConfig(@Nonnull String hostName, - @Nonnull Integer portNumber, - @Nonnull String topicName, - @Nonnull String protocol, - String userName, - String userPassword, - @Nonnull String contentType, - int maxBatchSize, - int maxRecoveryQueueSize) { - this.hostName = hostName; - this.portNumber = portNumber; - this.topicName = topicName; - this.protocol = protocol; - this.userName = userName; - this.userPassword = userPassword; - this.contentType = contentType; - this.maxBatchSize = maxBatchSize; - this.maxRecoveryQueueSize = maxRecoveryQueueSize; - } - - - /** - * Builder to initialize immutable {@link DMaaPMRPublisherConfig} object - */ - public static class Builder { - - private String hostName; - private Integer portNumber; - private String topicName; - private String userName; - private String userPassword; - private String protocol; - private String contentType; - private int maxBatchSize; - private int maxRecoveryQueueSize; - - public Builder(@Nonnull String hostName, @Nonnull String topicName) { - // required values - this.hostName = hostName; - this.topicName = topicName; - // Default values - this.portNumber = AnalyticsConstants.DEFAULT_PORT_NUMBER; - this.userName = AnalyticsConstants.DEFAULT_USER_NAME; - this.userPassword = AnalyticsConstants.DEFAULT_USER_PASSWORD; - this.protocol = AnalyticsConstants.DEFAULT_PROTOCOL; - this.contentType = AnalyticsConstants.DEFAULT_CONTENT_TYPE; - this.maxBatchSize = AnalyticsConstants.DEFAULT_PUBLISHER_MAX_BATCH_SIZE; - this.maxRecoveryQueueSize = AnalyticsConstants.DEFAULT_PUBLISHER_MAX_RECOVERY_QUEUE_SIZE; - } - - /** - * Setup for custom host port number - Defaults to 80. - * - * @param portNumber custom port number - * @return Builder object itself for chaining - */ - public Builder setPortNumber(@Nonnull Integer portNumber) { - this.portNumber = portNumber; - return this; - } - - - /** - * Setup user name for authentication. If no username is provided authentication will be disabled - * - * @param userName user name for DMaaP Topic Authentication - * @return Builder object itself for chaining - */ - public Builder setUserName(@Nonnull String userName) { - this.userName = userName; - return this; - } - - - /** - * Setup user password for authentication. If no password is provided authentication will be disabled - * - * @param userPassword user password for DMaaP Topic Authentication - * @return Builder object itself for chaining - */ - public Builder setUserPassword(@Nonnull String userPassword) { - this.userPassword = userPassword; - return this; - } - - - /** - * Setup custom Publisher protocol - Defaults to https. - * Note: Only http and https are currently supported. - * - * @param protocol protocol e.g. https - * @return Builder object itself for chaining - */ - public Builder setProtocol(@Nonnull String protocol) { - this.protocol = normalizeValidateProtocol(protocol); - return this; - } - - - /** - * Setup custom Publisher content-type - Defaults to application/json - * - * @param contentType content type e.g. application/json - * @return Builder object itself for chaining - */ - public Builder setContentType(@Nonnull String contentType) { - final String normalizedContentType = normalizeValidateContentType(contentType); - this.contentType = normalizedContentType; - return this; - } - - - /** - * Setup custom Publisher Max Batch Size - Defaults to 100 - * - * @param maxBatchSize max Batch Size - * @return Builder object itself for chaining - */ - public Builder setMaxBatchSize(int maxBatchSize) { - this.maxBatchSize = maxBatchSize; - return this; - } - - - /** - * Setup custom Maximum Recovery Queue Size. Recovery Queue is used to hold messages temporarily in case - * DMaaP MR Publisher topic is not responding for any reason. Defaults to 100,000 - * - * @param maxRecoveryQueueSize max recovery queue size - * @return Builder object itself for chaining - */ - public Builder setMaxRecoveryQueueSize(int maxRecoveryQueueSize) { - this.maxRecoveryQueueSize = maxRecoveryQueueSize; - return this; - } - - /** - * Creates immutable instance of {@link DMaaPMRPublisherConfig} - * - * @return Builds and returns thread safe, immutable {@link DMaaPMRPublisherConfig} object - */ - public DMaaPMRPublisherConfig build() { - return new DMaaPMRPublisherConfig(hostName, portNumber, topicName, protocol, userName, userPassword, - contentType, maxBatchSize, maxRecoveryQueueSize); - } - - } - - - /** - * Returns max Publisher Batch Queue Size - * - * @return max Publisher Batch Queue size - */ - public int getMaxBatchSize() { - return maxBatchSize; - } - - /** - * Returns max Publisher Recovery Queue Size - * - * @return max Recovery Queue size - */ - public int getMaxRecoveryQueueSize() { - return maxRecoveryQueueSize; - } - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - if (!super.equals(o)) { - return false; - } - DMaaPMRPublisherConfig that = (DMaaPMRPublisherConfig) o; - return maxBatchSize == that.maxBatchSize && - maxRecoveryQueueSize == that.maxRecoveryQueueSize; - } - - @Override - public int hashCode() { - return Objects.hashCode(super.hashCode(), maxBatchSize, maxRecoveryQueueSize); - } - - - @Override - public String toString() { - return Objects.toStringHelper(this) - .add("baseConfig", super.toString()) - .add("maxBatchSize", maxBatchSize) - .add("maxRecoveryQueueSize", maxRecoveryQueueSize) - .toString(); - } -} +/*
+ * ===============================LICENSE_START======================================
+ * dcae-analytics
+ * ================================================================================
+ * Copyright © 2017 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.openecomp.dcae.apod.analytics.dmaap.domain.config;
+
+import com.google.common.base.Objects;
+import org.openecomp.dcae.apod.analytics.common.AnalyticsConstants;
+
+import javax.annotation.Nonnull;
+
+/**
+ * <p>
+ * Immutable DMaaP MR Configuration for DMaaP MR Publisher.
+ * <p>
+ * Use {@link DMaaPMRPublisherConfig.Builder} to construct Subscriber Configuration
+ * </p>
+ * <p>
+ * @author Rajiv Singla . Creation Date: 10/12/2016.
+ */
+public class DMaaPMRPublisherConfig extends DMaaPMRBaseConfig {
+
+ /**
+ * Publisher batching queue size
+ */
+ private int maxBatchSize;
+
+ /**
+ * Publisher Recovery Queue Size
+ */
+ private int maxRecoveryQueueSize;
+
+
+ private DMaaPMRPublisherConfig(@Nonnull String hostName,
+ @Nonnull Integer portNumber,
+ @Nonnull String topicName,
+ @Nonnull String protocol,
+ String userName,
+ String userPassword,
+ @Nonnull String contentType,
+ int maxBatchSize,
+ int maxRecoveryQueueSize) {
+ this.hostName = hostName;
+ this.portNumber = portNumber;
+ this.topicName = topicName;
+ this.protocol = protocol;
+ this.userName = userName;
+ this.userPassword = userPassword;
+ this.contentType = contentType;
+ this.maxBatchSize = maxBatchSize;
+ this.maxRecoveryQueueSize = maxRecoveryQueueSize;
+ }
+
+
+ /**
+ * Builder to initialize immutable {@link DMaaPMRPublisherConfig} object
+ */
+ public static class Builder {
+
+ private String hostName;
+ private Integer portNumber;
+ private String topicName;
+ private String userName;
+ private String userPassword;
+ private String protocol;
+ private String contentType;
+ private int maxBatchSize;
+ private int maxRecoveryQueueSize;
+
+ public Builder(@Nonnull String hostName, @Nonnull String topicName) {
+ // required values
+ this.hostName = hostName;
+ this.topicName = topicName;
+ // Default values
+ this.portNumber = AnalyticsConstants.DEFAULT_PORT_NUMBER;
+ this.userName = AnalyticsConstants.DEFAULT_USER_NAME;
+ this.userPassword = AnalyticsConstants.DEFAULT_USER_PASSWORD;
+ this.protocol = AnalyticsConstants.DEFAULT_PROTOCOL;
+ this.contentType = AnalyticsConstants.DEFAULT_CONTENT_TYPE;
+ this.maxBatchSize = AnalyticsConstants.DEFAULT_PUBLISHER_MAX_BATCH_SIZE;
+ this.maxRecoveryQueueSize = AnalyticsConstants.DEFAULT_PUBLISHER_MAX_RECOVERY_QUEUE_SIZE;
+ }
+
+ /**
+ * Setup for custom host port number - Defaults to 80.
+ *
+ * @param portNumber custom port number
+ * @return Builder object itself for chaining
+ */
+ public Builder setPortNumber(@Nonnull Integer portNumber) {
+ this.portNumber = portNumber;
+ return this;
+ }
+
+
+ /**
+ * Setup user name for authentication. If no username is provided authentication will be disabled
+ *
+ * @param userName user name for DMaaP Topic Authentication
+ * @return Builder object itself for chaining
+ */
+ public Builder setUserName(@Nonnull String userName) {
+ this.userName = userName;
+ return this;
+ }
+
+
+ /**
+ * Setup user password for authentication. If no password is provided authentication will be disabled
+ *
+ * @param userPassword user password for DMaaP Topic Authentication
+ * @return Builder object itself for chaining
+ */
+ public Builder setUserPassword(@Nonnull String userPassword) {
+ this.userPassword = userPassword;
+ return this;
+ }
+
+
+ /**
+ * Setup custom Publisher protocol - Defaults to https.
+ * Note: Only http and https are currently supported.
+ *
+ * @param protocol protocol e.g. https
+ * @return Builder object itself for chaining
+ */
+ public Builder setProtocol(@Nonnull String protocol) {
+ this.protocol = normalizeValidateProtocol(protocol);
+ return this;
+ }
+
+
+ /**
+ * Setup custom Publisher content-type - Defaults to application/json
+ *
+ * @param contentType content type e.g. application/json
+ * @return Builder object itself for chaining
+ */
+ public Builder setContentType(@Nonnull String contentType) {
+ final String normalizedContentType = normalizeValidateContentType(contentType);
+ this.contentType = normalizedContentType;
+ return this;
+ }
+
+
+ /**
+ * Setup custom Publisher Max Batch Size - Defaults to 100
+ *
+ * @param maxBatchSize max Batch Size
+ * @return Builder object itself for chaining
+ */
+ public Builder setMaxBatchSize(int maxBatchSize) {
+ this.maxBatchSize = maxBatchSize;
+ return this;
+ }
+
+
+ /**
+ * Setup custom Maximum Recovery Queue Size. Recovery Queue is used to hold messages temporarily in case
+ * DMaaP MR Publisher topic is not responding for any reason. Defaults to 100,000
+ *
+ * @param maxRecoveryQueueSize max recovery queue size
+ * @return Builder object itself for chaining
+ */
+ public Builder setMaxRecoveryQueueSize(int maxRecoveryQueueSize) {
+ this.maxRecoveryQueueSize = maxRecoveryQueueSize;
+ return this;
+ }
+
+ /**
+ * Creates immutable instance of {@link DMaaPMRPublisherConfig}
+ *
+ * @return Builds and returns thread safe, immutable {@link DMaaPMRPublisherConfig} object
+ */
+ public DMaaPMRPublisherConfig build() {
+ return new DMaaPMRPublisherConfig(hostName, portNumber, topicName, protocol, userName, userPassword,
+ contentType, maxBatchSize, maxRecoveryQueueSize);
+ }
+
+ }
+
+
+ /**
+ * Returns max Publisher Batch Queue Size
+ *
+ * @return max Publisher Batch Queue size
+ */
+ public int getMaxBatchSize() {
+ return maxBatchSize;
+ }
+
+ /**
+ * Returns max Publisher Recovery Queue Size
+ *
+ * @return max Recovery Queue size
+ */
+ public int getMaxRecoveryQueueSize() {
+ return maxRecoveryQueueSize;
+ }
+
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ if (!super.equals(o)) {
+ return false;
+ }
+ DMaaPMRPublisherConfig that = (DMaaPMRPublisherConfig) o;
+ return maxBatchSize == that.maxBatchSize &&
+ maxRecoveryQueueSize == that.maxRecoveryQueueSize;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(super.hashCode(), maxBatchSize, maxRecoveryQueueSize);
+ }
+
+
+ @Override
+ public String toString() {
+ return Objects.toStringHelper(this)
+ .add("baseConfig", super.toString())
+ .add("maxBatchSize", maxBatchSize)
+ .add("maxRecoveryQueueSize", maxRecoveryQueueSize)
+ .toString();
+ }
+}
diff --git a/dcae-analytics-dmaap/src/main/java/org/openecomp/dcae/apod/analytics/dmaap/domain/config/DMaaPMRSubscriberConfig.java b/dcae-analytics-dmaap/src/main/java/org/openecomp/dcae/apod/analytics/dmaap/domain/config/DMaaPMRSubscriberConfig.java index e2feeac..7252ce0 100644 --- a/dcae-analytics-dmaap/src/main/java/org/openecomp/dcae/apod/analytics/dmaap/domain/config/DMaaPMRSubscriberConfig.java +++ b/dcae-analytics-dmaap/src/main/java/org/openecomp/dcae/apod/analytics/dmaap/domain/config/DMaaPMRSubscriberConfig.java @@ -1,295 +1,295 @@ -/* - * ===============================LICENSE_START====================================== - * dcae-analytics - * ================================================================================ - * Copyright © 2017 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.openecomp.dcae.apod.analytics.dmaap.domain.config; - -import com.google.common.base.Objects; -import org.openecomp.dcae.apod.analytics.common.AnalyticsConstants; - -import java.util.UUID; - -import javax.annotation.Nonnull; - -/** - * <p> - * Immutable DMaaP MR Configuration for Subscriber. - * <p> - * Use {@link DMaaPMRSubscriberConfig.Builder} to construct Subscriber Configuration - * <p> - * - * @author Rajiv Singla . Creation Date: 10/12/2016. - */ -public final class DMaaPMRSubscriberConfig extends DMaaPMRBaseConfig { - - private final String consumerId; - private final String consumerGroup; - private final Integer timeoutMS; - private final Integer messageLimit; - - private DMaaPMRSubscriberConfig(@Nonnull String hostName, - @Nonnull Integer portNumber, - @Nonnull String topicName, - @Nonnull String protocol, - String userName, - String userPassword, - @Nonnull String contentType, - @Nonnull String consumerId, - @Nonnull String consumerGroup, - @Nonnull Integer timeoutMS, - @Nonnull Integer messageLimit) { - this.hostName = hostName; - this.portNumber = portNumber; - this.topicName = topicName; - this.protocol = protocol; - this.userName = userName; - this.userPassword = userPassword; - this.contentType = contentType; - this.consumerId = consumerId; - this.consumerGroup = consumerGroup; - this.timeoutMS = timeoutMS; - this.messageLimit = messageLimit; - } - - /** - * Builder to initialize immutable {@link DMaaPMRSubscriberConfig} object - */ - public static class Builder { - - private String hostName; - private Integer portNumber; - private String topicName; - private String userName; - private String userPassword; - private String protocol; - private String contentType; - private String consumerId; - private String consumerGroup; - private Integer timeoutMS; - private Integer messageLimit; - - public Builder(@Nonnull String hostName, - @Nonnull String topicName) { - // Required Values - this.hostName = hostName; - this.topicName = topicName; - - // Default values - this.portNumber = AnalyticsConstants.DEFAULT_PORT_NUMBER; - this.userName = AnalyticsConstants.DEFAULT_USER_NAME; - this.userPassword = AnalyticsConstants.DEFAULT_USER_PASSWORD; - this.protocol = AnalyticsConstants.DEFAULT_PROTOCOL; - this.contentType = AnalyticsConstants.DEFAULT_CONTENT_TYPE; - this.consumerId = UUID.randomUUID().toString(); // consumer is assigned a random id by default - this.consumerGroup = AnalyticsConstants.DEFAULT_SUBSCRIBER_GROUP_PREFIX + consumerId; // random group - this.timeoutMS = AnalyticsConstants.DEFAULT_SUBSCRIBER_TIMEOUT_MS; // defaults to 10ms timeout - this.messageLimit = AnalyticsConstants.DEFAULT_SUBSCRIBER_MESSAGE_LIMIT; // defaults to 1000 message limit - } - - - /** - * Setup for custom host port number - Defaults to 80. - * - * @param portNumber custom port number - * @return Builder object itself for chaining - */ - public Builder setPortNumber(@Nonnull Integer portNumber) { - this.portNumber = portNumber; - return this; - } - - - /** - * Setup user name for authentication. If no username is provided authentication will be disabled - * - * @param userName user name for DMaaP Topic Authentication - * @return Builder object itself for chaining - */ - public Builder setUserName(@Nonnull String userName) { - this.userName = userName; - return this; - } - - - /** - * Setup user password for authentication. If no password is provided authentication will be disabled - * - * @param userPassword user password for DMaaP Topic Authentication - * @return Builder object itself for chaining - */ - public Builder setUserPassword(@Nonnull String userPassword) { - this.userPassword = userPassword; - return this; - } - - - /** - * Setup custom Subscriber protocol - Defaults to https. - * Note: Only http and https are currently supported. - * - * @param protocol protocol e.g. https or http - * @return Builder object itself for chaining - */ - public Builder setProtocol(@Nonnull String protocol) { - - this.protocol = normalizeValidateProtocol(protocol); - return this; - } - - /** - * Setup custom Subscriber content-type - Defaults to application/json - * - * @param contentType content type e.g. application/json - * @return Builder object itself for chaining - */ - public Builder setContentType(@Nonnull String contentType) { - final String normalizedContentType = normalizeValidateContentType(contentType); - this.contentType = normalizedContentType; - return this; - } - - - /** - * Setup custom Consumer Id - Defaults to random Id - * - * @param consumerId - custom consumer ID - * @return Builder object itself for chaining - */ - public Builder setConsumerId(@Nonnull String consumerId) { - this.consumerId = consumerId; - return this; - } - - /** - * Setup custom Consumer Group - Default to OpenDCAE-DMaaPSub-ConsumerID - * - * @param consumerGroup - custom Consumer Group - * @return Builder object itself for chaining - */ - public Builder setConsumerGroup(@Nonnull String consumerGroup) { - this.consumerGroup = consumerGroup; - return this; - } - - /** - * Setup Custom Subscriber timeout in ms - Default to no timeout limit - * - * @param timeoutMS timeout in milliseconds - * @return Builder object itself for chaining - */ - public Builder setTimeoutMS(@Nonnull Integer timeoutMS) { - this.timeoutMS = timeoutMS; - return this; - } - - /** - * Setup custom Subscriber Message Limit - Default to no limit - * - * @param messageLimit message Limit - * @return Builder object itself for chaining - */ - public Builder setMessageLimit(@Nonnull Integer messageLimit) { - this.messageLimit = messageLimit; - return this; - } - - /** - * Builds Immutable instance of {@link DMaaPMRSubscriberConfig} - * - * @return immutable DMaaP Subscriber Config Object - */ - public DMaaPMRSubscriberConfig build() { - return new DMaaPMRSubscriberConfig(hostName, portNumber, topicName, protocol, userName, userPassword, - contentType, consumerId, consumerGroup, timeoutMS, messageLimit); - } - - } - - - /** - * DMaaP MR Subscriber Consumer Id - * - * @return consumer Id - */ - public String getConsumerId() { - return consumerId; - } - - /** - * DMaaP MR Subscriber Consumer Group - * - * @return consumer group - */ - public String getConsumerGroup() { - return consumerGroup; - } - - /** - * DMaaP MR Subscriber Timeout in ms - * - * @return subscriber timeout ms - */ - public Integer getTimeoutMS() { - return timeoutMS; - } - - /** - * DMaaP MR Subscriber message limit - * - * @return subscriber message limit - */ - public Integer getMessageLimit() { - return messageLimit; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - if (!super.equals(o)) { - return false; - } - DMaaPMRSubscriberConfig that = (DMaaPMRSubscriberConfig) o; - return Objects.equal(consumerId, that.consumerId) && - Objects.equal(consumerGroup, that.consumerGroup) && - Objects.equal(timeoutMS, that.timeoutMS) && - Objects.equal(messageLimit, that.messageLimit); - } - - @Override - public int hashCode() { - return Objects.hashCode(super.hashCode(), consumerId, consumerGroup, timeoutMS, messageLimit); - } - - - @Override - public String toString() { - return Objects.toStringHelper(this) - .add("baseConfig", super.toString()) - .add("consumerId", consumerId) - .add("consumerGroup", consumerGroup) - .add("timeoutMS", timeoutMS) - .add("messageLimit", messageLimit) - .toString(); - } -} +/*
+ * ===============================LICENSE_START======================================
+ * dcae-analytics
+ * ================================================================================
+ * Copyright © 2017 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.openecomp.dcae.apod.analytics.dmaap.domain.config;
+
+import com.google.common.base.Objects;
+import org.openecomp.dcae.apod.analytics.common.AnalyticsConstants;
+
+import java.util.UUID;
+
+import javax.annotation.Nonnull;
+
+/**
+ * <p>
+ * Immutable DMaaP MR Configuration for Subscriber.
+ * <p>
+ * Use {@link DMaaPMRSubscriberConfig.Builder} to construct Subscriber Configuration
+ * <p>
+ *
+ * @author Rajiv Singla . Creation Date: 10/12/2016.
+ */
+public final class DMaaPMRSubscriberConfig extends DMaaPMRBaseConfig {
+
+ private final String consumerId;
+ private final String consumerGroup;
+ private final Integer timeoutMS;
+ private final Integer messageLimit;
+
+ private DMaaPMRSubscriberConfig(@Nonnull String hostName,
+ @Nonnull Integer portNumber,
+ @Nonnull String topicName,
+ @Nonnull String protocol,
+ String userName,
+ String userPassword,
+ @Nonnull String contentType,
+ @Nonnull String consumerId,
+ @Nonnull String consumerGroup,
+ @Nonnull Integer timeoutMS,
+ @Nonnull Integer messageLimit) {
+ this.hostName = hostName;
+ this.portNumber = portNumber;
+ this.topicName = topicName;
+ this.protocol = protocol;
+ this.userName = userName;
+ this.userPassword = userPassword;
+ this.contentType = contentType;
+ this.consumerId = consumerId;
+ this.consumerGroup = consumerGroup;
+ this.timeoutMS = timeoutMS;
+ this.messageLimit = messageLimit;
+ }
+
+ /**
+ * Builder to initialize immutable {@link DMaaPMRSubscriberConfig} object
+ */
+ public static class Builder {
+
+ private String hostName;
+ private Integer portNumber;
+ private String topicName;
+ private String userName;
+ private String userPassword;
+ private String protocol;
+ private String contentType;
+ private String consumerId;
+ private String consumerGroup;
+ private Integer timeoutMS;
+ private Integer messageLimit;
+
+ public Builder(@Nonnull String hostName,
+ @Nonnull String topicName) {
+ // Required Values
+ this.hostName = hostName;
+ this.topicName = topicName;
+
+ // Default values
+ this.portNumber = AnalyticsConstants.DEFAULT_PORT_NUMBER;
+ this.userName = AnalyticsConstants.DEFAULT_USER_NAME;
+ this.userPassword = AnalyticsConstants.DEFAULT_USER_PASSWORD;
+ this.protocol = AnalyticsConstants.DEFAULT_PROTOCOL;
+ this.contentType = AnalyticsConstants.DEFAULT_CONTENT_TYPE;
+ this.consumerId = UUID.randomUUID().toString(); // consumer is assigned a random id by default
+ this.consumerGroup = AnalyticsConstants.DEFAULT_SUBSCRIBER_GROUP_PREFIX + consumerId; // random group
+ this.timeoutMS = AnalyticsConstants.DEFAULT_SUBSCRIBER_TIMEOUT_MS; // defaults to 10ms timeout
+ this.messageLimit = AnalyticsConstants.DEFAULT_SUBSCRIBER_MESSAGE_LIMIT; // defaults to 1000 message limit
+ }
+
+
+ /**
+ * Setup for custom host port number - Defaults to 80.
+ *
+ * @param portNumber custom port number
+ * @return Builder object itself for chaining
+ */
+ public Builder setPortNumber(@Nonnull Integer portNumber) {
+ this.portNumber = portNumber;
+ return this;
+ }
+
+
+ /**
+ * Setup user name for authentication. If no username is provided authentication will be disabled
+ *
+ * @param userName user name for DMaaP Topic Authentication
+ * @return Builder object itself for chaining
+ */
+ public Builder setUserName(@Nonnull String userName) {
+ this.userName = userName;
+ return this;
+ }
+
+
+ /**
+ * Setup user password for authentication. If no password is provided authentication will be disabled
+ *
+ * @param userPassword user password for DMaaP Topic Authentication
+ * @return Builder object itself for chaining
+ */
+ public Builder setUserPassword(@Nonnull String userPassword) {
+ this.userPassword = userPassword;
+ return this;
+ }
+
+
+ /**
+ * Setup custom Subscriber protocol - Defaults to https.
+ * Note: Only http and https are currently supported.
+ *
+ * @param protocol protocol e.g. https or http
+ * @return Builder object itself for chaining
+ */
+ public Builder setProtocol(@Nonnull String protocol) {
+
+ this.protocol = normalizeValidateProtocol(protocol);
+ return this;
+ }
+
+ /**
+ * Setup custom Subscriber content-type - Defaults to application/json
+ *
+ * @param contentType content type e.g. application/json
+ * @return Builder object itself for chaining
+ */
+ public Builder setContentType(@Nonnull String contentType) {
+ final String normalizedContentType = normalizeValidateContentType(contentType);
+ this.contentType = normalizedContentType;
+ return this;
+ }
+
+
+ /**
+ * Setup custom Consumer Id - Defaults to random Id
+ *
+ * @param consumerId - custom consumer ID
+ * @return Builder object itself for chaining
+ */
+ public Builder setConsumerId(@Nonnull String consumerId) {
+ this.consumerId = consumerId;
+ return this;
+ }
+
+ /**
+ * Setup custom Consumer Group - Default to OpenDCAE-DMaaPSub-ConsumerID
+ *
+ * @param consumerGroup - custom Consumer Group
+ * @return Builder object itself for chaining
+ */
+ public Builder setConsumerGroup(@Nonnull String consumerGroup) {
+ this.consumerGroup = consumerGroup;
+ return this;
+ }
+
+ /**
+ * Setup Custom Subscriber timeout in ms - Default to no timeout limit
+ *
+ * @param timeoutMS timeout in milliseconds
+ * @return Builder object itself for chaining
+ */
+ public Builder setTimeoutMS(@Nonnull Integer timeoutMS) {
+ this.timeoutMS = timeoutMS;
+ return this;
+ }
+
+ /**
+ * Setup custom Subscriber Message Limit - Default to no limit
+ *
+ * @param messageLimit message Limit
+ * @return Builder object itself for chaining
+ */
+ public Builder setMessageLimit(@Nonnull Integer messageLimit) {
+ this.messageLimit = messageLimit;
+ return this;
+ }
+
+ /**
+ * Builds Immutable instance of {@link DMaaPMRSubscriberConfig}
+ *
+ * @return immutable DMaaP Subscriber Config Object
+ */
+ public DMaaPMRSubscriberConfig build() {
+ return new DMaaPMRSubscriberConfig(hostName, portNumber, topicName, protocol, userName, userPassword,
+ contentType, consumerId, consumerGroup, timeoutMS, messageLimit);
+ }
+
+ }
+
+
+ /**
+ * DMaaP MR Subscriber Consumer Id
+ *
+ * @return consumer Id
+ */
+ public String getConsumerId() {
+ return consumerId;
+ }
+
+ /**
+ * DMaaP MR Subscriber Consumer Group
+ *
+ * @return consumer group
+ */
+ public String getConsumerGroup() {
+ return consumerGroup;
+ }
+
+ /**
+ * DMaaP MR Subscriber Timeout in ms
+ *
+ * @return subscriber timeout ms
+ */
+ public Integer getTimeoutMS() {
+ return timeoutMS;
+ }
+
+ /**
+ * DMaaP MR Subscriber message limit
+ *
+ * @return subscriber message limit
+ */
+ public Integer getMessageLimit() {
+ return messageLimit;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ if (!super.equals(o)) {
+ return false;
+ }
+ DMaaPMRSubscriberConfig that = (DMaaPMRSubscriberConfig) o;
+ return Objects.equal(consumerId, that.consumerId) &&
+ Objects.equal(consumerGroup, that.consumerGroup) &&
+ Objects.equal(timeoutMS, that.timeoutMS) &&
+ Objects.equal(messageLimit, that.messageLimit);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(super.hashCode(), consumerId, consumerGroup, timeoutMS, messageLimit);
+ }
+
+
+ @Override
+ public String toString() {
+ return Objects.toStringHelper(this)
+ .add("baseConfig", super.toString())
+ .add("consumerId", consumerId)
+ .add("consumerGroup", consumerGroup)
+ .add("timeoutMS", timeoutMS)
+ .add("messageLimit", messageLimit)
+ .toString();
+ }
+}
diff --git a/dcae-analytics-dmaap/src/main/java/org/openecomp/dcae/apod/analytics/dmaap/domain/response/DMaaPMRPublisherResponse.java b/dcae-analytics-dmaap/src/main/java/org/openecomp/dcae/apod/analytics/dmaap/domain/response/DMaaPMRPublisherResponse.java index 6fc980e..845f6df 100644 --- a/dcae-analytics-dmaap/src/main/java/org/openecomp/dcae/apod/analytics/dmaap/domain/response/DMaaPMRPublisherResponse.java +++ b/dcae-analytics-dmaap/src/main/java/org/openecomp/dcae/apod/analytics/dmaap/domain/response/DMaaPMRPublisherResponse.java @@ -1,38 +1,38 @@ -/* - * ===============================LICENSE_START====================================== - * dcae-analytics - * ================================================================================ - * Copyright © 2017 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.openecomp.dcae.apod.analytics.dmaap.domain.response; - -/** - * <p> - * Contract for all DMaaPMR Publisher Response - * <p> - * @author Rajiv Singla . Creation Date: 10/13/2016. - */ -public interface DMaaPMRPublisherResponse extends DMaaPMRResponse { - - - /** - * Gets number of pending messages - * - * @return pending messages in the batch queue - */ - int getPendingMessagesCount(); -} +/*
+ * ===============================LICENSE_START======================================
+ * dcae-analytics
+ * ================================================================================
+ * Copyright © 2017 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.openecomp.dcae.apod.analytics.dmaap.domain.response;
+
+/**
+ * <p>
+ * Contract for all DMaaPMR Publisher Response
+ * <p>
+ * @author Rajiv Singla . Creation Date: 10/13/2016.
+ */
+public interface DMaaPMRPublisherResponse extends DMaaPMRResponse {
+
+
+ /**
+ * Gets number of pending messages
+ *
+ * @return pending messages in the batch queue
+ */
+ int getPendingMessagesCount();
+}
diff --git a/dcae-analytics-dmaap/src/main/java/org/openecomp/dcae/apod/analytics/dmaap/domain/response/DMaaPMRPublisherResponseImpl.java b/dcae-analytics-dmaap/src/main/java/org/openecomp/dcae/apod/analytics/dmaap/domain/response/DMaaPMRPublisherResponseImpl.java index 36a0388..92996b4 100644 --- a/dcae-analytics-dmaap/src/main/java/org/openecomp/dcae/apod/analytics/dmaap/domain/response/DMaaPMRPublisherResponseImpl.java +++ b/dcae-analytics-dmaap/src/main/java/org/openecomp/dcae/apod/analytics/dmaap/domain/response/DMaaPMRPublisherResponseImpl.java @@ -1,70 +1,70 @@ -/* - * ===============================LICENSE_START====================================== - * dcae-analytics - * ================================================================================ - * Copyright © 2017 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.openecomp.dcae.apod.analytics.dmaap.domain.response; - -import com.google.common.base.Objects; - -import javax.annotation.Nonnull; - -/** - * <p> - * An simple implementation of {@link DMaaPMRPublisherResponse} - * <p> - * @author Rajiv Singla . Creation Date: 10/13/2016. - */ -public class DMaaPMRPublisherResponseImpl implements DMaaPMRPublisherResponse { - - private final Integer responseCode; - private final String responseMessage; - private final int pendingMessagesCount; - - public DMaaPMRPublisherResponseImpl(@Nonnull Integer responseCode, - @Nonnull String responseMessage, - int pendingMessagesCount) { - this.responseCode = responseCode; - this.responseMessage = responseMessage; - this.pendingMessagesCount = pendingMessagesCount; - } - - @Override - public Integer getResponseCode() { - return responseCode; - } - - @Override - public String getResponseMessage() { - return responseMessage; - } - - @Override - public int getPendingMessagesCount() { - return pendingMessagesCount; - } - - @Override - public String toString() { - return Objects.toStringHelper(this) - .add("responseCode", responseCode) - .add("responseMessage", responseMessage) - .add("pendingMessagesCount", pendingMessagesCount) - .toString(); - } -} +/*
+ * ===============================LICENSE_START======================================
+ * dcae-analytics
+ * ================================================================================
+ * Copyright © 2017 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.openecomp.dcae.apod.analytics.dmaap.domain.response;
+
+import com.google.common.base.Objects;
+
+import javax.annotation.Nonnull;
+
+/**
+ * <p>
+ * An simple implementation of {@link DMaaPMRPublisherResponse}
+ * <p>
+ * @author Rajiv Singla . Creation Date: 10/13/2016.
+ */
+public class DMaaPMRPublisherResponseImpl implements DMaaPMRPublisherResponse {
+
+ private final Integer responseCode;
+ private final String responseMessage;
+ private final int pendingMessagesCount;
+
+ public DMaaPMRPublisherResponseImpl(@Nonnull Integer responseCode,
+ @Nonnull String responseMessage,
+ int pendingMessagesCount) {
+ this.responseCode = responseCode;
+ this.responseMessage = responseMessage;
+ this.pendingMessagesCount = pendingMessagesCount;
+ }
+
+ @Override
+ public Integer getResponseCode() {
+ return responseCode;
+ }
+
+ @Override
+ public String getResponseMessage() {
+ return responseMessage;
+ }
+
+ @Override
+ public int getPendingMessagesCount() {
+ return pendingMessagesCount;
+ }
+
+ @Override
+ public String toString() {
+ return Objects.toStringHelper(this)
+ .add("responseCode", responseCode)
+ .add("responseMessage", responseMessage)
+ .add("pendingMessagesCount", pendingMessagesCount)
+ .toString();
+ }
+}
diff --git a/dcae-analytics-dmaap/src/main/java/org/openecomp/dcae/apod/analytics/dmaap/domain/response/DMaaPMRResponse.java b/dcae-analytics-dmaap/src/main/java/org/openecomp/dcae/apod/analytics/dmaap/domain/response/DMaaPMRResponse.java index 70d4af2..661a7e5 100644 --- a/dcae-analytics-dmaap/src/main/java/org/openecomp/dcae/apod/analytics/dmaap/domain/response/DMaaPMRResponse.java +++ b/dcae-analytics-dmaap/src/main/java/org/openecomp/dcae/apod/analytics/dmaap/domain/response/DMaaPMRResponse.java @@ -1,46 +1,46 @@ -/* - * ===============================LICENSE_START====================================== - * dcae-analytics - * ================================================================================ - * Copyright © 2017 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.openecomp.dcae.apod.analytics.dmaap.domain.response; - -/** - * <p> - * Contract for DMaaP MR Responses - * <p> - * @author Rajiv Singla . Creation Date: 10/13/2016. - */ -public interface DMaaPMRResponse { - - /** - * Gets HTTP Response Code - * - * @return HTTP Response code as String - */ - Integer getResponseCode(); - - /** - * Gets Response Message - * - * @return Response Message - */ - String getResponseMessage(); - - -} +/*
+ * ===============================LICENSE_START======================================
+ * dcae-analytics
+ * ================================================================================
+ * Copyright © 2017 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.openecomp.dcae.apod.analytics.dmaap.domain.response;
+
+/**
+ * <p>
+ * Contract for DMaaP MR Responses
+ * <p>
+ * @author Rajiv Singla . Creation Date: 10/13/2016.
+ */
+public interface DMaaPMRResponse {
+
+ /**
+ * Gets HTTP Response Code
+ *
+ * @return HTTP Response code as String
+ */
+ Integer getResponseCode();
+
+ /**
+ * Gets Response Message
+ *
+ * @return Response Message
+ */
+ String getResponseMessage();
+
+
+}
diff --git a/dcae-analytics-dmaap/src/main/java/org/openecomp/dcae/apod/analytics/dmaap/domain/response/DMaaPMRSubscriberResponse.java b/dcae-analytics-dmaap/src/main/java/org/openecomp/dcae/apod/analytics/dmaap/domain/response/DMaaPMRSubscriberResponse.java index fb75fef..228e2d3 100644 --- a/dcae-analytics-dmaap/src/main/java/org/openecomp/dcae/apod/analytics/dmaap/domain/response/DMaaPMRSubscriberResponse.java +++ b/dcae-analytics-dmaap/src/main/java/org/openecomp/dcae/apod/analytics/dmaap/domain/response/DMaaPMRSubscriberResponse.java @@ -1,40 +1,40 @@ -/* - * ===============================LICENSE_START====================================== - * dcae-analytics - * ================================================================================ - * Copyright © 2017 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.openecomp.dcae.apod.analytics.dmaap.domain.response; - -import java.util.List; - -/** - * <p> - * Contract for all DMaaP MR Subscriber Responses - * </p> - * @author Rajiv Singla . Creation Date: 10/13/2016. - */ -public interface DMaaPMRSubscriberResponse extends DMaaPMRResponse { - - /** - * Returns message fetched from DMaaP MR Topic - * - * @return collection of actual message retrieved from DMaaP MR Topic - */ - List<String> getFetchedMessages(); - -} +/*
+ * ===============================LICENSE_START======================================
+ * dcae-analytics
+ * ================================================================================
+ * Copyright © 2017 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.openecomp.dcae.apod.analytics.dmaap.domain.response;
+
+import java.util.List;
+
+/**
+ * <p>
+ * Contract for all DMaaP MR Subscriber Responses
+ * </p>
+ * @author Rajiv Singla . Creation Date: 10/13/2016.
+ */
+public interface DMaaPMRSubscriberResponse extends DMaaPMRResponse {
+
+ /**
+ * Returns message fetched from DMaaP MR Topic
+ *
+ * @return collection of actual message retrieved from DMaaP MR Topic
+ */
+ List<String> getFetchedMessages();
+
+}
diff --git a/dcae-analytics-dmaap/src/main/java/org/openecomp/dcae/apod/analytics/dmaap/domain/response/DMaaPMRSubscriberResponseImpl.java b/dcae-analytics-dmaap/src/main/java/org/openecomp/dcae/apod/analytics/dmaap/domain/response/DMaaPMRSubscriberResponseImpl.java index fd84800..08f0dab 100644 --- a/dcae-analytics-dmaap/src/main/java/org/openecomp/dcae/apod/analytics/dmaap/domain/response/DMaaPMRSubscriberResponseImpl.java +++ b/dcae-analytics-dmaap/src/main/java/org/openecomp/dcae/apod/analytics/dmaap/domain/response/DMaaPMRSubscriberResponseImpl.java @@ -1,80 +1,80 @@ -/* - * ===============================LICENSE_START====================================== - * dcae-analytics - * ================================================================================ - * Copyright © 2017 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.openecomp.dcae.apod.analytics.dmaap.domain.response; - -import com.google.common.base.Objects; -import com.google.common.collect.ImmutableList; - -import java.util.List; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import static java.util.Collections.unmodifiableList; - -/** - * <p> - * A simple implementation for {@link DMaaPMRSubscriberResponse} - * <p> - * @author Rajiv Singla . Creation Date: 10/13/2016. - */ -public class DMaaPMRSubscriberResponseImpl implements DMaaPMRSubscriberResponse { - - private final Integer responseCode; - private final String responseMessage; - private final List<String> fetchedMessages; - - public DMaaPMRSubscriberResponseImpl(@Nonnull Integer responseCode, - @Nonnull String responseMessage, - @Nullable List<String> fetchedMessages) { - this.responseCode = responseCode; - this.responseMessage = responseMessage; - this.fetchedMessages = fetchedMessages != null ? fetchedMessages : ImmutableList.<String>of(); - } - - public DMaaPMRSubscriberResponseImpl(Integer responseCode, String responseMessage) { - this(responseCode, responseMessage, null); - } - - @Override - public Integer getResponseCode() { - return responseCode; - } - - @Override - public String getResponseMessage() { - return responseMessage; - } - - @Override - public List<String> getFetchedMessages() { - return unmodifiableList(fetchedMessages); - } - - @Override - public String toString() { - return Objects.toStringHelper(this) - .add("responseCode", responseCode) - .add("responseMessage", responseMessage) - .add("fetchedMessages(size)", fetchedMessages.size()) - .toString(); - } -} +/*
+ * ===============================LICENSE_START======================================
+ * dcae-analytics
+ * ================================================================================
+ * Copyright © 2017 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.openecomp.dcae.apod.analytics.dmaap.domain.response;
+
+import com.google.common.base.Objects;
+import com.google.common.collect.ImmutableList;
+
+import java.util.List;
+
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
+import static java.util.Collections.unmodifiableList;
+
+/**
+ * <p>
+ * A simple implementation for {@link DMaaPMRSubscriberResponse}
+ * <p>
+ * @author Rajiv Singla . Creation Date: 10/13/2016.
+ */
+public class DMaaPMRSubscriberResponseImpl implements DMaaPMRSubscriberResponse {
+
+ private final Integer responseCode;
+ private final String responseMessage;
+ private final List<String> fetchedMessages;
+
+ public DMaaPMRSubscriberResponseImpl(@Nonnull Integer responseCode,
+ @Nonnull String responseMessage,
+ @Nullable List<String> fetchedMessages) {
+ this.responseCode = responseCode;
+ this.responseMessage = responseMessage;
+ this.fetchedMessages = fetchedMessages != null ? fetchedMessages : ImmutableList.<String>of();
+ }
+
+ public DMaaPMRSubscriberResponseImpl(Integer responseCode, String responseMessage) {
+ this(responseCode, responseMessage, null);
+ }
+
+ @Override
+ public Integer getResponseCode() {
+ return responseCode;
+ }
+
+ @Override
+ public String getResponseMessage() {
+ return responseMessage;
+ }
+
+ @Override
+ public List<String> getFetchedMessages() {
+ return unmodifiableList(fetchedMessages);
+ }
+
+ @Override
+ public String toString() {
+ return Objects.toStringHelper(this)
+ .add("responseCode", responseCode)
+ .add("responseMessage", responseMessage)
+ .add("fetchedMessages(size)", fetchedMessages.size())
+ .toString();
+ }
+}
|