2 * ============LICENSE_START=======================================================
3 * Copyright (C) 2016-2018 Ericsson. All rights reserved.
4 * Modifications Copyright (C) 2019 Nordix Foundation.
5 * ================================================================================
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
18 * SPDX-License-Identifier: Apache-2.0
19 * ============LICENSE_END=========================================================
22 package org.onap.policy.apex.plugins.context.locking.curator;
24 import org.onap.policy.apex.context.parameters.LockManagerParameters;
27 * Bean class for Curator locking parameters.
29 * @author Liam Fallon (liam.fallon@ericsson.com)
31 public class CuratorLockManagerParameters extends LockManagerParameters {
33 /** The default address used to connect to the Zookeeper server. */
34 public static final String DEFAULT_ZOOKEEPER_ADDRESS = "localhost:2181";
36 /** The default sleep time to use when connecting to the Zookeeper server. */
37 public static final int DEFAULT_ZOOKEEPER_CONNECT_SLEEP_TIME = 1000;
39 /** The default number of times to retry failed connections to the Zookeeper server. */
40 public static final int DEFAULT_ZOOKEEPER_CONNECT_RETRIES = 3;
43 private String zookeeperAddress = DEFAULT_ZOOKEEPER_ADDRESS;
44 private int zookeeperConnectSleepTime = DEFAULT_ZOOKEEPER_CONNECT_SLEEP_TIME;
45 private int zookeeperContextRetries = DEFAULT_ZOOKEEPER_CONNECT_RETRIES;
51 public CuratorLockManagerParameters() {
56 * Gets the zookeeper address.
58 * @return the zookeeper address
60 public String getZookeeperAddress() {
61 return zookeeperAddress;
65 * Sets the zookeeper address.
67 * @param zookeeperAddress the zookeeper address
69 public void setZookeeperAddress(final String zookeeperAddress) {
70 this.zookeeperAddress = zookeeperAddress;
74 * Gets the zookeeper connect sleep time.
76 * @return the zookeeper connect sleep time
78 public int getZookeeperConnectSleepTime() {
79 return zookeeperConnectSleepTime;
83 * Sets the zookeeper connect sleep time.
85 * @param zookeeperConnectSleepTime the zookeeper connect sleep time
87 public void setZookeeperConnectSleepTime(final int zookeeperConnectSleepTime) {
88 this.zookeeperConnectSleepTime = zookeeperConnectSleepTime;
92 * Gets the zookeeper context retries.
94 * @return the zookeeper context retries
96 public int getZookeeperContextRetries() {
97 return zookeeperContextRetries;
101 * Sets the zookeeper context retries.
103 * @param zookeeperContextRetries the zookeeper context retries
105 public void setZookeeperContextRetries(final int zookeeperContextRetries) {
106 this.zookeeperContextRetries = zookeeperContextRetries;
112 * @see org.onap.policy.apex.context.parameters.LockManagerParameters#toString()
115 public String toString() {
116 return "CuratorLockManagerParameters [zookeeperAddress=" + zookeeperAddress + ", zookeeperConnectSleepTime="
117 + zookeeperConnectSleepTime + ", zookeeperContextRetries=" + zookeeperContextRetries + "]";