mirror of https://github.com/gnosygnu/xowa
parent
2145f6382c
commit
5fe27b5b3b
@ -0,0 +1,34 @@
|
||||
/*
|
||||
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.core.net; import gplx.*; import gplx.core.*;
|
||||
public class Gfo_inet_conn_ {
|
||||
public static Gfo_inet_conn new_mem_hash() {return new Gfo_inet_conn__mem__hash();}
|
||||
public static Gfo_inet_conn new_mem_pile() {return new Gfo_inet_conn__mem__pile();}
|
||||
}
|
||||
class Gfo_inet_conn__mem__hash implements Gfo_inet_conn {
|
||||
private final Hash_adp_bry hash = Hash_adp_bry.cs();
|
||||
public void Clear() {hash.Clear();}
|
||||
public void Upload_data(byte[] url, byte[] data) {hash.Add(url, data);}
|
||||
public byte[] Download_data(byte[] url) {return (byte[])hash.Get_by(url);}
|
||||
}
|
||||
class Gfo_inet_conn__mem__pile implements Gfo_inet_conn {
|
||||
private final List_adp pile = List_adp_.new_();
|
||||
public void Clear() {pile.Clear();}
|
||||
public void Upload_data(byte[] url, byte[] data) {pile.Add(data);}
|
||||
public byte[] Download_data(byte[] url) {return (byte[])List_adp_.Pop_last(pile);}
|
||||
}
|
@ -1,40 +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.apps.metas; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*;
|
||||
import gplx.dbs.*;
|
||||
import gplx.xowa.langs.cases.*;
|
||||
import gplx.xowa.wikis.domains.*;
|
||||
import gplx.xowa.wmfs.data.*;
|
||||
public class Xoa_ns_mgr {
|
||||
private final Xoa_app app;
|
||||
private final Hash_adp_bry hash = Hash_adp_bry.cs();
|
||||
private Site_core_db core_db;
|
||||
public Xoa_ns_mgr(Xoa_app app) {
|
||||
this.app = app;
|
||||
}
|
||||
public void Add(byte[] wiki_domain, Xow_ns_mgr ns_mgr) {hash.Add(wiki_domain, ns_mgr);} // TEST:
|
||||
public Xow_ns_mgr Get_or_load(byte[] wiki_domain) {
|
||||
Xow_ns_mgr rv = (Xow_ns_mgr)hash.Get_by_bry(wiki_domain);
|
||||
if (rv == null) {
|
||||
if (core_db == null) core_db = new Site_core_db(app.Fsys_mgr().Cfg_site_meta_fil());
|
||||
rv = core_db.Load_ns(wiki_domain);
|
||||
Add(wiki_domain, rv);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue