import java.util.List;
import java.util.ListIterator;
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
/**
* This is common utility class with static methods for handling collections.
*
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
-public class CollectionUtils {
- /**
- * Private constructor used to prevent sub class instantiation.
- */
- private CollectionUtils() {
- }
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public final class CollectionUtils {
/**
* Compare two lists, checks for equality, then for equality on members.
* ============LICENSE_START=======================================================
* Copyright (C) 2016-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.
package org.onap.policy.apex.model.utilities;
import java.io.File;
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
import org.slf4j.ext.XLogger;
import org.slf4j.ext.XLoggerFactory;
*
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
-public abstract class DirectoryUtils {
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public final class DirectoryUtils {
// Get a reference to the logger
private static final XLogger LOGGER = XLoggerFactory.getXLogger(DirectoryUtils.class);
- /**
- * Private constructor used to prevent sub class instantiation.
- */
- private DirectoryUtils() {
- }
-
/**
* Method to get an empty temporary directory in the system temporary directory on the local machine that will be
* deleted on (normal) shutdown.
import java.util.List;
import java.util.Map.Entry;
import java.util.NavigableMap;
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
/**
* This class provides utility functions for tree maps. A function to find the nearest match in the tree map to an input
*
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
-public class TreeMapUtils {
-
- /**
- * This class is a utility class that can't be instantiated.
- */
- private TreeMapUtils() {
- // Private constructor to block subclassing
- }
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public final class TreeMapUtils {
/**
* Find the list of entries that matches a given word, for example "p" will match "put", "policy", and "push".
/*
* ============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.
* 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.model.utilities.comparison;
+import lombok.Getter;
+
/**
* This class is used to template key differences for bulk key comparisons in models. It performs a difference check
* between two keys.
* @author Liam Fallon (liam.fallon@ericsson.com)
* @param <K> the generic type
*/
+@Getter
public class KeyDifference<K> {
// The keys being compared
private K leftKey;
this.rightKey = rightKey;
}
- /**
- * Gets the left key.
- *
- * @return the left key
- */
- public K getLeftKey() {
- return leftKey;
- }
-
- /**
- * Gets the right key.
- *
- * @return the right key
- */
- public K getRightKey() {
- return rightKey;
- }
-
/**
* Checks if the left and right keys are equal.
*
/*
* ============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.
* 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=========================================================
*/
import java.util.Map;
import java.util.Map.Entry;
import java.util.TreeMap;
+import lombok.Getter;
/**
* This class holds the result of a difference check between two keyed maps. Four results are returned in the class. The
* @param <K> the generic type
* @param <V> the generic type
*/
+@Getter
public class KeyedMapDifference<K, V> {
private static final String KEY = "key=";
private static final String VALUE = ",value=";
private Map<K, V> identicalValues = new TreeMap<>();
private Map<K, List<V>> differentValues = new TreeMap<>();
- /**
- * Gets the entries that were found only in the left map.
- *
- * @return the entries only in the left map
- */
- public Map<K, V> getLeftOnly() {
- return leftOnly;
- }
-
- /**
- * Gets the entries that were found only in the right map.
- *
- * @return the entries only in the right map
- */
- public Map<K, V> getRightOnly() {
- return rightOnly;
- }
-
- /**
- * Gets the entries that were identical (keys and values the same) in both maps.
- *
- * @return the identical entries
- */
- public Map<K, V> getIdenticalValues() {
- return identicalValues;
- }
-
- /**
- * Gets the entries that had the same key but different values in both maps.
- *
- * @return the entries that were different. There are two values in the list of values for each entry. The first
- * value is the value that was in the left map and the second value is the value that was in the right map.
- */
- public Map<K, List<V>> getDifferentValues() {
- return differentValues;
- }
-
/**
* Return a string representation of the differences.
*
/**
* Output the entries in a map with entries that are in one side only as a string.
- *
+ *
* @param sideMap the map for the side being checked
* @param sideMapString the string that represents the map in output strings
* @param keysOnly if true, just add key information and not entries
/**
* Output the differences between two the maps as a string.
- *
+ *
* @param keysOnly if true, just add key information and not entries
* @return the differences as a string
*/
/**
* Output the identical entries in the maps as a string.
- *
+ *
* @param keysOnly if true, just add key information and not entries
* @return the identical entries as a string
*/
/*-
* ============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.
* 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=========================================================
*/
* @param <P> the generic type
*/
public class JsonHandler<P> {
+ private static final Gson GSON = new GsonBuilder().serializeNulls().create();
/**
* This method reads objects of a given class from an input stream.
* @return the object read
*/
public P read(final Class<P> inputClass, final InputStream inputStream) {
- // Register the adapters for our carrier technologies and event protocols with GSON
- final GsonBuilder gsonBuilder = new GsonBuilder();
-
- final Gson gson = gsonBuilder.serializeNulls().create();
final Reader jsonResourceReader = new InputStreamReader(inputStream);
- return gson.fromJson(jsonResourceReader, inputClass);
+ return GSON.fromJson(jsonResourceReader, inputClass);
}
}
/*-
* ============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.
import java.util.concurrent.atomic.AtomicLong;
import lombok.EqualsAndHashCode;
import lombok.Getter;
+import lombok.Setter;
import lombok.ToString;
import org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey;
import org.slf4j.Logger;
// An identifier for the current event execution. The default value here will always be unique
// in a single JVM
+ @Setter
private long executionId = ApexEvent.getNextExecutionId();
// Event related properties used during processing of this event
+ @Setter
private Properties executionProperties = new Properties();
// A string holding a message that indicates why processing of this event threw an exception
+ @Setter
private String exceptionMessage;
/**
}
}
- /**
- * Sets the pass-thru executionID for this event.
- *
- * <p>The default value for executionID is unique in the current JVM. For some applications/deployments this
- * executionID may need to be globally unique
- *
- * @param executionId the executionID
- */
- public void setExecutionId(final long executionId) {
- this.executionId = executionId;
- }
-
- /**
- * Set the execution properties for this event.
- *
- * @param executionProperties the execution properties to set
- */
- public void setExecutionProperties(Properties executionProperties) {
- this.executionProperties = executionProperties;
- }
-
- /**
- * Sets the exception message explaining why processing of this event to fail.
- *
- * @param exceptionMessage the exception message
- */
- public void setExceptionMessage(final String exceptionMessage) {
- this.exceptionMessage = exceptionMessage;
- }
-
/*
* Map overrides from here
*/
/*-
* ============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.
import java.util.EnumMap;
import java.util.Map;
+import lombok.Getter;
import org.onap.policy.apex.core.infrastructure.threading.ApplicationThreadFactory;
import org.onap.policy.apex.service.parameters.eventhandler.EventHandlerPeeredMode;
public abstract class ApexPluginsEventConsumer implements ApexEventConsumer, Runnable {
// The name for this consumer
+ @Getter
protected String name = null;
// The peer references for this event handler
consumerThread.start();
}
- /**
- * {@inheritDoc}.
- */
- @Override
- public String getName() {
- return name;
- }
-
/**
* {@inheritDoc}.
*/
/*-
* ============LICENSE_START=======================================================
* 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.
import java.util.EnumMap;
import java.util.Map;
import java.util.Properties;
+import lombok.Getter;
import org.onap.policy.apex.service.parameters.eventhandler.EventHandlerPeeredMode;
public abstract class ApexPluginsEventProducer implements ApexEventProducer {
// The name for this producer
+ @Getter
protected String name = null;
// The peer references for this event handler
protected Map<EventHandlerPeeredMode, PeeredReference> peerReferenceMap =
new EnumMap<>(EventHandlerPeeredMode.class);
- /**
- * {@inheritDoc}.
- */
- @Override
- public String getName() {
- return name;
- }
-
/**
* {@inheritDoc}.
*/
/*-
* ============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.
* 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.service.engine.event;
+import lombok.Getter;
import org.onap.policy.apex.service.parameters.eventhandler.EventHandlerPeeredMode;
/**
* This class holds a reference to an event consumer and producer that have been peered.
- *
+ *
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
+@Getter
public class PeeredReference {
// The consumer putting events into APEX
private final ApexEventConsumer peeredConsumer;
/**
* Create a peered consumer/producer reference.
- *
+ *
* @param peeredMode the peered mode for which to return the reference
* @param consumer the consumer that is receiving event
* @param producer the producer that is sending events
peeredConsumer.setPeeredReference(peeredMode, this);
peeredProducer.setPeeredReference(peeredMode, this);
}
-
- /**
- * Gets the synchronous consumer putting events into the cache.
- *
- * @return the source synchronous consumer
- */
- public ApexEventConsumer getPeeredConsumer() {
- return peeredConsumer;
- }
-
- /**
- * Gets the synchronous producer taking events from the cache.
- *
- * @return the synchronous producer that is taking events from the cache
- */
- public ApexEventProducer getPeeredProducer() {
- return peeredProducer;
- }
}
* ============LICENSE_START=======================================================
* Copyright (C) 2016-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.
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
+import lombok.Getter;
import org.onap.policy.apex.core.infrastructure.threading.ThreadUtilities;
import org.onap.policy.apex.service.parameters.eventhandler.EventHandlerPeeredMode;
import org.slf4j.ext.XLogger;
private static final long CACHE_STOP_WAIT_INTERVAL = 10;
// The time in milliseconds to wait for the reply to a sent synchronous event
+ @Getter
private long synchronousEventTimeout = DEFAULT_SYNCHRONOUS_EVENT_TIMEOUT;
// Map holding outstanding synchronous events
synchronousEventCacheThread.start();
}
- /**
- * Gets the timeout value for synchronous events.
- *
- * @return the synchronous event timeout
- */
- public long getSynchronousEventTimeout() {
- return synchronousEventTimeout;
- }
-
/**
* Cache a synchronized event sent into Apex in the event cache.
*
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2021 Bell Canada. All rights reserved.
* Modifications Copyright (C) 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.
import java.util.ArrayList;
import java.util.List;
+import lombok.AllArgsConstructor;
import org.onap.policy.apex.core.engine.engine.ApexEngine;
import org.onap.policy.apex.core.engine.event.EnEvent;
import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
*
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
+@AllArgsConstructor
public final class ApexEvent2EnEventConverter implements ApexEventConverter {
// The Apex engine with its event definitions
private final ApexEngine apexEngine;
- /**
- * Set up the event converter.
- *
- * @param apexEngine The engine to use to create events to be converted
- */
- public ApexEvent2EnEventConverter(final ApexEngine apexEngine) {
- this.apexEngine = apexEngine;
- }
-
/**
* {@inheritDoc}.
*/
/*-
* ============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.
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.TimeUnit;
+import lombok.Getter;
import org.onap.policy.apex.core.infrastructure.threading.ApplicationThreadFactory;
import org.onap.policy.apex.core.infrastructure.threading.ThreadUtilities;
import org.onap.policy.apex.service.engine.event.ApexEventConsumer;
private ApexEventReceiver eventReceiver;
// The name for this consumer
+ @Getter
private String name = null;
// The peer references for this event handler
private boolean stopOrderedFlag = false;
// The number of events received to date
+ @Getter
private int eventsReceived = 0;
@Override
consumerThread.start();
}
- /**
- * {@inheritDoc}.
- */
- @Override
- public String getName() {
- return name;
- }
-
- /**
- * Get the number of events received to date.
- *
- * @return the number of events received
- */
- public int getEventsReceived() {
- return eventsReceived;
- }
-
/**
* {@inheritDoc}.
*/
* ============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.
import java.util.EnumMap;
import java.util.Map;
import java.util.Properties;
+import lombok.Getter;
import org.onap.policy.apex.service.engine.event.ApexEventConsumer;
import org.onap.policy.apex.service.engine.event.ApexEventException;
import org.onap.policy.apex.service.engine.event.ApexEventProducer;
private static final Logger LOGGER = LoggerFactory.getLogger(EventRequestorProducer.class);
// The name for this producer
+ @Getter
private String name = null;
// The peer references for this event handler
new EnumMap<>(EventHandlerPeeredMode.class);
// The number of events sent
+ @Getter
private int eventsSent = 0;
/**
}
}
- /**
- * {@inheritDoc}.
- */
- @Override
- public String getName() {
- return name;
- }
-
- /**
- * Get the number of events sent to date.
- *
- * @return the number of events received
- */
- public int getEventsSent() {
- return eventsSent;
- }
-
/**
* {@inheritDoc}.
*/
import java.io.File;
import lombok.Getter;
import lombok.Setter;
+import lombok.ToString;
import org.onap.policy.apex.service.engine.event.impl.filecarrierplugin.consumer.ApexFileEventConsumer;
import org.onap.policy.apex.service.engine.event.impl.filecarrierplugin.producer.ApexFileEventProducer;
import org.onap.policy.apex.service.parameters.carriertechnology.CarrierTechnologyParameters;
*/
@Getter
@Setter
+@ToString
public class FileCarrierTechnologyParameters extends CarrierTechnologyParameters {
// @formatter:off
/** The label of this carrier technology. */
this.setEventConsumerPluginClass(FILE_EVENT_CONSUMER_PLUGIN_CLASS);
}
- /**
- * {@inheritDoc}.
- */
- @Override
- public String toString() {
- return "FILECarrierTechnologyParameters [fileName=" + fileName + ", standardIO=" + standardIo
- + ", standardError=" + standardError + ", streamingMode=" + streamingMode + ", startDelay="
- + startDelay + "]";
- }
-
/**
* {@inheritDoc}.
*/
* ============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.
private final boolean delimiterAtStart;
private boolean blockEndTokenUsed;
- // The thread used to read the text from the stream
- private Thread textConsumputionThread;
-
// The input stream for text
private InputStream inputStream;
this.inputStream = incomingInputStream;
// Configure and start the text reading thread
- textConsumputionThread = new ApplicationThreadFactory(this.getClass().getName()).newThread(this);
+ Thread textConsumputionThread = new ApplicationThreadFactory(this.getClass().getName()).newThread(this);
textConsumputionThread.setDaemon(true);
textConsumputionThread.start();
}
/*-
* ============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.
* 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.service.engine.event.impl.filecarrierplugin.consumer;
+import lombok.Getter;
+import lombok.Setter;
+
/**
* This class is a bean that holds a block of text read from an incoming text file.
*
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
+@Getter
+@Setter
public class TextBlock {
private boolean endOfText = false;
private String text;
this.endOfText = endOfText;
this.text = text;
}
-
- /**
- * Checks if is end of text.
- *
- * @return true, if checks if is end of text
- */
- public boolean isEndOfText() {
- return endOfText;
- }
-
- /**
- * Sets whether end of text has been reached.
- *
- * @param endOfText the end of text flag value
- */
- public void setEndOfText(final boolean endOfText) {
- this.endOfText = endOfText;
- }
-
- /**
- * Gets the text of the text block.
- *
- * @return the text of the text block
- */
- public String getText() {
- return text;
- }
-
- /**
- * Sets the text of the text block.
- *
- * @param text the text of the text block
- */
- public void setText(final String text) {
- this.text = text;
- }
}
/*-
* ============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.
* 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.service.engine.event.impl.jsonprotocolplugin;
+import lombok.Getter;
+import lombok.Setter;
import org.onap.policy.apex.service.parameters.eventprotocol.EventProtocolTextCharDelimitedParameters;
// @formatter:off
* definition in this field name in the schema, there must be one and only one field in the
* event definition, the event has a single parameter whose type is the Pojo. This parameter is optional.
* </ol>
- *
+ *
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
//@formatter:on
+@Getter
+@Setter
public class JsonEventProtocolParameters extends EventProtocolTextCharDelimitedParameters {
/** The label of this event protocol. */
public static final String JSON_EVENT_PROTOCOL_LABEL = "JSON";
public String getName() {
return this.getLabel();
}
-
- /**
- * Gets the name alias.
- *
- * @return the name alias
- */
- public String getNameAlias() {
- return nameAlias;
- }
-
- /**
- * Gets the version alias.
- *
- * @return the version alias
- */
- public String getVersionAlias() {
- return versionAlias;
- }
-
- /**
- * Gets the name space alias.
- *
- * @return the name space alias
- */
- public String getNameSpaceAlias() {
- return nameSpaceAlias;
- }
-
- /**
- * Gets the source alias.
- *
- * @return the source alias
- */
- public String getSourceAlias() {
- return sourceAlias;
- }
-
- /**
- * Gets the target alias.
- *
- * @return the target alias
- */
- public String getTargetAlias() {
- return targetAlias;
- }
-
- /**
- * Return the name of the POJO field to use for POJO decoding and encoding.
- *
- * @return the name of the POJO field
- */
- public String getPojoField() {
- return pojoField;
- }
-
- /**
- * Sets the name alias.
- *
- * @param nameAlias the new name alias
- */
- public void setNameAlias(String nameAlias) {
- this.nameAlias = nameAlias;
- }
-
- /**
- * Sets the version alias.
- *
- * @param versionAlias the new version alias
- */
- public void setVersionAlias(String versionAlias) {
- this.versionAlias = versionAlias;
- }
-
- /**
- * Sets the name space alias.
- *
- * @param nameSpaceAlias the new name space alias
- */
- public void setNameSpaceAlias(String nameSpaceAlias) {
- this.nameSpaceAlias = nameSpaceAlias;
- }
-
- /**
- * Sets the source alias.
- *
- * @param sourceAlias the new source alias
- */
- public void setSourceAlias(String sourceAlias) {
- this.sourceAlias = sourceAlias;
- }
-
- /**
- * Sets the target alias.
- *
- * @param targetAlias the new target alias
- */
- public void setTargetAlias(String targetAlias) {
- this.targetAlias = targetAlias;
- }
-
- /**
- * Sets the POJO field that name for POJO decoding and encoding.
- *
- * @param pojoField The name of the POJO field to use on the event
- */
- public void setPojoField(final String pojoField) {
- this.pojoField = pojoField;
- }
}
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 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.
package org.onap.policy.apex.service.engine.main;
+import lombok.AllArgsConstructor;
import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
import org.onap.policy.apex.service.engine.event.ApexEvent;
import org.onap.policy.apex.service.engine.runtime.EngineService;
* service and the EngDep service for that engine. It also acts as an event
* receiver for asynchronous and synchronous events.
*/
+@AllArgsConstructor
public class ApexEngineServiceHandler {
// The logger for this class
private static final XLogger LOGGER = XLoggerFactory.getXLogger(ApexEngineServiceHandler.class);
// The Apex engine service, the Apex engine itself
private final EngineService apexEngineService;
- /**
- * Instantiates a new engine holder with its engine service and EngDep service.
- *
- * @param apexEngineService the apex engine service
- */
- ApexEngineServiceHandler(final EngineService apexEngineService) {
- this.apexEngineService = apexEngineService;
- }
-
/**
* This method forwards an event to the Apex service.
*
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 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.
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.TimeUnit;
+import lombok.Getter;
import org.onap.policy.apex.core.infrastructure.threading.ApplicationThreadFactory;
import org.onap.policy.apex.core.infrastructure.threading.ThreadUtilities;
import org.onap.policy.apex.service.engine.event.ApexEvent;
private static final long EVENT_QUEUE_POLL_INTERVAL = 20;
// The name of the marshaler
+ @Getter
private final String name;
// The engine service and producer parameters
// Apex event producer and event converter, all conversions are to and from string
// representation of events
+ @Getter
private ApexEventProducer producer;
+ @Getter
private ApexEventProtocolConverter converter;
// Temporary event holder for events coming out of Apex
marshallerThread.start();
}
- /**
- * Gets the name of the marshaler.
- *
- * @return the marshaler name
- */
- public String getName() {
- return name;
- }
-
- /**
- * Gets the technology specific producer for this marshaler.
- *
- * @return the producer
- */
- public ApexEventProducer getProducer() {
- return producer;
- }
-
- /**
- * Gets the event protocol converter for this marshaler.
- *
- * @return the event protocol converter
- */
- public ApexEventProtocolConverter getConverter() {
- return converter;
- }
-
/**
* Callback method called on implementations of this interface when Apex emits an event.
*
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2019-2021 Nordix Foundation.
* Modifications Copyright (C) 2020-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.
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.TimeUnit;
+import lombok.Getter;
import lombok.NonNull;
import org.onap.policy.apex.core.infrastructure.threading.ApplicationThreadFactory;
import org.onap.policy.apex.core.infrastructure.threading.ThreadUtilities;
private static final long EVENT_QUEUE_POLL_INTERVAL = 20;
// The name of the unmarshaler
+ @Getter
private final String name;
// The engine service and consumer parameters
private ApexEngineServiceHandler engineServiceHandler;
// Apex event producer and event converter, all events are sent as string representations
+ @Getter
private ApexEventConsumer consumer;
+ @Getter
private ApexEventProtocolConverter converter;
// Temporary event holder for events going into Apex
unmarshallerThread.start();
}
- /**
- * Gets the name of the unmarshaler.
- *
- * @return the unmarshaler name
- */
- public String getName() {
- return name;
- }
-
- /**
- * Gets the technology specific consumer for this unmarshaler.
- *
- * @return the consumer
- */
- public ApexEventConsumer getConsumer() {
- return consumer;
- }
-
- /**
- * Gets the event protocol converter for this unmarshaler.
- *
- * @return the event protocol converter
- */
- public ApexEventProtocolConverter getConverter() {
- return converter;
- }
-
/**
* Connect a synchronous unmarshaler with a synchronous marshaler.
*
/*-
* ============LICENSE_START=======================================================
* 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.
package org.onap.policy.apex.service.engine.main;
import java.util.concurrent.atomic.AtomicLong;
+import lombok.NoArgsConstructor;
import org.onap.policy.common.utils.services.Registry;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+@NoArgsConstructor
public class ApexPolicyStatisticsManager {
private static final Logger LOGGER = LoggerFactory.getLogger(ApexPolicyStatisticsManager.class);
public static final String REG_APEX_PDP_POLICY_COUNTER = "object:pdp/statistics/policy/counter";
private final AtomicLong policyExecutedSuccessCount = new AtomicLong(0);
private final AtomicLong policyExecutedFailCount = new AtomicLong(0);
- /**
- * Constructs the object.
- */
- public ApexPolicyStatisticsManager() {
- super();
- }
-
/**
* To get the ApexPolicyStatisticsManager in Registry.
*
/*-
* ============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.
* 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.service.engine.runtime.impl;
+import lombok.AllArgsConstructor;
import org.onap.policy.apex.core.engine.engine.EnEventListener;
import org.onap.policy.apex.core.engine.event.EnEvent;
import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
*
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
+@AllArgsConstructor
public final class EnEventListenerImpl implements EnEventListener {
// Listener for ApexEvents
- private ApexEventListener apexEventListener = null;
+ private final ApexEventListener apexEventListener;
// Converter for Engine events to Apex Events
- private ApexEvent2EnEventConverter apexEnEventConverter = null;
-
- /**
- * Instantiates a new listener implementation.
- *
- * @param apexEventListener the apex event listener
- * @param apexEnEventConverter the ApexEvent to enEvent converter
- */
- public EnEventListenerImpl(final ApexEventListener apexEventListener,
- final ApexEvent2EnEventConverter apexEnEventConverter) {
- this.apexEventListener = apexEventListener;
- this.apexEnEventConverter = apexEnEventConverter;
- }
+ private final ApexEvent2EnEventConverter apexEnEventConverter;
/**
* {@inheritDoc}.
public void startPeriodicEvents(final long period) throws ApexException {
// Check if periodic events are already started
if (periodicEventGenerator != null) {
- String message = "Peiodic event geneation already running on engine " + engineServiceKey.getId() + ", "
+ String message = "Periodic event geneation already running on engine " + engineServiceKey.getId() + ", "
+ periodicEventGenerator.toString();
LOGGER.warn(message);
throw new ApexException(message);
public void stopPeriodicEvents() throws ApexException {
// Check if periodic events are already started
if (periodicEventGenerator == null) {
- LOGGER.warn("Peiodic event geneation not running on engine " + engineServiceKey.getId());
- throw new ApexException("Peiodic event geneation not running on engine " + engineServiceKey.getId());
+ LOGGER.warn("Periodic event geneation not running on engine " + engineServiceKey.getId());
+ throw new ApexException("Periodic event geneation not running on engine " + engineServiceKey.getId());
}
// Stop periodic events
/*-
* ============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.service.parameters;
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
+
/**
* This class holds constants used when managing parameter groups in apex.
*/
-public abstract class ApexParameterConstants {
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public final class ApexParameterConstants {
public static final String MAIN_GROUP_NAME = "APEX_PARAMETERS";
public static final String ENGINE_SERVICE_GROUP_NAME = "ENGINE_SERVICE_PARAMETERS";
public static final String EVENT_HANDLER_GROUP_NAME = "EVENT_HANDLER_PARAMETERS";
-
- /**
- * Private default constructor to prevent subclassing.
- */
- private ApexParameterConstants() {
- // Prevents subclassing
- }
-
}
package org.onap.policy.apex.service.parameters.carriertechnology;
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
import org.onap.policy.common.parameters.ParameterGroupImpl;
import org.onap.policy.common.parameters.ParameterRuntimeException;
import org.onap.policy.common.parameters.annotations.ClassName;
*/
@NotNull
@NotBlank
+@NoArgsConstructor(access = AccessLevel.PROTECTED)
public abstract class CarrierTechnologyParameters extends ParameterGroupImpl {
// The carrier technology label
private @ClassName String eventProducerPluginClass = null;
private @ClassName String eventConsumerPluginClass = null;
- /**
- * Constructor to create a carrier technology parameters instance with the name of a sub class of this class and
- * register the instance with the parameter service.
- */
- protected CarrierTechnologyParameters() {
- super();
- }
-
/**
* Gets the label of the carrier technology.
*
import javax.ws.rs.core.MultivaluedHashMap;
import javax.ws.rs.core.MultivaluedMap;
import lombok.Getter;
+import lombok.NoArgsConstructor;
import lombok.Setter;
import org.apache.commons.lang3.StringUtils;
import org.onap.policy.common.parameters.BeanValidationResult;
//@formatter:on
@Setter
@Getter
+@NoArgsConstructor
public class RestPluginCarrierTechnologyParameters extends CarrierTechnologyParameters {
// Get a reference to the logger
private static final Logger LOGGER = LoggerFactory.getLogger(RestPluginCarrierTechnologyParameters.class);
protected String[][] httpHeaders = null;
protected String httpCodeFilter = DEFAULT_HTTP_CODE_FILTER;
- /**
- * Constructor to create a REST carrier technology parameters instance and
- * register the instance with the parameter service.
- */
- public RestPluginCarrierTechnologyParameters() {
- super();
- }
-
/**
* Check if http headers have been set for the REST request.
*
import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
import org.onap.policy.apex.service.parameters.ApexParameterConstants;
import org.onap.policy.apex.service.parameters.carriertechnology.CarrierTechnologyParameters;
import org.onap.policy.apex.service.parameters.eventprotocol.EventProtocolParameters;
*
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
+@Getter
+@ToString
public class EventHandlerParameters implements ParameterGroup {
// Get a reference to the logger
private static final Logger LOGGER = LoggerFactory.getLogger(EventHandlerParameters.class);
+ @Setter
private String name = null;
+ @Setter
private @NotNull @Valid CarrierTechnologyParameters carrierTechnologyParameters = null;
+ @Setter
private @NotNull @Valid EventProtocolParameters eventProtocolParameters = null;
private boolean synchronousMode = false;
private String synchronousPeer = null;
private boolean requestorMode = false;
private String requestorPeer = null;
private long requestorTimeout = 0;
+ @Setter
private String eventName = null;
+ @Setter
private String eventNameFilter = null;
/**
this.name = ApexParameterConstants.EVENT_HANDLER_GROUP_NAME;
}
- /**
- * Gets the name of the event handler.
- *
- * @return the event handler name
- */
- public String getName() {
- return name;
- }
-
- /**
- * Sets the name of the event handler.
- *
- * @param name the event handler name
- */
- public void setName(final String name) {
- this.name = name;
- }
-
/**
* Checks if the name of the event handler is set.
*
return !(name == null || name.trim().length() == 0);
}
- /**
- * Gets the carrier technology parameters of the event handler.
- *
- * @return the carrierTechnologyParameters of the event handler
- */
- public CarrierTechnologyParameters getCarrierTechnologyParameters() {
- return carrierTechnologyParameters;
- }
-
- /**
- * Sets the carrier technology parameters of the event handler.
- *
- * @param carrierTechnologyParameters the carrierTechnologyParameters to set
- */
- public void setCarrierTechnologyParameters(final CarrierTechnologyParameters carrierTechnologyParameters) {
- this.carrierTechnologyParameters = carrierTechnologyParameters;
- }
-
- /**
- * Gets the event protocol parameters of the event handler.
- *
- * @return the eventProtocolParameters
- */
- public EventProtocolParameters getEventProtocolParameters() {
- return eventProtocolParameters;
- }
-
- /**
- * Sets the event protocol parameters.
- *
- * @param eventProtocolParameters the eventProtocolParameters to set
- */
- public void setEventProtocolParameters(final EventProtocolParameters eventProtocolParameters) {
- this.eventProtocolParameters = eventProtocolParameters;
- }
-
/**
* Checks if the event handler is in the given peered mode.
*
return eventName != null;
}
- /**
- * Gets the event name for this event handler.
- *
- * @return the event name
- */
- public String getEventName() {
- return eventName;
- }
-
- /**
- * Sets the event name for this event handler.
- *
- * @param eventName the event name
- */
- public void setEventName(final String eventName) {
- this.eventName = eventName;
- }
-
/**
* Check if event name filtering is being used.
*
return eventNameFilter != null;
}
- /**
- * Gets the event name filter for this event handler.
- *
- * @return the event name filter
- */
- public String getEventNameFilter() {
- return eventNameFilter;
- }
-
- /**
- * Sets the event name filter for this event handler.
- *
- * @param eventNameFilter the event name filter
- */
- public void setEventNameFilter(final String eventNameFilter) {
- this.eventNameFilter = eventNameFilter;
- }
-
/**
* {@inheritDoc}.
*/
return result;
}
-
- /**
- * Check if we're using synchronous mode.
- *
- * @return true if if we're using synchronous mode
- */
- public boolean isSynchronousMode() {
- return synchronousMode;
- }
-
- /**
- * The synchronous peer for this event handler.
- *
- * @return the synchronous peer for this event handler
- */
- public String getSynchronousPeer() {
- return synchronousPeer;
- }
-
- /**
- * Get the timeout for synchronous operations.
- *
- * @return the timeout for synchronous operations
- */
- public long getSynchronousTimeout() {
- return synchronousTimeout;
- }
-
- /**
- * Check if this event handler will use requestor mode.
- *
- * @return true if this event handler will use requestor mode
- */
- public boolean isRequestorMode() {
- return requestorMode;
- }
-
- /**
- * The requestor peer for this event handler.
- *
- * @return the requestor peer for this event handler
- */
- public String getRequestorPeer() {
- return requestorPeer;
- }
-
- /**
- * Get the requestor timeout.
- *
- * @return the requestorTimeout.
- */
- public long getRequestorTimeout() {
- return requestorTimeout;
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- public String toString() {
- return "EventHandlerParameters [name=" + name + ", carrierTechnologyParameters=" + carrierTechnologyParameters
- + ", eventProtocolParameters=" + eventProtocolParameters + ", synchronousMode="
- + synchronousMode + ", synchronousPeer=" + synchronousPeer + ", synchronousTimeout="
- + synchronousTimeout + ", requestorMode=" + requestorMode + ", requestorPeer=" + requestorPeer
- + ", requestorTimeout=" + requestorTimeout + ", eventName=" + eventName + ", eventNameFilter="
- + eventNameFilter + "]";
- }
}
package org.onap.policy.apex.service.parameters.eventprotocol;
+import lombok.AccessLevel;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.ToString;
import org.onap.policy.common.parameters.ParameterGroupImpl;
import org.onap.policy.common.parameters.ParameterRuntimeException;
import org.onap.policy.common.parameters.annotations.ClassName;
*/
@NotNull
@NotBlank
+@Getter
+@ToString
+@NoArgsConstructor(access = AccessLevel.PROTECTED)
public abstract class EventProtocolParameters extends ParameterGroupImpl {
// The event protocol label
private String label = null;
// Event protocol converter plugin class for this event protocol
private @ClassName String eventProtocolPluginClass;
- /**
- * Constructor to create an event protocol parameters instance with the name of a sub class of this class and
- * register the instance with the parameter service.
- */
- protected EventProtocolParameters() {
- super();
- }
-
- /**
- * Gets the label of the event protocol.
- *
- * @return the label of the event protocol
- */
- public String getLabel() {
- return label;
- }
-
/**
* Sets the label of the event protocol.
*
this.label = label.replaceAll("\\s+", "");
}
- /**
- * Gets the event event protocol plugin class.
- *
- * @return the event event protocol plugin class
- */
- public String getEventProtocolPluginClass() {
- return eventProtocolPluginClass;
- }
-
/**
* Sets the event event protocol plugin class.
*
this.eventProtocolPluginClass = eventProtocolPluginClass.replaceAll("\\s+", "");
}
- /**
- * {@inheritDoc}.
- */
- @Override
- public String toString() {
- return "CarrierTechnologyParameters [label=" + label + ", EventProtocolPluginClass=" + eventProtocolPluginClass
- + "]";
- }
-
@Override
public String getName() {
return this.getLabel();
package org.onap.policy.apex.service.parameters.eventprotocol;
+import lombok.AccessLevel;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+import lombok.ToString;
import org.onap.policy.common.parameters.BeanValidationResult;
import org.onap.policy.common.parameters.ValidationStatus;
*
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
+@Getter
+@Setter
+@ToString(callSuper = true)
+@NoArgsConstructor(access = AccessLevel.PROTECTED)
public abstract class EventProtocolTextCharDelimitedParameters extends EventProtocolParameters {
// The starting and ending character delimiter
private char startChar = '\0';
private char endChar = '\0';
- /**
- * Constructor to create an event protocol parameters instance with the name of a sub class of this class.
- */
- protected EventProtocolTextCharDelimitedParameters() {
- super();
- }
-
- /**
- * Gets the start character that delimits the start of text blocks.
- *
- * @return the start char
- */
- public char getStartChar() {
- return startChar;
- }
-
- /**
- * Sets the start character that delimits the start of text blocks.
- *
- * @param startChar the start character
- */
- public void setStartChar(final char startChar) {
- this.startChar = startChar;
- }
-
- /**
- * Gets the end character that delimits the end of text blocks.
- *
- * @return the end character
- */
- public char getEndChar() {
- return endChar;
- }
-
- /**
- * Sets the end character that delimits the end of text blocks.
- *
- * @param endChar the end character
- */
- public void setEndChar(final char endChar) {
- this.endChar = endChar;
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- public String toString() {
- return "EventProtocolTextCharDelimitedParameters {" + super.toString() + "} [startChar=" + startChar
- + ", endChar=" + endChar + "]";
- }
-
/**
* {@inheritDoc}.
*/
package org.onap.policy.apex.service.parameters.eventprotocol;
+import lombok.AccessLevel;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+import lombok.ToString;
import org.onap.policy.common.parameters.annotations.NotBlank;
import org.onap.policy.common.parameters.annotations.NotNull;
*
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
+@Getter
+@Setter
+@ToString
+@NoArgsConstructor(access = AccessLevel.PROTECTED)
public abstract class EventProtocolTextTokenDelimitedParameters extends EventProtocolParameters {
// The delimiter token for text blocks
private @NotNull @NotBlank String startDelimiterToken = null;
private String endDelimiterToken = null;
private boolean delimiterAtStart = true;
-
- /**
- * Constructor to create an event protocol parameters instance with the name of a sub class of this class.
- */
- protected EventProtocolTextTokenDelimitedParameters() {
- super();
- }
-
- /**
- * Gets the start delimiter token that delimits events in the text.
- *
- * @return the start delimiter token
- */
- public String getStartDelimiterToken() {
- return startDelimiterToken;
- }
-
- /**
- * Sets the start delimiter token that delimits events in the text.
- *
- * @param startDelimiterToken
- * delimiterToken the delimiter token
- */
- public void setStartDelimiterToken(final String startDelimiterToken) {
- this.startDelimiterToken = startDelimiterToken;
- }
-
- /**
- * Gets the end delimiter token that delimits events in the text.
- *
- * @return the end delimiter token
- */
- public String getEndDelimiterToken() {
- return endDelimiterToken;
- }
-
- /**
- * Sets the end delimiter token that delimits events in the text.
- *
- * @param endDelimiterToken
- * delimiterToken the delimiter token
- */
- public void setEndDelimiterToken(final String endDelimiterToken) {
- this.endDelimiterToken = endDelimiterToken;
- }
-
- /**
- * Check if there must be a delimiter at the start of the first text block.
- *
- * @return true if there must be a delimiter at the start of the text block
- */
- public boolean isDelimiterAtStart() {
- return delimiterAtStart;
- }
-
- /**
- * Sets if there has to be a delimiter at the start of the first text block.
- *
- * @param delimiterAtStart
- * true if there must be a delimiter at the start of the text block
- */
- public void setDelimiterAtStart(boolean delimiterAtStart) {
- this.delimiterAtStart = delimiterAtStart;
- }
-
- @Override
- public String toString() {
- return "EventProtocolTextTokenDelimitedParameters [startDelimiterToken=" + startDelimiterToken
- + ", endDelimiterToken=" + endDelimiterToken + ", delimiterAtStart=" + delimiterAtStart + "]";
- }
}
/*
* ============LICENSE_START=======================================================
* Copyright (C) 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.
public void run() throws ApexEventException {
final EngineServiceEventInterface engineServiceEventInterface = Mockito.mock(EngineServiceEventInterface.class);
- final int period = random.nextInt(200);
+ // don't want the timer to fire, so make it wait at least two seconds
+ final int period = random.nextInt(2000) + 2000;
final ApexPeriodicEventGenerator generator = new ApexPeriodicEventGenerator(engineServiceEventInterface,
period);
* Copyright (C) 2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2020-2021 Nordix Foundation.
* Modifications Copyright (C) 2020 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.
esImpl.startPeriodicEvents(100000);
assertThatThrownBy(() -> esImpl.startPeriodicEvents(100000)).isInstanceOf(ApexException.class)
- .hasMessage("Peiodic event geneation already running on engine Engine:0.0.1, ApexPeriodicEventGenerator "
+ .hasMessage("Periodic event geneation already running on engine Engine:0.0.1, ApexPeriodicEventGenerator "
+ "[period=100000, firstEventTime=0, lastEventTime=0, eventCount=0]");
esImpl.stopPeriodicEvents();
assertThatThrownBy(() -> esImpl.stopPeriodicEvents()).isInstanceOf(ApexException.class)
- .hasMessage("Peiodic event geneation not running on engine Engine:0.0.1");
+ .hasMessage("Periodic event geneation not running on engine Engine:0.0.1");
assertThatThrownBy(() -> esImpl.clear(null)).isInstanceOf(ApexException.class)
.hasMessage("engine key must be specified and may not be null");
esImpl.startPeriodicEvents(100000);
fail("test should throw an exception");
} catch (ApexException apEx) {
- assertEquals("Peiodic event geneation already running on engine Engine:0.0.1, ApexPeriodicEventGenerator "
+ assertEquals("Periodic event geneation already running on engine Engine:0.0.1, ApexPeriodicEventGenerator "
+ "[period=100000, firstEventTime=0, lastEventTime=0, eventCount=0]", apEx.getMessage());
}
esImpl.stopPeriodicEvents();
fail("test should throw an exception");
} catch (ApexException apEx) {
- assertEquals("Peiodic event geneation not running on engine Engine:0.0.1", apEx.getMessage());
+ assertEquals("Periodic event geneation not running on engine Engine:0.0.1", apEx.getMessage());
}
try {
public class ApexStarterActivator {
private static final Logger LOGGER = LoggerFactory.getLogger(ApexStarterActivator.class);
- private final ApexStarterParameterGroup apexStarterParameterGroup;
+ @Getter
+ private final ApexStarterParameterGroup parameterGroup;
private List<TopicSink> topicSinks; // topics to which apex-pdp sends pdp status
private List<TopicSource> topicSources; // topics to which apex-pdp listens to for messages from pap.
private static final String[] MSG_TYPE_NAMES = { "messageName" };
instanceId = NetworkUtil.genUniqueName("apex");
LOGGER.debug("ApexStarterActivator initializing with instance id: {}", instanceId);
try {
- this.apexStarterParameterGroup = apexStarterParameterGroup;
+ this.parameterGroup = apexStarterParameterGroup;
this.msgDispatcher = new MessageTypeDispatcher(MSG_TYPE_NAMES);
} catch (final RuntimeException e) {
throw new ApexStarterRunTimeException(e);
}
}
- /**
- * Get the parameters used by the activator.
- *
- * @return apexStarterParameterGroup the parameters of the activator
- */
- public ApexStarterParameterGroup getParameterGroup() {
- return apexStarterParameterGroup;
- }
-
/**
* Registers the dispatcher with the topic source(s).
*/
/*-
* ============LICENSE_START=======================================================
* 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.
package org.onap.policy.apex.services.onappf;
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
+
/**
* Names of various items contained in the Registry.
*/
-public class ApexStarterConstants {
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public final class ApexStarterConstants {
// Registry keys
public static final String REG_APEX_STARTER_ACTIVATOR = "object:activator/apex_starter";
public static final String REG_PDP_STATUS_OBJECT = "object:pdp/status";
public static final String REG_PDP_STATUS_PUBLISHER = "object:pdp/status/publisher";
public static final String REG_APEX_PDP_TOPIC_SINKS = "object:apex/pdp/topic/sinks";
public static final String REG_APEX_ENGINE_HANDLER = "object:engine/apex/handler";
-
- private ApexStarterConstants() {
- super();
- }
}
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019-2021 Nordix Foundation.
- * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019, 2021 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2020 Bell Canada. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
package org.onap.policy.apex.services.onappf;
import java.util.Arrays;
+import lombok.Getter;
import org.onap.policy.apex.service.engine.main.ApexPolicyStatisticsManager;
import org.onap.policy.apex.services.onappf.exception.ApexStarterException;
import org.onap.policy.apex.services.onappf.exception.ApexStarterRunTimeException;
private static final Logger LOGGER = LoggerFactory.getLogger(ApexStarterMain.class);
private ApexStarterActivator activator;
- private ApexStarterParameterGroup parameterGroup;
+ @Getter
+ private ApexStarterParameterGroup parameters;
/**
* Instantiates the ApexStarter.
arguments.validate();
// Read the parameters
- parameterGroup = new ApexStarterParameterHandler().getParameters(arguments);
+ parameters = new ApexStarterParameterHandler().getParameters(arguments);
// create the activator
- activator = new ApexStarterActivator(parameterGroup);
+ activator = new ApexStarterActivator(parameters);
Registry.register(ApexStarterConstants.REG_APEX_STARTER_ACTIVATOR, activator);
Registry.register(ApexPolicyStatisticsManager.REG_APEX_PDP_POLICY_COUNTER,
new ApexPolicyStatisticsManager());
LOGGER.info(successMsg);
}
- /**
- * Get the parameters specified in JSON.
- *
- * @return parameterGroup the parameters
- */
- public ApexStarterParameterGroup getParameters() {
- return parameterGroup;
- }
-
/**
* Shut down Execution.
*/
public void shutdown() throws ApexStarterException {
// clear the parameterGroup variable
- parameterGroup = null;
+ parameters = null;
// clear the apex starter activator
if (activator != null && activator.isAlive()) {
/*-
* ============LICENSE_START=======================================================
* 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.
import java.util.List;
import java.util.Timer;
import java.util.TimerTask;
+import lombok.Getter;
import org.onap.policy.apex.services.onappf.handler.PdpMessageHandler;
import org.onap.policy.common.endpoints.event.comm.TopicSink;
import org.onap.policy.common.endpoints.event.comm.client.TopicSinkClient;
private TopicSinkClient topicSinkClient;
private Timer timer;
+ @Getter
private long interval;
/**
timer.purge();
}
- /**
- * Get the current time interval used by the timer task.
- *
- * @return interval the current time interval
- */
- public long getInterval() {
- return interval;
- }
-
/**
* Method to send pdp status message to pap on demand.
*