Project

General

Profile

« Previous | Next » 

Revision 3234

Added by Jing Tao almost 17 years ago

Add event log for timed replication.

View differences:

src/edu/ucsb/nceas/metacat/ReplicationHandler.java
374 374
                      remoteserver);
375 375
          REVINSERTNUMBER++;
376 376
      }
377
      String ip = getIpFromURL(u);
378
      EventLog.getInstance().log(ip, MetacatReplication.REPLICATIONUSER, accNumber, actions);
377 379
      
378 380

  
379 381
    }//try
......
490 492
                        remoteserver);
491 493
            REVINSERTNUMBER++;
492 494
        }
495
        String ip = getIpFromURL(u);
496
        EventLog.getInstance().log(ip, MetacatReplication.REPLICATIONUSER, accNumber, actions);
493 497
        
494 498
      }//if
495 499
      else
......
553 557
         DocumentImpl.delete(accnum, null, null, notifyServer);
554 558
         logMetacat.info("Successfully deleted doc " + docId);
555 559
         MetacatReplication.replLog("Doc " + docId + " deleted");
560
         URL u = new URL("https://"+notifyServer);
561
         String ip = getIpFromURL(u);
562
         EventLog.getInstance().log(ip, MetacatReplication.REPLICATIONUSER, docId, "delete");
556 563
      }
557 564

  
558 565
    }//try
......
1204 1211

  
1205 1212
       }//for datafile
1206 1213
   }
1214
   
1215
   /*
1216
    * Return a ip address for given url
1217
    */
1218
   private String getIpFromURL(URL url)
1219
   {
1220
	   String ip = null;
1221
	   try
1222
	   {
1223
	      InetAddress address = InetAddress.getByName(url.getHost());
1224
	      ip = address.getHostAddress();
1225
	   }
1226
	   catch(UnknownHostException e)
1227
	   {
1228
		   logMetacat.error("Error in get ip address for host: "
1229
                   +e.getMessage());
1230
	   }
1231

  
1232
	   return ip;
1233
   }
1207 1234
  
1208 1235
}
1209 1236

  

Also available in: Unified diff