Use lombok in policy-endpoints 16/122016/1
authorJim Hahn <jrh3@att.com>
Thu, 17 Jun 2021 15:54:29 +0000 (11:54 -0400)
committerJim Hahn <jrh3@att.com>
Thu, 17 Jun 2021 15:56:38 +0000 (11:56 -0400)
Issue-ID: POLICY-3394
Change-Id: I8dfb0814d5cc544b2c334dc11a3e69ef407f163f
Signed-off-by: Jim Hahn <jrh3@att.com>
24 files changed:
policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/TopicEndpointManager.java
policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/TopicEndpointProxy.java
policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/NoopTopicFactories.java
policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/UebTopicFactories.java
policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/BusTopicBase.java
policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/BusTopicParams.java
policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/InlineBusTopicSink.java
policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/SingleThreadedBusTopicSource.java
policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/TopicBase.java
policy-endpoints/src/main/java/org/onap/policy/common/endpoints/features/NetLoggerFeatureProviders.java
policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/client/HttpClientFactoryInstance.java
policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/client/internal/JerseyClient.java
policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/server/HttpServletServerFactoryInstance.java
policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/server/JsonExceptionMapper.java
policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/server/YamlExceptionMapper.java
policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/server/internal/JettyServletServer.java
policy-endpoints/src/main/java/org/onap/policy/common/endpoints/listeners/JsonListener.java
policy-endpoints/src/main/java/org/onap/policy/common/endpoints/listeners/ScoListener.java
policy-endpoints/src/main/java/org/onap/policy/common/endpoints/properties/PolicyEndPointProperties.java
policy-endpoints/src/main/java/org/onap/policy/common/endpoints/report/HealthCheckReport.java
policy-endpoints/src/main/java/org/onap/policy/common/endpoints/utils/DmaapPropertyUtils.java
policy-endpoints/src/main/java/org/onap/policy/common/endpoints/utils/NetLoggerUtil.java
policy-endpoints/src/main/java/org/onap/policy/common/endpoints/utils/PropertyUtils.java
policy-endpoints/src/main/java/org/onap/policy/common/endpoints/utils/UebPropertyUtils.java

index c390afc..fb18a30 100644 (file)
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * ONAP
  * ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019, 2021 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.
 
 package org.onap.policy.common.endpoints.event.comm;
 
+import lombok.AccessLevel;
 import lombok.Getter;
+import lombok.NoArgsConstructor;
 
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
 public class TopicEndpointManager {
 
     /**
@@ -29,9 +32,4 @@ public class TopicEndpointManager {
      */
     @Getter
     private static TopicEndpoint manager = new TopicEndpointProxy();
-
-
-    private TopicEndpointManager() {
-        // do nothing
-    }
 }
index cf89762..293bf60 100644 (file)
@@ -24,6 +24,7 @@ import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
 import java.util.Properties;
+import lombok.Getter;
 import org.onap.policy.common.capabilities.Startable;
 import org.onap.policy.common.endpoints.event.comm.bus.DmaapTopicFactories;
 import org.onap.policy.common.endpoints.event.comm.bus.DmaapTopicSink;
