Revision 4698
Added by daigle over 15 years ago
MetacatReplication.java | ||
---|---|---|
40 | 40 |
import edu.ucsb.nceas.metacat.service.PropertyService; |
41 | 41 |
import edu.ucsb.nceas.metacat.service.SessionService; |
42 | 42 |
import edu.ucsb.nceas.metacat.util.AuthUtil; |
43 |
import edu.ucsb.nceas.metacat.util.MetaCatUtil;
|
|
43 |
import edu.ucsb.nceas.metacat.util.MetacatUtil;
|
|
44 | 44 |
import edu.ucsb.nceas.metacat.util.SessionData; |
45 | 45 |
import edu.ucsb.nceas.metacat.util.SystemUtil; |
46 | 46 |
import edu.ucsb.nceas.utilities.FileUtil; |
... | ... | |
626 | 626 |
logMetacat.info("Force replication action: "+dbaction); |
627 | 627 |
// sending back read request to remote server |
628 | 628 |
URL u = new URL("https://" + server + "?server=" |
629 |
+MetaCatUtil.getLocalReplicationServerName()
|
|
629 |
+MetacatUtil.getLocalReplicationServerName()
|
|
630 | 630 |
+"&action=read&docid=" + docid); |
631 | 631 |
String xmldoc = MetacatReplication.getURLContent(u); |
632 | 632 |
|
633 | 633 |
// get the document info from server |
634 | 634 |
URL docinfourl = new URL("https://" + server + |
635 |
"?server="+MetaCatUtil.getLocalReplicationServerName()
|
|
635 |
"?server="+MetacatUtil.getLocalReplicationServerName()
|
|
636 | 636 |
+"&action=getdocumentinfo&docid=" + docid); |
637 | 637 |
|
638 | 638 |
String docInfoStr = MetacatReplication.getURLContent(docinfourl); |
... | ... | |
793 | 793 |
try |
794 | 794 |
{ |
795 | 795 |
//docid was switch to two parts uinque code and rev |
796 |
//String uniqueCode=MetaCatUtil.getDocIdFromString(docid);
|
|
797 |
//int rev=MetaCatUtil.getVersionFromString(docid);
|
|
796 |
//String uniqueCode=MetacatUtil.getDocIdFromString(docid);
|
|
797 |
//int rev=MetacatUtil.getVersionFromString(docid);
|
|
798 | 798 |
if(params.containsKey("dbaction")) |
799 | 799 |
{ |
800 | 800 |
dbaction = ((String[])params.get("dbaction"))[0]; |
... | ... | |
810 | 810 |
logMetacat.info("Force replication action: "+dbaction); |
811 | 811 |
// get the document info from server |
812 | 812 |
URL docinfourl = new URL("https://" + server + |
813 |
"?server="+MetaCatUtil.getLocalReplicationServerName()
|
|
813 |
"?server="+MetacatUtil.getLocalReplicationServerName()
|
|
814 | 814 |
+"&action=getdocumentinfo&docid=" + docid); |
815 | 815 |
|
816 | 816 |
String docInfoStr = MetacatReplication.getURLContent(docinfourl); |
... | ... | |
849 | 849 |
//Get data file and store it into local file system. |
850 | 850 |
// sending back readdata request to server |
851 | 851 |
URL url = new URL("https://" + server + "?server=" |
852 |
+MetaCatUtil.getLocalReplicationServerName()
|
|
852 |
+MetacatUtil.getLocalReplicationServerName()
|
|
853 | 853 |
+"&action=readdata&docid=" + docid); |
854 | 854 |
String datafilePath = PropertyService.getProperty("application.datafilepath"); |
855 | 855 |
|
... | ... | |
1041 | 1041 |
filepath = PropertyService.getProperty("application.datafilepath"); |
1042 | 1042 |
String server = params.get("server")[0]; |
1043 | 1043 |
URL u = new URL("https://" + server + "?server=" |
1044 |
+MetaCatUtil.getLocalReplicationServerName()
|
|
1044 |
+MetacatUtil.getLocalReplicationServerName()
|
|
1045 | 1045 |
+"&action=test"); |
1046 | 1046 |
String test = MetacatReplication.getURLContent(u); |
1047 | 1047 |
//couldn't pass the test |
... | ... | |
1146 | 1146 |
//in the key store, this is security issue |
1147 | 1147 |
String server = params.get("server")[0]; |
1148 | 1148 |
URL u = new URL("https://" + server + "?server=" |
1149 |
+MetaCatUtil.getLocalReplicationServerName()
|
|
1149 |
+MetacatUtil.getLocalReplicationServerName()
|
|
1150 | 1150 |
+"&action=test"); |
1151 | 1151 |
String test = MetacatReplication.getURLContent(u); |
1152 | 1152 |
//couldn't pass the test |
... | ... | |
1242 | 1242 |
//try to open a https stream to test if the request server's public key |
1243 | 1243 |
//in the key store, this is security issue |
1244 | 1244 |
URL u = new URL("https://" + server + "?server=" |
1245 |
+MetaCatUtil.getLocalReplicationServerName()
|
|
1245 |
+MetacatUtil.getLocalReplicationServerName()
|
|
1246 | 1246 |
+"&action=test"); |
1247 | 1247 |
String test = MetacatReplication.getURLContent(u); |
1248 | 1248 |
//couldn't pass the test |
... | ... | |
1278 | 1278 |
|
1279 | 1279 |
// Append local server's name and replication servlet to doclist |
1280 | 1280 |
doclist.append("<?xml version=\"1.0\"?><replication>"); |
1281 |
doclist.append("<server>").append(MetaCatUtil.getLocalReplicationServerName());
|
|
1281 |
doclist.append("<server>").append(MetacatUtil.getLocalReplicationServerName());
|
|
1282 | 1282 |
//doclist.append(util.getProperty("replicationpath")); |
1283 | 1283 |
doclist.append("</server><updates>"); |
1284 | 1284 |
|
... | ... | |
1325 | 1325 |
while(tablehasrows) |
1326 | 1326 |
{ |
1327 | 1327 |
String recordDoctype = rs.getString(3); |
1328 |
Vector<String> packagedoctypes = MetaCatUtil.getOptionList(
|
|
1328 |
Vector<String> packagedoctypes = MetacatUtil.getOptionList(
|
|
1329 | 1329 |
PropertyService.getProperty("xml.packagedoctype")); |
1330 | 1330 |
//if this is a package file, put it at the end |
1331 | 1331 |
//because if a package file is read before all of the files it |
... | ... | |
1373 | 1373 |
String recordDoctype = rs.getString(3); |
1374 | 1374 |
if(!recordDoctype.equals("BIN")) |
1375 | 1375 |
{ //don't replicate data files |
1376 |
Vector<String> packagedoctypes = MetaCatUtil.getOptionList(
|
|
1376 |
Vector<String> packagedoctypes = MetacatUtil.getOptionList(
|
|
1377 | 1377 |
PropertyService.getProperty("xml.packagedoctype")); |
1378 | 1378 |
if(recordDoctype != null && !packagedoctypes.contains(recordDoctype)) |
1379 | 1379 |
{ //if this is a package file, put it at the end |
... | ... | |
1777 | 1777 |
Hashtable<String,String> sl = new Hashtable<String,String>(); |
1778 | 1778 |
DBConnection dbConn = null; |
1779 | 1779 |
int serialNumber = -1; |
1780 |
docId=MetaCatUtil.getDocIdFromString(docId);
|
|
1780 |
docId=MetacatUtil.getDocIdFromString(docId);
|
|
1781 | 1781 |
PreparedStatement pstmt=null; |
1782 | 1782 |
int serverLocation; |
1783 | 1783 |
try |
... | ... | |
1868 | 1868 |
int serialNumber = -1; |
1869 | 1869 |
PreparedStatement pstmt = null; |
1870 | 1870 |
int serverCode = 1; |
1871 |
String docId=MetaCatUtil.getDocIdFromString(accNum);
|
|
1871 |
String docId=MetacatUtil.getDocIdFromString(accNum);
|
|
1872 | 1872 |
|
1873 | 1873 |
try |
1874 | 1874 |
{ |
Also available in: Unified diff
Renamed MetaCatUtil to MetacatUtil