Skip to content

Commit

Permalink
NAS-2642: The first 25 URIs get skipped
Browse files Browse the repository at this point in the history
  • Loading branch information
Knud Åge Hansen committed Aug 23, 2017
1 parent bc550ea commit d43c013
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -582,13 +582,16 @@ public void job(HttpServletRequest req, HttpServletResponse resp, List<Integer>
generateJobIsNotRunning(numerics, sb);
}

String pageName = NAS_JOB + h3Job.jobId;
String pageName = NAS_JOB;
if (h3Job != null) {
pageName += h3Job.jobId;
}
generatePageInformation(numerics, locale, masterTplBuilder, sb, menuSb, pageName);

if (masterTplBuilder.titlePlace != null) {
if (masterTplBuilder.titlePlace != null && h3Job != null) {
masterTplBuilder.titlePlace.setText("Details and Actions on Running Job "+h3Job.jobId);
}
if (masterTplBuilder.headingPlace != null) {
if (masterTplBuilder.headingPlace != null && h3Job != null) {
masterTplBuilder.headingPlace.setText("Details and Actions on Running Job "+h3Job.jobId);
}

Expand Down Expand Up @@ -691,12 +694,14 @@ public void frontier_list(HttpServletRequest req, HttpServletResponse resp, List
String regex = getParameterRegex(req);
long limit = getLimit(req);
String initials = getInitials(req);
/*
page = getPage(req, page);
linesPerPage = limit;
pageString = getParameterPage(req, pageString);
*/

String script = getGroovyScript();

//Another content has to be loaded in and the number of pages shall be determined from that content

/*
//RandomAccessFile raf = new RandomAccessFile("/home/nicl/workspace-nas-h3/heritrix3-scripts/src/main/java/view-frontier-url.groovy", "r");
Expand All @@ -717,8 +722,7 @@ public void frontier_list(HttpServletRequest req, HttpServletResponse resp, List
//printCrawlLog '.*' //View already crawled lines uris matching a given regexp

Heritrix3JobMonitor h3Job = environment.h3JobMonitorThread.getRunningH3Job(numerics.get(0));
Pageable pageable = h3Job;
//long pendingUris = job.crawlController.frontier.pendingUris;
// Pageable pageable = h3Job;

if (h3Job != null && h3Job.isReady()) {
generateJobInformation(menuSb, h3Job);
Expand All @@ -730,6 +734,7 @@ public void frontier_list(HttpServletRequest req, HttpServletResponse resp, List
sb.append("&nbsp;");
produceInitials(sb, initials);

/*
long totalCachedLines = h3Job.getTotalCachedLines();
long totalCachedSize = h3Job.getLastIndexed();
Expand All @@ -751,6 +756,8 @@ public void frontier_list(HttpServletRequest req, HttpServletResponse resp, List
//produceItemsPerPage(linesPerPage, pageString, sb);
sb.append("</div>\n");
producePagination(lines, linesPerPage, page, pages, sb, pageable);
*/

generateGroovy(sb, script, h3Job);
} else {
generateJobIsNotRunning(numerics, sb);
Expand Down Expand Up @@ -797,7 +804,7 @@ private String getDeleteScript(String regex, long limit, String initials, String
script += "\ninitials = \"" + initials + "\"";
script += "\ndeleteFromFrontier '" + regex + "'\n";
} else {
//parametre bliver ikke overført til groovy???
//It seems like the groovy script can't get hold of the parameters
script += "\n";
script += "\nlistFrontier '" + regex + "', " + limit + "\n";
}
Expand All @@ -806,6 +813,7 @@ private String getDeleteScript(String regex, long limit, String initials, String

private void generateGroovy(StringBuilder sb, String script, Heritrix3JobMonitor h3Job) {
ScriptResult scriptResult = h3Job.h3wrapper.ExecuteShellScriptInJob(h3Job.jobResult.job.shortName, "groovy", script);

//System.out.println(new String(scriptResult.response, "UTF-8"));
if (scriptResult != null && scriptResult.script != null) {
if (scriptResult.script.htmlOutput != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ void listFrontier(String regex, long limit) {
try {
htmlOut.println 0

while (cursor.getNext(key, value, null) == OperationStatus.SUCCESS && index < page * linesPerPage) {
//while (cursor.getNext(key, value, null) == OperationStatus.SUCCESS && index < page * linesPerPage) {
while (cursor.getNext(key, value, null) == OperationStatus.SUCCESS && index < 25) {
index++
content = content + index + '\n'
}
Expand Down

0 comments on commit d43c013

Please sign in to comment.