Project

General

Profile

« Previous | Next » 

Revision 1015

Added by Jing Tao over 22 years ago

Fixed the bug that handle force replication

View differences:

src/edu/ucsb/nceas/metacat/ReplicationHandler.java
195 195
        server = (String)(keys.nextElement());
196 196
        MetacatReplication.replLog("full update started to: " + server);
197 197
        u = new URL("https://" + server + "?server="
198
        +getLocalReplicationServerName()+"&action=update");
198
        +util.getLocalReplicationServerName()+"&action=update");
199 199
        //System.out.println("Sending Message: " + u.toString());
200 200
        String result = MetacatReplication.getURLContent(u);
201 201
        responses.add(result);
......
255 255
          if(flag)
256 256
          { //if the document needs to be updated or inserted, this is executed
257 257
            u = new URL("https://" + docServer + "?server="+
258
                  getLocalReplicationServerName()+"&action=read&docid="+docid);
258
              util.getLocalReplicationServerName()+"&action=read&docid="+docid);
259 259
            //System.out.println("Sending message: " + u.toString());
260 260
            String newxmldoc = MetacatReplication.getURLContent(u);
261 261
            DocInfoHandler dih = new DocInfoHandler();
262 262
            XMLReader docinfoParser = initParser(dih);
263 263
            URL docinfoUrl = new URL("https://" + docServer + 
264
                  "?server="+getLocalReplicationServerName()+
264
                  "?server="+util.getLocalReplicationServerName()+
265 265
                  "&action=getdocumentinfo&docid="+docid);
266 266
            //System.out.println("Sending message: " + docinfoUrl.toString());
267 267
            String docInfoStr = MetacatReplication.getURLContent(docinfoUrl);
......
317 317
        {
318 318
          server = (String)(keys.nextElement()); 
319 319
          URL dateurl = new URL("https://" + server + "?server="+
320
          getLocalReplicationServerName()+"&action=gettime");
320
          util.getLocalReplicationServerName()+"&action=gettime");
321 321
          String datexml = MetacatReplication.getURLContent(dateurl);
322 322
          String datestr = datexml.substring(11, datexml.indexOf('<', 11));
323 323
          StringBuffer sql = new StringBuffer();
......
389 389
      { //go through each server
390 390
        server = (String)(keys.nextElement());
391 391
        URL u = new URL("https://" + server + "?server="+
392
        getLocalReplicationServerName()+"&action=getcatalog");
393
        System.out.println("sending message " + u.toString());
392
        util.getLocalReplicationServerName()+"&action=getcatalog");
393
        //System.out.println("sending message " + u.toString());
394 394
        String catxml = MetacatReplication.getURLContent(u);
395 395
        //System.out.println("catxml: " + catxml);
396 396
        CatalogMessageHandler cmh = new CatalogMessageHandler();
......
636 636
    return parser;
637 637
  }
638 638
  
639
  /**
640
   * Method to get the name of local replication server
641
   */
642
   private String getLocalReplicationServerName()
643
   {
644
     String replicationServerName=null;
645
     String serverHost=null;
646
     serverHost=util.getOption("server");
647
     // append "context/servelet/replication" to the host name
648
     replicationServerName=serverHost+"/"+util.getOption("context")+
649
                                            "/servlet/replication";
650
     return replicationServerName;
651
       
652
   }
639
 
653 640
}
654 641
   

Also available in: Unified diff