* ============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 {
/**
*/
@Getter
private static TopicEndpoint manager = new TopicEndpointProxy();
-
-
- private TopicEndpointManager() {
- // do nothing
- }
}
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;
/**
* Is this element locked boolean.
*/
+ @Getter
private volatile boolean locked = false;
/**
* Is this element alive boolean.
*/
+ @Getter
private volatile boolean alive = false;
@Override
}
- @Override
- public boolean isAlive() {
- return this.alive;
- }
-
@Override
public boolean lock() {
boolean shouldLock;
return true;
}
- @Override
- public boolean isLocked() {
- return this.locked;
- }
-
@Override
public TopicSource getTopicSource(Topic.CommInfrastructure commType, String topicName) {
* ============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 {
/**
*/
@Getter
private static final NoopTopicSourceFactory sourceFactory = new NoopTopicSourceFactory();
-
-
- private NoopTopicFactories() {
- // do nothing
- }
}
* ============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 {
/**
*/
@Getter
private static final UebTopicSourceFactory sourceFactory = new IndexedUebTopicSourceFactory();
-
-
- private UebTopicFactories() {
- // do nothing
- }
}
* ============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 {
/**
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()) {
* 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");
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;
private String clientName;
private String hostname;
private String basePath;
+ @Getter
private String serializationProvider;
public static TopicParamsBuilder builder() {
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;
* ============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.
* ================================================================================
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;
/**
* The partition key to publish to.
*/
- protected String partitionId;
+ @Getter
+ @Setter
+ protected String partitionKey;
/**
* Message bus publisher.
super(busTopicParams);
if (busTopicParams.isPartitionIdInvalid()) {
- this.partitionId = UUID.randomUUID().toString();
+ this.partitionKey = UUID.randomUUID().toString();
} else {
- this.partitionId = busTopicParams.getPartitionId();
+ this.partitionKey = busTopicParams.getPartitionId();
}
}
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);
return true;
}
- @Override
- public void setPartitionKey(String partitionKey) {
- this.partitionId = partitionKey;
- }
-
- @Override
- public String getPartitionKey() {
- return this.partitionId;
- }
-
@Override
public void shutdown() {
this.stop();
@Override
public String toString() {
- return "InlineBusTopicSink [partitionId=" + partitionId + ", alive=" + alive + ", publisher=" + publisher + "]";
+ return "InlineBusTopicSink [partitionId=" + partitionKey + ", alive=" + alive + ", publisher=" + publisher
+ + "]";
}
}
* ============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.
* ================================================================================
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;
/**
* 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;
/**
+ 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;
- }
-
}
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 {
/**
/**
* All my subscribers for new message notifications.
*/
+ @Getter(AccessLevel.NONE)
protected final ArrayList<TopicListener> topicListeners = new ArrayList<>();
/**
}
}
- @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()];
* ============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 {
/**
@Getter
private static final OrderedServiceImpl<NetLoggerFeatureApi> providers =
new OrderedServiceImpl<>(NetLoggerFeatureApi.class);
-
- private NetLoggerFeatureProviders() {
- // do nothing
- }
}
* ============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 {
/**
*/
@Getter
private static final HttpClientFactory clientFactory = new IndexedHttpClientFactory();
-
-
- private HttpClientFactoryInstance() {
- // do nothing
- }
}
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;
/**
* Http Client implementation using a Jersey Client.
*/
+@Getter
@ToString
public class JerseyClient implements HttpClient {
private static final Pattern COMMA_PAT = Pattern.compile(",");
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()) {
* ============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 {
/**
*/
@Getter
private static final HttpServletServerFactory serverFactory = new IndexedHttpServletServerFactory();
-
-
- private HttpServletServerFactoryInstance() {
- // do nothing
- }
-
}
/*-
* ============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.
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;
}
@Getter
+ @AllArgsConstructor
private static class SimpleResponse {
private String errorDetails;
-
- public SimpleResponse(String errorDetails) {
- this.errorDetails = errorDetails;
- }
}
}
/*-
* ============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.
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;
}
@Getter
+ @AllArgsConstructor
private static class SimpleResponse {
private String errorDetails;
-
- public SimpleResponse(String errorDetails) {
- this.errorDetails = errorDetails;
- }
}
}
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;
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;
/**
* 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;
/**
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);
* ============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");
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;
* 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);
*/
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
* ============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");
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;
*
* @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);
*/
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.
* ============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 */
* Definition of No limit fetching.
*/
public static final int NO_LIMIT_FETCH = -1;
-
-
- private PolicyEndPointProperties() {
- // do nothing
- }
}
package org.onap.policy.common.endpoints.report;
+import lombok.Getter;
+import lombok.Setter;
import lombok.ToString;
/**
*
* @author Ram Krishna Verma (ram.krishna.verma@ericsson.com)
*/
+@Getter
+@Setter
@ToString
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;
- }
}
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*");
/**
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.
* ============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.
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;
* 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.
IN, OUT
}
- /**
- * Get Network Logger.
- *
- * @return logger instance
- */
- public static Logger getNetworkLogger() {
- return netLogger;
- }
-
/**
* Logs a message to the network logger.
*
* @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);
}
/**
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)) {
* ============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.
*/
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.
*
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.