Revision 5151
Added by daigle almost 15 years ago
src/edu/ucsb/nceas/metacat/replication/ReplicationService.java | ||
---|---|---|
277 | 277 |
//Get hub value |
278 | 278 |
hub = ((String[]) params.get("hub"))[0]; |
279 | 279 |
|
280 |
/*pstmt = dbConn.prepareStatement("INSERT INTO xml_replication " + |
|
281 |
"(server, last_checked, replicate, datareplicate, hub) " + |
|
282 |
"VALUES ('" + server + "', to_date(" + |
|
283 |
"'01/01/00', 'MM/DD/YY'), '" + |
|
284 |
replicate +"', '" +dataReplicate+"', '" |
|
285 |
+ hub +"')");*/ |
|
286 |
pstmt = dbConn.prepareStatement("INSERT INTO xml_replication " |
|
280 |
String toDateSql = DatabaseService.getDBAdapter().toDate("01/01/1980","MM/DD/YYYY"); |
|
281 |
String sql = "INSERT INTO xml_replication " |
|
287 | 282 |
+ "(server, last_checked, replicate, datareplicate, hub) " |
288 |
+ "VALUES ('" |
|
289 |
+ server |
|
290 |
+ "', " |
|
291 |
+ DatabaseService.getDBAdapter().toDate("01/01/1980", |
|
292 |
"MM/DD/YYYY") + ", '" + replicate + "', '" |
|
293 |
+ dataReplicate + "', '" + hub + "')"); |
|
294 |
|
|
283 |
+ "VALUES (?," + toDateSql + ",?,?,?)"; |
|
284 |
|
|
285 |
pstmt = dbConn.prepareStatement(sql); |
|
286 |
|
|
287 |
pstmt.setString(1, server); |
|
288 |
pstmt.setInt(2, Integer.parseInt(replicate)); |
|
289 |
pstmt.setInt(3, Integer.parseInt(dataReplicate)); |
|
290 |
pstmt.setInt(4, Integer.parseInt(hub)); |
|
291 |
|
|
292 |
String sqlReport = "XMLAccessAccess.getXMLAccessForDoc - SQL: " + sql; |
|
293 |
sqlReport += " [" + server + "," + replicate + |
|
294 |
"," + dataReplicate + "," + hub + "]"; |
|
295 |
|
|
296 |
logMetacat.info(sqlReport); |
|
297 |
|
|
295 | 298 |
pstmt.execute(); |
296 | 299 |
pstmt.close(); |
297 | 300 |
dbConn.commit(); |
... | ... | |
323 | 326 |
// download certificate with the public key on this server |
324 | 327 |
// and import it as a trusted certificate |
325 | 328 |
String certURL = ((String[]) params.get("certificate"))[0]; |
326 |
downloadCertificate(certURL); |
|
329 |
if (certURL != null && !certURL.equals("")) { |
|
330 |
downloadCertificate(certURL); |
|
331 |
} |
|
327 | 332 |
|
328 | 333 |
// delete server from server list |
329 | 334 |
} else if (subaction.equals("delete")) { |
Also available in: Unified diff
Change add sql to use a prepared statement. Only try to download a cert if a url was provided.