Commit in hps-java/src/main/java/org/lcsim/hps/conditions on MAIN | |||
ConnectionParameters.java | +19 | -10 | 1.3 -> 1.4 |
add name of conditions table to config
diff -u -r1.3 -r1.4 --- ConnectionParameters.java 18 Sep 2013 21:02:38 -0000 1.3 +++ ConnectionParameters.java 19 Sep 2013 01:27:44 -0000 1.4 @@ -11,7 +11,7 @@
* return a Connection object based on these parameters. * * @author jeremym
- * @version $Id: ConnectionParameters.java,v 1.3 2013/09/18 21:02:38 jeremy Exp $
+ * @version $Id: ConnectionParameters.java,v 1.4 2013/09/19 01:27:44 jeremy Exp $
*/ public final class ConnectionParameters {
@@ -21,6 +21,7 @@
private int port = 3306; private String hostname = "mysql-node03.slac.stanford.edu"; private String database = "rd_hps_cond";
+ private String conditionsTable = "conditions_test";
/** * No argument constructor that uses the defaults.
@@ -35,12 +36,13 @@
* @param hostname The hostname. * @param port The port number. */
- ConnectionParameters(String user, String password, String database, String hostname, int port) {
+ ConnectionParameters(String user, String password, String database, String hostname, int port, String conditionsTable) {
this.user = user; this.password = password; this.database = database; this.hostname = hostname; this.port = port;
+ this.conditionsTable = conditionsTable;
} /**
@@ -87,6 +89,13 @@
} /**
+ * Get the name of the conditions data table. + */ + public String getConditionsTable() { + return conditionsTable; + } + + /**
* Create a database connection from these parameters. * The caller is responsible for closing it when finished. * @return The Connection object.
@@ -107,13 +116,13 @@
* @param properties The properties file. * @return The ConnectionParameters created from the properties file. */
- public static final ConnectionParameters fromProperties(Properties properties) - { - String user = properties.get("hps.conditions.db.user").toString(); - String password = properties.getProperty("hps.conditions.db.password").toString(); - String database = properties.getProperty("hps.conditions.db.database").toString(); - String hostname = properties.getProperty("hps.conditions.db.hostname").toString(); - int port = Integer.parseInt(properties.getProperty("hps.conditions.db.port").toString()); - return new ConnectionParameters(user, password, database, hostname, port);
+ public static final ConnectionParameters fromProperties(Properties properties) { + String user = properties.get("user").toString(); + String password = properties.getProperty("password").toString(); + String database = properties.getProperty("database").toString(); + String hostname = properties.getProperty("hostname").toString(); + int port = Integer.parseInt(properties.getProperty("port").toString()); + String conditionsTable = properties.getProperty("conditionsTable").toString(); + return new ConnectionParameters(user, password, database, hostname, port, conditionsTable);
} }
\ No newline at end of file
Use REPLY-ALL to reply to list
To unsubscribe from the LCD-CVS list, click the following link:
https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=LCD-CVS&A=1