コード例 #1
0
 @Override
 public void Cmd_run() {
   Init_bldr_bmks();
   this.time_bgn = System_.Ticks();
   int total_pending = Xob_xfer_regy_tbl.Select_total_pending(bldr_conn);
   // if (total_pending > 250000 && src_bin_mgr__fsdb_version == null)
   usr_dlg.Note_many("", "", "total pending: ~{0}", total_pending);
   List_adp list = List_adp_.New();
   boolean loop = true;
   while (loop) {
     byte rslt = Select_fsdb_itms(list);
     switch (rslt) {
       case Select_rv_stop:
         if (bin_db_mgr.Tier_id_is_last(tier_id_val)) loop = false;
         else {
           ++tier_id_val;
           page_id_val = 0;
           continue;
         }
         break;
       case Select_rv_next_page:
         ++page_id_val;
         lnki_id_val = 0;
         continue;
       case Select_rv_process:
         break;
     }
     if (!loop) break; // no more ttls found
     int len = list.Count();
     usr_dlg.Prog_many("", "", "fetched pages: ~{0}", len);
     for (int i = 0; i < len; ++i) {
       Xodb_tbl_oimg_xfer_itm fsdb = (Xodb_tbl_oimg_xfer_itm) list.Get_at(i);
       Download_itm(fsdb);
       if (exit_now
           || exec_count >= exec_count_max
           || exec_fail >= exec_fail_max
           || page_id_val >= page_id_end) {
         this.Txn_sav();
         return;
       }
     }
   }
   exec_done = true;
 }
コード例 #2
0
 public void Fsdb_search_by_list(
     List_adp itms, Xow_wiki cur_wiki, Xoa_page page, Xog_js_wkr js_wkr) {
   if (!fsdb_enabled) return;
   int len = itms.Count();
   Gfo_usr_dlg usr_dlg = Gfo_usr_dlg_.Instance;
   Xow_wiki wiki = page.Commons_mgr().Source_wiki_or(cur_wiki);
   Xou_cache_mgr cache_mgr = wiki.App().User().User_db_mgr().Cache_mgr();
   for (int i = 0; i < len; i++) {
     if (usr_dlg.Canceled()) return;
     Xof_fsdb_itm fsdb = (Xof_fsdb_itm) itms.Get_at(i);
     if (fsdb.Hdump_mode() == Xof_fsdb_itm.Hdump_mode__null) {
       Xof_orig_itm orig = wiki.File__orig_mgr().Find_by_ttl_or_null(fsdb.Lnki_ttl(), i, len);
       if (orig != Xof_orig_itm.Null) { // orig exists;
         gplx.xowa.files.repos.Xof_repo_itm repo =
             wiki.File__repo_mgr().Get_trg_by_id_or_null(orig.Repo(), fsdb.Lnki_ttl(), Bry_.Empty);
         if (repo == null) continue;
         fsdb.Init_at_orig(
             orig.Repo(),
             repo.Wiki_domain(),
             orig.Ttl(),
             orig.Ext(),
             orig.W(),
             orig.H(),
             orig.Redirect());
       }
     }
     fsdb.Init_at_xfer(i, len);
     Xof_file_wkr.Show_img(
         fsdb,
         usr_dlg,
         wiki.File__bin_mgr(),
         wiki.File__mnt_mgr(),
         cache_mgr,
         wiki.File__repo_mgr(),
         js_wkr,
         img_size,
         url_bldr,
         page);
   }
 }
コード例 #3
0
 private byte Select_fsdb_itms(List_adp list) {
   list.Clear();
   boolean pages_found = false, links_found = false;
   DataRdr rdr =
       Xob_xfer_regy_tbl.Select_by_tier_page(bldr_conn, tier_id_val, page_id_val, select_interval);
   try {
     while (rdr.MoveNextPeer()) {
       pages_found = true; // at least one page found; set true
       Xodb_tbl_oimg_xfer_itm itm = Xodb_tbl_oimg_xfer_itm.new_rdr_(rdr);
       if (itm.Lnki_page_id() == page_id_val // same page_id
           && itm.Lnki_id() <= lnki_id_val // ... but lnki_id < last
       ) continue; // ... ignore; note that select is by page_id, not page_id + link_id; needed
       // else restarts would not resume exactly at same point;
       links_found = true;
       list.Add(itm);
     }
   } finally {
     rdr.Rls();
   }
   if (pages_found && !links_found)
     return Select_rv_next_page; // pages found, but all links processed
   else if (!pages_found) return Select_rv_stop; // no more pages found
   else return Select_rv_process; // pages and links found
 }