java/sql-dk/src/info/globalcode/sql/dk/configuration/DatabaseDefinition.java
branchv_0
changeset 179 236332caeb29
parent 155 eb3676c6929b
child 184 53fb05ce504c
equal deleted inserted replaced
178:5a5fc66f11b1 179:236332caeb29
    17  */
    17  */
    18 package info.globalcode.sql.dk.configuration;
    18 package info.globalcode.sql.dk.configuration;
    19 
    19 
    20 import static info.globalcode.sql.dk.Xmlns.CONFIGURATION;
    20 import static info.globalcode.sql.dk.Xmlns.CONFIGURATION;
    21 import info.globalcode.sql.dk.DatabaseConnection;
    21 import info.globalcode.sql.dk.DatabaseConnection;
       
    22 import info.globalcode.sql.dk.jmx.ConnectionManagement;
       
    23 import java.lang.management.ManagementFactory;
    22 import java.sql.SQLException;
    24 import java.sql.SQLException;
       
    25 import java.util.Hashtable;
       
    26 import java.util.logging.Level;
       
    27 import java.util.logging.Logger;
       
    28 import javax.management.MBeanServer;
       
    29 import javax.management.ObjectName;
    23 import javax.xml.bind.annotation.XmlElement;
    30 import javax.xml.bind.annotation.XmlElement;
    24 
    31 
    25 /**
    32 /**
    26  * Configured (but not yet connected) database connection.
    33  * Configured (but not yet connected) database connection.
    27  *
    34  *
    28  * @author Ing. František Kučera (frantovo.cz)
    35  * @author Ing. František Kučera (frantovo.cz)
    29  */
    36  */
    30 public class DatabaseDefinition implements NameIdentified {
    37 public class DatabaseDefinition implements NameIdentified {
    31 
    38 
       
    39 	private static final Logger log = Logger.getLogger(DatabaseDefinition.class.getName());
    32 	private String name;
    40 	private String name;
    33 	private String url;
    41 	private String url;
    34 	private String userName;
    42 	private String userName;
    35 	private String password;
    43 	private String password;
    36 	private Properties properties = new Properties();
    44 	private Properties properties = new Properties();
    81 		this.properties = properties;
    89 		this.properties = properties;
    82 	}
    90 	}
    83 
    91 
    84 	/**
    92 	/**
    85 	 * @param properties ad-hoc properties from CLI options (for the JDBC driver)
    93 	 * @param properties ad-hoc properties from CLI options (for the JDBC driver)
       
    94 	 * @param jmxBean JMX management bean for progress reporting | null = disable JMX
       
    95 	 */
       
    96 	public DatabaseConnection connect(Properties properties, ConnectionManagement jmxBean) throws SQLException {
       
    97 		return new DatabaseConnection(this, properties, jmxBean);
       
    98 	}
       
    99 
       
   100 	/**
       
   101 	 * @see #connect(info.globalcode.sql.dk.configuration.Properties, java.lang.String)
       
   102 	 * With disabled JMX reporting.
    86 	 */
   103 	 */
    87 	public DatabaseConnection connect(Properties properties) throws SQLException {
   104 	public DatabaseConnection connect(Properties properties) throws SQLException {
    88 		return new DatabaseConnection(this, properties);
   105 		return new DatabaseConnection(this, properties, null);
    89 	}
   106 	}
    90 }
   107 }