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 +-- 13 files changed, 75 insertions(+), 272 deletions(-) (limited to 'plugins/plugins-context') 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}. */ -- cgit 1.2.3-korg