2 * ============LICENSE_START=======================================================
3 * Copyright (C) 2016-2018 Ericsson. All rights reserved.
4 * ================================================================================
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
17 * SPDX-License-Identifier: Apache-2.0
18 * ============LICENSE_END=========================================================
21 package org.onap.policy.apex.plugins.context.locking.curator;
23 import org.onap.policy.apex.context.parameters.LockManagerParameters;
24 import org.onap.policy.apex.model.basicmodel.service.ParameterService;
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() {
52 super(CuratorLockManagerParameters.class.getCanonicalName());
53 ParameterService.registerParameters(CuratorLockManagerParameters.class, this);
57 * Gets the zookeeper address.
59 * @return the zookeeper address
61 public String getZookeeperAddress() {
62 return zookeeperAddress;
66 * Sets the zookeeper address.
68 * @param zookeeperAddress the zookeeper address
70 public void setZookeeperAddress(final String zookeeperAddress) {
71 this.zookeeperAddress = zookeeperAddress;
75 * Gets the zookeeper connect sleep time.
77 * @return the zookeeper connect sleep time
79 public int getZookeeperConnectSleepTime() {
80 return zookeeperConnectSleepTime;
84 * Sets the zookeeper connect sleep time.
86 * @param zookeeperConnectSleepTime the zookeeper connect sleep time
88 public void setZookeeperConnectSleepTime(final int zookeeperConnectSleepTime) {
89 this.zookeeperConnectSleepTime = zookeeperConnectSleepTime;
93 * Gets the zookeeper context retries.
95 * @return the zookeeper context retries
97 public int getZookeeperContextRetries() {
98 return zookeeperContextRetries;
102 * Sets the zookeeper context retries.
104 * @param zookeeperContextRetries the zookeeper context retries
106 public void setZookeeperContextRetries(final int zookeeperContextRetries) {
107 this.zookeeperContextRetries = zookeeperContextRetries;
113 * @see org.onap.policy.apex.context.parameters.LockManagerParameters#toString()
116 public String toString() {
117 return "CuratorLockManagerParameters [zookeeperAddress=" + zookeeperAddress + ", zookeeperConnectSleepTime="
118 + zookeeperConnectSleepTime + ", zookeeperContextRetries=" + zookeeperContextRetries + "]";