Use lombok for apex-pdp #7 76/123076/2
authorJim Hahn <jrh3@att.com>
Tue, 3 Aug 2021 18:08:09 +0000 (14:08 -0400)
committerJim Hahn <jrh3@att.com>
Fri, 6 Aug 2021 19:14:31 +0000 (15:14 -0400)
Updated thru core-protocols.

Issue-ID: POLICY-3391
Change-Id: I2226fee16b276eba5c7f3fd1921a6cef36654f07
Signed-off-by: Jim Hahn <jrh3@att.com>
29 files changed:
core/core-engine/src/main/java/org/onap/policy/apex/core/engine/EngineParameterConstants.java
core/core-engine/src/main/java/org/onap/policy/apex/core/engine/ExecutorParameters.java
core/core-engine/src/main/java/org/onap/policy/apex/core/engine/TaskParameters.java
core/core-engine/src/main/java/org/onap/policy/apex/core/engine/context/ApexInternalContext.java
core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/impl/ApexEngineConstants.java
core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/impl/ApexEngineImpl.java
core/core-engine/src/main/java/org/onap/policy/apex/core/engine/event/EnEvent.java
core/core-engine/src/main/java/org/onap/policy/apex/core/engine/event/EnField.java
core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateExecutor.java
core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateFinalizerExecutor.java
core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateMachineExecutor.java
core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/TaskExecutor.java
core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/AbstractExecutionContext.java
core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/AxStateFacade.java
core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/AxTaskFacade.java
core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/StateFinalizerExecutionContext.java
core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/java/classes/ClassUtils.java
core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/java/compile/singleclass/SingleClassLoader.java
core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/MessageHolder.java
core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/RawMessageHandler.java
core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/messageblock/MessageBlock.java
core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/messageblock/MessageBlockHandler.java
core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/messageblock/RawMessageBlock.java
core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/util/MessagingUtils.java
core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/threading/ApplicationThreadFactory.java
core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/threading/ThreadUtilities.java
core/core-infrastructure/src/test/java/org/onap/policy/apex/core/infrastructure/messaging/DummyMessageListener.java
core/core-protocols/src/main/java/org/onap/policy/apex/core/protocols/Message.java
core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/SupportMessageTester.java

index 1ac0ef6..3cd283b 100644 (file)
@@ -1,6 +1,7 @@
 /*-
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2018 Ericsson. All rights reserved.
+ *  Modifications Copyright (C) 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.apex.core.engine;
 
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
+
 /**
  * This class holds constants used when managing engine parameter groups in apex.
  */
