Example #1
0
 // ---------------------------------------------------------
 // for "SrvReg"
 // add a new entry of service registration to the database
 // or replace/update its previous registration
 // ---------------------------------------------------------
 public synchronized int addEntry(
     boolean deleted,
     String ltag,
     String type,
     String url,
     int lifetime,
     String scope,
     String attr,
     int reg_flag,
     long versionTS,
     long arrivalTS,
     String acceptDA,
     long acceptTS) {
   if (!table.containsKey(ltag + url)) {
     if ((reg_flag & Const.fresh_flag) == 0) { // incermental SrvReg
       return Const.INVALID_UPDATE;
     }
     table.put(ltag + url, new Entry());
   }
   Entry e = (Entry) table.get(ltag + url);
   return e.update(
       deleted, ltag, url, type, lifetime, scope, attr, reg_flag, versionTS, arrivalTS, acceptDA,
       acceptTS);
 }