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 --- .../curator/CuratorLockManagerParameters.java | 80 +++------------------- .../curator/CuratorReentrantReadWriteLock.java | 18 ++--- 2 files changed, 15 insertions(+), 83 deletions(-) (limited to 'plugins/plugins-context/plugins-context-locking/plugins-context-locking-curator/src/main') 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}. */ -- cgit 1.2.3-korg