summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2021-08-03 14:08:09 -0400
committerJim Hahn <jrh3@att.com>2021-08-06 15:14:31 -0400
commit0ed6c16727aa92c93965a7da756536b113b262c8 (patch)
treef7961bccd0db40a9f9985a5936381f183432235c /core
parent9344ec1396b7151262e9b4ac48c72020e2b03e7e (diff)
Use lombok for apex-pdp #7
Updated thru core-protocols. Issue-ID: POLICY-3391 Change-Id: I2226fee16b276eba5c7f3fd1921a6cef36654f07 Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'core')
-rw-r--r--core/core-engine/src/main/java/org/onap/policy/apex/core/engine/EngineParameterConstants.java15
-rw-r--r--core/core-engine/src/main/java/org/onap/policy/apex/core/engine/ExecutorParameters.java60
-rw-r--r--core/core-engine/src/main/java/org/onap/policy/apex/core/engine/TaskParameters.java9
-rw-r--r--core/core-engine/src/main/java/org/onap/policy/apex/core/engine/context/ApexInternalContext.java12
-rw-r--r--core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/impl/ApexEngineConstants.java20
-rw-r--r--core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/impl/ApexEngineImpl.java30
-rw-r--r--core/core-engine/src/main/java/org/onap/policy/apex/core/engine/event/EnEvent.java74
-rw-r--r--core/core-engine/src/main/java/org/onap/policy/apex/core/engine/event/EnField.java30
-rw-r--r--core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateExecutor.java11
-rw-r--r--core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateFinalizerExecutor.java22
-rw-r--r--core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateMachineExecutor.java11
-rw-r--r--core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/TaskExecutor.java10
-rw-r--r--core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/AbstractExecutionContext.java21
-rw-r--r--core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/AxStateFacade.java12
-rw-r--r--core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/AxTaskFacade.java12
-rw-r--r--core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/StateFinalizerExecutionContext.java22
-rw-r--r--core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/java/classes/ClassUtils.java12
-rw-r--r--core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/java/compile/singleclass/SingleClassLoader.java28
-rw-r--r--core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/MessageHolder.java90
-rw-r--r--core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/RawMessageHandler.java2
-rw-r--r--core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/messageblock/MessageBlock.java35
-rw-r--r--core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/messageblock/MessageBlockHandler.java9
-rw-r--r--core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/messageblock/RawMessageBlock.java34
-rw-r--r--core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/util/MessagingUtils.java10
-rw-r--r--core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/threading/ApplicationThreadFactory.java35
-rw-r--r--core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/threading/ThreadUtilities.java12
-rw-r--r--core/core-infrastructure/src/test/java/org/onap/policy/apex/core/infrastructure/messaging/DummyMessageListener.java3
-rw-r--r--core/core-protocols/src/main/java/org/onap/policy/apex/core/protocols/Message.java102
-rw-r--r--core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/SupportMessageTester.java7
29 files changed, 146 insertions, 604 deletions
diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/EngineParameterConstants.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/EngineParameterConstants.java
index 1ac0ef6c2..3cd283b74 100644
--- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/EngineParameterConstants.java
+++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/EngineParameterConstants.java
@@ -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.
@@ -20,18 +21,14 @@
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
- }
-
}
diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/ExecutorParameters.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/ExecutorParameters.java
index 7bff07d9a..f7dc5dd0b 100644
--- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/ExecutorParameters.java
+++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/ExecutorParameters.java
@@ -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
diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/TaskParameters.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/TaskParameters.java
index 2bb3dc19a..248110419 100644
--- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/TaskParameters.java
+++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/TaskParameters.java
@@ -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.
*
diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/context/ApexInternalContext.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/context/ApexInternalContext.java
index 0589e8311..1fee1971e 100644
--- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/context/ApexInternalContext.java
+++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/context/ApexInternalContext.java
@@ -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
@@ -90,15 +93,6 @@ public class ApexInternalContext implements AxConceptGetter<ContextAlbum> {
}
/**
- * 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.
*
* @return the context albums
diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/impl/ApexEngineConstants.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/impl/ApexEngineConstants.java
index e01feb730..cba2dc9f6 100644
--- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/impl/ApexEngineConstants.java
+++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/impl/ApexEngineConstants.java
@@ -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
- }
}
diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/impl/ApexEngineImpl.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/impl/ApexEngineImpl.java
index d45be9652..0d9d34d39 100644
--- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/impl/ApexEngineImpl.java
+++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/impl/ApexEngineImpl.java
@@ -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
@@ -446,22 +451,6 @@ public class ApexEngineImpl implements ApexEngine {
* {@inheritDoc}.
*/
@Override
- public AxArtifactKey getKey() {
- return key;
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- public final AxEngineState getState() {
- return state;
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
public AxEngineModel getEngineStatus() {
final var engineModel = new AxEngineModel(key);
engineModel.setTimestamp(System.currentTimeMillis());
@@ -490,15 +479,6 @@ public class ApexEngineImpl implements ApexEngine {
}
/**
- * 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.
*
* @param incomingEvent The incoming event that caused the exception
diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/event/EnEvent.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/event/EnEvent.java
index d4b212421..29802e06d 100644
--- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/event/EnEvent.java
+++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/event/EnEvent.java
@@ -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;
/**
@@ -116,15 +115,6 @@ public class EnEvent extends HashMap<String, Object> {
}
/**
- * Gets the event definition of this event.
- *
- * @return the event definition
- */
- public AxEvent getAxEvent() {
- return axEvent;
- }
-
- /**
* Get the name of the event.
*
* @return the event name
@@ -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;
- }
}
diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/event/EnField.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/event/EnField.java
index 63a45fee2..99a95cae1 100644
--- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/event/EnField.java
+++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/event/EnField.java
@@ -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;
@@ -72,24 +75,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.
*
* @return the field name
@@ -108,15 +93,6 @@ public class EnField implements Serializable {
}
/**
- * Get the value of the field.
- *
- * @return the value
- */
- public Object getValue() {
- return value;
- }
-
- /**
* {@inheritDoc}.
*/
@Override
diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateExecutor.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateExecutor.java
index 11d0aa1c9..5fb51ca70 100644
--- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateExecutor.java
+++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateExecutor.java
@@ -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;
@@ -300,14 +303,6 @@ public class StateExecutor implements Executor<EnEvent, StateOutput, AxState, Ap
* {@inheritDoc}.
*/
@Override
- public Executor<?, ?, ?, ?> getParent() {
- return parent;
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
public AxState getSubject() {
return axState;
}
diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateFinalizerExecutor.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateFinalizerExecutor.java
index 5f9951813..f490a9849 100644
--- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateFinalizerExecutor.java
+++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateFinalizerExecutor.java
@@ -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,18 +71,10 @@ 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}.
*/
@Override
@@ -181,14 +177,6 @@ public abstract class StateFinalizerExecutor
* {@inheritDoc}.
*/
@Override
- public Executor<?, ?, ?, ?> getParent() {
- return parent;
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
public AxStateFinalizerLogic getSubject() {
return finalizerLogic;
}
diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateMachineExecutor.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateMachineExecutor.java
index 52429a215..3f6d6cfe6 100644
--- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateMachineExecutor.java
+++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateMachineExecutor.java
@@ -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;
@@ -202,14 +205,6 @@ public class StateMachineExecutor implements Executor<EnEvent, Collection<EnEven
* {@inheritDoc}.
*/
@Override
- public final Executor<?, ?, ?, ?> getParent() {
- return parent;
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
public final AxPolicy getSubject() {
return axPolicy;
}
diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/TaskExecutor.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/TaskExecutor.java
index 31e27d244..ed5c0f271 100644
--- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/TaskExecutor.java
+++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/TaskExecutor.java
@@ -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;
@@ -277,14 +279,6 @@ public abstract class TaskExecutor
* {@inheritDoc}.
*/
@Override
- public Executor<?, ?, ?, ?> getParent() {
- return parent;
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
public AxTask getSubject() {
return axTask;
}
diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/AbstractExecutionContext.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/AbstractExecutionContext.java
index 527673108..3e6d13023 100644
--- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/AbstractExecutionContext.java
+++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/AbstractExecutionContext.java
@@ -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;
@@ -57,19 +59,6 @@ public class AbstractExecutionContext {
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.
*
* @param theObject the object to get a JSON representation of
diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/AxStateFacade.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/AxStateFacade.java
index f433eedcd..75d2aa82f 100644
--- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/AxStateFacade.java
+++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/AxStateFacade.java
@@ -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
@@ -44,15 +47,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.
*
* @return the default task key
diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/AxTaskFacade.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/AxTaskFacade.java
index 5f39bcd56..8a310c616 100644
--- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/AxTaskFacade.java
+++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/AxTaskFacade.java
@@ -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);
@@ -51,15 +54,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.
*
* @return the task name
diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/StateFinalizerExecutionContext.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/StateFinalizerExecutionContext.java
index 6b2576d90..eb5f5f35d 100644
--- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/StateFinalizerExecutionContext.java
+++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/StateFinalizerExecutionContext.java
@@ -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;
- }
}
diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/java/classes/ClassUtils.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/java/classes/ClassUtils.java
index 03bedce81..e3a51f085 100644
--- a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/java/classes/ClassUtils.java
+++ b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/java/classes/ClassUtils.java
@@ -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);
@@ -59,13 +62,6 @@ public abstract class ClassUtils {
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
*
* @return a set of class names for all classes in the class path
diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/java/compile/singleclass/SingleClassLoader.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/java/compile/singleclass/SingleClassLoader.java
index 61293f5d9..55fa498fd 100644
--- a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/java/compile/singleclass/SingleClassLoader.java
+++ b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/java/compile/singleclass/SingleClassLoader.java
@@ -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.
@@ -20,23 +21,19 @@
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);
}
}
diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/MessageHolder.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/MessageHolder.java
index e5c5aaee5..abc5c90de 100644
--- a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/MessageHolder.java
+++ b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/MessageHolder.java
@@ -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;
/**
@@ -64,15 +70,6 @@ public class MessageHolder<M> implements Serializable {
}
/**
- * Return the messages in this message holder.
- *
- * @return the messages
- */
- public List<M> getMessages() {
- return messages;
- }
-
- /**
* Adds a message to this message holder.
*
* @param message the message to add
@@ -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;
- }
}
diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/RawMessageHandler.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/RawMessageHandler.java
index 0493eafb5..1bc100084 100644
--- a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/RawMessageHandler.java
+++ b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/RawMessageHandler.java
@@ -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) {
diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/messageblock/MessageBlock.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/messageblock/MessageBlock.java
index ba98fd748..75e82a0d2 100644
--- a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/messageblock/MessageBlock.java
+++ b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/messageblock/MessageBlock.java
@@ -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;
- }
-
}
diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/messageblock/MessageBlockHandler.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/messageblock/MessageBlockHandler.java
index 3134c67cf..0349cb548 100644
--- a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/messageblock/MessageBlockHandler.java
+++ b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/messageblock/MessageBlockHandler.java
@@ -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);
}
diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/messageblock/RawMessageBlock.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/messageblock/RawMessageBlock.java
index 7e8f09c5d..e9448abff 100644
--- a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/messageblock/RawMessageBlock.java
+++ b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/messageblock/RawMessageBlock.java
@@ -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;
- }
}
diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/util/MessagingUtils.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/util/MessagingUtils.java
index bda1f870c..ba84ca069 100644
--- a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/util/MessagingUtils.java
+++ b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/util/MessagingUtils.java
@@ -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;
@@ -52,13 +55,6 @@ public final class MessagingUtils {
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.
*
diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/threading/ApplicationThreadFactory.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/threading/ApplicationThreadFactory.java
index dc9c13d7b..dd8b8294f 100644
--- a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/threading/ApplicationThreadFactory.java
+++ b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/threading/ApplicationThreadFactory.java
@@ -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;
/**
@@ -101,38 +107,11 @@ 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 + "]";
}
}
diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/threading/ThreadUtilities.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/threading/ThreadUtilities.java
index eb4e0210b..58939d622 100644
--- a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/threading/ThreadUtilities.java
+++ b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/threading/ThreadUtilities.java
@@ -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.
@@ -20,21 +21,18 @@
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.
*
* @param milliseconds the milliseconds
diff --git a/core/core-infrastructure/src/test/java/org/onap/policy/apex/core/infrastructure/messaging/DummyMessageListener.java b/core/core-infrastructure/src/test/java/org/onap/policy/apex/core/infrastructure/messaging/DummyMessageListener.java
index d9bd93cd2..f81394c1c 100644
--- a/core/core-infrastructure/src/test/java/org/onap/policy/apex/core/infrastructure/messaging/DummyMessageListener.java
+++ b/core/core-infrastructure/src/test/java/org/onap/policy/apex/core/infrastructure/messaging/DummyMessageListener.java
@@ -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);
}
diff --git a/core/core-protocols/src/main/java/org/onap/policy/apex/core/protocols/Message.java b/core/core-protocols/src/main/java/org/onap/policy/apex/core/protocols/Message.java
index b79308e4a..005c181a0 100644
--- a/core/core-protocols/src/main/java/org/onap/policy/apex/core/protocols/Message.java
+++ b/core/core-protocols/src/main/java/org/onap/policy/apex/core/protocols/Message.java
@@ -22,6 +22,11 @@
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;
/**
@@ -74,24 +86,6 @@ public abstract class Message implements Serializable {
}
/**
- * 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.
*
* @param newMessageData 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;
- }
}
diff --git a/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/SupportMessageTester.java b/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/SupportMessageTester.java
index 1f8ccabb1..f275f4b79 100644
--- a/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/SupportMessageTester.java
+++ b/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/SupportMessageTester.java
@@ -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