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

Graph: Support version 2 graphs

This commit is contained in:
gnosygnu
2018-03-03 08:52:14 -05:00
parent 54d74b0acd
commit 93bac15244
23 changed files with 240 additions and 53 deletions

View File

@@ -74,7 +74,9 @@ public class Xoax_addon_mgr {
, new gplx.xowa.addons.wikis.fulltexts .Xosearch_fulltext_addon()
// jsons
, new gplx.xowa.addons.servers.https.utils .Xoa_util_addon()
);
if (app.Mode().Tid_is_http()) {
app.Addon_mgr().Itms__add_many(new gplx.xowa.addons.servers.https.Xoax_long_poll_addon());
}

View File

@@ -21,7 +21,7 @@ import gplx.xowa.addons.apps.cfgs.specials.edits.pages.*; import gplx.xowa.addon
public class Xocfg_edit_svc {
private final Xoa_app app;
private Xocfg_edit_loader edit_loader;
private final Xog_cbk_trg cbk_trg = Xog_cbk_trg.New(Xocfg_edit_special.Prototype.Special__meta().Ttl_bry());
private final Xog_cbk_trg cbk_trg = Xog_cbk_trg.New_by_page(Xocfg_edit_special.Prototype.Special__meta().Ttl_bry());
public Xocfg_edit_svc(Xoa_app app) {
this.app = app;
}

View File

@@ -25,7 +25,7 @@ import gplx.dbs.*; import gplx.xowa.specials.xowa.diags.*;
* run stored procs? EXEC debug_image 'A.png'
*/
class Xosql_exec_svc {
private gplx.xowa.guis.cbks.Xog_cbk_trg cbk_trg = gplx.xowa.guis.cbks.Xog_cbk_trg.New(gplx.xowa.addons.apps.maints.sql_execs.specials.Xosql_exec_special.Prototype.Special__meta().Ttl_bry());
private gplx.xowa.guis.cbks.Xog_cbk_trg cbk_trg = gplx.xowa.guis.cbks.Xog_cbk_trg.New_by_page(gplx.xowa.addons.apps.maints.sql_execs.specials.Xosql_exec_special.Prototype.Special__meta().Ttl_bry());
private final Xoa_app app;
public Xosql_exec_svc(Xoa_app app) {
this.app = app;

View File

@@ -45,7 +45,7 @@ class Xoa_update_svc implements Gfo_invk {
// start download
Xojs_wkr__download download_wkr = new Xojs_wkr__download
( app.Gui__cbk_mgr(), Xog_cbk_trg.New(Xoa_update_special.Prototype.Special__meta().Ttl_bry())
( app.Gui__cbk_mgr(), Xog_cbk_trg.New_by_page(Xoa_update_special.Prototype.Special__meta().Ttl_bry())
, "xo.app_updater.download__prog", Gfo_invk_cmd.New_by_key(this, Invk__download_done), Gfo_invk_cmd.New_by_key(this, Invk__download_fail), src, trg, src_len);
download_wkr.Exec_async("app_updater");
}

View File

@@ -18,7 +18,7 @@ import gplx.core.brys.evals.*; import gplx.core.gfobjs.*; import gplx.core.progs
import gplx.xowa.addons.bldrs.centrals.tasks.*; import gplx.xowa.addons.bldrs.centrals.steps.*; import gplx.xowa.addons.bldrs.centrals.cmds.*; import gplx.xowa.addons.bldrs.centrals.dbs.*; import gplx.xowa.addons.bldrs.centrals.mgrs.*;
import gplx.xowa.guis.cbks.*;
public class Xobc_task_mgr implements Xog_json_wkr {
private final Xog_cbk_trg cbk_trg = Xog_cbk_trg.New(Xobc_task_special.Prototype.Special__meta().Ttl_bry());
private final Xog_cbk_trg cbk_trg = Xog_cbk_trg.New_by_page(Xobc_task_special.Prototype.Special__meta().Ttl_bry());
public Xobc_task_mgr(Xoa_app app, Io_url data_db_url) {
this.app = app;
this.cbk_mgr = app.Gui__cbk_mgr();

View File

@@ -0,0 +1,28 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.xowa.addons.servers.https.utils; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.servers.*; import gplx.xowa.addons.servers.https.*;
import gplx.xowa.htmls.bridges.*;
public class Xoa_util_addon implements Xoax_addon_itm, Xoax_addon_itm__json {
public String Addon__key() {return ADDON__KEY;} private static final String ADDON__KEY = "xowa.app.util";
public Bridge_cmd_itm[] Json_cmds() {
return new Bridge_cmd_itm[]
{ Xoa_util_bridge.Prototype
};
}
public static Xoa_util_addon Get_by_app(Xoa_app app) {
return (Xoa_util_addon)app.Addon_mgr().Itms__get_or_null(ADDON__KEY);
}
}

View File

@@ -0,0 +1,41 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.xowa.addons.servers.https.utils; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.servers.*; import gplx.xowa.addons.servers.https.*;
import gplx.langs.jsons.*;
import gplx.xowa.htmls.bridges.*;
public class Xoa_util_bridge implements Bridge_cmd_itm {
private Xoa_util_svc svc;
public void Init_by_app(Xoa_app app) {
svc = new Xoa_util_svc(app);
}
public String Exec(Json_nde data) {
byte proc_id = proc_hash.Get_as_byte_or(data.Get_as_bry_or(Bridge_cmd_mgr.Msg__proc, null), Byte_ascii.Max_7_bit);
Json_nde args = data.Get_kv(Bridge_cmd_mgr.Msg__args).Val_as_nde();
switch (proc_id) {
case Proc__page_get: svc.Page_get(args); break;
default: throw Err_.new_unhandled_default(proc_id);
}
return "";
}
private static final byte Proc__page_get = 0;
private static final Hash_adp_bry proc_hash = Hash_adp_bry.cs()
.Add_str_byte("page_get" , Proc__page_get)
;
public byte[] Key() {return BRIDGE_KEY;} public static final byte[] BRIDGE_KEY = Bry_.new_a7("xowa.app.util.misc");
public static final Xoa_util_bridge Prototype = new Xoa_util_bridge(); Xoa_util_bridge() {}
}

View File

@@ -0,0 +1,54 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.xowa.addons.servers.https.utils; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.servers.*; import gplx.xowa.addons.servers.https.*;
import gplx.langs.jsons.*;
import gplx.xowa.htmls.bridges.*;
import gplx.xowa.wikis.caches.*;
import gplx.xowa.guis.cbks.*;
public class Xoa_util_svc {
private final Xoa_app app;
private final Xog_cbk_mgr cbk_mgr;
public Xoa_util_svc(Xoa_app app) {
this.app = app;
this.cbk_mgr = app.Gui__cbk_mgr();
}
public void Page_get(Json_nde args) {
// get args
String page_get_cbk = args.Get_as_str("page_get_cbk");
byte[] wiki_bry = args.Get_as_bry("wiki");
byte[] page_bry = args.Get_as_bry("page");
String vega_cbk_guid = args.Get_as_str("vega_cbk_guid");
String page_guid = args.Get_as_str("page_guid");
// get wiki
Xow_wiki wiki_base = app.Wiki_mgri().Get_by_or_make_init_y(wiki_bry);
if (!wiki_base.Type_is_edit()) {
throw Err_.new_unimplemented();
}
Xowe_wiki wiki = (Xowe_wiki)wiki_base;
// get page
Xoa_ttl ttl = wiki.Ttl_parse(page_bry);
Xow_page_cache_itm page_itm = wiki.Cache_mgr().Page_cache().Get_or_load_as_itm_2(ttl);
Xog_cbk_trg cbk_trg = Xog_cbk_trg.New_by_guid(page_guid);
cbk_mgr.Send_json(cbk_trg, page_get_cbk, gplx.core.gfobjs.Gfobj_nde.New()
.Add_bry("wiki", wiki_bry)
.Add_bry("page", page_bry)
.Add_str("vega_cbk_guid", vega_cbk_guid)
.Add_bry("page_text", page_itm.Wtxt__direct())
);
}
}

View File

@@ -21,7 +21,7 @@ import gplx.xowa.langs.cases.*;
class Xowdir_item_mgr {
private final Xoa_app app;
private final Json_wtr json_wtr = new Json_wtr();
private gplx.xowa.guis.cbks.Xog_cbk_trg cbk_trg = gplx.xowa.guis.cbks.Xog_cbk_trg.New(Xowdir_item_special.Prototype.Special__meta().Ttl_bry());
private gplx.xowa.guis.cbks.Xog_cbk_trg cbk_trg = gplx.xowa.guis.cbks.Xog_cbk_trg.New_by_page(Xowdir_item_special.Prototype.Special__meta().Ttl_bry());
public Xowdir_item_mgr(Xoa_app app) {
this.app = app;
}

View File

@@ -19,7 +19,7 @@ import gplx.langs.jsons.*;
import gplx.xowa.addons.wikis.directorys.dbs.*;
class Xowdir_list_svc {
private final Xoa_app app;
private gplx.xowa.guis.cbks.Xog_cbk_trg cbk_trg = gplx.xowa.guis.cbks.Xog_cbk_trg.New(Xowdir_list_special.Prototype.Special__meta().Ttl_bry());
private gplx.xowa.guis.cbks.Xog_cbk_trg cbk_trg = gplx.xowa.guis.cbks.Xog_cbk_trg.New_by_page(Xowdir_list_special.Prototype.Special__meta().Ttl_bry());
public Xowdir_list_svc(Xoa_app app) {
this.app = app;
}

View File

@@ -23,7 +23,7 @@ import gplx.xowa.addons.wikis.fulltexts.indexers.specials.*;
import gplx.xowa.addons.wikis.fulltexts.indexers.bldrs.*;
class Xofulltext_indexer_svc implements Gfo_invk {
private final Xoa_app app;
private final Xog_cbk_trg cbk_trg = Xog_cbk_trg.New(Xofulltext_indexer_special.Prototype.Special__meta().Ttl_bry());
private final Xog_cbk_trg cbk_trg = Xog_cbk_trg.New_by_page(Xofulltext_indexer_special.Prototype.Special__meta().Ttl_bry());
public Xofulltext_indexer_svc(Xoa_app app) {
this.app = app;
}

View File

@@ -65,7 +65,7 @@ class Xofulltext_searcher_svc implements Gfo_invk {
private void Search(Xofulltext_args_qry args) {
// create ui
Xofulltext_cache_mgr cache_mgr = args.cache_mgr;
Xofulltext_searcher_ui ui = new Xofulltext_searcher_ui(cache_mgr, app.Gui__cbk_mgr(), new Xog_cbk_trg(args.page_guid));
Xofulltext_searcher_ui ui = new Xofulltext_searcher_ui(cache_mgr, app.Gui__cbk_mgr(), Xog_cbk_trg.New_by_guid(args.page_guid));
try {
// loop wikis
@@ -138,7 +138,7 @@ class Xofulltext_searcher_svc implements Gfo_invk {
}
private void Snips_show_all(int qry_id, byte[] wiki_bry, int page_id, String page_guid) {
Xofulltext_cache_mgr cache_mgr = this.Cache_mgr();
Xofulltext_searcher_ui searcher_ui = new Xofulltext_searcher_ui(cache_mgr, app.Gui__cbk_mgr(), new Xog_cbk_trg(page_guid));
Xofulltext_searcher_ui searcher_ui = new Xofulltext_searcher_ui(cache_mgr, app.Gui__cbk_mgr(), Xog_cbk_trg.New_by_guid(page_guid));
Xofulltext_cache_line[] lines = cache_mgr.Get_lines_rest(qry_id, wiki_bry, page_id);
for (Xofulltext_cache_line line : lines) {