1
0
mirror of https://github.com/gnosygnu/xowa.git synced 2026-03-02 03:49:30 +00:00

'v3.5.1.1'

This commit is contained in:
gnosygnu
2016-05-01 21:06:12 -04:00
parent 5ce4ea2a08
commit 96636f3161
131 changed files with 2287 additions and 928 deletions

View File

@@ -45,7 +45,7 @@ public class Xoax_addon_mgr {
// specials
, new gplx.xowa.addons.apps.file_browsers .Fbrow_addon()
, new gplx.xowa.addons.updates.downloads .Xoax_downloads_addon()
, new gplx.xowa.addons.builds.centrals .Xoax_downloads_addon()
// jsons
, new gplx.xowa.addons.servers.https .Xoax_long_poll_addon()
@@ -67,8 +67,10 @@ public class Xoax_addon_mgr {
if (Type_adp_.Implements_intf_obj(addon, Xoax_addon_itm__json.class)) {
Xoax_addon_itm__json addon_json = (Xoax_addon_itm__json)addon;
gplx.xowa.htmls.bridges.Bridge_cmd_itm[] json_cmds = addon_json.Json__cmds();
for (gplx.xowa.htmls.bridges.Bridge_cmd_itm json_cmd : json_cmds)
for (gplx.xowa.htmls.bridges.Bridge_cmd_itm json_cmd : json_cmds) {
json_cmd.Init_by_app(app);
app.Html__bridge_mgr().Cmd_mgr().Add(json_cmd);
}
}
}
app.Gui__cbk_mgr().Reg(gplx.xowa.addons.servers.https.Xog_cbk_wkr__http.Instance);

View File

@@ -0,0 +1,49 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.addons.builds.centrals; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.builds.*;
import gplx.langs.jsons.*;
public class Xoa_dashboard_bridge implements gplx.xowa.htmls.bridges.Bridge_cmd_itm {
public void Init_by_app(Xoa_app app) {}
public String Exec(Json_nde data) {
Xobc_ui_mgr dl_mgr = Xoa_dashboard_special.Download_mgr;
byte proc_id = proc_hash.Get_as_byte_or(data.Get_as_bry_or(Msg__proc, null), Byte_ascii.Max_7_bit);
Json_nde args = data.Get_kv(Msg__args).Val_as_nde();
switch (proc_id) {
case Proc__init: dl_mgr.Init(); break;
case Proc__todo__move_to_work: dl_mgr.Todo__move_to_work(args.Get_as_str("job_uid")); break;
case Proc__work__resume: dl_mgr.Work__resume(args.Get_as_str("job_uid")); break;
case Proc__work__pause: dl_mgr.Work__pause(args.Get_as_str("job_uid")); break;
case Proc__work__cancel: dl_mgr.Work__cancel(args.Get_as_str("job_uid")); break;
default: throw Err_.new_unhandled_default(proc_id);
}
return "";
}
private static final byte[] Msg__proc = Bry_.new_a7("proc"), Msg__args = Bry_.new_a7("args");
private static final byte Proc__init = 0, Proc__todo__move_to_work = 1, Proc__work__resume = 2, Proc__work__pause = 3, Proc__work__cancel = 4;
private static final Hash_adp_bry proc_hash = Hash_adp_bry.cs()
.Add_str_byte("init" , Proc__init)
.Add_str_byte("todo__move_to_work" , Proc__todo__move_to_work)
.Add_str_byte("work__resume__send" , Proc__work__resume)
.Add_str_byte("work__pause__send" , Proc__work__pause)
.Add_str_byte("work__cancel__send" , Proc__work__cancel)
;
public byte[] Key() {return BRIDGE_KEY;}
public static final byte[] BRIDGE_KEY = Bry_.new_a7("builder_central.exec");
public static final Xoa_dashboard_bridge Prototype = new Xoa_dashboard_bridge(); Xoa_dashboard_bridge() {}
}

View File

@@ -0,0 +1,83 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.addons.builds.centrals; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.builds.*;
import gplx.core.gfobjs.*; import gplx.xowa.guis.cbks.*;
class Xoa_dashboard_file_mgr {
private final Xog_cbk_mgr cbk_mgr;
private final Ordered_hash hash = Ordered_hash_.New();
public Xoa_dashboard_file_mgr(Xog_cbk_mgr cbk_mgr) {
this.cbk_mgr = cbk_mgr;
}
public void Add(Xobc_file_itm itm) {hash.Add(itm.Job_uid(), itm);}
public void Clear() {hash.Clear();}
public int Len() {return hash.Len();}
public Xobc_file_itm Get_at(int i) {return (Xobc_file_itm)hash.Get_at(i);}
public Xobc_file_itm Get_by(String k) {return (Xobc_file_itm)hash.Get_by(k);}
public Xobc_file_itm Del_by(String k) {
Xobc_file_itm rv = (Xobc_file_itm)hash.Get_by(k);
hash.Del(k);
return rv;
}
public void Exec_all(String invk_cmd) {
int len = hash.Len();
for (int i = 0; i < len; ++i) {
Xobc_file_itm itm = (Xobc_file_itm)hash.Get_at(i);
GfoInvkAble_.Invk(itm, invk_cmd);
}
}
public void Exec_one(String invk_cmd, String file_id) {this.Exec_one(invk_cmd, file_id, null, null);}
public void Exec_one(String invk_cmd, String file_id, String send_func, Gfobj_nde send_data) {
Xobc_file_itm itm = (Xobc_file_itm)hash.Get_by(file_id);
GfoInvkAble_.Invk(itm, invk_cmd);
if (send_func != null) cbk_mgr.Send_json(send_func, send_data);
}
public void Move_all(Xoa_dashboard_file_mgr trg) {this.Move_all(trg, null);}
public void Move_all(Xoa_dashboard_file_mgr trg, String invk_cmd) {
List_adp tmp = List_adp_.new_();
int len = hash.Len();
for (int i = 0; i < len; ++i)
tmp.Add((Xobc_file_itm)hash.Get_at(i));
for (int i = 0; i < len; ++i) {
Xobc_file_itm itm = (Xobc_file_itm)tmp.Get_at(i);
if (invk_cmd != null) GfoInvkAble_.Invk(itm, invk_cmd);
hash.Del(itm.Job_uid());
trg.Add(itm);
}
}
public void Move_one(String file_id, Xoa_dashboard_file_mgr trg) {this.Move_one(file_id, trg, null, null, null);}
public void Move_one(String file_id, Xoa_dashboard_file_mgr trg, String invk_cmd) {this.Move_one(file_id, trg, invk_cmd, null, null);}
public void Move_one(String file_id, Xoa_dashboard_file_mgr trg, String invk_cmd, String send_func, Gfobj_nde send_data) {
Xobc_file_itm itm = (Xobc_file_itm)hash.Get_by(file_id);
if (invk_cmd != null) GfoInvkAble_.Invk(itm, invk_cmd);
hash.Del(file_id);
trg.Add(itm);
if (send_func != null) cbk_mgr.Send_json(send_func, send_data);
}
public void To_nde(Bry_bfr tmp_bfr, Gfobj_ary ary_obj) {
Gfobj_ary_nde ary = (Gfobj_ary_nde)ary_obj;
List_adp list = List_adp_.new_();
int len = hash.Len();
for (int i = 0; i < len; ++i) {
Xobc_file_itm sub_itm = (Xobc_file_itm)hash.Get_at(i);
Gfobj_nde sub_nde = Gfobj_nde.New();
sub_itm.Write_to_nde(tmp_bfr, sub_nde);
list.Add(sub_nde);
}
ary.Ary_nde_((Gfobj_nde[])list.To_ary_and_clear(Gfobj_nde.class));
}
}

View File

@@ -0,0 +1,63 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.addons.builds.centrals; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.builds.*;
import gplx.xowa.specials.*; import gplx.core.net.*; import gplx.xowa.wikis.pages.*;
import gplx.xowa.addons.builds.centrals.itms.*; import gplx.xowa.addons.builds.centrals.*;
import gplx.xowa.addons.apps.file_browsers.*;
import gplx.core.security.*; import gplx.core.progs.*; import gplx.xowa.guis.cbks.*;
public class Xoa_dashboard_special implements Xows_page {
public static Xobc_ui_mgr Download_mgr;
private static boolean init = true;
public void Special__gen(Xow_wiki wiki, Xoa_page page, Xoa_url url, Xoa_ttl ttl) {
if (init) {
init = false;
Download_mgr = new Xobc_ui_mgr(wiki.App().Gui__cbk_mgr());
wiki.App().Gui__cbk_mgr().Reg(new gplx.xowa.guis.cbks.swts.Xog_cbk_wkr__swt(((Xoae_app)wiki.App()).Gui_mgr()));
}
Download_mgr.Clear();
Io_url addon_dir = wiki.App().Fsys_mgr().Bin_addon_dir().GenSubDir_nest("bldr", "central");
Xopage_html_data html_data = Write_html(wiki.App(), addon_dir);
html_data.Apply(page);
}
private static Xopage_html_data Write_html(Xoa_app app, Io_url addon_dir) {
// write body
Xodl_itm_regy owner_itm = new Xodl_itm_regy();
byte[] template_src = Io_mgr.Instance.LoadFilBry(addon_dir.GenSubFil_nest("tmpl", "bldr.central.main.mustache.html"));
Bry_bfr tmp_bfr = Bry_bfr.new_();
byte[] body = gplx.langs.mustaches.Mustache_wtr_.Write_to_bry(tmp_bfr, template_src, owner_itm);
// write head
Xopage_html_data rv = new Xopage_html_data(Display_ttl, body);
rv.Head_tags().Add(Xopg_tag_itm.New_css_file(addon_dir.GenSubFil_nest("css", "bldr.central.css")));
rv.Head_tags().Add(Xopg_tag_itm.New_js_file(addon_dir.GenSubFil_nest("js", "lib", "mustache.js")));
rv.Head_tags().Add(Xopg_tag_itm.New_html_code(addon_dir.GenSubFil_nest("tmpl", "bldr.central.row.mustache.html"), "bldr.central.row"));
rv.Tail_tags().Add(Xopg_tag_itm.New_js_file(addon_dir.GenSubFil_nest("js", "xo.elem.js")));
rv.Tail_tags().Add(Xopg_tag_itm.New_js_file(addon_dir.GenSubFil_nest("js", "xo.tmpl.js")));
rv.Tail_tags().Add(Xopg_tag_itm.New_js_file(addon_dir.GenSubFil_nest("js", "xo.notify.js")));
rv.Tail_tags().Add(Xopg_tag_itm.New_js_file(addon_dir.GenSubFil_nest("js", "xo.server.js")));
rv.Tail_tags().Add(Xopg_tag_itm.New_js_file(addon_dir.GenSubFil_nest("js", "bldr.central.util.js")));
rv.Tail_tags().Add(Xopg_tag_itm.New_js_file(addon_dir.GenSubFil_nest("js", "bldr.central.js")));
return rv;
}
public static final String SPECIAL_KEY = "XowaWikiDownload";
public static final byte[] Display_ttl = Bry_.new_a7("Download Central");
public Xows_special_meta Special__meta() {return new Xows_special_meta(Xows_special_meta_.Src__xowa, SPECIAL_KEY);}
public static final Xows_page Prototype = new Xoa_dashboard_special();
public Xows_page Special__clone() {return this;}
}

View File

@@ -15,27 +15,20 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.addons.updates.downloads; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.updates.*;
import gplx.xowa.specials.*;
public class Xoax_downloads_addon implements Xoax_addon_itm, Xoax_addon_itm__special {
package gplx.xowa.addons.builds.centrals; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.builds.*;
import gplx.xowa.specials.*; import gplx.xowa.htmls.bridges.*;
public class Xoax_downloads_addon implements Xoax_addon_itm, Xoax_addon_itm__special, Xoax_addon_itm__json {
public Xows_page[] Pages_ary() {
return new Xows_page[]
{ Xodl_special_page.Prototype
{ Xoa_dashboard_special.Prototype
};
}
public Bridge_cmd_itm[] Json__cmds() {
return new Bridge_cmd_itm[]
{ gplx.xowa.addons.builds.centrals.Xoa_dashboard_bridge.Prototype
};
}
public static final byte[] ADDON_KEY = Bry_.new_a7("xowa.imports.downloads");
public byte[] Addon__key() {return ADDON_KEY;}
}
// class Xodl_core_regy {
// public void Update() {} // update from http
// public void Load() {} // load bin/
// }
// class Xodl_user_regy {
// public void Load() {}
// public void Apply() {} // mark already downloaded items
// }
// class Xodl_main_mgr {
// public void Show_ui() {} // show list for ui
// public void Process() {} // process choices
// }

View File

@@ -0,0 +1,117 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.addons.builds.centrals; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.builds.*;
import gplx.core.gfobjs.*; import gplx.xowa.guis.cbks.*;
import gplx.xowa.addons.builds.centrals.jobs.*;
class Xobc_file_itm implements GfoInvkAble {
public Xobc_file_itm(Xog_cbk_mgr cbk_mgr, String job_uid, String job_name) {
this.job_uid = job_uid;
this.job_name = job_name;
this.tasks = new Xobc_job_itm[]
{ new Xobc_job_itm__verify(cbk_mgr, "77801297-db0a-47b4-af95-0db1eb63a192", Io_url_.new_fil_("C:\\xowa\\wiki\\en.wikipedia.org\\en.wikipedia.org-core.xowa"))
};
this.tasks_len = tasks.length;
}
public String Job_uid() {return job_uid;} private final String job_uid; // guid
public String Job_name() {return job_name;} private final String job_name; // Simple Wikipedia: html
public String Job_type() {return job_type;} private final String job_type = "gplx.xowa.bldr.wikis.copy_part";
public Xobc_job_itm[] Tasks() {return tasks;} private Xobc_job_itm[] tasks; private int tasks_len = 0;
public void Pause() {
for (int i = 0; i < tasks_len; ++i) {
Xobc_job_itm task = tasks[i];
if ( !task.Prog__paused() // ignore already paused tasks
&& task.Prog__started() // only pause tasks if started; don't pause inited tasks
)
task.Prog__pause();
}
}
public void Resume() {
for (int i = 0; i < tasks_len; ++i) {
Xobc_job_itm task = tasks[i];
if (task.Prog__paused())
task.Prog__resume();
else {
gplx.core.threads.Thread_adp_.invk_("job: " + task.Job_name(), task, "").Start();
break; // only start one
}
}
}
public void Cancel() {
for (int i = 0; i < tasks_len; ++i) {
Xobc_job_itm task = tasks[i];
task.Prog__cancel();
}
}
public void Write_to_nde(Bry_bfr tmp_bfr, Gfobj_nde itm) {
itm.Add_str ("job_uid" , job_uid);
itm.Add_str ("job_name" , job_name);
Gfobj_ary_nde ary_nde = itm.New_ary_nde("subs");
Gfobj_nde[] ary = new Gfobj_nde[tasks_len];
ary_nde.Ary_nde_(ary);
long prog_time_end = 0;
long prog_data_end = 0;
for (int i = 0; i < tasks_len; ++i) {
Xobc_job_itm sub_itm = tasks[i];
Gfobj_nde sub_nde = Gfobj_nde.New();
ary[i] = sub_nde;
sub_itm.Write_to_nde(tmp_bfr, sub_nde);
prog_time_end += sub_itm.Prog__end();
}
itm.Add_str ("prog_data_end_str" , gplx.core.ios.Io_size_.To_str_new(tmp_bfr, prog_data_end, 2));
itm.Add_str ("prog_time_end_str" , Time_dhms_.To_str(tmp_bfr, prog_time_end, true, 2));
}
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
if (String_.Eq(k, Invk__pause)) this.Pause();
else if (String_.Eq(k, Invk__resume)) this.Resume();
else if (String_.Eq(k, Invk__cancel)) this.Cancel();
else return GfoInvkAble_.Rv_unhandled;
return this;
}
public static final String Invk__pause = "pause", Invk__resume = "resume", Invk__cancel = "cancel";
}
/*
{ prog_finished : 0
, prog_data_cur : 0
, prog_data_end : 10
, prog_data_end_str : '1.81 gb'
, prog_time_cur : 0
, prog_time_end : 30
, prog_time_end_str : '30'
, jobs:
[
{ job_type : 'gplx.xowa.core.security.verify'
, job_name : 'verifying'
, job_sort : 0
, job_uid : '77801297-db0a-47b4-af95-0db1eb63a192'
, prog_data_cur : 0
, prog_data_end : 1819264175
, prog_time_cur : 0
, prog_time_end : 10
}
, { job_type : 'gplx.xowa.core.ios.zips.zip_decompress'
, job_name : 'unzipping'
, job_sort : 1
, job_uid : '79fbfebe-0165-42b0-b71a-c66f95cb7fd1'
, prog_data_cur : 0
, prog_data_end : 1819264175
, prog_time_cur : 0
, prog_time_end : 20
}
]
}
*/

View File

@@ -0,0 +1,31 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.addons.builds.centrals; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.builds.*;
class Xobc_rate_mgr {
private final Ordered_hash hash = Ordered_hash_.New();
public int Len() {return hash.Len();}
public Xobc_rate_itm Get_at(int i) {return (Xobc_rate_itm)hash.Get_at(i);}
public Xobc_rate_itm Get_by(String k) {return (Xobc_rate_itm)hash.Get_by(k);}
public void Add(Xobc_rate_itm rate) {hash.Add_if_dupe_use_nth(rate.Key(), rate);}
}
class Xobc_rate_itm {
public Xobc_rate_itm(String type, String key, long rate) {this.type = type; this.key = key; this.rate = rate;}
public String Type() {return type;} private final String type; // EX: download
public String Key() {return key;} private final String key; // EX: http://archive.org|C:\xowa\wiki\
public long Rate() {return rate;} private final long rate; // EX: 4000000
}

View File

@@ -0,0 +1,74 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.addons.builds.centrals; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.builds.*;
import gplx.xowa.guis.cbks.*; import gplx.core.gfobjs.*;
public class Xobc_ui_mgr {
private final Xoa_dashboard_file_mgr work_mgr, todo_mgr, done_mgr;
private final Xog_cbk_mgr cbk_mgr;
public Xobc_ui_mgr(Xog_cbk_mgr cbk_mgr) {
this.cbk_mgr = cbk_mgr;
work_mgr = new Xoa_dashboard_file_mgr(cbk_mgr);
todo_mgr = new Xoa_dashboard_file_mgr(cbk_mgr);
done_mgr = new Xoa_dashboard_file_mgr(cbk_mgr);
}
public void Init() {
todo_mgr.Clear();
todo_mgr.Add(new Xobc_file_itm(cbk_mgr, "0", "Simple Wikipedia: html"));
Bry_bfr tmp_bfr = Bry_bfr.new_();
Gfobj_nde root = Gfobj_nde.New();
Gfobj_nde lists_nde = root.New_nde("lists");
Gfobj_ary todo_ary = lists_nde.New_ary_nde("todo");
todo_mgr.To_nde(tmp_bfr, todo_ary);
cbk_mgr.Send_json("xo.bldr.core.init__recv", root);
}
public void Clear() {
work_mgr.Clear();
todo_mgr.Clear();
done_mgr.Clear();
}
public void Todo__move_to_work(String job_uid) {todo_mgr.Move_one(job_uid, work_mgr, null, "xo.bldr.todo.move_to_work__recv", Gfobj_nde.New().Add_str("job_uid", job_uid));}
public void Work__resume(String job_uid) {work_mgr.Exec_one(Xobc_file_itm.Invk__resume, job_uid, "xo.bldr.work.resume__recv", Gfobj_nde.New().Add_str("job_uid", job_uid));}
public void Work__pause(String job_uid) {work_mgr.Exec_one(Xobc_file_itm.Invk__pause, job_uid, "xo.bldr.work.pause__recv", Gfobj_nde.New().Add_str("job_uid", job_uid));}
public void Work__cancel(String job_uid) {work_mgr.Move_one(job_uid, todo_mgr, Xobc_file_itm.Invk__cancel, "xo.bldr.work.cancel__recv", Gfobj_nde.New().Add_str("job_uid", job_uid));}
public void Work__pause_all() {work_mgr.Exec_all(Xobc_file_itm.Invk__pause);}
public void Work__resume_all() {
int len = work_mgr.Len();
for (int i = 0; i < len; ++i) {
Xobc_file_itm itm = work_mgr.Get_at(i);
itm.Resume();
}
if (len > 0) { // TODO: if multiple items paused; send back notify for each paused item
Xobc_file_itm itm = work_mgr.Get_at(0);
itm.Resume();
cbk_mgr.Send_json("work__resume__recv", Gfobj_nde.New().Add_str("file_id", itm.Job_uid()));
}
}
public void Work__cancel_all() {work_mgr.Move_all(todo_mgr, Xobc_file_itm.Invk__cancel);}
public void Work__complete(String file_id) {work_mgr.Move_one(file_id, done_mgr);} // not called by ui called by task wkr
public void Todo__load(String url) {
// Xobc_job_itm
}
/*
public void User__rates__load() {}
public void User__rates__save() {}
public void Done__save() {}
public void Done__load() {}
*/
}

View File

@@ -15,10 +15,9 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.addons.updates.downloads.itms; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.updates.*; import gplx.xowa.addons.updates.downloads.*;
package gplx.xowa.addons.builds.centrals.itms; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.builds.*; import gplx.xowa.addons.builds.centrals.*;
import gplx.langs.jsons.*; import gplx.langs.mustaches.*;
import gplx.xowa.addons.updates.downloads.core.*;
public class Xodl_itm_pack implements Mustache_doc_itm, Gfo_download_itm {
public class Xodl_itm_pack implements Mustache_doc_itm {
public int Id = -1; // EX: 1
public String Wiki = ""; // EX: 'simple.wikipedia.org'
public String Date = ""; // EX: '2016-04-07'

View File

@@ -15,7 +15,7 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.addons.updates.downloads.itms; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.updates.*; import gplx.xowa.addons.updates.downloads.*;
package gplx.xowa.addons.builds.centrals.itms; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.builds.*; import gplx.xowa.addons.builds.centrals.*;
import gplx.langs.jsons.*; import gplx.langs.mustaches.*;
public class Xodl_itm_regy implements Mustache_doc_itm {
public Xodl_itm_pack[] Packs = Xodl_itm_pack.Ary_empty;

View File

@@ -15,7 +15,7 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.addons.updates.downloads.itms; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.updates.*; import gplx.xowa.addons.updates.downloads.*;
package gplx.xowa.addons.builds.centrals.itms; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.builds.*; import gplx.xowa.addons.builds.centrals.*;
import org.junit.*; import gplx.core.tests.*;
import gplx.langs.jsons.*;
public class Xodl_itm_regy_tst {

View File

@@ -0,0 +1,54 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.addons.builds.centrals.jobs; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.builds.*; import gplx.xowa.addons.builds.centrals.*;
public class Time_dhms_ {
public static String To_str(Bry_bfr bfr, long val, boolean show_unit, int max_places) {To_bfr(bfr, val, show_unit, max_places); return bfr.To_str_and_clear();}
public static void To_bfr(Bry_bfr bfr, long val, boolean show_unit, int max_places) {
byte suffix = Byte_ascii.Null;
int count = 0;
for (int i = 0; i < 4; ++i) {
// get factor and unit
long factor = 0;
byte unit = Byte_ascii.Null;
switch(i) {
case 0: unit = Byte_ascii.Ltr_d; factor = 86400; break;
case 1: unit = Byte_ascii.Ltr_h; factor = 3600; break;
case 2: unit = Byte_ascii.Ltr_m; factor = 60; break;
case 3: unit = Byte_ascii.Ltr_s; factor = 1; break;
}
// calc cur and update val; EX: 3690 -> cur:1,mod:90
int cur = (int)(val / factor);
val %= factor;
if (count == 0) { // no str yet
if ( cur == 0 // cur is 0; EX: 3690 and factor = 86400 -> 0 days; don't write anything
&& i != 3) // unless it is the seconds place; need to handle "0 s" specifically
continue;
suffix = unit; // set suffix
bfr.Add_int_variable(cur); // write cur; note that this is not zero-padded
}
else { // str exists
bfr.Add_int_pad_bgn(Byte_ascii.Num_0, 2, cur); // write cur; note that this zero-padded; also, note will write "00" if cur == 0
}
if (++count == max_places) break; // stop if max-places reached; EX: 86400 should write 1:00, not 1:00:00:00
if (i != 3) // do not add ":" if seconds
bfr.Add_byte_colon();
}
if (show_unit) // add units; EX: " s" for seconds
bfr.Add_byte_space().Add_byte(suffix);
}
}

View File

@@ -0,0 +1,37 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.addons.builds.centrals.jobs; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.builds.*; import gplx.xowa.addons.builds.centrals.*;
import org.junit.*; import gplx.core.tests.*;
public class Time_dhms__tst {
private final Time_dhms__fxt fxt = new Time_dhms__fxt();
@Test public void S___0() {fxt.Test__to_str( 0, 4, "0 s");}
@Test public void S___1() {fxt.Test__to_str( 1, 4, "1 s");}
@Test public void S___2() {fxt.Test__to_str( 30, 4, "30 s");}
@Test public void M___1() {fxt.Test__to_str( 60, 4, "1:00 m");}
@Test public void M___2() {fxt.Test__to_str( 600, 4, "10:00 m");}
@Test public void H___1() {fxt.Test__to_str( 3600, 4, "1:00:00 h");}
@Test public void H___2() {fxt.Test__to_str( 5025, 4, "1:23:45 h");}
@Test public void D___1() {fxt.Test__to_str( 86400, 4, "1:00:00:00 d");}
@Test public void Max_places() {fxt.Test__to_str( 86400, 2, "1:00 d");}
}
class Time_dhms__fxt {
private final Bry_bfr bfr = Bry_bfr.new_();
public Time_dhms__fxt Test__to_str(long v, int max_places, String expd) {
Gftest.Eq__str(expd, Time_dhms_.To_str(bfr, v, Bool_.Y, max_places));
return this;}
}

View File

@@ -15,7 +15,11 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.addons.updates.downloads.unzips; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.updates.*; import gplx.xowa.addons.updates.downloads.*;
public interface Gfo_unzip_cbk {
void Unzip__end_itm(Gfo_unzip_itm itm);
package gplx.xowa.addons.builds.centrals.jobs; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.builds.*; import gplx.xowa.addons.builds.centrals.*;
public interface Xobc_job_itm extends gplx.core.progs.Gfo_prog_ui, GfoInvkAble {
String Job_uid();
String Job_name();
void Write_to_nde(Bry_bfr tmp_bfr, gplx.core.gfobjs.Gfobj_nde itm);
Xobc_job_itm Owner();
Xobc_job_itm[] Subs();
}

View File

@@ -15,7 +15,8 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.addons.updates.downloads.core; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.updates.*; import gplx.xowa.addons.updates.downloads.*;
public interface Gfo_download_wkr {
void Download__bgn(Gfo_download_cbk cbk, Gfo_download_itm[] itms);
package gplx.xowa.addons.builds.centrals.jobs; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.builds.*; import gplx.xowa.addons.builds.centrals.*;
public class Xobc_job_itm_ {
public static final Xobc_job_itm[] Ary_empty = new Xobc_job_itm[0];
public static final Xobc_job_itm Null = null;
}

View File

@@ -0,0 +1,60 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.addons.builds.centrals.jobs; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.builds.*; import gplx.xowa.addons.builds.centrals.*;
import gplx.core.progs.*; import gplx.core.gfobjs.*;
import gplx.core.ios.zips.*; import gplx.xowa.guis.cbks.*;
public class Xobc_job_itm__unzip extends Gfo_prog_ui_base implements Xobc_job_itm {
private final Xog_cbk_mgr cbk_mgr;
private long nxt_time;
public Xobc_job_itm__unzip(Xog_cbk_mgr cbk_mgr, String job_uid, Io_url url) {
this.cbk_mgr = cbk_mgr; this.job_uid = job_uid;
this.Prog__end_(10);
}
public String Job_uid() {return job_uid;} private final String job_uid;
public String Job_name() {return job_name;} private final String job_name = "unzipping";
public Xobc_job_itm Owner() {return Xobc_job_itm_.Null;}
public Xobc_job_itm[] Subs() {return Xobc_job_itm_.Ary_empty;}
public void Task__exec() {
}
public void Write_to_nde(Bry_bfr tmp_bfr, gplx.core.gfobjs.Gfobj_nde nde) {
nde.Add_str ("job_uid" , job_uid);
nde.Add_str ("job_name" , job_name);
nde.Add_long("prog_data_cur" , this.Prog__cur());
nde.Add_long("prog_data_end" , this.Prog__end());
nde.Add_long("prog_time_cur" , 0);
nde.Add_long("prog_time_end" , this.Prog__end());
}
@Override public byte Prog__notify__working(long cur, long end) {
long cur_time = gplx.core.envs.Env_.TickCount();
if (cur_time < nxt_time) return Gfo_prog_ui_.State__started; // message came too soon. ignore it
nxt_time = cur_time + 200;
Gfobj_nde nde = Gfobj_nde.New();
nde.Add_str("job_uid", job_uid);
nde.Add_str("task_type", "verify");
nde.Add_long("prog_cur", cur);
nde.Add_long("prog_end", end);
cbk_mgr.Send_json("work__update_progress", nde);
return super.Prog__notify__working(cur, end);
}
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
Task__exec();
return this;
}
}

View File

@@ -0,0 +1,65 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.addons.builds.centrals.jobs; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.builds.*; import gplx.xowa.addons.builds.centrals.*;
import gplx.core.progs.*; import gplx.core.gfobjs.*;
import gplx.core.security.*; import gplx.xowa.guis.cbks.*;
public class Xobc_job_itm__verify extends Gfo_prog_ui_base implements Xobc_job_itm {
private final Xog_cbk_mgr cbk_mgr; private final Io_url url;
private long nxt_time;
public Xobc_job_itm__verify(Xog_cbk_mgr cbk_mgr, String job_uid, Io_url url) {
this.cbk_mgr = cbk_mgr; this.job_uid = job_uid; this.url = url;
this.Prog__end_(10);
}
public String Job_uid() {return job_uid;} private final String job_uid;
public String Job_name() {return job_name;} private final String job_name = "verifying";
public Xobc_job_itm Owner() {return Xobc_job_itm_.Null;}
public Xobc_job_itm[] Subs() {return Xobc_job_itm_.Ary_empty;}
public byte[] Hash() {return hash;} private byte[] hash;
public void Task__exec() {
Hash_algo algo = Hash_algo_.New__md5();
gplx.core.ios.IoStream stream = Io_mgr.Instance.OpenStreamRead(url);
try {this.hash = algo.Hash_stream_as_bry(this, stream);}
finally {stream.Rls();}
}
public void Write_to_nde(Bry_bfr tmp_bfr, gplx.core.gfobjs.Gfobj_nde nde) {
nde.Add_str ("job_uid" , job_uid);
nde.Add_str ("job_name" , job_name);
nde.Add_long("prog_data_cur" , this.Prog__cur());
nde.Add_long("prog_data_end" , this.Prog__end());
nde.Add_long("prog_time_cur" , 0);
nde.Add_long("prog_time_end" , this.Prog__end());
}
@Override public byte Prog__notify__working(long cur, long end) {
long cur_time = gplx.core.envs.Env_.TickCount();
if (cur_time < nxt_time) return Gfo_prog_ui_.State__started; // message came too soon. ignore it
nxt_time = cur_time + 200;
Gfobj_nde nde = Gfobj_nde.New();
nde.Add_str("job_uid", job_uid);
nde.Add_str("task_type", "verify");
nde.Add_long("prog_cur", cur);
nde.Add_long("prog_end", end);
cbk_mgr.Send_json("work__update_progress", nde);
return super.Prog__notify__working(cur, end);
}
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
Task__exec();
return this;
}
}

View File

@@ -22,6 +22,7 @@ public class Http_long_poll_cmd implements gplx.xowa.htmls.bridges.Bridge_cmd_it
public int Sleep_interval = 100;
public int Send_interval = 1000;
public void Init_by_app(Xoa_app app) {}
public void Send_msg(String msg) {
msgs.Add(msg);
}

View File

@@ -17,6 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.addons.servers.https; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.servers.*;
public class Http_send_msg_cmd implements gplx.xowa.htmls.bridges.Bridge_cmd_itm {
public void Init_by_app(Xoa_app app) {}
public String Exec(gplx.langs.jsons.Json_nde data) {
gplx.langs.jsons.Json_nde jnde = (gplx.langs.jsons.Json_nde)data.Get_as_itm_or_null(Bry_.new_a7("msg"));
Http_long_poll_cmd.Instance.Send_msg(jnde.Print_as_json());

View File

@@ -16,8 +16,9 @@ You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.addons.servers.https; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.servers.*;
import gplx.xowa.guis.cbks.*;
import gplx.xowa.guis.cbks.*; import gplx.core.gfobjs.*;
public class Xog_cbk_wkr__http implements Xog_cbk_wkr {
public Object Send_json(String func, Gfobj_nde data) {return null;}
public void Send_prog(String head) {
Http_long_poll_cmd.Instance.Send_msg(head);
}

View File

@@ -1,32 +0,0 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.addons.updates.downloads; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.updates.*;
import gplx.xowa.addons.updates.downloads.core.*;
import gplx.xowa.addons.updates.downloads.itms.*;
class Xodl_download_mgr implements Gfo_download_cbk {
public void Download(Gfo_download_wkr download_wkr, Xodl_itm_pack[] packs) {
download_wkr.Download__bgn(this, packs);
}
public void Download__end_itm(Gfo_download_itm itm) {
// unzip; start
}
public void Download__end_all(Gfo_download_itm[] itms) {}
public void Unzip__end(Gfo_download_itm[] itms) {
// register
}
}

View File

@@ -1,63 +0,0 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.addons.updates.downloads; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.updates.*;
import gplx.xowa.specials.*; import gplx.core.net.*; import gplx.xowa.wikis.pages.*;
import gplx.xowa.addons.updates.downloads.itms.*; import gplx.xowa.addons.updates.downloads.core.*;
import gplx.xowa.addons.apps.file_browsers.*;
public class Xodl_special_page implements Xows_page {
public static Gfo_download_wkr Download_wkr = Gfo_download_wkr_.Noop;
public void Special__gen(Xow_wiki wiki, Xoa_page page, Xoa_url url, Xoa_ttl ttl) {
Io_url addon_dir = wiki.App().Fsys_mgr().Bin_addon_dir().GenSubDir_nest("import", "wiki_download");
Xoa_url_arg_mgr arg_mgr = new Xoa_url_arg_mgr(null).Init(url.Qargs_ary());
byte[] ids_bry = arg_mgr.Read_bry_or_null("ids");
if (ids_bry == null) {
Xopage_html_data html_data = Write_html(wiki.App(), addon_dir);
html_data.Apply(page);
}
else {
Xodl_itm_regy regy = Load_regy(addon_dir);
int[] ids_ary = Int_.Ary_parse(String_.new_u8(ids_bry), ",");
Xodl_itm_pack[] packs = regy.Packs__select(ids_ary);
if (packs.length > 0) {
Xodl_download_mgr download_mgr = new Xodl_download_mgr();
download_mgr.Download(Download_wkr, packs);
}
}
}
private static Xodl_itm_regy Load_regy(Io_url addon_dir) {
return Xodl_itm_regy.Load_by_json(addon_dir.GenSubFil_nest("data", "wiki_download.json"));
}
private static Xopage_html_data Write_html(Xoa_app app, Io_url addon_dir) {
// write body
Xodl_itm_regy owner_itm = Load_regy(addon_dir);
byte[] template_src = Io_mgr.Instance.LoadFilBry(addon_dir.GenSubFil_nest("bin", "wiki_download.mustache.html"));
Bry_bfr tmp_bfr = Bry_bfr.new_();
byte[] body = gplx.langs.mustaches.Mustache_wtr_.Write_to_bry(tmp_bfr, template_src, owner_itm);
// write head
Xopage_html_data rv = new Xopage_html_data(Display_ttl, body);
rv.Head_tags().Add(Xopg_tag_itm.New_css_file(addon_dir.GenSubFil_nest("bin", "wiki_download.css")));
return rv;
}
public static final String SPECIAL_KEY = "XowaWikiDownload";
public static final byte[] Display_ttl = Bry_.new_a7("Download wikis");
public Xows_special_meta Special__meta() {return new Xows_special_meta(Xows_special_meta_.Src__xowa, SPECIAL_KEY);}
public static final Xows_page Prototype = new Xodl_special_page();
public Xows_page Special__clone() {return this;}
}

View File

@@ -1,22 +0,0 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.addons.updates.downloads.core; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.updates.*; import gplx.xowa.addons.updates.downloads.*;
public interface Gfo_download_cbk {
void Download__end_itm(Gfo_download_itm itm);
void Download__end_all(Gfo_download_itm[] itms);
}

View File

@@ -1,23 +0,0 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.addons.updates.downloads.core; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.updates.*; import gplx.xowa.addons.updates.downloads.*;
public interface Gfo_download_itm {
String Download__src();
Io_url Download__trg();
void Download__trg_(Io_url v);
}

View File

@@ -1,24 +0,0 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.addons.updates.downloads.core; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.updates.*; import gplx.xowa.addons.updates.downloads.*;
public class Gfo_download_wkr_ {
public static final Gfo_download_wkr Noop = new Gfo_download_wkr__noop();
}
class Gfo_download_wkr__noop implements Gfo_download_wkr {
public void Download__bgn(Gfo_download_cbk cbk, Gfo_download_itm[] itms) {cbk.Download__end_all(itms);}
}

View File

@@ -1,22 +0,0 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.addons.updates.downloads.unzips; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.updates.*; import gplx.xowa.addons.updates.downloads.*;
public interface Gfo_unzip_itm {
Io_url Unzip__src_fil();
Io_url Unzip__trg_dir();
}

View File

@@ -1,25 +0,0 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.addons.updates.downloads.unzips; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.updates.*; import gplx.xowa.addons.updates.downloads.*;
public interface Gfo_unzip_wkr {
void Unzip__bgn(Gfo_unzip_cbk cbk, Gfo_unzip_itm itm);
}
class Gfo_unzip_wkr__noop implements Gfo_unzip_wkr {
public void Unzip__bgn(Gfo_unzip_cbk cbk, Gfo_unzip_itm itm) {cbk.Unzip__end_itm(itm);}
public static final Gfo_unzip_wkr__noop Instance = new Gfo_unzip_wkr__noop(); Gfo_unzip_wkr__noop() {}
}

View File

@@ -1,27 +0,0 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.addons.updates.downloads.unzips; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.updates.*; import gplx.xowa.addons.updates.downloads.*;
import gplx.core.ios.zips.*;
class Gfo_unzip_wkr__jre implements Gfo_unzip_wkr {
public void Unzip__bgn(Gfo_unzip_cbk cbk, Gfo_unzip_itm itm) {
Io_zip_mgr_base.Instance.Unzip_to_dir(itm.Unzip__src_fil(), itm.Unzip__trg_dir());
cbk.Unzip__end_itm(itm);
}
public static final Gfo_unzip_wkr__jre Instance = new Gfo_unzip_wkr__jre(); Gfo_unzip_wkr__jre() {}
}