2 * ============LICENSE_START=======================================================
3 * feature-distributed-locking
4 * ================================================================================
5 * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
20 package org.onap.policy.distributed.locking;
22 import java.util.Properties;
24 import org.onap.policy.common.utils.properties.PropertyConfiguration;
25 import org.onap.policy.common.utils.properties.exception.PropertyException;
26 import org.slf4j.Logger;
27 import org.slf4j.LoggerFactory;
30 public class DistributedLockingProperties extends PropertyConfiguration{
32 private static final Logger logger = LoggerFactory.getLogger(DistributedLockingProperties.class);
35 * Feature properties all begin with this prefix.
37 public static final String PREFIX = "distributed.locking.";
39 public static final String DB_DRIVER = "javax.persistence.jdbc.driver";
40 public static final String DB_URL = "javax.persistence.jdbc.url";
41 public static final String DB_USER = "javax.persistence.jdbc.user";
42 public static final String DB_PWD = "javax.persistence.jdbc.password";
43 public static final String AGING_PROPERTY = PREFIX + "lock.aging";
44 public static final String HEARTBEAT_INTERVAL_PROPERTY = PREFIX + "heartbeat.interval";
47 * Properties from which this was constructed.
49 private Properties source;
54 @Property(name = DB_DRIVER)
55 private String dbDriver;
60 @Property(name = DB_URL)
66 @Property(name = DB_USER)
67 private String dbUser;
72 @Property(name = DB_PWD)
76 * Used to set expiration time for lock.
78 @Property(name = AGING_PROPERTY, defaultValue = "300000")
79 private long agingProperty;
82 * Indicates intervals at which we refresh locks.
84 @Property(name = HEARTBEAT_INTERVAL_PROPERTY, defaultValue = "60000")
85 private long heartBeatIntervalProperty;
87 public DistributedLockingProperties(Properties props) throws PropertyException {
93 public Properties getSource() {
98 public String getDbDriver() {
103 public String getDbUrl() {
108 public String getDbUser() {
113 public String getDbPwd() {
118 public long getAgingProperty() {
119 return agingProperty;
123 public long getHeartBeatIntervalProperty() {
124 return heartBeatIntervalProperty;