@@ -53,11 +54,13 @@ class TopicEndpointProxy implements TopicEndpoint {
     /**
      * Is this element locked boolean.
      */
+    @Getter
     private volatile boolean locked = false;
 
     /**
      * Is this element alive boolean.
      */
+    @Getter
     private volatile boolean alive = false;
 
     @Override
@@ -434,11 +437,6 @@ class TopicEndpointProxy implements TopicEndpoint {
 
     }
 
-    @Override
-    public boolean isAlive() {
-        return this.alive;
-    }
-
     @Override
     public boolean lock() {
         boolean shouldLock;
@@ -483,11 +481,6 @@ class TopicEndpointProxy implements TopicEndpoint {
         return true;
     }
 
-    @Override
-    public boolean isLocked() {
-        return this.locked;
-    }
-
     @Override
     public TopicSource getTopicSource(Topic.CommInfrastructure commType, String topicName) {
 
index aa85e71..c3e7e0a 100644 (file)
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * ONAP
  * ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019, 2021 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.
 
 package org.onap.policy.common.endpoints.event.comm.bus;
 
+import lombok.AccessLevel;
 import lombok.Getter;
+import lombok.NoArgsConstructor;
 
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
 public class NoopTopicFactories {
 
     /**
@@ -35,9 +38,4 @@ public class NoopTopicFactories {
      */
     @Getter
     private static final NoopTopicSourceFactory sourceFactory = new NoopTopicSourceFactory();
-
-
-    private NoopTopicFactories() {
-        // do nothing
-    }
 }
index d02758b..721f213 100644 (file)
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * ONAP
  * ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019, 2021 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.
 
 package org.onap.policy.common.endpoints.event.comm.bus;
 
+import lombok.AccessLevel;
 import lombok.Getter;
+import lombok.NoArgsConstructor;
 
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
 public class UebTopicFactories {
 
     /**
@@ -35,9 +38,4 @@ public class UebTopicFactories {
      */
     @Getter
     private static final UebTopicSourceFactory sourceFactory = new IndexedUebTopicSourceFactory();
-
-
-    private UebTopicFactories() {
-        // do nothing
-    }
 }
index 6dd6a3e..67ee84e 100644 (file)
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * ONAP
  * ================================================================================
- * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2019, 2021 AT&T Intellectual Property. All rights reserved.
  * Modifications Copyright (C) 2020 Bell Canada. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
 
 package org.onap.policy.common.endpoints.event.comm.bus.internal;
 
+import lombok.Getter;
 import org.onap.policy.common.endpoints.event.comm.bus.ApiKeyEnabled;
 
 /**
  * Bus Topic Base.
  */
+@Getter
 public abstract class BusTopicBase extends TopicBase implements ApiKeyEnabled {
 
     /**
@@ -68,34 +70,6 @@ public abstract class BusTopicBase extends TopicBase implements ApiKeyEnabled {
         this.allowSelfSignedCerts = busTopicParams.isAllowSelfSignedCerts();
     }
 
-    @Override
-    public String getApiKey() {
-        return apiKey;
-    }
-
-    @Override
-    public String getApiSecret() {
-        return apiSecret;
-    }
-
-    /**
-     * Is using HTTPS.
-     *
-     * @return if using https
-     */
-    public boolean isUseHttps() {
-        return useHttps;
-    }
-
-    /**
-     * Is self signed certificates allowed.
-     *
-     * @return if self signed certificates are allowed
-     */
-    public boolean isAllowSelfSignedCerts() {
-        return allowSelfSignedCerts;
-    }
-
     protected boolean anyNullOrEmpty(String... args) {
         for (String arg : args) {
             if (arg == null || arg.isEmpty()) {
index 9df7221..f9537f5 100644 (file)
@@ -3,7 +3,7 @@
  * ONAP
  * ================================================================================
  * Copyright (C) 2018 Samsung Electronics Co., Ltd. All rights reserved.
- * Modifications Copyright (C) 2018-2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2018-2019, 2021 AT&T Intellectual Property. All rights reserved.
  * Modifications Copyright (C) 2019 Nordix Foundation.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -24,7 +24,9 @@ package org.onap.policy.common.endpoints.event.comm.bus.internal;
 
 import java.util.List;
 import java.util.Map;
+import lombok.AccessLevel;
 import lombok.Getter;
+import lombok.NoArgsConstructor;
 import lombok.Setter;
 import org.apache.commons.lang3.StringUtils;
 
@@ -78,6 +80,7 @@ public class BusTopicParams {
     private String clientName;
     private String hostname;
     private String basePath;
+    @Getter
     private String serializationProvider;
 
     public static TopicParamsBuilder builder() {
@@ -165,17 +168,11 @@ public class BusTopicParams {
         return additionalProps != null;
     }
 
-    public String getSerializationProvider() {
-        return serializationProvider;
-    }
-
+    @NoArgsConstructor(access = AccessLevel.PRIVATE)
     public static class TopicParamsBuilder {
 
         final BusTopicParams params = new BusTopicParams();
 
-        private TopicParamsBuilder() {
-        }
-
         public TopicParamsBuilder servers(List<String> servers) {
             this.params.servers = servers;
             return this;
index d586f88..27ed5e7 100644 (file)
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * policy-endpoints
  * ================================================================================
- * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2021 AT&T Intellectual Property. All rights reserved.
  * Modifications Copyright (C) 2018-2019 Samsung Electronics Co., Ltd.
  * Modifications Copyright (C) 2020 Bell Canada. All rights reserved.
 * ================================================================================
@@ -23,6 +23,8 @@
 package org.onap.policy.common.endpoints.event.comm.bus.internal;
 
 import java.util.UUID;
+import lombok.Getter;
+import lombok.Setter;
 import org.onap.policy.common.endpoints.event.comm.bus.BusTopicSink;
 import org.onap.policy.common.endpoints.utils.NetLoggerUtil;
 import org.onap.policy.common.endpoints.utils.NetLoggerUtil.EventType;
@@ -44,7 +46,9 @@ public abstract class InlineBusTopicSink extends BusTopicBase implements BusTopi
     /**
      * The partition key to publish to.
      */
-    protected String partitionId;
+    @Getter
+    @Setter
+    protected String partitionKey;
 
     /**
      * Message bus publisher.
@@ -68,9 +72,9 @@ public abstract class InlineBusTopicSink extends BusTopicBase implements BusTopi
         super(busTopicParams);
 
         if (busTopicParams.isPartitionIdInvalid()) {
-            this.partitionId = UUID.randomUUID().toString();
+            this.partitionKey = UUID.randomUUID().toString();
         } else {
-            this.partitionId = busTopicParams.getPartitionId();
+            this.partitionKey = busTopicParams.getPartitionId();
         }
     }
 
@@ -139,7 +143,7 @@ public abstract class InlineBusTopicSink extends BusTopicBase implements BusTopi
 
             NetLoggerUtil.log(EventType.OUT, this.getTopicCommInfrastructure(), this.topic, message);
 
-            publisher.send(this.partitionId, message);
+            publisher.send(this.partitionKey, message);
             broadcast(message);
         } catch (Exception e) {
             logger.warn("{}: cannot send because of {}", this, e.getMessage(), e);
@@ -149,16 +153,6 @@ public abstract class InlineBusTopicSink extends BusTopicBase implements BusTopi
         return true;
     }
 
-    @Override
-    public void setPartitionKey(String partitionKey) {
-        this.partitionId = partitionKey;
-    }
-
-    @Override
-    public String getPartitionKey() {
-        return this.partitionId;
-    }
-
     @Override
     public void shutdown() {
         this.stop();
@@ -188,6 +182,7 @@ public abstract class InlineBusTopicSink extends BusTopicBase implements BusTopi
 
     @Override
     public String toString() {
-        return "InlineBusTopicSink [partitionId=" + partitionId + ", alive=" + alive + ", publisher=" + publisher + "]";
+        return "InlineBusTopicSink [partitionId=" + partitionKey + ", alive=" + alive + ", publisher=" + publisher
+                        + "]";
     }
 }
index 376a62d..3b7851d 100644 (file)
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * policy-endpoints
  * ================================================================================
- * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2021 AT&T Intellectual Property. All rights reserved.
  * Modifications Copyright (C) 2018-2019 Samsung Electronics Co., Ltd.
  * Modifications Copyright (C) 2020 Bell Canada. All rights reserved.
  * ================================================================================
@@ -25,6 +25,7 @@ package org.onap.policy.common.endpoints.event.comm.bus.internal;
 import java.io.IOException;
 import java.net.MalformedURLException;
 import java.util.UUID;
+import lombok.Getter;
 import org.onap.policy.common.endpoints.event.comm.TopicListener;
 import org.onap.policy.common.endpoints.event.comm.bus.BusTopicSource;
 import org.onap.policy.common.endpoints.properties.PolicyEndPointProperties;
@@ -50,21 +51,25 @@ public abstract class SingleThreadedBusTopicSource extends BusTopicBase
     /**
      * Bus consumer group.
      */
+    @Getter
     protected final String consumerGroup;
 
     /**
      * Bus consumer instance.
      */
+    @Getter
     protected final String consumerInstance;
 
     /**
      * Bus fetch timeout.
      */
+    @Getter
     protected final int fetchTimeout;
 
     /**
      * Bus fetch limit.
      */
+    @Getter
     protected final int fetchLimit;
 
     /**
@@ -269,30 +274,9 @@ public abstract class SingleThreadedBusTopicSource extends BusTopicBase
                 + topicListeners.size() + ", toString()=" + super.toString() + "]";
     }
 
-    @Override
-    public String getConsumerGroup() {
-        return consumerGroup;
-    }
-
-    @Override
-    public String getConsumerInstance() {
-        return consumerInstance;
-    }
-
     @Override
     public void shutdown() {
         this.stop();
         this.topicListeners.clear();
     }
-
-    @Override
-    public int getFetchTimeout() {
-        return fetchTimeout;
-    }
-
-    @Override
-    public int getFetchLimit() {
-        return fetchLimit;
-    }
-
 }
index dca1437..daeaea1 100644 (file)
@@ -23,12 +23,15 @@ package org.onap.policy.common.endpoints.event.comm.bus.internal;
 
 import java.util.ArrayList;
 import java.util.List;
+import lombok.AccessLevel;
+import lombok.Getter;
 import org.apache.commons.collections4.queue.CircularFifoQueue;
 import org.onap.policy.common.endpoints.event.comm.Topic;
 import org.onap.policy.common.endpoints.event.comm.TopicListener;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+@Getter
 public abstract class TopicBase implements Topic {
 
     /**
@@ -72,6 +75,7 @@ public abstract class TopicBase implements Topic {
     /**
      * All my subscribers for new message notifications.
      */
+    @Getter(AccessLevel.NONE)
     protected final ArrayList<TopicListener> topicListeners = new ArrayList<>();
 
     /**
@@ -218,31 +222,6 @@ public abstract class TopicBase implements Topic {
         }
     }
 
-    @Override
-    public boolean isLocked() {
-        return this.locked;
-    }
-
-    @Override
-    public String getTopic() {
-        return topic;
-    }
-
-    @Override
-    public String getEffectiveTopic() {
-        return effectiveTopic;
-    }
-
-    @Override
-    public boolean isAlive() {
-        return this.alive;
-    }
-
-    @Override
-    public List<String> getServers() {
-        return servers;
-    }
-
     @Override
     public synchronized String[] getRecentEvents() {
         var events = new String[recentEvents.size()];
index 8b09f38..ba84b55 100644 (file)
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * ONAP
  * ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019, 2021 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.
 
 package org.onap.policy.common.endpoints.features;
 
+import lombok.AccessLevel;
 import lombok.Getter;
+import lombok.NoArgsConstructor;
 import org.onap.policy.common.utils.services.OrderedServiceImpl;
 
 /**
  * Providers for network logging feature.
  */
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
 public class NetLoggerFeatureProviders {
 
     /**
@@ -34,8 +37,4 @@ public class NetLoggerFeatureProviders {
     @Getter
     private static final OrderedServiceImpl<NetLoggerFeatureApi> providers =
                     new OrderedServiceImpl<>(NetLoggerFeatureApi.class);
-
-    private NetLoggerFeatureProviders() {
-        // do nothing
-    }
 }
index c292164..f64be30 100644 (file)
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * ONAP
  * ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019, 2021 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.
 
 package org.onap.policy.common.endpoints.http.client;
 
+import lombok.AccessLevel;
 import lombok.Getter;
+import lombok.NoArgsConstructor;
 
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
 public class HttpClientFactoryInstance {
 
     /**
@@ -29,9 +32,4 @@ public class HttpClientFactoryInstance {
      */
     @Getter
     private static final HttpClientFactory clientFactory = new IndexedHttpClientFactory();
-
-
-    private HttpClientFactoryInstance() {
-        // do nothing
-    }
 }
index 709b148..753994a 100644 (file)
@@ -38,13 +38,13 @@ import javax.ws.rs.client.Invocation.Builder;
 import javax.ws.rs.client.InvocationCallback;
 import javax.ws.rs.client.WebTarget;
 import javax.ws.rs.core.Response;
+import lombok.Getter;
 import lombok.ToString;
 import org.apache.commons.lang3.StringUtils;
 import org.glassfish.jersey.client.ClientProperties;
 import org.glassfish.jersey.client.authentication.HttpAuthenticationFeature;
 import org.onap.policy.common.endpoints.event.comm.bus.internal.BusTopicParams;
 import org.onap.policy.common.endpoints.http.client.HttpClient;
-import org.onap.policy.common.gson.annotation.GsonJsonIgnore;
 import org.onap.policy.common.utils.network.NetworkUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -52,6 +52,7 @@ import org.slf4j.LoggerFactory;
 /**
  * Http Client implementation using a Jersey Client.
  */
+@Getter
 @ToString
 public class JerseyClient implements HttpClient {
     private static final Pattern COMMA_PAT = Pattern.compile(",");
@@ -266,52 +267,6 @@ public class JerseyClient implements HttpClient {
         return this.alive;
     }
 
-    @Override
-    public String getName() {
-        return name;
-    }
-
-    @Override
-    public boolean isHttps() {
-        return https;
-    }
-
-    @Override
-    public boolean isSelfSignedCerts() {
-        return selfSignedCerts;
-    }
-
-    @Override
-    public String getHostname() {
-        return hostname;
-    }
-
-    @Override
-    public int getPort() {
-        return port;
-    }
-
-    @Override
-    public String getBasePath() {
-        return basePath;
-    }
-
-    @Override
-    public String getUserName() {
-        return userName;
-    }
-
-    @GsonJsonIgnore
-    @Override
-    public String getPassword() {
-        return password;
-    }
-
-    @Override
-    public String getBaseUrl() {
-        return baseUrl;
-    }
-
     private Builder getBuilder(String path, Map<String, Object> headers) {
         var builder = getWebTarget().path(path).request();
         for (Entry<String, Object> header : headers.entrySet()) {
index a56be70..58e27cb 100644 (file)
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * ONAP
  * ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019, 2021 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.
 
 package org.onap.policy.common.endpoints.http.server;
 
+import lombok.AccessLevel;
 import lombok.Getter;
+import lombok.NoArgsConstructor;
 
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
 public class HttpServletServerFactoryInstance {
 
     /**
@@ -29,10 +32,4 @@ public class HttpServletServerFactoryInstance {
      */
     @Getter
     private static final HttpServletServerFactory serverFactory = new IndexedHttpServletServerFactory();
-
-
-    private HttpServletServerFactoryInstance() {
-        // do nothing
-    }
-
 }
index 55b3a0d..d0df156 100644 (file)
@@ -1,6 +1,6 @@
 /*-
  * ============LICENSE_START=======================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019, 2021 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.
@@ -26,6 +26,7 @@ import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
 import javax.ws.rs.ext.ExceptionMapper;
 import javax.ws.rs.ext.Provider;
+import lombok.AllArgsConstructor;
 import lombok.Getter;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -46,11 +47,8 @@ public class JsonExceptionMapper implements ExceptionMapper<JsonSyntaxException>
     }
 
     @Getter
+    @AllArgsConstructor
     private static class SimpleResponse {
         private String errorDetails;
-
-        public SimpleResponse(String errorDetails) {
-            this.errorDetails = errorDetails;
-        }
     }
 }
index 7eac932..15a584f 100644 (file)
@@ -1,6 +1,6 @@
 /*-
  * ============LICENSE_START=======================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019, 2021 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.
@@ -24,6 +24,7 @@ import javax.ws.rs.Produces;
 import javax.ws.rs.core.Response;
 import javax.ws.rs.ext.ExceptionMapper;
 import javax.ws.rs.ext.Provider;
+import lombok.AllArgsConstructor;
 import lombok.Getter;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -45,11 +46,8 @@ public class YamlExceptionMapper implements ExceptionMapper<YAMLException> {
     }
 
     @Getter
+    @AllArgsConstructor
     private static class SimpleResponse {
         private String errorDetails;
-
-        public SimpleResponse(String errorDetails) {
-            this.errorDetails = errorDetails;
-        }
     }
 }
index 4afe2c0..e4b5137 100644 (file)
@@ -24,6 +24,7 @@ package org.onap.policy.common.endpoints.http.server.internal;
 
 import java.util.EnumSet;
 import javax.servlet.DispatcherType;
+import lombok.Getter;
 import lombok.ToString;
 import org.eclipse.jetty.security.ConstraintMapping;
 import org.eclipse.jetty.security.ConstraintSecurityHandler;
@@ -44,7 +45,6 @@ import org.eclipse.jetty.util.security.Credential;
 import org.eclipse.jetty.util.ssl.SslContextFactory;
 import org.onap.aaf.cadi.filter.CadiFilter;
 import org.onap.policy.common.endpoints.http.server.HttpServletServer;
-import org.onap.policy.common.gson.annotation.GsonJsonIgnore;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -72,26 +72,31 @@ public abstract class JettyServletServer implements HttpServletServer, Runnable
     /**
      * Server name.
      */
+    @Getter
     protected final String name;
 
     /**
      * Server host address.
      */
+    @Getter
     protected final String host;
 
     /**
      * Server port to bind.
      */
+    @Getter
     protected final int port;
 
     /**
      * Server auth user name.
      */
+    @Getter
     protected String user;
 
     /**
      * Server auth password name.
      */
+    @Getter
     protected String password;
 
     /**
@@ -461,49 +466,6 @@ public abstract class JettyServletServer implements HttpServletServer, Runnable
         return false;
     }
 
-    @Override
-    public int getPort() {
-        return this.port;
-    }
-
-    /**
-     * Get name.
-     *
-     * @return the name
-     */
-    @Override
-    public String getName() {
-        return name;
-    }
-
-    /**
-     * Get host.
-     *
-     * @return the host
-     */
-    public String getHost() {
-        return host;
-    }
-
-    /**
-     * Get user.
-     *
-     * @return the user
-     */
-    public String getUser() {
-        return user;
-    }
-
-    /**
-     * Get password.
-     *
-     * @return the password
-     */
-    @GsonJsonIgnore
-    public String getPassword() {
-        return password;
-    }
-
     @Override
     public void setSerializationProvider(String provider) {
         throw new UnsupportedOperationException("setSerializationProvider()" + NOT_SUPPORTED);
index ce60f59..2e17107 100644 (file)
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * ONAP
  * ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019, 2021 AT&T Intellectual Property. All rights reserved.
  * Modifications Copyright (C) 2020 Bell Canada. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -21,6 +21,8 @@
 
 package org.onap.policy.common.endpoints.listeners;
 
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
 import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure;
 import org.onap.policy.common.endpoints.event.comm.TopicListener;
 import org.onap.policy.common.utils.coder.Coder;
@@ -34,6 +36,7 @@ import org.slf4j.LoggerFactory;
  * Listens for messages received on a topic, in JSON format, decodes them into a
  * {@link StandardCoderObject}, and then offers the objects to the subclass.
  */
+@NoArgsConstructor(access = AccessLevel.PROTECTED)
 public abstract class JsonListener implements TopicListener {
     private static final Logger logger = LoggerFactory.getLogger(JsonListener.class);
 
@@ -42,13 +45,6 @@ public abstract class JsonListener implements TopicListener {
      */
     private static final Coder coder = new StandardCoder();
 
-    /**
-     * Constructs the object.
-     */
-    protected JsonListener() {
-        super();
-    }
-
     @Override
     public void onTopicEvent(CommInfrastructure infra, String topic, String event) {
         // decode from JSON into a standard object
index 117071c..dc6ff12 100644 (file)
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * ONAP
  * ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019, 2021 AT&T Intellectual Property. All rights reserved.
  * Modifications Copyright (C) 2020 Bell Canada. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -21,6 +21,8 @@
 
 package org.onap.policy.common.endpoints.listeners;
 
+import lombok.AccessLevel;
+import lombok.AllArgsConstructor;
 import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure;
 import org.onap.policy.common.utils.coder.Coder;
 import org.onap.policy.common.utils.coder.CoderException;
@@ -35,6 +37,7 @@ import org.slf4j.LoggerFactory;
  *
  * @param <T> type of message/POJO this handles
  */
+@AllArgsConstructor(access = AccessLevel.PROTECTED)
 public abstract class ScoListener<T> {
 
     private static final Logger logger = LoggerFactory.getLogger(ScoListener.class);
@@ -49,15 +52,6 @@ public abstract class ScoListener<T> {
      */
     private final Class<T> clazz;
 
-    /**
-     * Constructs the object.
-     *
-     * @param clazz class of message this handles
-     */
-    protected ScoListener(Class<T> clazz) {
-        this.clazz = clazz;
-    }
-
     /**
      * Receives an event, translates it into the desired type of object, and passes it to
      * the subclass.
index ef9259b..b373cfc 100644 (file)
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * ONAP
  * ================================================================================
- * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2021 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.
 
 package org.onap.policy.common.endpoints.properties;
 
-public class PolicyEndPointProperties {
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
+
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public final class PolicyEndPointProperties {
 
     /* Generic property suffixes */
 
@@ -145,9 +149,4 @@ public class PolicyEndPointProperties {
      * Definition of No limit fetching.
      */
     public static final int NO_LIMIT_FETCH = -1;
-
-
-    private PolicyEndPointProperties() {
-        // do nothing
-    }
 }
index c214c91..bb80fcc 100644 (file)
@@ -21,6 +21,8 @@
 
 package org.onap.policy.common.endpoints.report;
 
+import lombok.Getter;
+import lombok.Setter;
 import lombok.ToString;
 
 /**
@@ -28,6 +30,8 @@ import lombok.ToString;
  *
  * @author Ram Krishna Verma (ram.krishna.verma@ericsson.com)
  */
+@Getter
+@Setter
 @ToString
 public class HealthCheckReport {
 
@@ -36,94 +40,4 @@ public class HealthCheckReport {
     private boolean healthy;
     private int code;
     private String message;
-
-    /**
-     * Returns the name of this report.
-     *
-     * @return the name
-     */
-    public String getName() {
-        return name;
-    }
-
-    /**
-     * Set the name of this report.
-     *
-     * @param name the name to set
-     */
-    public void setName(final String name) {
-        this.name = name;
-    }
-
-    /**
-     * Returns the url of this report.
-     *
-     * @return the url
-     */
-    public String getUrl() {
-        return url;
-    }
-
-    /**
-     * Set the url of this report.
-     *
-     * @param url the url to set
-     */
-    public void setUrl(final String url) {
-        this.url = url;
-    }
-
-    /**
-     * Returns the health status of this report.
-     *
-     * @return the healthy
-     */
-    public boolean isHealthy() {
-        return healthy;
-    }
-
-    /**
-     * Set the health status of this report.
-     *
-     * @param healthy the healthy to set
-     */
-    public void setHealthy(final boolean healthy) {
-        this.healthy = healthy;
-    }
-
-    /**
-     * Returns the code of this report.
-     *
-     * @return the code
-     */
-    public int getCode() {
-        return code;
-    }
-
-    /**
-     * Set the code of this report.
-     *
-     * @param code the code to set
-     */
-    public void setCode(final int code) {
-        this.code = code;
-    }
-
-    /**
-     * Returns the message of this report.
-     *
-     * @return the message
-     */
-    public String getMessage() {
-        return message;
-    }
-
-    /**
-     * Set the message of this report.
-     *
-     * @param message the message to set
-     */
-    public void setMessage(final String message) {
-        this.message = message;
-    }
 }
index f339b87..3b35197 100644 (file)
@@ -27,12 +27,15 @@ import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
 import org.apache.commons.lang3.StringUtils;
 import org.onap.policy.common.endpoints.event.comm.bus.internal.BusTopicParams;
 import org.onap.policy.common.endpoints.event.comm.bus.internal.BusTopicParams.TopicParamsBuilder;
 import org.onap.policy.common.endpoints.properties.PolicyEndPointProperties;
 
-public class DmaapPropertyUtils {
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public final class DmaapPropertyUtils {
     private static final Pattern COMMA_SPACE_PAT = Pattern.compile("\\s*,\\s*");
 
     /**
@@ -67,10 +70,6 @@ public class DmaapPropertyUtils {
         PROP_TO_DME = Collections.unmodifiableMap(map);
     }
 
-    private DmaapPropertyUtils() {
-        // do nothing
-    }
-
     /**
      * Makes a topic builder, configuring it with properties that are common to both
      * sources and sinks.
index c7dd516..6002c3f 100644 (file)
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * policy-endpoints
  * ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019, 2021 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.
@@ -20,6 +20,7 @@
 
 package org.onap.policy.common.endpoints.utils;
 
+import lombok.Getter;
 import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure;
 import org.onap.policy.common.endpoints.features.NetLoggerFeatureProviders;
 import org.onap.policy.common.utils.services.FeatureApiUtils;
@@ -37,7 +38,8 @@ public class NetLoggerUtil {
      * Loggers.
      */
     private static final Logger logger = LoggerFactory.getLogger(NetLoggerUtil.class);
-    private static final Logger netLogger = LoggerFactory.getLogger("network");
+    @Getter
+    private static final Logger networkLogger = LoggerFactory.getLogger("network");
 
     /**
      * Constant for the system line separator.
@@ -51,15 +53,6 @@ public class NetLoggerUtil {
         IN, OUT
     }
 
-    /**
-     * Get Network Logger.
-     *
-     * @return logger instance
-     */
-    public static Logger getNetworkLogger() {
-        return netLogger;
-    }
-
     /**
      * Logs a message to the network logger.
      *
@@ -69,7 +62,7 @@ public class NetLoggerUtil {
      * @param message message to be logged
      */
     public static void log(EventType type, CommInfrastructure protocol, String topic, String message) {
-        log(netLogger, type, protocol, topic, message);
+        log(networkLogger, type, protocol, topic, message);
     }
 
     /**
@@ -85,7 +78,7 @@ public class NetLoggerUtil {
                     String message) {
         if (eventLogger == null) {
             logger.debug("the logger is null, defaulting to network logger");
-            eventLogger = netLogger;
+            eventLogger = networkLogger;
         }
 
         if (featureBeforeLog(eventLogger, type, protocol, topic, message)) {
index 7f15502..904f953 100644 (file)
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * ONAP
  * ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019, 2021 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.
 package org.onap.policy.common.endpoints.utils;
 
 import java.util.Properties;
+import lombok.AllArgsConstructor;
 import org.apache.commons.lang3.StringUtils;
 
 /**
  * Utilities for extracting property values and converting them to other types.
  */
+@AllArgsConstructor
 public class PropertyUtils {
     /**
      * Properties on which to work.
@@ -42,20 +44,6 @@ public class PropertyUtils {
      */
     private TriConsumer<String, String, Exception> invalidHandler;
 
-
-    /**
-     * Constructs the object.
-     *
-     * @param properties properties on which to work
-     * @param prefix prefix to prepend to property names
-     * @param invalidHandler function to invoke if a property value is invalid
-     */
-    public PropertyUtils(Properties properties, String prefix, TriConsumer<String, String, Exception> invalidHandler) {
-        this.properties = properties;
-        this.prefix = prefix;
-        this.invalidHandler = invalidHandler;
-    }
-
     /**
      * Gets a string property.
      *
index 33262b4..8aff9f2 100644 (file)
@@ -24,17 +24,16 @@ import com.google.re2j.Pattern;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
 import org.onap.policy.common.endpoints.event.comm.bus.internal.BusTopicParams;
 import org.onap.policy.common.endpoints.event.comm.bus.internal.BusTopicParams.TopicParamsBuilder;
 import org.onap.policy.common.endpoints.properties.PolicyEndPointProperties;
 
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
 public class UebPropertyUtils {
     private static final Pattern COMMA_SPACE_PAT = Pattern.compile("\\s*,\\s*");
 
-    private UebPropertyUtils() {
-        // do nothing
-    }
-
     /**
      * Makes a topic builder, configuring it with properties that are common to both
      * sources and sinks.