mirror of https://github.com/gnosygnu/xowa
parent
baaef32df2
commit
b2a06b8125
@ -0,0 +1,28 @@
|
||||
/*
|
||||
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.dbs.conn_props; import gplx.*; import gplx.dbs.*;
|
||||
public class Db_conn_props_mgr {
|
||||
private final Ordered_hash hash = Ordered_hash_.New();
|
||||
public boolean Has(String key) {return hash.Has(key);}
|
||||
public boolean Match(String key, String expd_val) {
|
||||
String actl_val = (String)hash.Get_by(key);
|
||||
return actl_val == null ? false : String_.Eq(expd_val,actl_val);
|
||||
}
|
||||
public void Add(String key, String val) {hash.Add(key, val);}
|
||||
public void Del(String key) {hash.Del(key);}
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
/*
|
||||
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.dbs.engines.noops; import gplx.*; import gplx.dbs.*; import gplx.dbs.engines.*;
|
||||
import gplx.core.stores.*; import gplx.dbs.metas.*; import gplx.dbs.sqls.*; import gplx.dbs.conn_props.*; import gplx.dbs.qrys.bats.*;
|
||||
public class Noop_engine implements Db_engine {
|
||||
public String Tid() {return Noop_conn_info.Tid_const;}
|
||||
public Db_conn_info Conn_info() {return Db_conn_info_.Null;}
|
||||
public Db_conn_props_mgr Props() {return props;} private final Db_conn_props_mgr props = new Db_conn_props_mgr();
|
||||
public Db_batch_mgr Batch_mgr() {return batch_mgr;} private final Db_batch_mgr batch_mgr = new Db_batch_mgr();
|
||||
public Sql_qry_wtr Sql_wtr() {return sql_wtr;} private final Sql_qry_wtr sql_wtr = Sql_qry_wtr_.Basic;
|
||||
public void Conn_open() {}
|
||||
public void Conn_term() {}
|
||||
public Db_engine New_clone(Db_conn_info url) {return this;}
|
||||
public Db_rdr Exec_as_rdr__rls_manual (Object rdr_obj, String sql) {return Db_rdr_.Empty;}
|
||||
public Db_rdr Exec_as_rdr__rls_auto (Db_stmt stmt, Object rdr_obj, String sql) {return Db_rdr_.Empty;}
|
||||
public Db_stmt Stmt_by_qry(Db_qry qry) {return Db_stmt_.Null;}
|
||||
public Object Stmt_by_sql(String sql) {throw Err_.new_unimplemented();}
|
||||
public DataRdr New_rdr(java.sql.ResultSet rdr, String sql) {return DataRdr_.Null;}
|
||||
public void Txn_bgn(String name) {}
|
||||
public String Txn_end() {return "";}
|
||||
public void Txn_cxl() {}
|
||||
public void Txn_sav() {}
|
||||
public Object Exec_as_obj(Db_qry cmd) {return cmd.Exec_is_rdr() ? (Object)DataRdr_.Null : -1;}
|
||||
public void Meta_tbl_create(Dbmeta_tbl_itm meta) {}
|
||||
public void Meta_idx_create(Gfo_usr_dlg usr_dlg, Dbmeta_idx_itm... ary) {}
|
||||
public void Meta_fld_append(String tbl, Dbmeta_fld_itm fld) {}
|
||||
public void Meta_tbl_delete(String tbl) {}
|
||||
public void Env_db_attach(String alias, Db_conn conn) {}
|
||||
public void Env_db_attach(String alias, Io_url db_url) {}
|
||||
public void Env_db_detach(String alias) {}
|
||||
public boolean Meta_tbl_exists(String tbl) {return false;}
|
||||
public boolean Meta_fld_exists(String tbl, String fld) {return false;}
|
||||
public boolean Meta_idx_exists(String idx) {return false;}
|
||||
public Dbmeta_tbl_mgr Meta_mgr() {return meta_tbl_mgr;} private final Dbmeta_tbl_mgr meta_tbl_mgr = new Dbmeta_tbl_mgr(Dbmeta_reload_cmd_.Noop);
|
||||
public static final Noop_engine Instance = new Noop_engine(); Noop_engine() {}
|
||||
}
|
@ -1,49 +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.dbs.engines.nulls; import gplx.*; import gplx.dbs.*; import gplx.dbs.engines.*;
|
||||
import gplx.core.stores.*; import gplx.dbs.metas.*; import gplx.dbs.sqls.*;
|
||||
public class Noop_engine implements Db_engine {
|
||||
public String Tid() {return Noop_conn_info.Tid_const;}
|
||||
public Db_conn_info Conn_info() {return Db_conn_info_.Null;}
|
||||
public Sql_qry_wtr Sql_wtr() {return sql_wtr;} private final Sql_qry_wtr sql_wtr = Sql_qry_wtr_.Basic;
|
||||
public void Conn_open() {}
|
||||
public void Conn_term() {}
|
||||
public Db_engine New_clone(Db_conn_info url) {return this;}
|
||||
public Db_rdr New_rdr__rls_manual (Object rdr_obj, String sql) {return Db_rdr_.Empty;}
|
||||
public Db_rdr New_rdr__rls_auto (Db_stmt stmt, Object rdr_obj, String sql) {return Db_rdr_.Empty;}
|
||||
public Db_stmt New_stmt_prep(Db_qry qry) {return Db_stmt_.Null;}
|
||||
public Object New_stmt_prep_as_obj(String sql) {throw Err_.new_unimplemented();}
|
||||
public DataRdr New_rdr(java.sql.ResultSet rdr, String sql) {return DataRdr_.Null;}
|
||||
public void Txn_bgn(String name) {}
|
||||
public String Txn_end() {return "";}
|
||||
public void Txn_cxl() {}
|
||||
public void Txn_sav() {}
|
||||
public Object Exec_as_obj(Db_qry cmd) {return cmd.Exec_is_rdr() ? (Object)DataRdr_.Null : -1;}
|
||||
public void Ddl_create_tbl(Dbmeta_tbl_itm meta) {}
|
||||
public void Ddl_create_idx(Gfo_usr_dlg usr_dlg, Dbmeta_idx_itm... ary) {}
|
||||
public void Ddl_append_fld(String tbl, Dbmeta_fld_itm fld) {}
|
||||
public void Ddl_delete_tbl(String tbl) {}
|
||||
public void Env_db_attach(String alias, Db_conn conn) {}
|
||||
public void Env_db_attach(String alias, Io_url db_url) {}
|
||||
public void Env_db_detach(String alias) {}
|
||||
public void Meta_reload() {}
|
||||
public boolean Meta_tbl_exists(String tbl) {return false;}
|
||||
public boolean Meta_fld_exists(String tbl, String fld) {return false;}
|
||||
public Dbmeta_tbl_mgr Meta_tbl_load_all() {return meta_tbl_mgr;} private final Dbmeta_tbl_mgr meta_tbl_mgr = new Dbmeta_tbl_mgr();
|
||||
public static final Noop_engine Instance = new Noop_engine(); Noop_engine() {}
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
/*
|
||||
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.dbs.engines.sqlite; import gplx.*; import gplx.dbs.*; import gplx.dbs.engines.*;
|
||||
import gplx.core.primitives.*; import gplx.dbs.qrys.*; import gplx.dbs.utls.*; import gplx.dbs.engines.*; import gplx.dbs.engines.sqlite.*;
|
||||
public class Sqlite_pragma implements Db_qry {
|
||||
private final String sql;
|
||||
public Sqlite_pragma(boolean parens, String key, String val) {
|
||||
String fmt = parens ? "PRAGMA {0}({1});" : "PRAGMA {0} = {1};";
|
||||
this.sql = String_.Format(fmt, key, val);
|
||||
}
|
||||
public int Tid() {return Db_qry_.Tid_pragma;}
|
||||
public boolean Exec_is_rdr() {return false;}
|
||||
public String Base_table() {return "";}
|
||||
public String To_sql__exec(gplx.dbs.sqls.Sql_qry_wtr wtr) {return sql;}
|
||||
|
||||
public static final String Const__journal_mode = "journal_mode", Const__journal_mode__wal = "wal", Const__journal_mode__off = "off";
|
||||
public static Sqlite_pragma New__journal__delete() {return new Sqlite_pragma(Bool_.N, Const__journal_mode , "delete");} // default
|
||||
public static Sqlite_pragma New__journal__truncate() {return new Sqlite_pragma(Bool_.N, Const__journal_mode , "truncate");}
|
||||
public static Sqlite_pragma New__journal__persist() {return new Sqlite_pragma(Bool_.N, Const__journal_mode , "persist");}
|
||||
public static Sqlite_pragma New__journal__memory() {return new Sqlite_pragma(Bool_.N, Const__journal_mode , "memory");}
|
||||
public static Sqlite_pragma New__journal__wal() {return new Sqlite_pragma(Bool_.N, Const__journal_mode , Const__journal_mode__wal);}
|
||||
public static Sqlite_pragma New__journal__off() {return new Sqlite_pragma(Bool_.N, Const__journal_mode , Const__journal_mode__off);}
|
||||
public static Sqlite_pragma New__synchronous__off() {return new Sqlite_pragma(Bool_.N, "synchronous" , "off");}
|
||||
public static Sqlite_pragma New__synchronous__normal() {return new Sqlite_pragma(Bool_.N, "synchronous" , "normal");} // default if WAL
|
||||
public static Sqlite_pragma New__synchronous__full() {return new Sqlite_pragma(Bool_.N, "synchronous" , "full");} // default otherwise
|
||||
public static Sqlite_pragma New__synchronous__extra() {return new Sqlite_pragma(Bool_.N, "synchronous" , "extra");}
|
||||
public static Sqlite_pragma New__wal_autocheckpoint(int v) {return new Sqlite_pragma(Bool_.N, "wal_auto_checkpoint", Int_.To_str(v));} // default is 1000
|
||||
public static Sqlite_pragma New__wal_checkpoint__passive() {return new Sqlite_pragma(Bool_.Y, "wal_checkpoint" , "passive");}
|
||||
public static Sqlite_pragma New__wal_checkpoint__full() {return new Sqlite_pragma(Bool_.Y, "wal_checkpoint" , "full");}
|
||||
public static Sqlite_pragma New__wal_checkpoint__restart() {return new Sqlite_pragma(Bool_.Y, "wal_checkpoint" , "restart");}
|
||||
public static Sqlite_pragma New__wal_checkpoint__truncate() {return new Sqlite_pragma(Bool_.Y, "wal_checkpoint" , "truncate");}
|
||||
public static Sqlite_pragma New__locking_mode__normal() {return new Sqlite_pragma(Bool_.N, "locking_mode" , "normal");} // default
|
||||
public static Sqlite_pragma New__locking_mode__exclusive() {return new Sqlite_pragma(Bool_.N, "locking_mode" , "exclusive");}
|
||||
public static Sqlite_pragma New__page_size(int v) {return new Sqlite_pragma(Bool_.N, "page_size" , Int_.To_str(v));} // default is 1024
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
/*
|
||||
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.dbs.metas; import gplx.*; import gplx.dbs.*;
|
||||
public class Dbmeta_reload_cmd_ {
|
||||
public static final Dbmeta_reload_cmd Noop = new Dbmeta_reload_cmd__noop();
|
||||
}
|
||||
class Dbmeta_reload_cmd__noop implements Dbmeta_reload_cmd {
|
||||
public void Load_all() {}
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
/*
|
||||
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.dbs.qrys.bats; import gplx.*; import gplx.dbs.*; import gplx.dbs.qrys.*;
|
||||
import gplx.dbs.engines.*; import gplx.dbs.engines.sqlite.*;
|
||||
public class Db_batch__journal_off {
|
||||
public static void Batch__init(Db_batch_mgr batch_mgr) {
|
||||
batch_mgr.Conn_bgn().Add(Db_batch__journal_off__conn_bgn.Instance);
|
||||
batch_mgr.Conn_end().Add(Db_batch__journal_off__conn_end.Instance);
|
||||
}
|
||||
public static void Batch__term(Db_batch_mgr batch_mgr) {
|
||||
batch_mgr.Conn_bgn().Del(Db_batch__journal_off__conn_bgn.Instance.Key());
|
||||
batch_mgr.Conn_end().Del(Db_batch__journal_off__conn_end.Instance.Key());
|
||||
}
|
||||
}
|
||||
class Db_batch__journal_off__conn_bgn implements Db_batch_itm {
|
||||
public String Key() {return KEY;} public static final String KEY = "journal_off.conn_bgn";
|
||||
public void Qry_bat__run(Db_engine engine) {
|
||||
engine.Props().Add(Sqlite_pragma.Const__journal_mode, Sqlite_pragma.Const__journal_mode__off);
|
||||
engine.Exec_as_obj(Sqlite_pragma.New__journal__off()); // off b/c failure and corruption doesn't matter to import
|
||||
engine.Exec_as_obj(Sqlite_pragma.New__synchronous__off()); // off b/c failure and corruption doesn't matter to import
|
||||
}
|
||||
public static final Db_batch__journal_off__conn_bgn Instance = new Db_batch__journal_off__conn_bgn(); Db_batch__journal_off__conn_bgn() {}
|
||||
}
|
||||
class Db_batch__journal_off__conn_end implements Db_batch_itm {
|
||||
public String Key() {return KEY;} public static final String KEY = "journal_off.conn_end";
|
||||
public void Qry_bat__run(Db_engine engine) {
|
||||
if (!engine.Props().Match(Sqlite_pragma.Const__journal_mode, Sqlite_pragma.Const__journal_mode__off)) return;
|
||||
engine.Exec_as_obj(Sqlite_pragma.New__journal__delete());
|
||||
engine.Exec_as_obj(Sqlite_pragma.New__synchronous__full());
|
||||
engine.Props().Del(Sqlite_pragma.Const__journal_mode);
|
||||
}
|
||||
public static final Db_batch__journal_off__conn_end Instance = new Db_batch__journal_off__conn_end(); Db_batch__journal_off__conn_end() {}
|
||||
}
|
@ -0,0 +1,62 @@
|
||||
/*
|
||||
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.dbs.qrys.bats; import gplx.*; import gplx.dbs.*; import gplx.dbs.qrys.*;
|
||||
import gplx.dbs.engines.*; import gplx.dbs.engines.sqlite.*;
|
||||
public class Db_batch__journal_wal {
|
||||
public static void Batch__init(Db_batch_mgr batch_mgr) {
|
||||
batch_mgr.Conn_bgn().Add(Db_batch__journal_wal__conn_bgn.Instance);
|
||||
batch_mgr.Conn_end().Add(Db_batch__journal_wal__conn_end.Instance);
|
||||
batch_mgr.Conn_bgn().Add(Db_batch__journal_wal__txn_end.Instance);
|
||||
}
|
||||
public static void Batch__term(Db_batch_mgr batch_mgr) {
|
||||
batch_mgr.Conn_bgn().Del(Db_batch__journal_wal__conn_bgn.Instance.Key());
|
||||
batch_mgr.Conn_end().Del(Db_batch__journal_wal__conn_end.Instance.Key());
|
||||
batch_mgr.Txn_end().Del(Db_batch__journal_wal__txn_end.Instance.Key());
|
||||
}
|
||||
}
|
||||
class Db_batch__journal_wal__conn_bgn implements Db_batch_itm {
|
||||
public String Key() {return KEY;} public static final String KEY = "journal_wal.conn_bgn";
|
||||
public void Qry_bat__run(Db_engine engine) {
|
||||
if (engine.Props().Match(Sqlite_pragma.Const__journal_mode, Sqlite_pragma.Const__journal_mode__off)) return; // if off, don't enable wal
|
||||
if (engine.Props().Match(Sqlite_pragma.Const__journal_mode, Sqlite_pragma.Const__journal_mode__wal)) return; // if wal, don't enable again
|
||||
engine.Props().Add(Sqlite_pragma.Const__journal_mode, Sqlite_pragma.Const__journal_mode__wal);
|
||||
engine.Exec_as_obj(Sqlite_pragma.New__journal__wal());
|
||||
engine.Exec_as_obj(Sqlite_pragma.New__synchronous__normal());
|
||||
engine.Exec_as_obj(Sqlite_pragma.New__wal_autocheckpoint(0));
|
||||
}
|
||||
public static final Db_batch__journal_wal__conn_bgn Instance = new Db_batch__journal_wal__conn_bgn(); Db_batch__journal_wal__conn_bgn() {}
|
||||
}
|
||||
class Db_batch__journal_wal__conn_end implements Db_batch_itm {
|
||||
public String Key() {return KEY;} public static final String KEY = "journal_wal.conn_end";
|
||||
public void Qry_bat__run(Db_engine engine) {
|
||||
if (!engine.Props().Match(Sqlite_pragma.Const__journal_mode, Sqlite_pragma.Const__journal_mode__wal)) return; // if in off mode, don't enable wal
|
||||
engine.Exec_as_obj(Sqlite_pragma.New__wal_checkpoint__truncate());
|
||||
engine.Exec_as_obj(Sqlite_pragma.New__journal__delete());
|
||||
engine.Exec_as_obj(Sqlite_pragma.New__synchronous__full());
|
||||
engine.Props().Del(Sqlite_pragma.Const__journal_mode);
|
||||
}
|
||||
public static final Db_batch__journal_wal__conn_end Instance = new Db_batch__journal_wal__conn_end(); Db_batch__journal_wal__conn_end() {}
|
||||
}
|
||||
class Db_batch__journal_wal__txn_end implements Db_batch_itm {
|
||||
public String Key() {return KEY;} public static final String KEY = "journal_wal.txn_end";
|
||||
public void Qry_bat__run(Db_engine engine) {
|
||||
if (!engine.Props().Match(Sqlite_pragma.Const__journal_mode, Sqlite_pragma.Const__journal_mode__wal)) return; // if in off mode, don't enable wal
|
||||
engine.Exec_as_obj(Sqlite_pragma.New__wal_checkpoint__truncate());
|
||||
}
|
||||
public static final Db_batch__journal_wal__txn_end Instance = new Db_batch__journal_wal__txn_end(); Db_batch__journal_wal__txn_end() {}
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
/*
|
||||
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.dbs.qrys.bats; import gplx.*; import gplx.dbs.*; import gplx.dbs.qrys.*;
|
||||
import gplx.dbs.engines.*;
|
||||
public class Db_batch_grp {
|
||||
public final Ordered_hash hash = Ordered_hash_.New();
|
||||
public Db_batch_grp(byte tid) {this.tid = tid;}
|
||||
public byte Tid() {return tid;} private final byte tid;
|
||||
public int Len() {return hash.Len();}
|
||||
public Db_batch_itm Get_at(int idx) {return (Db_batch_itm)hash.Get_at(idx); }
|
||||
public void Add(Db_batch_itm itm) {hash.Add(itm.Key(), itm);}
|
||||
public void Del(String key) {hash.Del(key);}
|
||||
public void Run(Db_engine engine) {
|
||||
int len = hash.Len();
|
||||
for (int i = 0; i < len; ++i) {
|
||||
Db_batch_itm itm = (Db_batch_itm)hash.Get_at(i);
|
||||
itm.Qry_bat__run(engine);
|
||||
}
|
||||
}
|
||||
public void Copy(Db_batch_grp src) {
|
||||
int len = src.Len();
|
||||
for (int i = 0; i < len; ++i) {
|
||||
Db_batch_itm itm = src.Get_at(i);
|
||||
this.Add(itm);
|
||||
}
|
||||
}
|
||||
public static final byte Tid__conn_bgn = 0, Tid__conn_end = 1, Tid__txn_bgn = 2, Tid__txn_end = 3;
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
/*
|
||||
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.dbs.qrys.bats; import gplx.*; import gplx.dbs.*; import gplx.dbs.qrys.*;
|
||||
import gplx.dbs.engines.*;
|
||||
public interface Db_batch_itm {
|
||||
String Key();
|
||||
void Qry_bat__run(Db_engine engine);
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
/*
|
||||
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.dbs.qrys.bats; import gplx.*; import gplx.dbs.*; import gplx.dbs.qrys.*;
|
||||
public class Db_batch_mgr {
|
||||
public Db_batch_grp Conn_bgn() {return conn_bgn;} private final Db_batch_grp conn_bgn = new Db_batch_grp(Db_batch_grp.Tid__conn_bgn);
|
||||
public Db_batch_grp Conn_end() {return conn_end;} private final Db_batch_grp conn_end = new Db_batch_grp(Db_batch_grp.Tid__conn_end);
|
||||
public Db_batch_grp Txn_end () {return txn_end;} private final Db_batch_grp txn_end = new Db_batch_grp(Db_batch_grp.Tid__txn_end);
|
||||
public void Copy(String src_tid, Db_batch_mgr src) {
|
||||
conn_bgn.Copy(src.conn_bgn);
|
||||
conn_end.Copy(src.conn_end);
|
||||
txn_end.Copy(src.txn_end);
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
/*
|
||||
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; import gplx.*; import gplx.xowa.*;
|
||||
import gplx.xowa.bldrs.wkrs.*;
|
||||
public interface Xoax_addon_bldr {
|
||||
Xob_cmd[] Cmds_ary();
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
/*
|
||||
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.apps.searchs; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.apps.*;
|
||||
import gplx.xowa.addons.apps.searchs.searchers.*;
|
||||
import gplx.xowa.addons.apps.searchs.searchers.rslts.*;
|
||||
public interface Srch_search_addon_api {
|
||||
void Search(Srch_search_qry qry, Srch_rslt_cbk cbk);
|
||||
}
|
@ -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.apps.searchs; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.apps.*;
|
||||
import gplx.xowa.bldrs.wkrs.*; import gplx.xowa.addons.apps.searchs.bldrs.cmds.*;
|
||||
public class Xoax_builds_search_addon implements Xoax_addon_itm, Xoax_addon_bldr {
|
||||
public Xob_cmd[] Cmds_ary() {
|
||||
return new Xob_cmd[]
|
||||
{ Xobldr__link__link_score.Prototype
|
||||
, Xobldr__page__page_score.Prototype
|
||||
, Xobldr__word__link_count.Prototype
|
||||
};
|
||||
}
|
||||
|
||||
public static final byte[] ADDON_KEY = Bry_.new_a7("xowa.builds.search");
|
||||
public byte[] Addon__key() {return ADDON_KEY;}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue