Revision 4698
Added by daigle over 15 years ago
ReplicationHandler.java | ||
---|---|---|
28 | 28 |
|
29 | 29 |
import edu.ucsb.nceas.metacat.service.DatabaseService; |
30 | 30 |
import edu.ucsb.nceas.metacat.service.PropertyService; |
31 |
import edu.ucsb.nceas.metacat.util.MetaCatUtil;
|
|
31 |
import edu.ucsb.nceas.metacat.util.MetacatUtil;
|
|
32 | 32 |
import edu.ucsb.nceas.utilities.PropertyNotFoundException; |
33 | 33 |
|
34 | 34 |
import java.sql.*; |
... | ... | |
64 | 64 |
int serverCheckCode = 1; |
65 | 65 |
ReplicationServerList serverList = null; |
66 | 66 |
//PrintWriter out; |
67 |
// private static final AbstractDatabase dbAdapter = MetaCatUtil.dbAdapter;
|
|
67 |
// private static final AbstractDatabase dbAdapter = MetacatUtil.dbAdapter;
|
|
68 | 68 |
private static Logger logMetacat = Logger.getLogger(ReplicationHandler.class); |
69 | 69 |
private static int DOCINSERTNUMBER = 1; |
70 | 70 |
private static int DOCERRORNUMBER = 1; |
... | ... | |
154 | 154 |
try |
155 | 155 |
{ |
156 | 156 |
u = new URL("https://" + server + "?server=" |
157 |
+MetaCatUtil.getLocalReplicationServerName()+"&action=update");
|
|
157 |
+MetacatUtil.getLocalReplicationServerName()+"&action=update");
|
|
158 | 158 |
logMetacat.info("Sending infomation " +u.toString()); |
159 | 159 |
result = MetacatReplication.getURLContent(u); |
160 | 160 |
} |
... | ... | |
298 | 298 |
serialNumber=dbConn.getCheckOutSerialNumber(); |
299 | 299 |
//if the document needs to be updated or inserted, this is executed |
300 | 300 |
String readDocURLString = "https://" + remoteserver + "?server="+ |
301 |
MetaCatUtil.getLocalReplicationServerName()+"&action=read&docid="+accNumber;
|
|
302 |
readDocURLString = MetaCatUtil.replaceWhiteSpaceForURL(readDocURLString);
|
|
301 |
MetacatUtil.getLocalReplicationServerName()+"&action=read&docid="+accNumber;
|
|
302 |
readDocURLString = MetacatUtil.replaceWhiteSpaceForURL(readDocURLString);
|
|
303 | 303 |
URL u = new URL(readDocURLString); |
304 | 304 |
|
305 | 305 |
// Get docid content |
... | ... | |
316 | 316 |
DocInfoHandler dih = new DocInfoHandler(); |
317 | 317 |
XMLReader docinfoParser = initParser(dih); |
318 | 318 |
String docInfoURLStr = "https://" + remoteserver + |
319 |
"?server="+MetaCatUtil.getLocalReplicationServerName()+
|
|
319 |
"?server="+MetacatUtil.getLocalReplicationServerName()+
|
|
320 | 320 |
"&action=getdocumentinfo&docid="+accNumber; |
321 |
docInfoURLStr = MetaCatUtil.replaceWhiteSpaceForURL(docInfoURLStr);
|
|
321 |
docInfoURLStr = MetacatUtil.replaceWhiteSpaceForURL(docInfoURLStr);
|
|
322 | 322 |
URL docinfoUrl = new URL(docInfoURLStr); |
323 | 323 |
logMetacat.info("Sending message: " + |
324 | 324 |
docinfoUrl.toString()); |
... | ... | |
446 | 446 |
DocInfoHandler dih = new DocInfoHandler(); |
447 | 447 |
XMLReader docinfoParser = initParser(dih); |
448 | 448 |
String docInfoURLString = "https://" + remoteserver + |
449 |
"?server="+MetaCatUtil.getLocalReplicationServerName()+
|
|
449 |
"?server="+MetacatUtil.getLocalReplicationServerName()+
|
|
450 | 450 |
"&action=getdocumentinfo&docid="+accNumber; |
451 |
docInfoURLString = MetaCatUtil.replaceWhiteSpaceForURL(docInfoURLString);
|
|
451 |
docInfoURLString = MetacatUtil.replaceWhiteSpaceForURL(docInfoURLString);
|
|
452 | 452 |
URL docinfoUrl = new URL(docInfoURLString); |
453 | 453 |
|
454 | 454 |
String docInfoStr = MetacatReplication.getURLContent(docinfoUrl); |
... | ... | |
473 | 473 |
String datafilePath = PropertyService.getProperty("application.datafilepath"); |
474 | 474 |
// Get data file content |
475 | 475 |
String readDataURLString = "https://" + remoteserver + "?server="+ |
476 |
MetaCatUtil.getLocalReplicationServerName()+
|
|
476 |
MetacatUtil.getLocalReplicationServerName()+
|
|
477 | 477 |
"&action=readdata&docid="+accNumber; |
478 |
readDataURLString = MetaCatUtil.replaceWhiteSpaceForURL(readDataURLString);
|
|
478 |
readDataURLString = MetacatUtil.replaceWhiteSpaceForURL(readDataURLString);
|
|
479 | 479 |
URL u = new URL(readDataURLString); |
480 | 480 |
InputStream input = u.openStream(); |
481 | 481 |
//register data file into xml_documents table and wite data file |
... | ... | |
625 | 625 |
logMetacat.info("Try to update last_check for server: "+server); |
626 | 626 |
// Get time from remote server |
627 | 627 |
URL dateurl = new URL("https://" + server + "?server="+ |
628 |
MetaCatUtil.getLocalReplicationServerName()+"&action=gettime");
|
|
628 |
MetacatUtil.getLocalReplicationServerName()+"&action=gettime");
|
|
629 | 629 |
String datexml = MetacatReplication.getURLContent(dateurl); |
630 | 630 |
logMetacat.info("datexml: "+datexml); |
631 | 631 |
if (datexml!=null && !datexml.equals("")) |
... | ... | |
698 | 698 |
server = replServer.getServerName(); |
699 | 699 |
// Try to get catalog |
700 | 700 |
URL u = new URL("https://" + server + "?server="+ |
701 |
MetaCatUtil.getLocalReplicationServerName()+"&action=getcatalog");
|
|
701 |
MetacatUtil.getLocalReplicationServerName()+"&action=getcatalog");
|
|
702 | 702 |
logMetacat.info("sending message " + u.toString()); |
703 | 703 |
String catxml = MetacatReplication.getURLContent(u); |
704 | 704 |
|
Also available in: Unified diff
Renamed MetaCatUtil to MetacatUtil