diff options
Diffstat (limited to 'UniversalVesAdapter/src/main')
2 files changed, 35 insertions, 56 deletions
diff --git a/UniversalVesAdapter/src/main/java/org/onap/universalvesadapter/configs/DMaaPMRPublisherConfig.java b/UniversalVesAdapter/src/main/java/org/onap/universalvesadapter/configs/DMaaPMRPublisherConfig.java index 70fcf58..137e3af 100644 --- a/UniversalVesAdapter/src/main/java/org/onap/universalvesadapter/configs/DMaaPMRPublisherConfig.java +++ b/UniversalVesAdapter/src/main/java/org/onap/universalvesadapter/configs/DMaaPMRPublisherConfig.java @@ -57,22 +57,20 @@ public class DMaaPMRPublisherConfig extends DMaaPMRBaseConfig { /** * Default uri path prefix */ - private String dmaapUriPathPrefix ; - - 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,String dmaapUriPathPrefix) { - 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; - this.dmaapUriPathPrefix =dmaapUriPathPrefix; - } + private String dmaapUriPathPrefix ; + + private DMaaPMRPublisherConfig(Builder builder) { + this.hostName = builder.hostName; + this.portNumber = builder.portNumber; + this.topicName = builder.topicName; + this.protocol = builder.protocol; + this.userName = builder.userName; + this.userPassword = builder.userPassword; + this.contentType = builder.contentType; + this.maxBatchSize = builder.maxBatchSize; + this.maxRecoveryQueueSize = builder.maxRecoveryQueueSize; + this.dmaapUriPathPrefix = builder.dmaapUriPathPrefix; + } /** * Builder to initialize immutable {@link DMaaPMRPublisherConfig} object @@ -204,10 +202,9 @@ public class DMaaPMRPublisherConfig extends DMaaPMRBaseConfig { * @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,dmaapUriPathPrefix); - } + public DMaaPMRPublisherConfig build() { + return new DMaaPMRPublisherConfig(this); + } } public String getDmaapUriPathPrefix() { diff --git a/UniversalVesAdapter/src/main/java/org/onap/universalvesadapter/configs/DMaaPMRSubscriberConfig.java b/UniversalVesAdapter/src/main/java/org/onap/universalvesadapter/configs/DMaaPMRSubscriberConfig.java index 72a7d9c..703684f 100644 --- a/UniversalVesAdapter/src/main/java/org/onap/universalvesadapter/configs/DMaaPMRSubscriberConfig.java +++ b/UniversalVesAdapter/src/main/java/org/onap/universalvesadapter/configs/DMaaPMRSubscriberConfig.java @@ -46,37 +46,22 @@ public final class DMaaPMRSubscriberConfig extends DMaaPMRBaseConfig { private String timeoutMSParam; private String messageLimitParam; private String uriPrefix; - - 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 int timeoutMS, - @Nonnull int messageLimit, - String timeoutMSParam, - String messageLimitParam, - String uriPrefix) { - 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; - this.timeoutMSParam=timeoutMSParam; - this.messageLimitParam=messageLimitParam; - this.uriPrefix=uriPrefix; - - + + public DMaaPMRSubscriberConfig(Builder builder) { + this.hostName = builder.hostName; + this.portNumber = builder.portNumber; + this.topicName = builder.topicName; + this.protocol = builder.protocol; + this.userName = builder.userName; + this.userPassword = builder.userPassword; + this.contentType = builder.contentType; + this.consumerId = builder.consumerId; + this.consumerGroup = builder.consumerGroup; + this.timeoutMS = builder.timeoutMS; + this.messageLimit = builder.messageLimit; + this.timeoutMSParam = builder.timeoutMSParam; + this.messageLimitParam = builder.messageLimitParam; + this.uriPrefix = builder.uriPreifix; } /** @@ -234,12 +219,9 @@ public final class DMaaPMRSubscriberConfig extends DMaaPMRBaseConfig { * Builds Immutable instance of {@link DMaaPMRSubscriberConfig} * * @return immutable DMaaP Subscriber Config Object - * @throws IOException */ - public DMaaPMRSubscriberConfig build() throws IOException { - return new DMaaPMRSubscriberConfig(hostName, portNumber, topicName, protocol, userName, userPassword, - contentType, consumerId, consumerGroup, timeoutMS, messageLimit, timeoutMSParam, messageLimitParam, - uriPreifix); + public DMaaPMRSubscriberConfig build() { + return new DMaaPMRSubscriberConfig(this); } } |