diff --git a/htroot/IndexImportOAIPMHList_p.html b/htroot/IndexImportOAIPMHList_p.html index 118de3245..99b0756c3 100644 --- a/htroot/IndexImportOAIPMHList_p.html +++ b/htroot/IndexImportOAIPMHList_p.html @@ -3,9 +3,24 @@ YaCy '#[clientname]#': OAI-PMH source import list #%env/templates/metas.template%# - + #(refresh)#::#(/refresh)# + #(source)#:: +

OAI Source List

+ + + + + #{table}# + + + + #{/table}# +
Source
#[source]#
+ #(/source)# + + #(import)#::

Import List

@@ -25,5 +40,6 @@ #{/table}#
+ #(/import)# diff --git a/htroot/IndexImportOAIPMHList_p.java b/htroot/IndexImportOAIPMHList_p.java index b6f0af69f..4f39cda82 100644 --- a/htroot/IndexImportOAIPMHList_p.java +++ b/htroot/IndexImportOAIPMHList_p.java @@ -23,10 +23,12 @@ // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA import java.util.ArrayList; +import java.util.Set; import net.yacy.document.importer.OAIPMHImporter; import de.anomic.http.server.RequestHeader; +import de.anomic.search.Switchboard; import de.anomic.server.serverObjects; import de.anomic.server.serverSwitch; @@ -34,25 +36,49 @@ public class IndexImportOAIPMHList_p { public static serverObjects respond(final RequestHeader header, serverObjects post, final serverSwitch env) { final serverObjects prop = new serverObjects(); + final Switchboard sb = (Switchboard) env; + + prop.put("refresh", 0); + prop.put("import", 0); + prop.put("source", 0); - ArrayList jobs = new ArrayList(); - for (OAIPMHImporter job: OAIPMHImporter.runningJobs) jobs.add(job); - for (OAIPMHImporter job: OAIPMHImporter.startedJobs) jobs.add(job); - for (OAIPMHImporter job: OAIPMHImporter.finishedJobs) jobs.add(job); + if (post != null && post.containsKey("source")) { + Set oaiRoots = OAIPMHImporter.getOAIServer(sb.loader); + + boolean dark = false; + int cnt = 0; + for (String root: oaiRoots) { + prop.put("source_table_" + cnt + "_dark", (dark) ? "1" : "0"); + prop.put("source_table_" + cnt + "_source", root); + dark = !dark; + cnt++; + } + prop.put("source_table", cnt); + prop.put("source", 1); + } - boolean dark = false; - int cnt = 0; - for (OAIPMHImporter job: jobs) { - prop.put("table_" + cnt + "_dark", (dark) ? "1" : "0"); - prop.put("table_" + cnt + "_thread", (job.isAlive()) ? "\"running\"" : "finished"); - prop.put("table_" + cnt + "_source", job.source()); - prop.put("table_" + cnt + "_chunkCount", job.chunkCount()); - prop.put("table_" + cnt + "_recordsCount", job.count()); - prop.put("table_" + cnt + "_speed", job.speed()); - dark = !dark; - cnt++; + if (post != null && post.containsKey("import")) { + ArrayList jobs = new ArrayList(); + for (OAIPMHImporter job: OAIPMHImporter.runningJobs) jobs.add(job); + for (OAIPMHImporter job: OAIPMHImporter.startedJobs) jobs.add(job); + for (OAIPMHImporter job: OAIPMHImporter.finishedJobs) jobs.add(job); + + boolean dark = false; + int cnt = 0; + for (OAIPMHImporter job: jobs) { + prop.put("import_table_" + cnt + "_dark", (dark) ? "1" : "0"); + prop.put("import_table_" + cnt + "_thread", (job.isAlive()) ? "\"running\"" : "finished"); + prop.put("import_table_" + cnt + "_source", job.source()); + prop.put("import_table_" + cnt + "_chunkCount", job.chunkCount()); + prop.put("import_table_" + cnt + "_recordsCount", job.count()); + prop.put("import_table_" + cnt + "_speed", job.speed()); + dark = !dark; + cnt++; + } + prop.put("import_table", cnt); + prop.put("import", 1); + prop.put("refresh", 1); } - prop.put("table", cnt); return prop; } diff --git a/htroot/IndexImportOAIPMH_p.html b/htroot/IndexImportOAIPMH_p.html index ead665810..00049abe4 100644 --- a/htroot/IndexImportOAIPMH_p.html +++ b/htroot/IndexImportOAIPMH_p.html @@ -15,7 +15,7 @@
Single request import This will submit only a single request as given here to a OAI-PMH server and imports records into the index
- + #(import-one)#::

@@ -32,14 +32,15 @@
Import all Records from a server - Import all records that follow acording to resumption elements into index
- - + Import all records that follow according to resumption elements into index
+ + + or  #(status)#::

Import started!

::

Bad input data: #[message]#

#(/status)#