97ba3b1030900c183e6a7c8f9e6fce95598505de
[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
24 import org.onap.policy.common.utils.properties.PropertyConfiguration;
25 import org.onap.policy.common.utils.properties.exception.PropertyException;
26
27
28 public class DistributedLockingProperties extends PropertyConfiguration{
29         
30         /**
31      * Feature properties all begin with this prefix.
32      */
33     public static final String PREFIX = "distributed.locking.";
34     
35         public static final String DB_DRIVER = "javax.persistence.jdbc.driver";
36         public static final String DB_URL = "javax.persistence.jdbc.url";
37         public static final String DB_USER = "javax.persistence.jdbc.user";
38         public static final String DB_PWD = "javax.persistence.jdbc.password";
39         public static final String AGING_PROPERTY = PREFIX + "lock.aging";
40         public static final String HEARTBEAT_INTERVAL_PROPERTY = PREFIX + "heartbeat.interval";
41         
42         /**
43      * Properties from which this was constructed.
44      */
45     private Properties source;
46
47     /**
48      * Database driver
49      */
50     @Property(name = DB_DRIVER)
51     private String dbDriver;
52     
53     /**
54      * Database url
55      */
56     @Property(name = DB_URL)
57     private String dbUrl;
58     
59     /**
60      * Database user
61      */
62     @Property(name = DB_USER)
63     private String dbUser;
64     
65     /**
66      * Database password
67      */
68     @Property(name = DB_PWD)
69     private String dbPwd;
70     
71     /**
72      * Used to set expiration time for lock.
73      */
74     @Property(name = AGING_PROPERTY, defaultValue = "300000")
75     private long agingProperty;
76     
77     /**
78      * Indicates intervals at which we refresh locks.
79      */
80     @Property(name = HEARTBEAT_INTERVAL_PROPERTY, defaultValue = "60000")
81     private long heartBeatIntervalProperty;
82
83     public DistributedLockingProperties(Properties props) throws PropertyException {
84         super(props);
85         source = props;
86     }
87
88
89         public Properties getSource() {
90                 return source;
91         }
92
93
94         public String getDbDriver() {
95                 return dbDriver;
96         }
97
98
99         public String getDbUrl() {
100                 return dbUrl;
101         }
102
103
104         public String getDbUser() {
105                 return dbUser;
106         }
107
108
109         public String getDbPwd() {
110                 return dbPwd;
111         }
112
113
114         public long getAgingProperty() {
115                 return agingProperty;
116         }
117
118
119         public long getHeartBeatIntervalProperty() {
120                 return heartBeatIntervalProperty;
121         }
122
123 }