b82f4b00e269cdc66c69c29ffa1108fca93263d2
[policy/drools-pdp.git] /
1 /*
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
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
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=========================================================
19  */
20 package org.onap.policy.distributed.locking;
21
22 import java.util.Properties;
23 import org.onap.policy.common.utils.properties.PropertyConfiguration;
24 import org.onap.policy.common.utils.properties.exception.PropertyException;
25
26
27 public class DistributedLockingProperties extends PropertyConfiguration {
28
29     /**
30      * Feature properties all begin with this prefix.
31      */
32     public static final String PREFIX = "distributed.locking.";
33
34     public static final String DB_DRIVER = "javax.persistence.jdbc.driver";
35     public static final String DB_URL = "javax.persistence.jdbc.url";
36     public static final String DB_USER = "javax.persistence.jdbc.user";
37     public static final String DB_PWD = "javax.persistence.jdbc.password";
38     public static final String AGING_PROPERTY = PREFIX + "lock.aging";
39     public static final String HEARTBEAT_INTERVAL_PROPERTY = PREFIX + "heartbeat.interval";
40
41     /**
42      * Properties from which this was constructed.
43      */
44     private Properties source;
45
46     /**
47      * Database driver
48      */
49     @Property(name = DB_DRIVER)
50     private String dbDriver;
51
52     /**
53      * Database url
54      */
55     @Property(name = DB_URL)
56     private String dbUrl;
57
58     /**
59      * Database user
60      */
61     @Property(name = DB_USER)
62     private String dbUser;
63
64     /**
65      * Database password
66      */
67     @Property(name = DB_PWD)
68     private String dbPwd;
69
70     /**
71      * Used to set expiration time for lock.
72      */
73     @Property(name = AGING_PROPERTY, defaultValue = "300000")
74     private long agingProperty;
75
76     /**
77      * Indicates intervals at which we refresh locks.
78      */
79     @Property(name = HEARTBEAT_INTERVAL_PROPERTY, defaultValue = "60000")
80     private long heartBeatIntervalProperty;
81
82     public DistributedLockingProperties(Properties props) throws PropertyException {
83         super(props);
84         source = props;
85     }
86
87
88     public Properties getSource() {
89         return source;
90     }
91
92
93     public String getDbDriver() {
94         return dbDriver;
95     }
96
97
98     public String getDbUrl() {
99         return dbUrl;
100     }
101
102
103     public String getDbUser() {
104         return dbUser;
105     }
106
107
108     public String getDbPwd() {
109         return dbPwd;
110     }
111
112
113     public long getAgingProperty() {
114         return agingProperty;
115     }
116
117
118     public long getHeartBeatIntervalProperty() {
119         return heartBeatIntervalProperty;
120     }
121
122
123     public void setDbDriver(String dbDriver) {
124         this.dbDriver = dbDriver;
125     }
126
127
128     public void setDbUrl(String dbUrl) {
129         this.dbUrl = dbUrl;
130     }
131
132
133     public void setDbUser(String dbUser) {
134         this.dbUser = dbUser;
135     }
136
137
138     public void setDbPwd(String dbPwd) {
139         this.dbPwd = dbPwd;
140     }
141
142
143     public void setAgingProperty(long agingProperty) {
144         this.agingProperty = agingProperty;
145     }
146
147
148     public void setHeartBeatIntervalProperty(long heartBeatIntervalProperty) {
149         this.heartBeatIntervalProperty = heartBeatIntervalProperty;
150     }
151
152 }