/
Harveststatus-jobdetails.jsp
342 lines (325 loc) · 14.3 KB
/
Harveststatus-jobdetails.jsp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
<%--
File: $Id$
Revision: $Revision$
Author: $Author$
Date: $Date$
The Netarchive Suite - Software to harvest and preserve websites
Copyright 2004-2012 The Royal Danish Library, the Danish State and
University Library, the National Library of France and the Austrian
National Library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
--%><%--
This page shows details about a single job.
Note that the response language for the page is set using requested locale
of the client browser when fmt:setBundle is called. After that, fmt:format
and reponse.getLocale use this locale.
--%><%@ page import="java.util.Map,
dk.netarkivet.common.exceptions.ForwardedToErrorPage,
dk.netarkivet.common.exceptions.UnknownID,
dk.netarkivet.common.utils.I18n,
dk.netarkivet.common.utils.StringUtils,
dk.netarkivet.common.webinterface.HTMLUtils,
dk.netarkivet.common.webinterface.SiteSection,
dk.netarkivet.harvester.datamodel.DomainDAO,
dk.netarkivet.harvester.datamodel.HarvestDefinitionDAO,
dk.netarkivet.harvester.datamodel.HarvestInfo,
dk.netarkivet.harvester.datamodel.Job,
dk.netarkivet.harvester.datamodel.JobDAO,
dk.netarkivet.harvester.datamodel.JobStatus,
dk.netarkivet.harvester.webinterface.Constants"
pageEncoding="UTF-8"
%><%@taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"
%><fmt:setLocale value="<%=HTMLUtils.getLocale(request)%>" scope="page"
/><fmt:setBundle scope="page" basename="<%=dk.netarkivet.harvester.Constants.TRANSLATIONS_BUNDLE%>"/><%!
private static final I18n I18N = new I18n(
dk.netarkivet.harvester.Constants.TRANSLATIONS_BUNDLE);
%><%
HTMLUtils.setUTF8(request);
long jobID;
try {
jobID = HTMLUtils.parseAndCheckInteger(pageContext,
Constants.JOB_PARAM, 1, Integer.MAX_VALUE);
} catch (ForwardedToErrorPage e) {
return;
}
Job job;
try {
job = JobDAO.getInstance().read(jobID);
} catch (UnknownID e) {
HTMLUtils.forwardWithErrorMessage(pageContext, I18N,
"errormsg;job.unknown.id.0", jobID);
return;
}
String harvestname;
String harvesturl= "/HarvestDefinition/Definitions-selective-harvests.jsp";
String jobdetailsUrl = "/History/Harveststatus-jobdetails.jsp";
boolean definitionsSitesectionDeployed = SiteSection.isDeployed(
Constants.DEFINITIONS_SITESECTION_DIRNAME);
final Long harvestID = job.getOrigHarvestDefinitionID();
try {
harvestname = HarvestDefinitionDAO.getInstance().getHarvestName(
harvestID);
// define harvesturl, only if we have deployed the Definitions sitesection
if (definitionsSitesectionDeployed) {
if (HarvestDefinitionDAO.getInstance().isSnapshot(harvestID)) {
harvesturl =
"/HarvestDefinition/Definitions-edit-snapshot-harvest.jsp?"
+ Constants.HARVEST_PARAM + "="
+ HTMLUtils.encode(harvestname);
} else {
harvesturl = "/HarvestDefinition/Definitions-edit-selective-harvest.jsp?"
+ Constants.HARVEST_PARAM + "="
+ HTMLUtils.encode(harvestname);
}
}
} catch (UnknownID e) {
// If no harvestdefinition is known with ID=harvestID
// Set harvestname = an internationalized version of
// "Unknown harvest" + harvestID
harvestname = I18N.getString(response.getLocale(),
"unknown.harvest.0", harvestID);
}
String harvestnameTdContents = HTMLUtils.escapeHtmlValues(harvestname);
if (definitionsSitesectionDeployed) {
harvestnameTdContents = "<a href=\"" + HTMLUtils.escapeHtmlValues(harvesturl)
+ "\">" + HTMLUtils.escapeHtmlValues(harvestname) + "</a>";
}
String jobstatusTdContents = job.getStatus().getLocalizedString(response.getLocale());
// If the status of the job is RESUBMITTED (and the new job is known),
// add a link to the new job
// Note: this information was only available from release 3.8.0
// So for historical jobs generated with previous versions of NetarchiveSuite,
// this information is not available.
if (job.getStatus().equals(JobStatus.RESUBMITTED)
&& job.getResubmittedAsJob() != null) {
jobstatusTdContents += "<br/>(<a href=\"" + jobdetailsUrl + "?"
+ Constants.JOB_PARAM + "=" + job.getResubmittedAsJob() + "\">"
+ "Job " + job.getResubmittedAsJob() + "</a>" + ")";
}
HTMLUtils.generateHeader(pageContext);
%>
<h3 class="page_heading"><fmt:message key="pagetitle;details.for.job.0">
<fmt:param value="<%=jobID%>"/>
</fmt:message></h3>
<table class="selection_table">
<tr>
<th><fmt:message key="table.job.jobid"/></th>
<th><fmt:message key="table.job.type"/></th>
<th><fmt:message key="table.job.harvestname"/></th>
<th><fmt:message key="table.job.harvestnumber"/></th>
<th><fmt:message key="table.job.creationtime"/></th>
<th><fmt:message key="table.job.starttime"/></th>
<th><fmt:message key="table.job.stoptime"/></th>
<th><fmt:message key="table.job.jobstatus"/></th>
<th><fmt:message key="table.job.harvesterror"/></th>
<th><fmt:message key="table.job.uploaderror"/></th>
<th><fmt:message key="table.job.objectlimit"/></th>
<th><fmt:message key="table.job.bytelimit"/></th>
</tr>
<tr>
<td><%=job.getJobID()%></td>
<td><%=job.getChannel()%>
</td>
<td><%=harvestnameTdContents %></td>
<td><%=dk.netarkivet.harvester.webinterface.HarvestStatus
.makeHarvestRunLink(harvestID,
job.getHarvestNum())%>
</td>
<td><fmt:formatDate type="both" value="<%=job.getCreationDate()%>"/></td>
<td><fmt:formatDate type="both" value="<%=job.getActualStart()%>"/></td>
<td><fmt:formatDate type="both" value="<%=job.getActualStop()%>"/></td>
<td><%=jobstatusTdContents %></td>
<td><a href="#harvesterror">
<%=HTMLUtils.escapeHtmlValues(job.getHarvestErrors())%>
</a></td>
<td><a href="#uploaderror">
<%=HTMLUtils.escapeHtmlValues(job.getUploadErrors())%>
</a></td>
<td><fmt:formatNumber type="number"
value="<%=job.getMaxObjectsPerDomain()%>"/></td>
<td><fmt:formatNumber type="number"
value="<%=job.getMaxBytesPerDomain()%>"/></td>
</tr>
</table>
<%-- display the searchFilter if QA webpages are deployed--%>
<%
if (SiteSection.isDeployed(Constants.QA_SITESECTION_DIRNAME)) { %>
<h3><fmt:message key="subtitle.job.qa.selection"/></h3>
<table class="selection_table">
<tr>
<td>
<p><a href="/<%=Constants.QA_SITESECTION_DIRNAME
%>/QA-changeIndex.jsp?<%=Constants.JOB_PARAM%>=<%=
job.getJobID()%>&<%=Constants.INDEXLABEL_PARAM%>=<%=
HTMLUtils.escapeHtmlValues(HTMLUtils.encode(I18N.getString(
response.getLocale(), "job.0", job.getJobID())))%>">
<fmt:message key="select.job.for.qa.with.viewerproxy"/>
</a></p>
</td>
</tr>
<tr>
<td><fmt:message key="helptext;select.job.for.qa.with.viewerproxy"/>
</td>
</tr>
</table>
<% } %>
<h3><fmt:message key="subtitle.job.domainconfigurations"/></h3>
<table class="selection_table">
<tr>
<th><fmt:message key="table.job.domainconfigurations.domain"/></th>
<th><fmt:message key="table.job.domainconfigurations.configuration"/></th>
<th><fmt:message key="table.job.domainconfigurations.bytesharvested"/></th>
<th><fmt:message key="table.job.domainconfigurations.documentsharvested"/></th>
<th><fmt:message key="table.job.domainconfigurations.stopreason"/></th>
</tr>
<%
DomainDAO ddao = DomainDAO.getInstance();
int rowcount = 0;
for (Map.Entry<String, String> conf :
job.getDomainConfigurationMap().entrySet()) {
String domainLink;
String configLink;
String domainName = conf.getKey();
String configName = conf.getValue();
if (SiteSection.isDeployed(
Constants.DEFINITIONS_SITESECTION_DIRNAME)) {
domainLink =
"<a href=\"/HarvestDefinition/Definitions-edit-domain.jsp?"
+ Constants.DOMAIN_PARAM + "="
+ HTMLUtils.encodeAndEscapeHTML(domainName) + "\">"
+ HTMLUtils.escapeHtmlValues(domainName) + "</a>";
configLink =
"<a href=\"/HarvestDefinition/Definitions-edit-domain-config.jsp?"
+ Constants.DOMAIN_PARAM + "="
+ HTMLUtils.encodeAndEscapeHTML(domainName) + "&"
+ Constants.CONFIG_NAME_PARAM + "="
+ HTMLUtils.encodeAndEscapeHTML(configName) + "&"
+ Constants.EDIT_CONFIG_PARAM + "=1\">"
+ HTMLUtils.escapeHtmlValues(configName) + "</a>";
} else {
domainLink = HTMLUtils.escapeHtmlValues(domainName);
configLink = HTMLUtils.escapeHtmlValues(configName);
}
HarvestInfo hi = ddao.getDomainJobInfo(job, domainName,
configName);
%>
<tr class="<%=HTMLUtils.getRowClass(rowcount++)%>">
<td><%=domainLink%></td>
<td><%=configLink%></td>
<% if (hi == null) { %>
<td>-</td><td>-</td><td>-</td>
<% } else { %>
<td><fmt:formatNumber type="number"
value="<%=hi.getSizeDataRetrieved()%>"/></td>
<td><fmt:formatNumber type="number"
value="<%=hi.getCountObjectRetrieved()%>"/></td>
<td><%=hi.getStopReason().getLocalizedString(response.getLocale())%></td>
</tr>
<%
}
}
%>
</table>
<h3><fmt:message key="subtitle.job.seedlist"/></h3>
<p>
<%
for (String seed : job.getSortedSeedList()) {
String url;
if (!seed.matches(Constants.PROTOCOL_REGEXP)) {
url = "http://" + seed;
} else {
url = seed;
}
// If length of seed exceeds Constants.MAX_SHOWN_SIZE_OF_URL
// show only Constants.MAX_SHOWN_SIZE_OF_URL of the seed, and append
// the string " .."
String shownSeed = StringUtils.makeEllipsis(seed,
Constants.MAX_SHOWN_SIZE_OF_URL);
%>
<a target="viewerproxy"
href="<%=HTMLUtils.escapeHtmlValues(url)%>"><%=
HTMLUtils.escapeHtmlValues(shownSeed)%>
</a>
<br/>
<%
}
%>
</p>
<%
if (SiteSection.isDeployed(Constants.QA_SITESECTION_DIRNAME)
&& job.getStatus().ordinal() > JobStatus.STARTED.ordinal()) {
//make links to reports from harvest, extracted from viewerproxy.
String harvestprefix = job.getHarvestFilenamePrefix();
%>
<h3><fmt:message key="subtitle;reports.for.job"/></h3>
<p><a href="/QA/QA-getreports.jsp?jobid=<%=jobID%>"><fmt:message key="harvest.reports"/></a></p>
<p><a href="/QA/QA-getfiles.jsp?jobid=<%=jobID%>&harvestprefix=<%=harvestprefix%>"><fmt:message key="harvest.files"/></a></p>
<!-- search in crawl-logs -->
<p>
<form method="post" action="/QA/QA-searchcrawllog.jsp">
<input type="hidden" name="<%= dk.netarkivet.viewerproxy.webinterface.Constants.JOBID_PARAM %>"
value="<%= jobID %>"/>
<input type="submit" value="<fmt:message key="display.crawl.log.lines.matching.regexp"/>"/>
<input type="text" name="<%= dk.netarkivet.viewerproxy.webinterface.Constants.REGEXP_PARAM %>" size="60"/>
</form>
</p>
<p>
<!-- make submit button for recalling crawl.log relevant for the specific domains. -->
<form method="post" action="/QA/QA-searchcrawllog.jsp">
<input type="hidden" name="<%= dk.netarkivet.viewerproxy.webinterface.Constants.JOBID_PARAM %>"
value="<%= jobID %>"/>
<input type="submit" value="<fmt:message key="crawl.log.lines.for.domain"/>"/>
<select name="<%= dk.netarkivet.viewerproxy.webinterface.Constants.DOMAIN_PARAM %>">
<% for (String domain : job.getDomainConfigurationMap().keySet()) {
%>
<option value="<%=HTMLUtils.escapeHtmlValues(domain)%>"><%=HTMLUtils.escapeHtmlValues(domain)%></option>
<%
}
%>
</select>
</form>
</p>
<%
}
%>
<h3><fmt:message key="subtitle.job.harvesttemplate">
<fmt:param value="<%=HTMLUtils.escapeHtmlValues((job.getOrderXMLName()))%>"/>
</fmt:message></h3>
<%
// make link to harvest template for job
String link = "/History/Harveststatus-download-job-harvest-template.jsp?"
+ "JobID=" + job.getJobID();
String linkWithrequestedType = link + "&requestedContentType=text/plain";
%>
<a href="<%=link %>"><fmt:message key="show.job.0.harvesttemplate">
<fmt:param value="<%=job.getJobID()%>"/>
</fmt:message></a> (<a href="<%=linkWithrequestedType %>">text/plain)</a>)
<%
if (job.getUploadErrors() != null
&& job.getUploadErrors().length() != 0) {
%>
<a id="uploaderror"></a>
<h3><fmt:message key="subtitle.job.uploaderror.details"/></h3>
<pre><%=HTMLUtils.escapeHtmlValues(job.getUploadErrorDetails())%></pre>
<%
}
if (job.getHarvestErrors() != null
&& job.getHarvestErrors().length() != 0) {
%>
<a id="harvesterror"></a>
<h3><fmt:message key="subtitle.job.harvesterror.details"/></h3>
<pre><%=HTMLUtils.escapeHtmlValues(job.getHarvestErrorDetails())%></pre>
<%
}
HTMLUtils.generateFooter(out);
%>