-public abstract class EngineParameterConstants {
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public final class EngineParameterConstants {
     public static final String MAIN_GROUP_NAME = "ENGINE_PARAMETERS";
     public static final String EXECUTOR_GROUP_NAME = "EXECUTOR_PARAMETERS";
-
-    /**
-     * Private default constructor to prevent subclassing.
-     */
-    private EngineParameterConstants() {
-        // Prevents subclassing
-    }
-
 }
index 7bff07d..f7dc5dd 100644 (file)
@@ -21,6 +21,8 @@
 
 package org.onap.policy.apex.core.engine;
 
+import lombok.Getter;
+import lombok.Setter;
 import org.onap.policy.common.parameters.ParameterGroupImpl;
 
 /**
@@ -32,6 +34,8 @@ import org.onap.policy.common.parameters.ParameterGroupImpl;
  *
  * @author Liam Fallon (liam.fallon@ericsson.com)
  */
+@Getter
+@Setter
 public class ExecutorParameters extends ParameterGroupImpl {
     // Executor Plugin classes for executors
     private String taskExecutorPluginClass;
@@ -46,62 +50,6 @@ public class ExecutorParameters extends ParameterGroupImpl {
         super(EngineParameterConstants.EXECUTOR_GROUP_NAME);
     }
 
-    /**
-     * Gets the task executor plugin class for the executor.
-     *
-     * @return the task executor plugin class for the executor
-     */
-    public String getTaskExecutorPluginClass() {
-        return taskExecutorPluginClass;
-    }
-
-    /**
-     * Sets the task executor plugin class for the executor.
-     *
-     * @param taskExecutorPluginClass the task executor plugin class for the executor
-     */
-    public void setTaskExecutorPluginClass(final String taskExecutorPluginClass) {
-        this.taskExecutorPluginClass = taskExecutorPluginClass;
-    }
-
-    /**
-     * Gets the task selection executor plugin class for the executor.
-     *
-     * @return the task selection executor plugin class for the executor
-     */
-    public String getTaskSelectionExecutorPluginClass() {
-        return taskSelectionExecutorPluginClass;
-    }
-
-    /**
-     * Sets the task selection executor plugin class for the executor.
-     *
-     * @param taskSelectionExecutorPluginClass the task selection executor plugin class for the
-     *        executor
-     */
-    public void setTaskSelectionExecutorPluginClass(final String taskSelectionExecutorPluginClass) {
-        this.taskSelectionExecutorPluginClass = taskSelectionExecutorPluginClass;
-    }
-
-    /**
-     * Gets the state finalizer executor plugin class for the executor.
-     *
-     * @return the state finalizer executor plugin class for the executor
-     */
-    public String getStateFinalizerExecutorPluginClass() {
-        return stateFinalizerExecutorPluginClass;
-    }
-
-    /**
-     * Sets the state finalizer executor plugin class for the executor.
-     *
-     * @param stateFinalizerExecutorPluginClass the state finalizer executor plugin class for the
-     *        executor
-     */
-    public void setStateFinalizerExecutorPluginClass(final String stateFinalizerExecutorPluginClass) {
-        this.stateFinalizerExecutorPluginClass = stateFinalizerExecutorPluginClass;
-    }
-
     @Override
     public String toString() {
         return "ExecutorParameters [name=" + getName() + ", taskExecutorPluginClass=" + taskExecutorPluginClass
index 2bb3dc1..2481104 100644 (file)
@@ -1,6 +1,7 @@
 /*-
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2020 Nordix Foundation.
+ *  Modifications Copyright (C) 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.
@@ -21,6 +22,7 @@
 package org.onap.policy.apex.core.engine;
 
 import lombok.Getter;
+import lombok.NoArgsConstructor;
 import lombok.Setter;
 import org.onap.policy.common.parameters.BeanValidator;
 import org.onap.policy.common.parameters.ValidationResult;
@@ -34,8 +36,9 @@ import org.onap.policy.common.parameters.annotations.NotNull;
  */
 @Getter
 @Setter
+@NoArgsConstructor
 public class TaskParameters {
-    private String name;
+    private String name = "taskParameters";
 
     // If taskId is not specified, then the taskParameter is added to all tasks in the engine.
     private String taskId;
@@ -47,10 +50,6 @@ public class TaskParameters {
     @NotBlank
     private String value;
 
-    public TaskParameters() {
-        this.name = "taskParameters";
-    }
-
     /**
      * Full constructor.
      *
index 0589e83..1fee197 100644 (file)
@@ -2,6 +2,7 @@
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2016-2018 Ericsson. All rights reserved.
  *  Modifications Copyright (C) 2019 Nordix Foundation.
+ *  Modifications Copyright (C) 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.
@@ -28,6 +29,7 @@ import java.util.Map.Entry;
 import java.util.NavigableMap;
 import java.util.Set;
 import java.util.TreeMap;
+import lombok.Getter;
 import org.onap.policy.apex.context.ContextAlbum;
 import org.onap.policy.apex.context.ContextException;
 import org.onap.policy.apex.context.Distributor;
@@ -52,6 +54,7 @@ import org.onap.policy.apex.model.utilities.comparison.KeyedMapDifference;
  */
 public class ApexInternalContext implements AxConceptGetter<ContextAlbum> {
     // The key of the currently running Apex model
+    @Getter
     private AxArtifactKey key;
 
     // The context albums being used in this engine
@@ -89,15 +92,6 @@ public class ApexInternalContext implements AxConceptGetter<ContextAlbum> {
         key = apexPolicyModel.getKey();
     }
 
-    /**
-     * Get the key of the internal context, which is the same as the key of the engine.
-     *
-     * @return the key
-     */
-    public AxArtifactKey getKey() {
-        return key;
-    }
-
     /**
      * Get the context albums of the engine.
      *
index e01feb7..cba2dc9 100644 (file)
@@ -1,30 +1,35 @@
 /*-
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2018 Ericsson. All rights reserved.
+ *  Modifications Copyright (C) 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.
  * 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.
- * 
+ *
  * SPDX-License-Identifier: Apache-2.0
  * ============LICENSE_END=========================================================
  */
 
 package org.onap.policy.apex.core.engine.engine.impl;
 
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
+
 /**
  * Constants for the Apex engine.
  *
  */
-public abstract class ApexEngineConstants {
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public final class ApexEngineConstants {
     /**
      * The amount of milliseconds to wait for the current Apex engine to timeout on engine stop
      * requests. If the timeout is exceeded, the stop aborts.
@@ -33,11 +38,4 @@ public abstract class ApexEngineConstants {
 
     /** The wait increment (or pause time) when waiting for the Apex engine to stop. */
     public static final int APEX_ENGINE_STOP_EXECUTION_WAIT_INCREMENT = 100;
-    
-    /**
-     * Private constructor to prevent subclassing.
-     */
-    private ApexEngineConstants() {
-        // Constructor to avoid subclassing
-    }
 }
index d45be96..0d9d34d 100644 (file)
@@ -3,6 +3,7 @@
  *  Copyright (C) 2016-2018 Ericsson. All rights reserved.
  *  Modifications Copyright (C) 2019-2020 Nordix Foundation.
  *  Modifications Copyright (C) 2021 Bell Canada. All rights reserved.
+ *  Modifications Copyright (C) 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.
@@ -31,6 +32,7 @@ import java.util.Map.Entry;
 import java.util.Set;
 import java.util.TreeMap;
 import java.util.TreeSet;
+import lombok.Getter;
 import org.onap.policy.apex.context.ContextAlbum;
 import org.onap.policy.apex.context.ContextException;
 import org.onap.policy.apex.core.engine.context.ApexInternalContext;
@@ -76,9 +78,11 @@ public class ApexEngineImpl implements ApexEngine {
     private static final String STOP = "stop()<-";
 
     // The artifact key of this engine
+    @Getter
     private final AxArtifactKey key;
 
     // The state of this engine
+    @Getter
     private AxEngineState state = AxEngineState.STOPPED;
     private final Object stateLockObj = new Object();
 
@@ -86,6 +90,7 @@ public class ApexEngineImpl implements ApexEngine {
     private final Map<String, EnEventListener> eventListeners = new LinkedHashMap<>();
 
     // The context of this engine
+    @Getter
     private ApexInternalContext internalContext = null;
 
     // The state machines
@@ -442,22 +447,6 @@ public class ApexEngineImpl implements ApexEngine {
         eventListeners.remove(listenerName);
     }
 
-    /**
-     * {@inheritDoc}.
-     */
-    @Override
-    public AxArtifactKey getKey() {
-        return key;
-    }
-
-    /**
-     * {@inheritDoc}.
-     */
-    @Override
-    public final AxEngineState getState() {
-        return state;
-    }
-
     /**
      * {@inheritDoc}.
      */
@@ -489,15 +478,6 @@ public class ApexEngineImpl implements ApexEngine {
         return currentContext;
     }
 
-    /**
-     * Get the internal context for the Apex engine.
-     *
-     * @return The Apex Internal Context
-     */
-    public ApexInternalContext getInternalContext() {
-        return internalContext;
-    }
-
     /**
      * Create an exception event from the incoming event including the exception information on the event.
      *
index d4b2124..29802e0 100644 (file)
@@ -31,6 +31,8 @@ import java.util.Map;
 import java.util.Properties;
 import java.util.Random;
 import java.util.Set;
+import lombok.AccessLevel;
+import lombok.EqualsAndHashCode;
 import lombok.Getter;
 import lombok.Setter;
 import org.onap.policy.apex.core.engine.monitoring.EventMonitor;
@@ -49,6 +51,9 @@ import org.slf4j.ext.XLoggerFactory;
  *
  * @author Liam Fallon (liam.fallon@ericsson.com)
  */
+@Getter
+@Setter
+@EqualsAndHashCode(callSuper = true, onlyExplicitlyIncluded = true)
 public class EnEvent extends HashMap<String, Object> {
     private static final long serialVersionUID = 6311863111866294637L;
 
@@ -58,37 +63,31 @@ public class EnEvent extends HashMap<String, Object> {
     // Repeasted string constants
     private static final String NULL_KEYS_ILLEGAL = "null keys are illegal on method parameter \"key\"";
 
+    /*
+     * This is not used for encryption/security, thus disabling sonar.
+     */
+    private static Random rand = new Random(System.nanoTime());     // NOSONAR
+
     // The definition of this event in the Apex model
+    @Setter(AccessLevel.NONE)
+    @EqualsAndHashCode.Include
     private final AxEvent axEvent;
 
     // The event monitor for this event
+    @Getter(AccessLevel.NONE)
     private final transient EventMonitor eventMonitor = new EventMonitor();
 
     // The stack of execution of this event, used for monitoring
-    @Getter
-    @Setter
     private AxConcept[] userArtifactStack;
 
-    /*
-     * This is not used for encryption/security, thus disabling sonar.
-     */
-    private static Random rand = new Random(System.nanoTime());     // NOSONAR
-
     // An identifier for the current event execution. The default value here will always be a random
-    // number, and should
-    // be reset
-    @Getter
-    @Setter
+    // number, and should be reset
     private long executionId = rand.nextLong();
 
     // Event related properties used during processing of this event
-    @Getter
-    @Setter
     private Properties executionProperties = new Properties();
 
     // A string holding a message that indicates why processing of this event threw an exception
-    @Getter
-    @Setter
     private String exceptionMessage;
 
     /**
@@ -115,15 +114,6 @@ public class EnEvent extends HashMap<String, Object> {
         this.axEvent = axEvent;
     }
 
-    /**
-     * Gets the event definition of this event.
-     *
-     * @return the event definition
-     */
-    public AxEvent getAxEvent() {
-        return axEvent;
-    }
-
     /**
      * Get the name of the event.
      *
@@ -298,40 +288,4 @@ public class EnEvent extends HashMap<String, Object> {
         return "EnEvent [axEvent=" + axEvent + ", userArtifactStack=" + Arrays.toString(userArtifactStack) + ", map="
                 + super.toString() + "]";
     }
-
-    /**
-     * {@inheritDoc}.
-     */
-    @Override
-    public int hashCode() {
-        final int prime = 31;
-        int result = super.hashCode();
-        result = prime * result + axEvent.hashCode();
-        return result;
-    }
-
-    /**
-     * {@inheritDoc}.
-     */
-    @Override
-    public boolean equals(Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (!super.equals(obj)) {
-            return false;
-        }
-        if (!(obj instanceof EnEvent)) {
-            return false;
-        }
-        EnEvent other = (EnEvent) obj;
-        if (axEvent == null) {
-            if (other.axEvent != null) {
-                return false;
-            }
-        } else if (!axEvent.equals(other.axEvent)) {
-            return false;
-        }
-        return true;
-    }
 }
index 63a45fe..99a95ca 100644 (file)
@@ -1,6 +1,7 @@
 /*-
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ *  Modifications Copyright (C) 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.
@@ -21,6 +22,7 @@
 package org.onap.policy.apex.core.engine.event;
 
 import java.io.Serializable;
+import lombok.Getter;
 import org.onap.policy.apex.context.ContextRuntimeException;
 import org.onap.policy.apex.context.SchemaHelper;
 import org.onap.policy.apex.context.impl.schema.SchemaHelperFactory;
@@ -34,6 +36,7 @@ import org.slf4j.ext.XLoggerFactory;
  *
  * @author Liam Fallon (liam.fallon@ericsson.com)
  */
+@Getter
 public class EnField implements Serializable {
     private static final long serialVersionUID = -5713525780081840333L;
 
@@ -71,24 +74,6 @@ public class EnField implements Serializable {
         }
     }
 
-    /**
-     * Gets the field definition of this field.
-     *
-     * @return the field definition
-     */
-    public AxField getAxField() {
-        return axField;
-    }
-
-    /**
-     * Gets the schema helper of this field.
-     *
-     * @return the schema helper for this field
-     */
-    public SchemaHelper getSchemaHelper() {
-        return schemaHelper;
-    }
-
     /**
      * Get the name of the field.
      *
@@ -107,15 +92,6 @@ public class EnField implements Serializable {
         return axField.getKey();
     }
 
-    /**
-     * Get the value of the field.
-     *
-     * @return the value
-     */
-    public Object getValue() {
-        return value;
-    }
-
     /**
      * {@inheritDoc}.
      */
index 11d0aa1..5fb51ca 100644 (file)
@@ -3,6 +3,7 @@
  *  Copyright (C) 2016-2018 Ericsson. All rights reserved.
  *  Modifications Copyright (C) 2019-2020 Nordix Foundation.
  *  Modifications Copyright (C) 2021 Bell Canada. All rights reserved.
+ *  Modifications Copyright (C) 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.
@@ -27,6 +28,7 @@ import java.util.Map;
 import java.util.Map.Entry;
 import java.util.Properties;
 import java.util.TreeMap;
+import lombok.Getter;
 import org.onap.policy.apex.context.ContextException;
 import org.onap.policy.apex.core.engine.ExecutorParameters;
 import org.onap.policy.apex.core.engine.context.ApexInternalContext;
@@ -58,6 +60,7 @@ public class StateExecutor implements Executor<EnEvent, StateOutput, AxState, Ap
 
     // Hold the state and context definitions for this state
     private AxState axState = null;
+    @Getter
     private Executor<?, ?, ?, ?> parent = null;
     private ApexInternalContext context = null;
 
@@ -296,14 +299,6 @@ public class StateExecutor implements Executor<EnEvent, StateOutput, AxState, Ap
         return axState.getKey();
     }
 
-    /**
-     * {@inheritDoc}.
-     */
-    @Override
-    public Executor<?, ?, ?, ?> getParent() {
-        return parent;
-    }
-
     /**
      * {@inheritDoc}.
      */
index 5f99518..f490a98 100644 (file)
@@ -2,6 +2,7 @@
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2016-2018 Ericsson. All rights reserved.
  *  Modifications Copyright (C) 2019 Nordix Foundation.
+ *  Modifications Copyright (C) 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.
@@ -25,6 +26,8 @@ import static org.onap.policy.common.utils.validation.Assertions.argumentOfClass
 
 import java.util.Map;
 import java.util.Properties;
+import lombok.AccessLevel;
+import lombok.Getter;
 import lombok.NonNull;
 import org.onap.policy.apex.context.ContextException;
 import org.onap.policy.apex.core.engine.ExecutorParameters;
@@ -53,6 +56,7 @@ public abstract class StateFinalizerExecutor
     private static final String EXECUTE_POST_SFL = "execute-post: state finalizer logic \"";
 
     // Hold the state and context definitions
+    @Getter
     private Executor<?, ?, ?, ?> parent = null;
     private AxState axState = null;
     private AxStateFinalizerLogic finalizerLogic = null;
@@ -67,17 +71,9 @@ public abstract class StateFinalizerExecutor
     // The execution context; contains the facades for events and context to be used by tasks
     // executed by this task
     // executor
+    @Getter(AccessLevel.PROTECTED)
     private StateFinalizerExecutionContext executionContext = null;
 
-    /**
-     * Gets the execution internalContext.
-     *
-     * @return the execution context
-     */
-    protected StateFinalizerExecutionContext getExecutionContext() {
-        return executionContext;
-    }
-
     /**
      * {@inheritDoc}.
      */
@@ -177,14 +173,6 @@ public abstract class StateFinalizerExecutor
         return finalizerLogic.getKey();
     }
 
-    /**
-     * {@inheritDoc}.
-     */
-    @Override
-    public Executor<?, ?, ?, ?> getParent() {
-        return parent;
-    }
-
     /**
      * {@inheritDoc}.
      */
index 52429a2..3f6d6cf 100644 (file)
@@ -3,6 +3,7 @@
  *  Copyright (C) 2016-2018 Ericsson. All rights reserved.
  *  Modifications Copyright (C) 2019 Nordix Foundation.
  *  Modifications Copyright (C) 2021 Bell Canada. All rights reserved.
+ *  Modifications Copyright (C) 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.
@@ -27,6 +28,7 @@ import java.util.Collections;
 import java.util.Map;
 import java.util.Properties;
 import java.util.TreeMap;
+import lombok.Getter;
 import org.onap.policy.apex.context.ContextException;
 import org.onap.policy.apex.core.engine.ExecutorParameters;
 import org.onap.policy.apex.core.engine.context.ApexInternalContext;
@@ -47,6 +49,7 @@ import org.onap.policy.apex.model.policymodel.concepts.AxStateOutput;
 public class StateMachineExecutor implements Executor<EnEvent, Collection<EnEvent>, AxPolicy, ApexInternalContext> {
     // The Apex Policy and context for this state machine
     private AxPolicy axPolicy = null;
+    @Getter
     private Executor<?, ?, ?, ?> parent = null;
     private ApexInternalContext internalContext = null;
 
@@ -198,14 +201,6 @@ public class StateMachineExecutor implements Executor<EnEvent, Collection<EnEven
         return axPolicy.getKey();
     }
 
-    /**
-     * {@inheritDoc}.
-     */
-    @Override
-    public final Executor<?, ?, ?, ?> getParent() {
-        return parent;
-    }
-
     /**
      * {@inheritDoc}.
      */
index 31e27d2..ed5c0f2 100644 (file)
@@ -3,6 +3,7 @@
  *  Copyright (C) 2016-2018 Ericsson. All rights reserved.
  *  Modifications Copyright (C) 2019-2020 Nordix Foundation.
  *  Modifications Copyright (C) 2021 Bell Canada. All rights reserved.
+ *  Modifications Copyright (C) 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.
@@ -60,6 +61,7 @@ public abstract class TaskExecutor
     private static final XLogger LOGGER = XLoggerFactory.getXLogger(TaskExecutor.class);
 
     // Hold the task and context definitions for this task
+    @Getter
     private Executor<?, ?, ?, ?> parent = null;
     private AxTask axTask = null;
     private ApexInternalContext internalContext = null;
@@ -273,14 +275,6 @@ public abstract class TaskExecutor
         return axTask.getKey();
     }
 
-    /**
-     * {@inheritDoc}.
-     */
-    @Override
-    public Executor<?, ?, ?, ?> getParent() {
-        return parent;
-    }
-
     /**
      * {@inheritDoc}.
      */
index 5276731..3e6d130 100644 (file)
@@ -23,6 +23,7 @@ package org.onap.policy.apex.core.engine.executor.context;
 
 import java.util.Properties;
 import lombok.Getter;
+import lombok.RequiredArgsConstructor;
 import lombok.Setter;
 import org.onap.policy.apex.context.SchemaHelper;
 import org.onap.policy.common.utils.coder.CoderException;
@@ -34,6 +35,7 @@ import org.onap.policy.common.utils.coder.StandardCoder;
  * policy, global, and external context.
  */
 @Getter
+@RequiredArgsConstructor
 public class AbstractExecutionContext {
     /** A constant <code>boolean true</code> value available for reuse e.g., for the return value */
     public static final Boolean IS_TRUE = true;
@@ -43,12 +45,12 @@ public class AbstractExecutionContext {
      */
     public static final Boolean IS_FALSE = false;
 
-    /** the execution ID for the current APEX policy execution instance. */
-    public final Long executionId;
-
     // Standard coder for JSON converts
     private static final StandardCoder STANDARD_CODER = new StandardCoder();
 
+    /** the execution ID for the current APEX policy execution instance. */
+    public final Long executionId;
+
     // A message specified in the logic
     @Setter
     private String message;
@@ -56,19 +58,6 @@ public class AbstractExecutionContext {
     // Execution properties for a policy execution
     private final Properties executionProperties;
 
-    /**
-     * Instantiates a new task execution context.
-     *
-     * @param executionId the execution ID for the current APEX policy execution instance
-     * @param executionProperties the execution properties for task execution
-     */
-    public AbstractExecutionContext(final long executionId, final Properties executionProperties) {
-
-        // Execution ID is the current policy execution instance
-        this.executionId = executionId;
-        this.executionProperties = executionProperties;
-    }
-
     /**
      * Get a JSON representation of an object.
      *
index f433eed..75d2aa8 100644 (file)
@@ -1,6 +1,7 @@
 /*-
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ *  Modifications Copyright (C) 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 +25,7 @@ import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
 import java.util.Set;
+import lombok.AllArgsConstructor;
 import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
 import org.onap.policy.apex.model.basicmodel.service.ModelService;
 import org.onap.policy.apex.model.policymodel.concepts.AxState;
@@ -35,6 +37,7 @@ import org.onap.policy.apex.model.policymodel.concepts.AxTasks;
  *
  * @author Sven van der Meer (sven.van.der.meer@ericsson.com)
  */
+@AllArgsConstructor
 public class AxStateFacade {
     // CHECKSTYLE:OFF: checkstyle:visibilityModifier Logic has access to this field
 
@@ -43,15 +46,6 @@ public class AxStateFacade {
 
     // CHECKSTYLE:ON: checkstyle:visibilityModifier
 
-    /**
-     * Instantiates a new AxState facade.
-     *
-     * @param state the state for which a facade is being presented
-     */
-    public AxStateFacade(final AxState state) {
-        this.state = state;
-    }
-
     /**
      * Gets the default task key of the state.
      *
index 5f39bcd..8a310c6 100644 (file)
@@ -2,6 +2,7 @@
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2016-2018 Ericsson. All rights reserved.
  *  Modifications Copyright (C) 2021 Bell Canada. All rights reserved.
+ *  Modifications Copyright (C) 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.
@@ -21,6 +22,7 @@
 
 package org.onap.policy.apex.core.engine.executor.context;
 
+import lombok.AllArgsConstructor;
 import org.onap.policy.apex.context.SchemaHelper;
 import org.onap.policy.apex.context.impl.schema.SchemaHelperFactory;
 import org.onap.policy.apex.core.engine.event.EnException;
@@ -36,6 +38,7 @@ import org.slf4j.ext.XLoggerFactory;
  *
  * @author Sven van der Meer (sven.van.der.meer@ericsson.com)
  */
+@AllArgsConstructor
 public class AxTaskFacade {
     // Logger for this class
     private static final XLogger LOGGER = XLoggerFactory.getXLogger(AxTaskFacade.class);
@@ -50,15 +53,6 @@ public class AxTaskFacade {
 
     // CHECKSTYLE:ON: checkstyle:visibilityModifier
 
-    /**
-     * Instantiates a new AxTask facade.
-     *
-     * @param task the task for which a facade is being presented
-     */
-    public AxTaskFacade(final AxTask task) {
-        this.task = task;
-    }
-
     /**
      * Gets the name of the task.
      *
index 6b2576d..eb5f5f3 100644 (file)
@@ -2,6 +2,7 @@
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2016-2018 Ericsson. All rights reserved.
  *  Modifications Copyright (C) 2020-2021 Nordix Foundation.
+ *  Modifications Copyright (C) 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.
@@ -28,6 +29,7 @@ import java.util.Properties;
 import java.util.Set;
 import java.util.TreeMap;
 import lombok.Getter;
+import lombok.Setter;
 import org.onap.policy.apex.context.ContextAlbum;
 import org.onap.policy.apex.context.ContextRuntimeException;
 import org.onap.policy.apex.core.engine.context.ApexInternalContext;
@@ -76,6 +78,8 @@ public class StateFinalizerExecutionContext extends AbstractExecutionContext {
      * The state output that the state finalizer logic has selected for a state. The state finalizer logic sets this
      * field in its logic after executing and the Apex engine uses this state output for this state.
      */
+    @Getter
+    @Setter
     private String selectedStateOutputName;
 
     /**
@@ -156,22 +160,4 @@ public class StateFinalizerExecutionContext extends AbstractExecutionContext {
                     + "\" on state \"" + subject.getId() + "\"");
         }
     }
-
-    /**
-     * Return the state output name selected by the state finalizer logic.
-     *
-     * @return the state output name
-     */
-    public String getSelectedStateOutputName() {
-        return selectedStateOutputName;
-    }
-
-    /**
-     * Set the state output name selected by the state finalizer logic.
-     *
-     * @param selectedStateOutputName the state output name
-     */
-    public void setSelectedStateOutputName(final String selectedStateOutputName) {
-        this.selectedStateOutputName = selectedStateOutputName;
-    }
 }
index 03bedce..e3a51f0 100644 (file)
@@ -34,6 +34,8 @@ import java.util.Set;
 import java.util.TreeSet;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipInputStream;
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
 import org.slf4j.ext.XLogger;
 import org.slf4j.ext.XLoggerFactory;
 
@@ -42,7 +44,8 @@ import org.slf4j.ext.XLoggerFactory;
  *
  * @author Liam Fallon (liam.fallon@ericsson.com)
  */
-public abstract class ClassUtils {
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public final class ClassUtils {
     // Get a reference to the logger
     private static final XLogger LOGGER = XLoggerFactory.getXLogger(ClassUtils.class);
 
@@ -58,13 +61,6 @@ public abstract class ClassUtils {
     // Token for library fragment in path
     private static final String LIBRARAY_PATH_TOKEN = "/lib";
 
-    /**
-     * Private constructor used to prevent sub class instantiation.
-     */
-    private ClassUtils() {
-        // Private constructor to block subclassing
-    }
-
     /**
      * Get the class names of all classes on the class path. WARNING: This is a heavy call, use sparingly
      *
index 61293f5..55fa498 100644 (file)
@@ -1,6 +1,7 @@
 /*-
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ *  Modifications Copyright (C) 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.apex.core.infrastructure.java.compile.singleclass;
 
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
 /**
  * The Class SingleClassLoader is responsible for class loading the single Java class being held in memory.
  *
  * @author Liam Fallon (liam.fallon@ericsson.com)
  */
+@Getter
+@AllArgsConstructor
 public class SingleClassLoader extends ClassLoader {
     // The byte code of the class held in memory as byte code in a ByteCodeFileObject
-    private final SingleClassByteCodeFileObject byteCodeFileObject;
-
-    /**
-     * Instantiates a new single class loader to load the byte code of the class that is being held in memory.
-     *
-     * @param byteCodeFileObject the byte code of the class
-     */
-    public SingleClassLoader(final SingleClassByteCodeFileObject byteCodeFileObject) {
-        this.byteCodeFileObject = byteCodeFileObject;
-    }
+    private final SingleClassByteCodeFileObject fileObject;
 
     /**
      * {@inheritDoc}.
@@ -45,15 +42,6 @@ public class SingleClassLoader extends ClassLoader {
     protected Class<?> findClass(final String className) throws ClassNotFoundException {
         // Creates a java Class that can be instantiated from the class defined in the byte code in the
         // ByteCodeFileObejct
-        return defineClass(className, byteCodeFileObject.getByteCode(), 0, byteCodeFileObject.getByteCode().length);
-    }
-
-    /**
-     * Gets the file object.
-     *
-     * @return the file object
-     */
-    SingleClassByteCodeFileObject getFileObject() {
-        return byteCodeFileObject;
+        return defineClass(className, fileObject.getByteCode(), 0, fileObject.getByteCode().length);
     }
 }
index e5c5aae..abc5c90 100644 (file)
@@ -1,6 +1,7 @@
 /*-
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ *  Modifications Copyright (C) 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 +25,9 @@ import java.io.Serializable;
 import java.net.InetAddress;
 import java.util.ArrayList;
 import java.util.List;
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
+import lombok.ToString;
 import org.slf4j.ext.XLogger;
 import org.slf4j.ext.XLoggerFactory;
 
@@ -34,9 +38,10 @@ import org.slf4j.ext.XLoggerFactory;
  * @author Sajeevan Achuthan (sajeevan.achuthan@ericsson.com)
  * @param <M> the generic type of message being handled by a message holder instance
  */
+@Getter
+@ToString
+@EqualsAndHashCode
 public class MessageHolder<M> implements Serializable {
-    private static final int HASH_PRIME = 31;
-    private static final int FOUR_BYTES = 32;
 
     // Serial ID
     private static final long serialVersionUID = 1235487535388793719L;
@@ -49,6 +54,7 @@ public class MessageHolder<M> implements Serializable {
     private final InetAddress senderHostAddress;
 
     // Sequence of message in the message holder
+    @ToString.Exclude
     private final List<M> messages;
 
     /**
@@ -63,15 +69,6 @@ public class MessageHolder<M> implements Serializable {
         creationTime = System.currentTimeMillis();
     }
 
-    /**
-     * Return the messages in this message holder.
-     *
-     * @return the messages
-     */
-    public List<M> getMessages() {
-        return messages;
-    }
-
     /**
      * Adds a message to this message holder.
      *
@@ -84,75 +81,4 @@ public class MessageHolder<M> implements Serializable {
             LOGGER.warn("duplicate message {} added to message holder", message);
         }
     }
-
-    /**
-     * Gets the creation time.
-     *
-     * @return the creation time
-     */
-    public long getCreationTime() {
-        return creationTime;
-    }
-
-    /**
-     * Gets the sender host address.
-     *
-     * @return the sender host address
-     */
-    public InetAddress getSenderHostAddress() {
-        return senderHostAddress;
-    }
-
-    /**
-     * {@inheritDoc}.
-     */
-    @Override
-    public String toString() {
-        return "ApexCommandProtocol [creationTime=" + creationTime + ", senderHostAddress=" + senderHostAddress + "]";
-    }
-
-    /**
-     * {@inheritDoc}.
-     */
-    @Override
-    public int hashCode() {
-        final int prime = HASH_PRIME;
-        int result = 1;
-        result = prime * result + ((senderHostAddress == null) ? 0 : senderHostAddress.hashCode());
-        result = prime * result + ((messages == null) ? 0 : messages.hashCode());
-        result = prime * result + (int) (creationTime ^ (creationTime >>> FOUR_BYTES));
-        return result;
-    }
-
-    /**
-     * {@inheritDoc}.
-     */
-    @Override
-    public boolean equals(final Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (obj == null) {
-            return false;
-        }
-        if (getClass() != obj.getClass()) {
-            return false;
-        }
-        final MessageHolder<?> other = (MessageHolder<?>) obj;
-        if (senderHostAddress == null) {
-            if (other.senderHostAddress != null) {
-                return false;
-            }
-        } else if (!senderHostAddress.equals(other.senderHostAddress)) {
-            return false;
-        }
-        if (messages == null) {
-            if (other.messages != null) {
-                return false;
-            }
-        } else if (!messages.equals(other.messages)) {
-            return false;
-        }
-        return creationTime == other.creationTime;
-    }
 }
index 0493eaf..1bc1000 100644 (file)
@@ -105,7 +105,7 @@ public class RawMessageHandler<M> implements WebSocketMessageListener<M>, Runnab
             if (messageHolder != null) {
                 final List<M> messages = messageHolder.getMessages();
                 if (messages != null) {
-                    messageBlockQueue.add(new MessageBlock<>(messages, incomingData.getConn()));
+                    messageBlockQueue.add(new MessageBlock<>(messages, incomingData.getWebSocket()));
                 }
             }
         } catch (final IOException | ClassNotFoundException e) {
index ba98fd7..75e82a0 100644 (file)
@@ -1,6 +1,7 @@
 /*-
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ *  Modifications Copyright (C) 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.
@@ -21,6 +22,8 @@
 package org.onap.policy.apex.core.infrastructure.messaging.impl.ws.messageblock;
 
 import java.util.List;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
 import org.java_websocket.WebSocket;
 
 /**
@@ -29,6 +32,8 @@ import org.java_websocket.WebSocket;
  * @author Sajeevan Achuthan (sajeevan.achuthan@ericsson.com)
  * @param <M> the generic type of message being handled
  */
+@Getter
+@AllArgsConstructor
 public final class MessageBlock<M> {
 
     // List of Messages received on a web socket
@@ -36,34 +41,4 @@ public final class MessageBlock<M> {
 
     // The web socket on which the messages are handled
     private final WebSocket webSocket;
-
-    /**
-     * Instantiates a new message block.
-     *
-     * @param messages the messages in the message block
-     * @param webSocket the web socket used to handle the message block
-     */
-    public MessageBlock(final List<M> messages, final WebSocket webSocket) {
-        this.messages = messages;
-        this.webSocket = webSocket;
-    }
-
-    /**
-     * Gets the messages.
-     *
-     * @return the messages
-     */
-    public List<M> getMessages() {
-        return messages;
-    }
-
-    /**
-     * Gets the web socket.
-     *
-     * @return the web socket
-     */
-    public WebSocket getConnection() {
-        return webSocket;
-    }
-
 }
index 3134c67..0349cb5 100644 (file)
@@ -1,6 +1,7 @@
 /*-
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ *  Modifications Copyright (C) 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.
@@ -59,8 +60,8 @@ public class MessageBlockHandler<M> {
     public void post(final RawMessageBlock rawMessageBlock) {
         if (rawMessageBlock.getMessage() != null) {
             if (LOGGER.isDebugEnabled()) {
-                LOGGER.debug("new raw message recieved from {}", rawMessageBlock.getConn() == null ? "server"
-                        : rawMessageBlock.getConn().getRemoteSocketAddress().getHostName());
+                LOGGER.debug("new raw message recieved from {}", rawMessageBlock.getWebSocket() == null ? "server"
+                        : rawMessageBlock.getWebSocket().getRemoteSocketAddress().getHostName());
             }
             eventBus.post(rawMessageBlock);
         }
@@ -74,8 +75,8 @@ public class MessageBlockHandler<M> {
     public void post(final MessageBlock<M> messageBlock) {
         if (messageBlock.getMessages() != null) {
             if (LOGGER.isDebugEnabled()) {
-                LOGGER.debug("new data message recieved from {}", messageBlock.getConnection() == null ? "server"
-                        : messageBlock.getConnection().getRemoteSocketAddress().getHostName());
+                LOGGER.debug("new data message recieved from {}", messageBlock.getWebSocket() == null ? "server"
+                        : messageBlock.getWebSocket().getRemoteSocketAddress().getHostName());
             }
             eventBus.post(messageBlock);
         }
index 7e8f09c..e9448ab 100644 (file)
@@ -1,6 +1,7 @@
 /*-
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ *  Modifications Copyright (C) 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.
@@ -21,6 +22,8 @@
 package org.onap.policy.apex.core.infrastructure.messaging.impl.ws.messageblock;
 
 import java.nio.ByteBuffer;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
 import org.java_websocket.WebSocket;
 
 /**
@@ -28,39 +31,12 @@ import org.java_websocket.WebSocket;
  *
  * @author Sajeevan Achuthan (sajeevan.achuthan@ericsson.com)
  */
+@Getter
+@AllArgsConstructor
 public final class RawMessageBlock {
     // The raw message
     private final ByteBuffer message;
 
     // The web socket on which the message is handled
     private final WebSocket webSocket;
-
-    /**
-     * Constructor, instantiate the bean.
-     *
-     * @param message {@link ByteBuffer} message from the web socket
-     * @param webSocket {@link WebSocket} the web socket on which the message is handled
-     */
-    public RawMessageBlock(final ByteBuffer message, final WebSocket webSocket) {
-        this.message = message;
-        this.webSocket = webSocket;
-    }
-
-    /**
-     * A getter method for message.
-     *
-     * @return the message
-     */
-    public ByteBuffer getMessage() {
-        return message;
-    }
-
-    /**
-     * A getter method for the web socket.
-     *
-     * @return the web socket
-     */
-    public WebSocket getConn() {
-        return webSocket;
-    }
 }
index bda1f87..ba84ca0 100644 (file)
@@ -30,6 +30,8 @@ import java.net.NetworkInterface;
 import java.net.Socket;
 import java.net.UnknownHostException;
 import java.util.Enumeration;
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
 import org.slf4j.ext.XLogger;
 import org.slf4j.ext.XLoggerFactory;
 
@@ -39,6 +41,7 @@ import org.slf4j.ext.XLoggerFactory;
  *
  * @author Sajeevan Achuthan (sajeevan.achuthan@ericsson.com)
  */
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
 public final class MessagingUtils {
     // The port number of the lowest user port, ports 0-1023 are system ports
     private static final int LOWEST_USER_PORT = 1024;
@@ -51,13 +54,6 @@ public final class MessagingUtils {
     // Logger for this class
     private static final XLogger LOGGER = XLoggerFactory.getXLogger(MessagingUtils.class);
 
-    /**
-     * Private constructor used to prevent sub class instantiation.
-     */
-    private MessagingUtils() {
-        // Private constructor to block subclassing
-    }
-
     /**
      * This method searches the availability of the port, if the requested port not available, this method will throw an
      * exception.
index dc9c13d..dd8b829 100644 (file)
@@ -1,6 +1,7 @@
 /*-
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ *  Modifications Copyright (C) 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.
@@ -22,6 +23,7 @@ package org.onap.policy.apex.core.infrastructure.threading;
 
 import java.util.concurrent.ThreadFactory;
 import java.util.concurrent.atomic.AtomicInteger;
+import lombok.Getter;
 
 /**
  * This class provides a thread factory for use by classes that require thread factories to handle concurrent operation.
@@ -34,8 +36,12 @@ public class ApplicationThreadFactory implements ThreadFactory {
     private static final AtomicInteger NEXT_POOL_NUMBER = new AtomicInteger();
     private final ThreadGroup group;
     private final AtomicInteger nextThreadNumber = new AtomicInteger();
+
+    @Getter
     private final String name;
+    @Getter
     private final long stackSize;
+    @Getter
     private final int threadPriority;
 
     /**
@@ -100,39 +106,12 @@ public class ApplicationThreadFactory implements ThreadFactory {
 
     }
 
-    /**
-     * Gets the name of the thread factory.
-     *
-     * @return the name
-     */
-    public String getName() {
-        return name;
-    }
-
-    /**
-     * Gets the stack size of the threads created by this thread factory.
-     *
-     * @return the stack size
-     */
-    public long getStackSize() {
-        return stackSize;
-    }
-
-    /**
-     * Gets the thread priority of the threads created by this thread factory.
-     *
-     * @return the thread priority
-     */
-    public int getThreadPriority() {
-        return threadPriority;
-    }
-
     /**
      * {@inheritDoc}.
      */
     @Override
     public String toString() {
-        return "ApplicationThreadFactory [nextPollNumber=" + NEXT_POOL_NUMBER + ",nextThreadNumber=" + nextThreadNumber
+        return "ApplicationThreadFactory [nextPoolNumber=" + NEXT_POOL_NUMBER + ",nextThreadNumber=" + nextThreadNumber
                 + ", name=" + name + ", stackSize=" + stackSize + ", threadPriority=" + threadPriority + "]";
     }
 }
index eb4e021..58939d6 100644 (file)
@@ -1,6 +1,7 @@
 /*-
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ *  Modifications Copyright (C) 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.apex.core.infrastructure.threading;
 
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
+
 /**
  * This class is a helper class for carrying out common threading tasks.
  *
  * @author Liam Fallon (liam.fallon@ericsson.com)
  */
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
 public final class ThreadUtilities {
 
-    /**
-     * Private constructor to prevent sub-classing of this class.
-     */
-    private ThreadUtilities() {
-        // Private constructor to prevent subclassing
-    }
-
     /**
      * Sleeps for the specified number of milliseconds, hiding interrupt handling.
      *
index d9bd93c..f81394c 100644 (file)
@@ -1,6 +1,7 @@
 /*-
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ *  Modifications Copyright (C) 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.
@@ -53,7 +54,7 @@ public abstract class DummyMessageListener implements MessageListener<String> {
         if (data != null) {
             if (logger.isDebugEnabled()) {
                 logger.debug("{} command recieved from machine {} ", data.getMessages().size(),
-                        data.getConnection().getRemoteSocketAddress().getHostString());
+                        data.getWebSocket().getRemoteSocketAddress().getHostString());
             }
             onCommand(data);
         }
index b79308e..005c181 100644 (file)
 package org.onap.policy.apex.core.protocols;
 
 import java.io.Serializable;
+import lombok.AccessLevel;
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
 import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
 
 /**
@@ -29,8 +34,10 @@ import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
  *
  * @author Sajeevan Achuthan (sajeevan.achuthan@ericsson.com)
  */
+@Getter
+@ToString
+@EqualsAndHashCode
 public abstract class Message implements Serializable {
-    private static final int HASH_PRIME = 31;
 
     // Serialization ID
     private static final long serialVersionUID = 2271443377544488309L;
@@ -42,12 +49,17 @@ public abstract class Message implements Serializable {
     private Action action = null;
 
     // The artifact key of the artifact to which this message is related
+    @Getter(AccessLevel.NONE)
     private AxArtifactKey targetKey = null;
 
     // The data of the message
+    @Setter
     private String messageData = null;
 
     // The timeout time for replies in milliseconds
+    @Setter
+    @ToString.Exclude
+    @EqualsAndHashCode.Exclude
     private int replyTimeout = DEFAULT_REPLY_TIMEOUT;
 
     /**
@@ -73,24 +85,6 @@ public abstract class Message implements Serializable {
         this.messageData = messageData;
     }
 
-    /**
-     * Set the message timeout.
-     *
-     * @param replyTimeout the timeout on reply messages in milliseconds
-     */
-    public void setReplyTimeout(final int replyTimeout) {
-        this.replyTimeout = replyTimeout;
-    }
-
-    /**
-     * Sets the message data.
-     *
-     * @param messageData the new message data
-     */
-    public void setMessageData(final String messageData) {
-        this.messageData = messageData;
-    }
-
     /**
      * Append to the message data.
      *
@@ -121,74 +115,4 @@ public abstract class Message implements Serializable {
     public final String getTargetName() {
         return targetKey.getName();
     }
-
-    /**
-     * Gets the action or message type of this message.
-     *
-     * @return the action
-     */
-    public final Action getAction() {
-        return action;
-    }
-
-    /**
-     * Gets the message data.
-     *
-     * @return the message data
-     */
-    public final String getMessageData() {
-        return messageData;
-    }
-
-    /**
-     * {@inheritDoc}.
-     */
-    @Override
-    public boolean equals(final Object object) {
-        if (this == object) {
-            return true;
-        }
-        if (object == null || getClass() != object.getClass()) {
-            return false;
-        }
-
-        final Message message = (Message) object;
-
-        if (action != null ? !action.equals(message.action) : message.action != null) {
-            return false;
-        }
-        if (targetKey != null ? !targetKey.equals(message.targetKey) : message.targetKey != null) {
-            return false;
-        }
-        return !(messageData != null ? !messageData.equals(message.messageData) : message.messageData != null);
-
-    }
-
-    /**
-     * {@inheritDoc}.
-     */
-    @Override
-    public int hashCode() {
-        int result = action != null ? action.hashCode() : 0;
-        result = HASH_PRIME * result + (targetKey != null ? targetKey.hashCode() : 0);
-        result = HASH_PRIME * result + (messageData != null ? messageData.hashCode() : 0);
-        return result;
-    }
-
-    /**
-     * {@inheritDoc}.
-     */
-    @Override
-    public String toString() {
-        return "Message [action=" + action + ", targetKey=" + targetKey + ", data=" + messageData + "]";
-    }
-
-    /**
-     * Get the timeout to wait for a reply.
-     *
-     * @return the timeout in milliseconds
-     */
-    public int getReplyTimeout() {
-        return replyTimeout;
-    }
 }
index 1f8ccab..f275f4b 100644 (file)
@@ -2,6 +2,7 @@
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2018 Ericsson. All rights reserved.
  *  Modifications Copyright (C) 2020 Nordix Foundation.
+ *  Modifications Copyright (C) 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.
@@ -40,8 +41,8 @@ public class SupportMessageTester {
 
         DummyMessage dummyMessage = new DummyMessage(new DummyAction(null), new AxArtifactKey("Target:0.0.1"));
         assertEquals(new DummyAction(null), dummyMessage.getAction());
-        assertEquals("Message [action=org.onap.policy.apex.core.protocols.DummyAction@1f, "
-            + "targetKey=AxArtifactKey:(name=Target,version=0.0.1), data=null]", dummyMessage.toString());
+        assertEquals("Message(action=org.onap.policy.apex.core.protocols.DummyAction@1f, "
+            + "targetKey=AxArtifactKey:(name=Target,version=0.0.1), messageData=null)", dummyMessage.toString());
 
         dummyMessage.setMessageData("Message Data");
         assertEquals("Message Data", dummyMessage.getMessageData());
@@ -60,7 +61,7 @@ public class SupportMessageTester {
         dummyMessage.setMessageData(null);
         assertNotEquals(0, dummyMessage.hashCode());
         dummyMessage = new DummyMessage(null, null, null);
-        assertEquals(0, dummyMessage.hashCode());
+        assertNotEquals(0, dummyMessage.hashCode());
 
         // disabling sonar because this code tests the equals() method
         assertEquals(dummyMessage, dummyMessage); // NOSONAR