public void Init_by_wiki(Xow_wiki wiki) {
   if (init) return;
   try {
     init = true;
     //				if (wiki.File__fsdb_mode().Tid_v0()) return;
     this.url_bldr = Xof_url_bldr.new_v2();
     this.repo_mgr = wiki.File__repo_mgr();
     Fsdb_db_mgr fsdb_core = wiki.File__fsdb_core();
     // Fsdb_db_mgr fsdb_core = Fsdb_db_mgr_.new_detect(wiki, wiki.Fsys_mgr().Root_dir(),
     // wiki.Fsys_mgr().File_dir());
     if (fsdb_core == null) return;
     fsdb_enabled = true;
     mnt_mgr.Ctor_by_load(fsdb_core);
     this.bin_mgr =
         new Xof_bin_mgr(
             mnt_mgr,
             repo_mgr,
             wiki.App().File__img_mgr().Wkr_resize_img(),
             wiki.App().Wmf_mgr().Download_wkr().Download_xrg().Download_fmt());
     bin_mgr.Wkrs__add(Xof_bin_wkr__fsdb_sql.new_(mnt_mgr));
     bin_mgr.Wkrs__add(Xof_bin_wkr__http_wmf.new_(wiki));
   } catch (Exception e) {
     throw Err_.new_exc(e, "xo", "failed to initialize fsdb_mgr}", "wiki", wiki.Domain_str());
   }
 }
 private void Download_itm(Xodb_tbl_oimg_xfer_itm fsdb) {
   try {
     tier_id_val = fsdb.Lnki_tier_id();
     page_id_val = fsdb.Lnki_page_id();
     lnki_id_val = fsdb.Lnki_id();
     fsdb.Orig_repo_name_(
         fsdb.Orig_repo_id() == Xof_repo_tid_.Tid__local
             ? wiki.Domain_bry()
             : Xow_domain_itm_.Bry__commons);
     Download_exec(fsdb);
     ++exec_count;
     if (exec_count % progress_interval == 0) Print_progress(fsdb);
     if (exec_count % poll_interval == 0) poll_mgr.Poll();
     if (exec_count % commit_interval == 0) Txn_sav();
     if (exec_count % delete_interval == 0) Delete_files();
   } catch (Exception exc) {
     ++exec_fail;
     usr_dlg.Warn_many(
         "",
         "",
         "download error; ttl=~{0} w=~{1} err=~{2}",
         fsdb.Orig_ttl(),
         fsdb.Lnki_w(),
         Err_.Message_gplx_full(exc));
   }
 }
 public static Fsdb_db_mgr new_src_bin_db_mgr(Xow_wiki wiki, String version) {
   String domain_str = wiki.Domain_str();
   Fsdb_db_mgr rv = null;
   Io_url url = null;
   if (String_.Eq(version, "v1")) {
     url =
         wiki.Fsys_mgr()
             .File_dir()
             .OwnerDir()
             .GenSubDir(domain_str + "-prv"); // v1: EX: /xowa/file/en.wikipedia.org-prv/
     rv = new Fsdb_db_mgr__v1(url);
   } else if (String_.Eq(version, "v2")) {
     url = wiki.Fsys_mgr().Root_dir().GenSubDir("prv"); // v2: EX: /xowa/wiki/en.wikipedia.org/prv/
     rv = Fsdb_db_mgr_.new_detect(wiki, url, url); // note that v2 is prioritized over v1
   } else throw Err_.new_wo_type("fsdb.make:unknown fsdb_type", "version", version);
   if (rv == null)
     throw Err_.new_wo_type(
         "fsdb.make:source fsdb not found", "version", version, "url", url.Raw());
   return rv;
 }
Beispiel #4
0
 public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
   throw Err_.new_unimplemented_w_msg("implemented for Xoa_cfg_mgr");
 }