equal
deleted
inserted
replaced
30 * @author Ing. František Kučera (frantovo.cz) |
30 * @author Ing. František Kučera (frantovo.cz) |
31 */ |
31 */ |
32 public class DatabaseDefinition implements NameIdentified { |
32 public class DatabaseDefinition implements NameIdentified { |
33 |
33 |
34 private static final Logger log = Logger.getLogger(DatabaseDefinition.class.getName()); |
34 private static final Logger log = Logger.getLogger(DatabaseDefinition.class.getName()); |
|
35 /** |
|
36 * database name in SQL-DK configuration |
|
37 */ |
35 private String name; |
38 private String name; |
|
39 /** |
|
40 * JDBC URL |
|
41 */ |
36 private String url; |
42 private String url; |
|
43 /** |
|
44 * JDBC user name |
|
45 */ |
37 private String userName; |
46 private String userName; |
|
47 /** |
|
48 * JDBC password |
|
49 */ |
38 private String password; |
50 private String password; |
|
51 /** |
|
52 * optional JDBC driver – if empty, the DriverManager is used to lookup specific Driver for |
|
53 * given URL |
|
54 */ |
|
55 private String driver; |
|
56 /** |
|
57 * JDBC properties |
|
58 */ |
39 private Properties properties = new Properties(); |
59 private Properties properties = new Properties(); |
40 |
60 |
41 @XmlElement(name = "name", namespace = CONFIGURATION) |
61 @XmlElement(name = "name", namespace = CONFIGURATION) |
42 @Override |
62 @Override |
43 public String getName() { |
63 public String getName() { |
73 |
93 |
74 public void setPassword(String password) { |
94 public void setPassword(String password) { |
75 this.password = password; |
95 this.password = password; |
76 } |
96 } |
77 |
97 |
|
98 public String getDriver() { |
|
99 return driver; |
|
100 } |
|
101 |
|
102 public void setDriver(String driver) { |
|
103 this.driver = driver; |
|
104 } |
|
105 |
78 @XmlElement(name = "property", namespace = CONFIGURATION) |
106 @XmlElement(name = "property", namespace = CONFIGURATION) |
79 public Properties getProperties() { |
107 public Properties getProperties() { |
80 return properties; |
108 return properties; |
81 } |
109 } |
82 |
110 |
85 } |
113 } |
86 |
114 |
87 /** |
115 /** |
88 * @param properties ad-hoc properties from CLI options (for the JDBC driver) |
116 * @param properties ad-hoc properties from CLI options (for the JDBC driver) |
89 * @param jmxBean JMX management bean for progress reporting | null = disable JMX |
117 * @param jmxBean JMX management bean for progress reporting | null = disable JMX |
90 * @return |
118 * @return |
91 * @throws java.sql.SQLException |
119 * @throws java.sql.SQLException |
92 */ |
120 */ |
93 public DatabaseConnection connect(Properties properties, ConnectionManagement jmxBean) throws SQLException { |
121 public DatabaseConnection connect(Properties properties, ConnectionManagement jmxBean) throws SQLException { |
94 return new DatabaseConnection(this, properties, jmxBean); |
122 return new DatabaseConnection(this, properties, jmxBean); |
95 } |
123 } |
96 |
124 |
97 /** |
125 /** |
98 * @param properties |
126 * @param properties |
99 * @return |
127 * @return |
100 * @throws java.sql.SQLException |
128 * @throws java.sql.SQLException |
101 * @see #connect(info.globalcode.sql.dk.configuration.Properties, java.lang.String) |
129 * @see #connect(info.globalcode.sql.dk.configuration.Properties, java.lang.String) |
102 * With disabled JMX reporting. |
130 * With disabled JMX reporting. |
103 */ |
131 */ |
104 public DatabaseConnection connect(Properties properties) throws SQLException { |
132 public DatabaseConnection connect(Properties properties) throws SQLException { |