0ed5930dd814a25032ab435f514f3dc646cf2e77
[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
21 package org.onap.policy.distributed.locking;
22
23 import java.util.Properties;
24 import org.onap.policy.common.utils.properties.BeanConfigurator;
25 import org.onap.policy.common.utils.properties.Property;
26 import org.onap.policy.common.utils.properties.exception.PropertyException;
27
28
29 public class DistributedLockingProperties {
30
31     /**
32      * Feature properties all begin with this prefix.
33      */
34     public static final String PREFIX = "distributed.locking.";
35
36     public static final String DB_DRIVER = "javax.persistence.jdbc.driver";
37     public static final String DB_URL = "javax.persistence.jdbc.url";
38     public static final String DB_USER = "javax.persistence.jdbc.user";
39     public static final String DB_PWD = "javax.persistence.jdbc.password";
40
41     /**
42      * Properties from which this was constructed.
43      */
44     private final 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      * Constructs the object, populating fields from the properties.
72      *
73      * @param props properties from which to configure this
74      * @throws PropertyException if an error occurs
75      */
76     public DistributedLockingProperties(Properties props) throws PropertyException {
77         source = props;
78
79         new BeanConfigurator().configureFromProperties(this, props);
80     }
81
82
83     public Properties getSource() {
84         return source;
85     }
86
87
88     public String getDbDriver() {
89         return dbDriver;
90     }
91
92
93     public String getDbUrl() {
94         return dbUrl;
95     }
96
97
98     public String getDbUser() {
99         return dbUser;
100     }
101
102
103     public String getDbPwd() {
104         return dbPwd;
105     }
106
107
108     public void setDbDriver(String dbDriver) {
109         this.dbDriver = dbDriver;
110     }
111
112
113     public void setDbUrl(String dbUrl) {
114         this.dbUrl = dbUrl;
115     }
116
117
118     public void setDbUser(String dbUser) {
119         this.dbUser = dbUser;
120     }
121
122
123     public void setDbPwd(String dbPwd) {
124         this.dbPwd = dbPwd;
125     }
126
127 }