From 338cc2611738783285f9edebd259f7e6bff3973d Mon Sep 17 00:00:00 2001 From: Jim Hahn Date: Mon, 2 Aug 2021 15:28:00 -0400 Subject: Use lombok in apex-pdp #3 Updated plugins thru plugins-persistence-jpa-eclipselink. Issue-ID: POLICY-3391 Change-Id: Id7a5aeca8bb45c7a089f0b9d49c9ecd4bc8a7178 Signed-off-by: Jim Hahn --- .../hazelcast/HazelcastContextDistributor.java | 18 +-- .../infinispan/InfinispanContextDistributor.java | 18 +-- .../InfinispanDistributorParameters.java | 105 ++----------- .../distribution/infinispan/InfinispanManager.java | 22 +-- .../curator/CuratorLockManagerParameters.java | 80 ++-------- .../curator/CuratorReentrantReadWriteLock.java | 18 +-- .../context/locking/hazelcast/HazelcastLock.java | 12 +- .../context/schema/avro/AvroBytesObjectMapper.java | 11 +- .../schema/avro/AvroDirectObjectMapper.java | 11 +- .../context/schema/avro/AvroNullableMapper.java | 18 +-- .../context/schema/avro/AvroSchemaHelper.java | 12 +- .../avro/AvroSchemaKeyTranslationUtilities.java | 11 +- .../schema/avro/AvroStringObjectMapper.java | 11 +- .../plugins/event/carrier/jms/ApexJmsProducer.java | 11 +- .../jms/JmsCarrierTechnologyParameters.java | 166 +-------------------- .../carrier/restclient/ApexRestClientConsumer.java | 13 +- .../carrier/restclient/ApexRestClientProducer.java | 13 +- .../carrier/restrequestor/ApexRestRequest.java | 71 +-------- .../restrequestor/ApexRestRequestorConsumer.java | 14 +- .../restrequestor/ApexRestRequestorProducer.java | 12 +- .../carrier/restrequestor/ApexRestRequestTest.java | 3 +- .../carrier/restserver/ApexRestServerProducer.java | 11 +- .../WebSocketCarrierTechnologyParameters.java | 29 +--- .../protocol/jms/Apex2JmsObjectEventConverter.java | 23 +-- .../jms/JmsObjectEventProtocolParameters.java | 43 +----- .../protocol/yaml/YamlEventProtocolParameters.java | 122 ++------------- 26 files changed, 131 insertions(+), 747 deletions(-) diff --git a/plugins/plugins-context/plugins-context-distribution/plugins-context-distribution-hazelcast/src/main/java/org/onap/policy/apex/plugins/context/distribution/hazelcast/HazelcastContextDistributor.java b/plugins/plugins-context/plugins-context-distribution/plugins-context-distribution-hazelcast/src/main/java/org/onap/policy/apex/plugins/context/distribution/hazelcast/HazelcastContextDistributor.java index 3d6bd55c0..c1956330a 100644 --- a/plugins/plugins-context/plugins-context-distribution/plugins-context-distribution-hazelcast/src/main/java/org/onap/policy/apex/plugins/context/distribution/hazelcast/HazelcastContextDistributor.java +++ b/plugins/plugins-context/plugins-context-distribution/plugins-context-distribution-hazelcast/src/main/java/org/onap/policy/apex/plugins/context/distribution/hazelcast/HazelcastContextDistributor.java @@ -1,19 +1,20 @@ /*- * ============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========================================================= */ @@ -23,6 +24,8 @@ package org.onap.policy.apex.plugins.context.distribution.hazelcast; import com.hazelcast.core.Hazelcast; import com.hazelcast.core.HazelcastInstance; import java.util.Map; +import lombok.AccessLevel; +import lombok.Setter; import org.onap.policy.apex.context.ContextException; import org.onap.policy.apex.context.impl.distribution.AbstractDistributor; import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey; @@ -40,6 +43,7 @@ public class HazelcastContextDistributor extends AbstractDistributor { private static final XLogger LOGGER = XLoggerFactory.getXLogger(HazelcastContextDistributor.class); // The hazelcast instance for distributing context for this JVM + @Setter(AccessLevel.PRIVATE) private static HazelcastInstance hazelcastInstance = null; /** @@ -71,14 +75,6 @@ public class HazelcastContextDistributor extends AbstractDistributor { LOGGER.exit("init(" + key + ")"); } - /** - * Set the hazelcast instance statically. - * @param newHazelcastInstance the hazelcast instance - */ - private static void setHazelcastInstance(HazelcastInstance newHazelcastInstance) { - hazelcastInstance = newHazelcastInstance; - } - /** * {@inheritDoc}. */ diff --git a/plugins/plugins-context/plugins-context-distribution/plugins-context-distribution-infinispan/src/main/java/org/onap/policy/apex/plugins/context/distribution/infinispan/InfinispanContextDistributor.java b/plugins/plugins-context/plugins-context-distribution/plugins-context-distribution-infinispan/src/main/java/org/onap/policy/apex/plugins/context/distribution/infinispan/InfinispanContextDistributor.java index f72407faa..346d23db8 100644 --- a/plugins/plugins-context/plugins-context-distribution/plugins-context-distribution-infinispan/src/main/java/org/onap/policy/apex/plugins/context/distribution/infinispan/InfinispanContextDistributor.java +++ b/plugins/plugins-context/plugins-context-distribution/plugins-context-distribution-infinispan/src/main/java/org/onap/policy/apex/plugins/context/distribution/infinispan/InfinispanContextDistributor.java @@ -1,19 +1,20 @@ /*- * ============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========================================================= */ @@ -21,6 +22,8 @@ package org.onap.policy.apex.plugins.context.distribution.infinispan; import java.util.Map; +import lombok.AccessLevel; +import lombok.Setter; import org.onap.policy.apex.context.ContextException; import org.onap.policy.apex.context.impl.distribution.AbstractDistributor; import org.onap.policy.apex.context.parameters.ContextParameterConstants; @@ -40,6 +43,7 @@ public class InfinispanContextDistributor extends AbstractDistributor { private static final XLogger LOGGER = XLoggerFactory.getXLogger(InfinispanContextDistributor.class); // The infinispan manager for distributing context for this JVM + @Setter(AccessLevel.PRIVATE) private static InfinispanManager infinispanManager = null; /** @@ -77,14 +81,6 @@ public class InfinispanContextDistributor extends AbstractDistributor { LOGGER.exit("init(" + key + ")"); } - /** - * Set the infinispan manager statically. - * @param newInfinispanManager the new infinspan manager instance - */ - private static void setInfinispanManager(InfinispanManager newInfinispanManager) { - infinispanManager = newInfinispanManager; - } - /** * {@inheritDoc}. */ diff --git a/plugins/plugins-context/plugins-context-distribution/plugins-context-distribution-infinispan/src/main/java/org/onap/policy/apex/plugins/context/distribution/infinispan/InfinispanDistributorParameters.java b/plugins/plugins-context/plugins-context-distribution/plugins-context-distribution-infinispan/src/main/java/org/onap/policy/apex/plugins/context/distribution/infinispan/InfinispanDistributorParameters.java index f6ee14886..91f39e26a 100644 --- a/plugins/plugins-context/plugins-context-distribution/plugins-context-distribution-infinispan/src/main/java/org/onap/policy/apex/plugins/context/distribution/infinispan/InfinispanDistributorParameters.java +++ b/plugins/plugins-context/plugins-context-distribution/plugins-context-distribution-infinispan/src/main/java/org/onap/policy/apex/plugins/context/distribution/infinispan/InfinispanDistributorParameters.java @@ -1,25 +1,30 @@ /*- * ============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.plugins.context.distribution.infinispan; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; import org.onap.policy.apex.context.parameters.DistributorParameters; /** @@ -27,9 +32,13 @@ import org.onap.policy.apex.context.parameters.DistributorParameters; * * @author Liam Fallon (liam.fallon@ericsson.com) */ +@Getter +@Setter +@ToString +@NoArgsConstructor public class InfinispanDistributorParameters extends DistributorParameters { // @formatter:off - + /** The default Infinispan configuration file location. */ public static final String DEFAULT_INFINISPAN_DISTRIBUTION_CONFIG_FILE = "infinispan/infinispan.xml"; @@ -48,92 +57,4 @@ public class InfinispanDistributorParameters extends DistributorParameters { private boolean preferIPv4Stack = DEFAULT_INFINISPAN_JAVA_NET_PREFER_IPV4_STACK; private String jgroupsBindAddress = DEFAULT_INFINSPAN_JGROUPS_BIND_ADDRESS; // @formatter:on - - /** - * The Constructor. - */ - public InfinispanDistributorParameters() { - super(); - } - - /** - * Gets the config file. - * - * @return the config file - */ - public String getConfigFile() { - return configFile; - } - - /** - * Sets the config file. - * - * @param configFile the config file - */ - public void setConfigFile(final String configFile) { - this.configFile = configFile; - } - - /** - * Gets the jgroups file. - * - * @return the jgroups file - */ - public String getJgroupsFile() { - return jgroupsFile; - } - - /** - * Sets the jgroups file. - * - * @param jgroupsFile the jgroups file - */ - public void setJgroupsFile(final String jgroupsFile) { - this.jgroupsFile = jgroupsFile; - } - - /** - * Prefer I pv 4 stack. - * - * @return true, if prefer I pv 4 stack - */ - public boolean preferIPv4Stack() { - return preferIPv4Stack; - } - - /** - * Sets the prefer I pv 4 stack. - * - * @param preferIPv4Stack the prefer I pv 4 stack - */ - public void setPreferIPv4Stack(final boolean preferIPv4Stack) { - this.preferIPv4Stack = preferIPv4Stack; - } - - /** - * Getj groups bind address. - * - * @return the j groups bind address - */ - public String getjGroupsBindAddress() { - return jgroupsBindAddress; - } - - /** - * Setj groups bind address. - * - * @param jgroupsBindAddress the j groups bind address - */ - public void setjGroupsBindAddress(final String jgroupsBindAddress) { - this.jgroupsBindAddress = jgroupsBindAddress; - } - - /** - * {@inheritDoc}. - */ - @Override - public String toString() { - return "InfinispanDistributorParameters [configFile=" + configFile + ", jgroupsFile=" + jgroupsFile - + ", preferIPv4Stack=" + preferIPv4Stack + ", jGroupsBindAddress=" + jgroupsBindAddress + "]"; - } } diff --git a/plugins/plugins-context/plugins-context-distribution/plugins-context-distribution-infinispan/src/main/java/org/onap/policy/apex/plugins/context/distribution/infinispan/InfinispanManager.java b/plugins/plugins-context/plugins-context-distribution/plugins-context-distribution-infinispan/src/main/java/org/onap/policy/apex/plugins/context/distribution/infinispan/InfinispanManager.java index 2d733a1ee..a9346bcc3 100644 --- a/plugins/plugins-context/plugins-context-distribution/plugins-context-distribution-infinispan/src/main/java/org/onap/policy/apex/plugins/context/distribution/infinispan/InfinispanManager.java +++ b/plugins/plugins-context/plugins-context-distribution/plugins-context-distribution-infinispan/src/main/java/org/onap/policy/apex/plugins/context/distribution/infinispan/InfinispanManager.java @@ -1,19 +1,20 @@ /*- * ============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========================================================= */ @@ -21,6 +22,7 @@ package org.onap.policy.apex.plugins.context.distribution.infinispan; import java.io.IOException; +import lombok.Getter; import org.infinispan.manager.DefaultCacheManager; import org.infinispan.manager.EmbeddedCacheManager; import org.onap.policy.apex.context.ContextException; @@ -35,6 +37,7 @@ public class InfinispanManager { private static final XLogger LOGGER = XLoggerFactory.getXLogger(InfinispanManager.class); // The Infinispan Cache Manager + @Getter private EmbeddedCacheManager cacheManager; /** @@ -84,15 +87,6 @@ public class InfinispanManager { cacheManager = null; } - /** - * Get the cache manager. - * - * @return the infinispan cache manager - */ - public EmbeddedCacheManager getCacheManager() { - return cacheManager; - } - /** * Set system properties used by Infinispan. * @@ -100,8 +94,8 @@ public class InfinispanManager { */ private void setSystemProperties(final InfinispanDistributorParameters infinispanDistributorParameters) { System.setProperty("java.net.preferIPv4Stack", - Boolean.toString(infinispanDistributorParameters.preferIPv4Stack())); - System.setProperty("jgroups.bind_addr", infinispanDistributorParameters.getjGroupsBindAddress()); + Boolean.toString(infinispanDistributorParameters.isPreferIPv4Stack())); + System.setProperty("jgroups.bind_addr", infinispanDistributorParameters.getJgroupsBindAddress()); } /** diff --git a/plugins/plugins-context/plugins-context-locking/plugins-context-locking-curator/src/main/java/org/onap/policy/apex/plugins/context/locking/curator/CuratorLockManagerParameters.java b/plugins/plugins-context/plugins-context-locking/plugins-context-locking-curator/src/main/java/org/onap/policy/apex/plugins/context/locking/curator/CuratorLockManagerParameters.java index 1b525e147..548c08ba6 100644 --- a/plugins/plugins-context/plugins-context-locking/plugins-context-locking-curator/src/main/java/org/onap/policy/apex/plugins/context/locking/curator/CuratorLockManagerParameters.java +++ b/plugins/plugins-context/plugins-context-locking/plugins-context-locking-curator/src/main/java/org/onap/policy/apex/plugins/context/locking/curator/CuratorLockManagerParameters.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. @@ -21,6 +22,10 @@ package org.onap.policy.apex.plugins.context.locking.curator; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; import org.onap.policy.apex.context.parameters.LockManagerParameters; /** @@ -28,6 +33,10 @@ import org.onap.policy.apex.context.parameters.LockManagerParameters; * * @author Liam Fallon (liam.fallon@ericsson.com) */ +@Getter +@Setter +@ToString +@NoArgsConstructor public class CuratorLockManagerParameters extends LockManagerParameters { // @formatter:off /** The default address used to connect to the Zookeeper server. */ @@ -43,75 +52,4 @@ public class CuratorLockManagerParameters extends LockManagerParameters { private String zookeeperAddress = DEFAULT_ZOOKEEPER_ADDRESS; private int zookeeperConnectSleepTime = DEFAULT_ZOOKEEPER_CONNECT_SLEEP_TIME; private int zookeeperContextRetries = DEFAULT_ZOOKEEPER_CONNECT_RETRIES; - // @formatter:on - - /** - * The Constructor. - */ - public CuratorLockManagerParameters() { - super(); - } - - /** - * Gets the zookeeper address. - * - * @return the zookeeper address - */ - public String getZookeeperAddress() { - return zookeeperAddress; - } - - /** - * Sets the zookeeper address. - * - * @param zookeeperAddress the zookeeper address - */ - public void setZookeeperAddress(final String zookeeperAddress) { - this.zookeeperAddress = zookeeperAddress; - } - - /** - * Gets the zookeeper connect sleep time. - * - * @return the zookeeper connect sleep time - */ - public int getZookeeperConnectSleepTime() { - return zookeeperConnectSleepTime; - } - - /** - * Sets the zookeeper connect sleep time. - * - * @param zookeeperConnectSleepTime the zookeeper connect sleep time - */ - public void setZookeeperConnectSleepTime(final int zookeeperConnectSleepTime) { - this.zookeeperConnectSleepTime = zookeeperConnectSleepTime; - } - - /** - * Gets the zookeeper context retries. - * - * @return the zookeeper context retries - */ - public int getZookeeperContextRetries() { - return zookeeperContextRetries; - } - - /** - * Sets the zookeeper context retries. - * - * @param zookeeperContextRetries the zookeeper context retries - */ - public void setZookeeperContextRetries(final int zookeeperContextRetries) { - this.zookeeperContextRetries = zookeeperContextRetries; - } - - /** - * {@inheritDoc}. - */ - @Override - public String toString() { - return "CuratorLockManagerParameters [zookeeperAddress=" + zookeeperAddress + ", zookeeperConnectSleepTime=" - + zookeeperConnectSleepTime + ", zookeeperContextRetries=" + zookeeperContextRetries + "]"; - } } diff --git a/plugins/plugins-context/plugins-context-locking/plugins-context-locking-curator/src/main/java/org/onap/policy/apex/plugins/context/locking/curator/CuratorReentrantReadWriteLock.java b/plugins/plugins-context/plugins-context-locking/plugins-context-locking-curator/src/main/java/org/onap/policy/apex/plugins/context/locking/curator/CuratorReentrantReadWriteLock.java index 0cc5ef555..5021a8a2f 100644 --- a/plugins/plugins-context/plugins-context-locking/plugins-context-locking-curator/src/main/java/org/onap/policy/apex/plugins/context/locking/curator/CuratorReentrantReadWriteLock.java +++ b/plugins/plugins-context/plugins-context-locking/plugins-context-locking-curator/src/main/java/org/onap/policy/apex/plugins/context/locking/curator/CuratorReentrantReadWriteLock.java @@ -1,19 +1,20 @@ /*- * ============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========================================================= */ @@ -22,6 +23,7 @@ package org.onap.policy.apex.plugins.context.locking.curator; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReadWriteLock; +import lombok.Getter; import org.apache.curator.framework.CuratorFramework; import org.apache.curator.framework.recipes.locks.InterProcessReadWriteLock; @@ -32,6 +34,7 @@ import org.apache.curator.framework.recipes.locks.InterProcessReadWriteLock; */ public class CuratorReentrantReadWriteLock implements ReadWriteLock { // The Lock ID + @Getter private final String lockId; // The Curator lock @@ -58,15 +61,6 @@ public class CuratorReentrantReadWriteLock implements ReadWriteLock { writeLockFacade = new CuratorLockFacade(curatorReadWriteLock.writeLock(), lockId); } - /** - * Get the lock Id of the lock. - * - * @return the lock ID - */ - public String getLockId() { - return lockId; - } - /** * {@inheritDoc}. */ diff --git a/plugins/plugins-context/plugins-context-locking/plugins-context-locking-hazelcast/src/main/java/org/onap/policy/apex/plugins/context/locking/hazelcast/HazelcastLock.java b/plugins/plugins-context/plugins-context-locking/plugins-context-locking-hazelcast/src/main/java/org/onap/policy/apex/plugins/context/locking/hazelcast/HazelcastLock.java index caec244b8..89f1b4425 100644 --- a/plugins/plugins-context/plugins-context-locking/plugins-context-locking-hazelcast/src/main/java/org/onap/policy/apex/plugins/context/locking/hazelcast/HazelcastLock.java +++ b/plugins/plugins-context/plugins-context-locking/plugins-context-locking-hazelcast/src/main/java/org/onap/policy/apex/plugins/context/locking/hazelcast/HazelcastLock.java @@ -2,6 +2,7 @@ * ============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. @@ -25,6 +26,7 @@ import com.hazelcast.core.HazelcastInstance; import com.hazelcast.cp.lock.FencedLock; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReadWriteLock; +import lombok.Getter; /** * This class maps a Hazelcast {@link ILock} to a Java {@link ReadWriteLock}. @@ -33,6 +35,7 @@ import java.util.concurrent.locks.ReadWriteLock; */ public class HazelcastLock implements ReadWriteLock { // The Lock ID + @Getter private final String lockId; // The hazelcast lock @@ -53,15 +56,6 @@ public class HazelcastLock implements ReadWriteLock { writeLock = hazelcastInstance.getCPSubsystem().getLock(lockId + "_WRITE"); } - /** - * Get the lock Id of the lock. - * - * @return the lock ID - */ - public String getLockId() { - return lockId; - } - /** * {@inheritDoc}. */ diff --git a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroBytesObjectMapper.java b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroBytesObjectMapper.java index c575eea02..6ea6857e9 100644 --- a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroBytesObjectMapper.java +++ b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroBytesObjectMapper.java @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. * Modifications Copyright (C) 2019-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. @@ -22,6 +23,7 @@ package org.onap.policy.apex.plugins.context.schema.avro; import java.nio.ByteBuffer; +import lombok.Getter; import org.apache.avro.Schema; import org.apache.avro.Schema.Type; import org.onap.policy.apex.context.ContextRuntimeException; @@ -40,6 +42,7 @@ public class AvroBytesObjectMapper implements AvroObjectMapper { // The user keyAvro type for direct mapping private AxKey userKey; + @Getter private Type avroType; // The Apex compatible class @@ -72,14 +75,6 @@ public class AvroBytesObjectMapper implements AvroObjectMapper { return null; } - /** - * {@inheritDoc}. - */ - @Override - public Type getAvroType() { - return avroType; - } - /** * {@inheritDoc}. */ diff --git a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroDirectObjectMapper.java b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroDirectObjectMapper.java index 2c2483384..945c30c6f 100644 --- a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroDirectObjectMapper.java +++ b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroDirectObjectMapper.java @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. * Modifications Copyright (C) 2019-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. @@ -24,6 +25,7 @@ package org.onap.policy.apex.plugins.context.schema.avro; import java.util.HashMap; import java.util.Map; import java.util.TreeMap; +import lombok.Getter; import org.apache.avro.Schema; import org.apache.avro.Schema.Type; import org.apache.avro.generic.GenericData; @@ -64,6 +66,7 @@ public class AvroDirectObjectMapper implements AvroObjectMapper { // The user keyAvro type for direct mapping private AxKey userKey; + @Getter private Type avroType; // The Apex compatible class @@ -96,14 +99,6 @@ public class AvroDirectObjectMapper implements AvroObjectMapper { return null; } - /** - * {@inheritDoc}. - */ - @Override - public Type getAvroType() { - return avroType; - } - /** * {@inheritDoc}. */ diff --git a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroNullableMapper.java b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroNullableMapper.java index b2fccaab3..1f53b628e 100644 --- a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroNullableMapper.java +++ b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroNullableMapper.java @@ -1,25 +1,27 @@ /*- * ============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.plugins.context.schema.avro; +import lombok.AllArgsConstructor; import org.apache.avro.Schema; import org.apache.avro.Schema.Type; import org.onap.policy.apex.model.basicmodel.concepts.ApexRuntimeException; @@ -30,19 +32,11 @@ import org.onap.policy.apex.model.basicmodel.concepts.AxKey; * * @author John Keeney (john.keeney@ericsson.com) */ +@AllArgsConstructor public class AvroNullableMapper extends AvroDirectObjectMapper { // The wrapped mapper for nullables private final AvroObjectMapper wrappedMapper; - /** - * The Constructor. - * - * @param wrappedMapper the wrapped mapper - */ - public AvroNullableMapper(final AvroObjectMapper wrappedMapper) { - this.wrappedMapper = wrappedMapper; - } - /** * {@inheritDoc}. */ diff --git a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaHelper.java b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaHelper.java index fe6779891..b7fe0663d 100644 --- a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaHelper.java +++ b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaHelper.java @@ -3,6 +3,7 @@ * Copyright (C) 2016-2018 Ericsson. All rights reserved. * Modifications Copyright (C) 2019-2021 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. @@ -28,6 +29,7 @@ import com.google.gson.JsonElement; import java.io.ByteArrayOutputStream; import java.util.LinkedHashSet; import java.util.Set; +import lombok.Getter; import org.apache.avro.Schema; import org.apache.avro.Schema.Field; import org.apache.avro.Schema.Type; @@ -55,6 +57,7 @@ public class AvroSchemaHelper extends AbstractSchemaHelper { private static final String OBJECT_TAG = ": object \""; // The Avro schema for this context schema + @Getter private Schema avroSchema; // The mapper that translates between Java and Avro objects @@ -81,15 +84,6 @@ public class AvroSchemaHelper extends AbstractSchemaHelper { setSchemaClass(avroObjectMapper.getJavaClass()); } - /** - * Getter to get the Avro schema. - * - * @return the Avro schema - */ - public Schema getAvroSchema() { - return avroSchema; - } - @Override public Object getSchemaObject() { return getAvroSchema(); diff --git a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaKeyTranslationUtilities.java b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaKeyTranslationUtilities.java index 34a4dedb0..babca5cb2 100644 --- a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaKeyTranslationUtilities.java +++ b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaKeyTranslationUtilities.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. @@ -26,12 +27,15 @@ import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import java.util.Map.Entry; +import lombok.AccessLevel; +import lombok.NoArgsConstructor; /** * This static final class contains utility methods for Avro schemas. * * @author Liam Fallon (liam.fallon@ericsson.com) */ +@NoArgsConstructor(access = AccessLevel.PRIVATE) public final class AvroSchemaKeyTranslationUtilities { // Constants for key replacements private static final String DOT_STRING = "."; @@ -41,13 +45,6 @@ public final class AvroSchemaKeyTranslationUtilities { private static final String COLON_STRING = ":"; private static final String COLON_STRING_REPLACEMENT = "_ColoN_"; - /** - * Default constructor to avoid subclassing. - */ - private AvroSchemaKeyTranslationUtilities() { - // Private constructor to prevent subclassing - } - /** * Translate characters in JSON keys to values that are legal in Avro. Avro names must start with [A-Za-z_] and * subsequently contain only [A-Za-z0-9_] diff --git a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroStringObjectMapper.java b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroStringObjectMapper.java index 27737b500..3d5e03605 100644 --- a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroStringObjectMapper.java +++ b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroStringObjectMapper.java @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. * Modifications Copyright (C) 2019-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. @@ -21,6 +22,7 @@ package org.onap.policy.apex.plugins.context.schema.avro; +import lombok.Getter; import org.apache.avro.Schema; import org.apache.avro.Schema.Type; import org.apache.avro.util.Utf8; @@ -40,6 +42,7 @@ public class AvroStringObjectMapper implements AvroObjectMapper { // The user keyAvro type for direct mapping private AxKey userKey; + @Getter private Type avroType; // The Apex compatible class @@ -72,14 +75,6 @@ public class AvroStringObjectMapper implements AvroObjectMapper { return null; } - /** - * {@inheritDoc}. - */ - @Override - public Type getAvroType() { - return avroType; - } - /** * {@inheritDoc}. */ diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/main/java/org/onap/policy/apex/plugins/event/carrier/jms/ApexJmsProducer.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/main/java/org/onap/policy/apex/plugins/event/carrier/jms/ApexJmsProducer.java index 44ed810fd..42bde24ca 100644 --- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/main/java/org/onap/policy/apex/plugins/event/carrier/jms/ApexJmsProducer.java +++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/main/java/org/onap/policy/apex/plugins/event/carrier/jms/ApexJmsProducer.java @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. * Modifications Copyright (C) 2019-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. @@ -33,6 +34,7 @@ import javax.jms.Session; import javax.jms.Topic; import javax.naming.InitialContext; import javax.naming.NamingException; +import lombok.Getter; import org.onap.policy.apex.service.engine.event.ApexEventException; import org.onap.policy.apex.service.engine.event.ApexEventProducer; import org.onap.policy.apex.service.engine.event.ApexEventRuntimeException; @@ -70,6 +72,7 @@ public class ApexJmsProducer implements ApexEventProducer { private MessageProducer messageProducer; // The name for this producer + @Getter private String name = null; // The peer references for this event handler @@ -171,14 +174,6 @@ public class ApexJmsProducer implements ApexEventProducer { return new InitialContext(jmsProducerProperties.getJmsProducerProperties()); } - /** - * {@inheritDoc}. - */ - @Override - public String getName() { - return name; - } - /** * {@inheritDoc}. */ diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/main/java/org/onap/policy/apex/plugins/event/carrier/jms/JmsCarrierTechnologyParameters.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/main/java/org/onap/policy/apex/plugins/event/carrier/jms/JmsCarrierTechnologyParameters.java index d4647b584..3e2f239df 100644 --- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/main/java/org/onap/policy/apex/plugins/event/carrier/jms/JmsCarrierTechnologyParameters.java +++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/main/java/org/onap/policy/apex/plugins/event/carrier/jms/JmsCarrierTechnologyParameters.java @@ -24,6 +24,8 @@ package org.onap.policy.apex.plugins.event.carrier.jms; import java.util.Properties; import javax.naming.Context; +import lombok.Getter; +import lombok.Setter; import org.onap.policy.apex.service.parameters.carriertechnology.CarrierTechnologyParameters; import org.onap.policy.common.parameters.annotations.Min; import org.onap.policy.common.parameters.annotations.NotBlank; @@ -70,6 +72,8 @@ import org.onap.policy.common.parameters.annotations.NotNull; * * @author Liam Fallon (liam.fallon@ericsson.com) */ +@Getter +@Setter public class JmsCarrierTechnologyParameters extends CarrierTechnologyParameters { /** The label of this carrier technology. */ public static final String JMS_CARRIER_TECHNOLOGY_LABEL = "JMS"; @@ -173,166 +177,4 @@ public class JmsCarrierTechnologyParameters extends CarrierTechnologyParameters return jmsProperties; } - - /** - * Gets the connection factory. - * - * @return the connection factory - */ - public String getConnectionFactory() { - return connectionFactory; - } - - /** - * Gets the initial context factory. - * - * @return the initial context factory - */ - public String getInitialContextFactory() { - return initialContextFactory; - } - - /** - * Gets the provider URL. - * - * @return the provider URL - */ - public String getProviderUrl() { - return providerUrl; - } - - /** - * Gets the security principal. - * - * @return the security principal - */ - public String getSecurityPrincipal() { - return securityPrincipal; - } - - /** - * Gets the security credentials. - * - * @return the security credentials - */ - public String getSecurityCredentials() { - return securityCredentials; - } - - /** - * Gets the producer topic. - * - * @return the producer topic - */ - public String getProducerTopic() { - return producerTopic; - } - - /** - * Gets the consumer topic. - * - * @return the consumer topic - */ - public String getConsumerTopic() { - return consumerTopic; - } - - /** - * Gets the consumer wait time. - * - * @return the consumer wait time - */ - public long getConsumerWaitTime() { - return consumerWaitTime; - } - - /** - * Sets the connection factory. - * - * @param connectionFactory the connection factory - */ - public void setConnectionFactory(final String connectionFactory) { - this.connectionFactory = connectionFactory; - } - - /** - * Sets the initial context factory. - * - * @param initialContextFactory the initial context factory - */ - public void setInitialContextFactory(final String initialContextFactory) { - this.initialContextFactory = initialContextFactory; - } - - /** - * Sets the provider URL. - * - * @param providerUrl the provider URL - */ - public void setProviderUrl(final String providerUrl) { - this.providerUrl = providerUrl; - } - - /** - * Sets the security principal. - * - * @param securityPrincipal the security principal - */ - public void setSecurityPrincipal(final String securityPrincipal) { - this.securityPrincipal = securityPrincipal; - } - - /** - * Sets the security credentials. - * - * @param securityCredentials the security credentials - */ - public void setSecurityCredentials(final String securityCredentials) { - this.securityCredentials = securityCredentials; - } - - /** - * Sets the producer topic. - * - * @param producerTopic the producer topic - */ - public void setProducerTopic(final String producerTopic) { - this.producerTopic = producerTopic; - } - - /** - * Sets the consumer topic. - * - * @param consumerTopic the consumer topic - */ - public void setConsumerTopic(final String consumerTopic) { - this.consumerTopic = consumerTopic; - } - - /** - * Sets the consumer wait time. - * - * @param consumerWaitTime the consumer wait time - */ - public void setConsumerWaitTime(final int consumerWaitTime) { - this.consumerWaitTime = consumerWaitTime; - } - - /** - * Checks if is object message sending. - * - * @return true, if checks if is object message sending - */ - public boolean isObjectMessageSending() { - return objectMessageSending; - } - - /** - * Sets the object message sending. - * - * @param objectMessageSending the object message sending - */ - public void setObjectMessageSending(final boolean objectMessageSending) { - this.objectMessageSending = objectMessageSending; - } } diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientConsumer.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientConsumer.java index 4f95c5636..db14006eb 100644 --- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientConsumer.java +++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientConsumer.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. @@ -28,6 +29,8 @@ import java.util.regex.Pattern; import javax.ws.rs.client.Client; import javax.ws.rs.client.ClientBuilder; import javax.ws.rs.core.Response; +import lombok.AccessLevel; +import lombok.Setter; import org.apache.commons.lang3.StringUtils; import org.onap.policy.apex.core.infrastructure.threading.ThreadUtilities; import org.onap.policy.apex.service.engine.event.ApexEventException; @@ -58,6 +61,7 @@ public class ApexRestClientConsumer extends ApexPluginsEventConsumer { private ApexEventReceiver eventReceiver; // The HTTP client that makes a REST call to get an input event for Apex + @Setter(AccessLevel.PROTECTED) private Client client; // The pattern for filtering status code @@ -176,13 +180,4 @@ public class ApexRestClientConsumer extends ApexPluginsEventConsumer { } } } - - /** - * Hook for unit test mocking of HTTP client. - * - * @param client the mocked client - */ - protected void setClient(final Client client) { - this.client = client; - } } diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientProducer.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientProducer.java index 565587f62..cb6b55371 100644 --- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientProducer.java +++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientProducer.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. @@ -29,6 +30,8 @@ import javax.ws.rs.client.Client; import javax.ws.rs.client.ClientBuilder; import javax.ws.rs.client.Entity; import javax.ws.rs.core.Response; +import lombok.AccessLevel; +import lombok.Setter; import org.onap.policy.apex.service.engine.event.ApexEventException; import org.onap.policy.apex.service.engine.event.ApexEventRuntimeException; import org.onap.policy.apex.service.engine.event.ApexPluginsEventProducer; @@ -50,6 +53,7 @@ public class ApexRestClientProducer extends ApexPluginsEventProducer { private static final Logger LOGGER = LoggerFactory.getLogger(ApexRestClientProducer.class); // The HTTP client that makes a REST call with an event from Apex + @Setter(AccessLevel.PROTECTED) private Client client; // The REST carrier properties @@ -157,13 +161,4 @@ public class ApexRestClientProducer extends ApexPluginsEventProducer { .headers(restProducerProperties.getHttpHeadersAsMultivaluedMap()).put(Entity.json(event)); } } - - /** - * Hook for unit test mocking of HTTP client. - * - * @param client the mocked client - */ - protected void setClient(final Client client) { - this.client = client; - } } diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/main/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/ApexRestRequest.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/main/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/ApexRestRequest.java index 08467f0bd..2cf7af1db 100644 --- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/main/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/ApexRestRequest.java +++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/main/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/ApexRestRequest.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. @@ -22,17 +23,24 @@ package org.onap.policy.apex.plugins.event.carrier.restrequestor; import java.util.Properties; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; /** * This class holds a record of a REST request for the REST requestor plugin. * * @author Liam Fallon (liam.fallon@ericsson.com) */ +@Getter +@ToString public class ApexRestRequest { private long executionId; private String eventName; private Object event; + @ToString.Exclude private Properties executionProperties; + @Setter private long timestamp; /** @@ -49,67 +57,4 @@ public class ApexRestRequest { this.eventName = eventName; this.event = event; } - - /** - * Gets the execution id. - * - * @return the execution id - */ - public long getExecutionId() { - return executionId; - } - - /** - * Gets the event name. - * - * @return the event name - */ - public String getEventName() { - return eventName; - } - - /** - * Gets the event. - * - * @return the event - */ - public Object getEvent() { - return event; - } - - /** - * Gets the executionProperties. - * - * @return the executionProperties - */ - public Properties getExecutionProperties() { - return executionProperties; - } - - /** - * Gets the timestamp. - * - * @return the timestamp - */ - public long getTimestamp() { - return timestamp; - } - - /** - * Sets the timestamp. - * - * @param timestamp the new timestamp - */ - public void setTimestamp(final long timestamp) { - this.timestamp = timestamp; - } - - /** - * {@inheritDoc}. - */ - @Override - public String toString() { - return "ApexRestRequest [executionId=" + executionId + ", eventName=" + eventName + ", event=" + event - + ", timestamp=" + timestamp + "]"; - } } diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/main/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/ApexRestRequestorConsumer.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/main/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/ApexRestRequestorConsumer.java index 81997e351..c0a43a387 100644 --- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/main/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/ApexRestRequestorConsumer.java +++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/main/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/ApexRestRequestorConsumer.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. @@ -42,6 +43,7 @@ import javax.ws.rs.client.ClientBuilder; import javax.ws.rs.client.Entity; import javax.ws.rs.client.Invocation.Builder; import javax.ws.rs.core.Response; +import lombok.Getter; import org.apache.commons.lang3.StringUtils; import org.onap.policy.apex.core.infrastructure.threading.ThreadUtilities; import org.onap.policy.apex.service.engine.event.ApexEventException; @@ -91,7 +93,8 @@ public class ApexRestRequestorConsumer extends ApexPluginsEventConsumer { // The number of events received to date private Object eventsReceivedLock = new Object(); - private Integer eventsReceived = 0; + @Getter + private int eventsReceived = 0; // The number of the next request runner thread private static long nextRequestRunnerThreadNo = 0; @@ -176,15 +179,6 @@ public class ApexRestRequestorConsumer extends ApexPluginsEventConsumer { } } - /** - * Get the number of events received to date. - * - * @return the number of events received - */ - public int getEventsReceived() { - return eventsReceived; - } - /** * {@inheritDoc}. */ diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/main/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/ApexRestRequestorProducer.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/main/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/ApexRestRequestorProducer.java index 27e9869c6..aebc15d69 100644 --- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/main/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/ApexRestRequestorProducer.java +++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/main/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/ApexRestRequestorProducer.java @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. * Modifications Copyright (C) 2019-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. @@ -22,6 +23,7 @@ package org.onap.policy.apex.plugins.event.carrier.restrequestor; 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.ApexEventRuntimeException; @@ -38,6 +40,7 @@ import org.onap.policy.apex.service.parameters.eventhandler.EventHandlerPeeredMo */ public class ApexRestRequestorProducer extends ApexPluginsEventProducer { // The number of events sent + @Getter private int eventsSent = 0; /** @@ -79,15 +82,6 @@ public class ApexRestRequestorProducer extends ApexPluginsEventProducer { } } - /** - * Get the number of events sent to date. - * - * @return the number of events received - */ - public int getEventsSent() { - return eventsSent; - } - /** * {@inheritDoc}. */ diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/test/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/ApexRestRequestTest.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/test/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/ApexRestRequestTest.java index 7c08b772c..d7b418a78 100644 --- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/test/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/ApexRestRequestTest.java +++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/test/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/ApexRestRequestTest.java @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 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. @@ -48,7 +49,7 @@ public class ApexRestRequestTest { rr.setTimestamp(1234567); assertEquals(1234567, rr.getTimestamp()); - assertEquals("ApexRestRequest [executionId=1, eventName=EventName, event=The Event String, timestamp=1234567]", + assertEquals("ApexRestRequest(executionId=1, eventName=EventName, event=The Event String, timestamp=1234567)", rr.toString()); } } diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/main/java/org/onap/policy/apex/plugins/event/carrier/restserver/ApexRestServerProducer.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/main/java/org/onap/policy/apex/plugins/event/carrier/restserver/ApexRestServerProducer.java index 62e6c459b..03913e081 100644 --- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/main/java/org/onap/policy/apex/plugins/event/carrier/restserver/ApexRestServerProducer.java +++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/main/java/org/onap/policy/apex/plugins/event/carrier/restserver/ApexRestServerProducer.java @@ -2,6 +2,7 @@ * ============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. @@ -24,6 +25,7 @@ package org.onap.policy.apex.plugins.event.carrier.restserver; import java.util.EnumMap; import java.util.Map; import java.util.Properties; +import lombok.Getter; import org.onap.policy.apex.service.engine.event.ApexEventException; import org.onap.policy.apex.service.engine.event.ApexEventProducer; import org.onap.policy.apex.service.engine.event.PeeredReference; @@ -43,6 +45,7 @@ public class ApexRestServerProducer implements ApexEventProducer { private static final Logger LOGGER = LoggerFactory.getLogger(ApexRestServerProducer.class); // The name for this producer + @Getter private String name = null; // The peer references for this event handler @@ -87,14 +90,6 @@ public class ApexRestServerProducer implements ApexEventProducer { } } - /** - * {@inheritDoc}. - */ - @Override - public String getName() { - return name; - } - /** * {@inheritDoc}. */ diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-websocket/src/main/java/org/onap/policy/apex/plugins/event/carrier/websocket/WebSocketCarrierTechnologyParameters.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-websocket/src/main/java/org/onap/policy/apex/plugins/event/carrier/websocket/WebSocketCarrierTechnologyParameters.java index f867020ec..89588ec37 100644 --- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-websocket/src/main/java/org/onap/policy/apex/plugins/event/carrier/websocket/WebSocketCarrierTechnologyParameters.java +++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-websocket/src/main/java/org/onap/policy/apex/plugins/event/carrier/websocket/WebSocketCarrierTechnologyParameters.java @@ -21,6 +21,7 @@ package org.onap.policy.apex.plugins.event.carrier.websocket; +import lombok.Getter; import org.apache.commons.lang3.StringUtils; import org.onap.policy.apex.service.parameters.carriertechnology.CarrierTechnologyParameters; import org.onap.policy.common.parameters.BeanValidationResult; @@ -34,6 +35,7 @@ import org.onap.policy.models.base.Validated; * * @author Liam Fallon (liam.fallon@ericsson.com) */ +@Getter public class WebSocketCarrierTechnologyParameters extends CarrierTechnologyParameters { // @formatter:off private static final int MIN_USER_PORT = 1024; @@ -73,33 +75,6 @@ public class WebSocketCarrierTechnologyParameters extends CarrierTechnologyParam this.setEventConsumerPluginClass(KWEB_SCOKET_EVENT_CONSUMER_PLUGIN_CLASS); } - /** - * Gets the host. - * - * @return the host - */ - public String getHost() { - return host; - } - - /** - * Gets the port. - * - * @return the port - */ - public int getPort() { - return port; - } - - /** - * Checks if is ws client. - * - * @return true, if checks if is ws client - */ - public boolean isWsClient() { - return wsClient; - } - /** * {@inheritDoc}. */ diff --git a/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-jms/src/main/java/org/onap/policy/apex/plugins/event/protocol/jms/Apex2JmsObjectEventConverter.java b/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-jms/src/main/java/org/onap/policy/apex/plugins/event/protocol/jms/Apex2JmsObjectEventConverter.java index 924765dc5..7f33fe6a7 100644 --- a/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-jms/src/main/java/org/onap/policy/apex/plugins/event/protocol/jms/Apex2JmsObjectEventConverter.java +++ b/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-jms/src/main/java/org/onap/policy/apex/plugins/event/protocol/jms/Apex2JmsObjectEventConverter.java @@ -3,6 +3,7 @@ * Copyright (C) 2016-2018 Ericsson. All rights reserved. * Modifications Copyright (C) 2019-2021 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. @@ -25,6 +26,8 @@ package org.onap.policy.apex.plugins.event.protocol.jms; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.List; +import lombok.Getter; +import lombok.NoArgsConstructor; import org.onap.policy.apex.service.engine.event.ApexEvent; import org.onap.policy.apex.service.engine.event.ApexEventException; import org.onap.policy.apex.service.engine.event.ApexEventProtocolConverter; @@ -39,21 +42,14 @@ import org.slf4j.ext.XLoggerFactory; * * @author Liam Fallon (liam.fallon@ericsson.com) */ +@Getter +@NoArgsConstructor public final class Apex2JmsObjectEventConverter implements ApexEventProtocolConverter { private static final XLogger LOGGER = XLoggerFactory.getXLogger(Apex2JmsObjectEventConverter.class); // JMS event protocol parameters on the consumer (JMS->Apex) sides private JmsObjectEventProtocolParameters eventProtocolParameters = null; - /** - * Constructor to create the Apex to JMS Object converter. - * - * @throws ApexEventException the apex event exception - */ - public Apex2JmsObjectEventConverter() throws ApexEventException { - // Nothing specific to initiate for this plugin - } - @Override public void init(final EventProtocolParameters parameters) { // Check if properties have been set for JMS object event conversion as a consumer. They may not be set because @@ -141,13 +137,4 @@ public final class Apex2JmsObjectEventConverter implements ApexEventProtocolConv // Return the single object from the Apex event message return apexEvent.values().iterator().next(); } - - /** - * Returns eventProtocolParameters field. Getter used only for testing - * - * @return eventProtocolParameters - */ - JmsObjectEventProtocolParameters getEventProtocolParameters() { - return eventProtocolParameters; - } } diff --git a/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-jms/src/main/java/org/onap/policy/apex/plugins/event/protocol/jms/JmsObjectEventProtocolParameters.java b/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-jms/src/main/java/org/onap/policy/apex/plugins/event/protocol/jms/JmsObjectEventProtocolParameters.java index 08875e182..e85ab229c 100644 --- a/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-jms/src/main/java/org/onap/policy/apex/plugins/event/protocol/jms/JmsObjectEventProtocolParameters.java +++ b/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-jms/src/main/java/org/onap/policy/apex/plugins/event/protocol/jms/JmsObjectEventProtocolParameters.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,6 +21,7 @@ package org.onap.policy.apex.plugins.event.protocol.jms; +import lombok.Getter; import org.onap.policy.apex.service.parameters.eventprotocol.EventProtocolParameters; /** @@ -39,10 +41,10 @@ import org.onap.policy.apex.service.parameters.eventprotocol.EventProtocolParame *
  • It puts a single entry into the Apex event map with the the simple class name of the incoming Java object being * the key of the entry and the actual incoming object as the value of the entry.
  • * - * + * *

    When sending an object to JMS, the plugin expects to receive an Apex event with a single entry. The plugin * marshals the value of that entry to an object that can be sent by JMS as a {@code javax.jms.ObjectMessage} instance. - * + * *

    The parameters for this plugin are: *

      *
    1. incomingEventSuffix: The suffix to append to the simple name of incoming Java class instances when they are @@ -57,6 +59,7 @@ import org.onap.policy.apex.service.parameters.eventprotocol.EventProtocolParame * * @author Liam Fallon (liam.fallon@ericsson.com) */ +@Getter public class JmsObjectEventProtocolParameters extends EventProtocolParameters { /** The label of this event protocol. */ public static final String JMS_OBJECT_EVENT_PROTOCOL_LABEL = "JMSOBJECT"; @@ -88,40 +91,4 @@ public class JmsObjectEventProtocolParameters extends EventProtocolParameters { // Set the event protocol plugin class this.setEventProtocolPluginClass(Apex2JmsObjectEventConverter.class.getName()); } - - /** - * Gets the incoming event version. - * - * @return the incoming event version - */ - public String getIncomingEventVersion() { - return incomingEventVersion; - } - - /** - * Gets the incoming event source. - * - * @return the incoming event source - */ - public String getIncomingEventSource() { - return incomingEventSource; - } - - /** - * Gets the incoming event target. - * - * @return the incoming event target - */ - public String getIncomingEventTarget() { - return incomingEventTarget; - } - - /** - * Gets the incoming event suffix. - * - * @return the incoming event suffix - */ - public String getIncomingEventSuffix() { - return incomingEventSuffix; - } } diff --git a/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-yaml/src/main/java/org/onap/policy/apex/plugins/event/protocol/yaml/YamlEventProtocolParameters.java b/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-yaml/src/main/java/org/onap/policy/apex/plugins/event/protocol/yaml/YamlEventProtocolParameters.java index b538b58f9..e5539cd04 100644 --- a/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-yaml/src/main/java/org/onap/policy/apex/plugins/event/protocol/yaml/YamlEventProtocolParameters.java +++ b/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-yaml/src/main/java/org/onap/policy/apex/plugins/event/protocol/yaml/YamlEventProtocolParameters.java @@ -1,25 +1,28 @@ /*- * ============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.plugins.event.protocol.yaml; +import lombok.Getter; +import lombok.Setter; import org.onap.policy.apex.service.parameters.eventprotocol.EventProtocolTextTokenDelimitedParameters; /** @@ -40,9 +43,11 @@ import org.onap.policy.apex.service.parameters.eventprotocol.EventProtocolTextTo *
    2. yamlFieldName: The name of the field in the APEX event that will contain the unmarshaled YAML object. The * parameter is optional and defaults to the value "yaml_field". *
    - * + * * @author Liam Fallon (liam.fallon@ericsson.com) */ +@Getter +@Setter public class YamlEventProtocolParameters extends EventProtocolTextTokenDelimitedParameters { /** The label of this event protocol. */ public static final String YAML_EVENT_PROTOCOL_LABEL = "YAML"; @@ -91,113 +96,4 @@ public class YamlEventProtocolParameters extends EventProtocolTextTokenDelimited // Set the event protocol plugin class this.setEventProtocolPluginClass(Apex2YamlEventConverter.class.getName()); } - - /** - * 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; - } - - /** - * Gets the YAML field name. - * - * @return the YAML field name - */ - public String getYamlFieldName() { - return yamlFieldName; - } - - /** - * 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 encapsulating object name. - * - * @param yamlFieldName - * the new YAML field name - */ - public void setYamlFieldName(String yamlFieldName) { - this.yamlFieldName = yamlFieldName; - } } -- cgit 1.2.3-korg