1
|
<!--
|
2
|
* harvester.html
|
3
|
*
|
4
|
* Authors: Duane Costa
|
5
|
* Copyright: 2004 Regents of the University of California and the
|
6
|
* National Center for Ecological Analysis and Synthesis,
|
7
|
* and the University of New Mexico.
|
8
|
* For Details: http://www.nceas.ucsb.edu/
|
9
|
* Created: 2004 April 9
|
10
|
* Version:
|
11
|
* File Info: '$ '
|
12
|
*
|
13
|
*
|
14
|
-->
|
15
|
<HTML>
|
16
|
<HEAD>
|
17
|
<TITLE>Metacat Harvester</TITLE>
|
18
|
<link rel="stylesheet" type="text/css" href="@docrooturl@default.css">
|
19
|
</HEAD>
|
20
|
<BODY>
|
21
|
<table width="100%">
|
22
|
<tr>
|
23
|
<td class="tablehead" colspan="2">
|
24
|
<p class="label">Metacat Harvester</p>
|
25
|
</td>
|
26
|
<td class="tablehead" colspan="2" align="right">
|
27
|
<a href="./properties.html">Back</a> |
|
28
|
<a href="./metacattour.html">Home</a> |
|
29
|
<a href="./unimplem.html">Next</a>
|
30
|
</td>
|
31
|
</tr>
|
32
|
</table>
|
33
|
<h4>Introduction</h4>
|
34
|
The Metacat Harvester (henceforth referred to as "Harvester") is a
|
35
|
program that automates the retrieval of EML documents from one or more sites
|
36
|
and their subsequent upload (insert or update) to Metacat. Harvester uses pull
|
37
|
technology to retrieve and upload documents to Metacat on a regularly
|
38
|
scheduled basis.
|
39
|
<P>
|
40
|
Although Harvester is included with a Metacat installation (beginning with
|
41
|
Metacat version 1.4.0), it is an extention to Metacat's functionality
|
42
|
that may be used optionally.
|
43
|
</P>
|
44
|
<h4>Definitions</h4>
|
45
|
The following table defines a number of terms that are useful in discussing
|
46
|
Harvester and its features.
|
47
|
<br><br>
|
48
|
<table border="1">
|
49
|
<tr>
|
50
|
<td><b>Term</b></td>
|
51
|
<td><b>Definition</b></td>
|
52
|
</tr>
|
53
|
<tr>
|
54
|
<td>Harvester</td>
|
55
|
<td>The Harvester program, a Java application that is bundled with the
|
56
|
Metacat distribution. When a user installs Metacat on a system,
|
57
|
the Harvester program is automatically included in the
|
58
|
installation.
|
59
|
</td>
|
60
|
</tr>
|
61
|
<tr>
|
62
|
<td>Harvester Administrator</td>
|
63
|
<td>The individual who installs and manages Harvester. Typically, this
|
64
|
would be the same individual who installs and manages Metacat at a
|
65
|
given installation.
|
66
|
</td>
|
67
|
</tr>
|
68
|
<tr>
|
69
|
<td>Harvest Site</td>
|
70
|
<td>A location from which Harvester can retrieve EML documents. A given
|
71
|
Harvester can retrieve documents from any number of different
|
72
|
Harvest Sites.
|
73
|
</td>
|
74
|
</tr>
|
75
|
<tr>
|
76
|
<td>Harvest</td>
|
77
|
<td>The act (by Harvester) of visiting a Harvest Site, retrieving a
|
78
|
number of EML documents, and inserting or updating the documents to
|
79
|
Metacat.
|
80
|
</td>
|
81
|
</tr>
|
82
|
<tr>
|
83
|
<td>Harvest List</td>
|
84
|
<td>An XML document that lists a set of EML documents to be harvested. The
|
85
|
Harvest List must conform to an XML Schema,
|
86
|
<a href="../../lib/harvester/harvestList.xsd">harvestList.xsd</a>.
|
87
|
</td>
|
88
|
</tr>
|
89
|
<tr>
|
90
|
<td>Site Contact</td>
|
91
|
<td>The individual at a particular Harvest Site who registers with
|
92
|
Harvester, composes a Harvest List, and periodically prepares
|
93
|
the site's EML documents for retrieval and upload to Metacat.
|
94
|
</td>
|
95
|
</tr>
|
96
|
<tr>
|
97
|
<td>Harvest List URL</td>
|
98
|
<td>A URL to the Harvest List, as specified by the Site Contact.
|
99
|
Each Harvest Site corresponds to a Harvest List URL. Harvester
|
100
|
uses the URL to locate and read a site's Harvest List.
|
101
|
</td>
|
102
|
</tr>
|
103
|
<tr>
|
104
|
<td>Document URL</td>
|
105
|
<td>A URL to an EML document, as specified in the Harvest List.
|
106
|
The Harvest List may contain any number of Document URLs. Each
|
107
|
Document URL provides a locator to a document to be harvested.
|
108
|
</td>
|
109
|
</tr>
|
110
|
<tr>
|
111
|
<td>Harvester Registration Page</td>
|
112
|
<td>A web page that provides a means for a Site Contact
|
113
|
to register with Harvester to schedule regular harvests from the
|
114
|
site. Registration involves logging in and then specifying various
|
115
|
settings for the Harvest Site, such as the Harvest List URL, the
|
116
|
harvest frequency, and the email address of the Site Contact.
|
117
|
</td>
|
118
|
</tr>
|
119
|
</table>
|
120
|
<h4>Managing Harvester</h4>
|
121
|
Harvester is managed by the Harvester Administrator. Typically, the same
|
122
|
individual who manages a Metacat server would also act as the Harvester
|
123
|
Administrator. The responsibilities of the Harvester Administrator include:
|
124
|
<ul>
|
125
|
<li><a href="#Configuring Harvester">Configuring Harvester</a></li>
|
126
|
<li><a href="#Running Harvester">Running Harvester</a></li>
|
127
|
<li><a href="#Reviewing Harvester">Reviewing Harvester reports to
|
128
|
the Harvester Administrator</a></li>
|
129
|
</ul>
|
130
|
<h5><a name="Configuring Harvester">Configuring Harvester</a></h5>
|
131
|
<p>Harvester must be configured to interact with a working Metacat
|
132
|
installation. Thus, a Metacat installation that has been properly
|
133
|
configured and installed is a pre-requisite to running Harvester.
|
134
|
Additionally, Harvester has a number of settable properties that
|
135
|
control its behavior. All Harvester configuration information is managed
|
136
|
in a single file,
|
137
|
<a href=../../lib/metacat.properties>metacat.properties</a>,
|
138
|
located at:
|
139
|
<pre> METACAT_HOME/lib/metacat.properties</pre>
|
140
|
where METACAT_HOME is the top-level directory that Metacat is
|
141
|
installed in.
|
142
|
</p>
|
143
|
<p>Harvester properties are grouped together in
|
144
|
<a href=../../lib/metacat.properties>metacat.properties</a>, beginning
|
145
|
after the comment line:
|
146
|
<pre><code> # Harvester properties</code></pre>
|
147
|
</p>
|
148
|
<p>The Harvester Administrator should edit
|
149
|
<a href=../../lib/metacat.properties>metacat.properties</a>,
|
150
|
setting appropriate values for the <code><b>harvesterAdministrator</b></code>
|
151
|
property, the <code><b>smtpServer</b></code> property, and possibly other
|
152
|
properties. The following table is a summary of each property and its function.
|
153
|
</p>
|
154
|
<table border="1">
|
155
|
<tr>
|
156
|
<td><b>Property</b></td>
|
157
|
<td><b>Description</b></td>
|
158
|
<td><b>Possible or default value</b></td>
|
159
|
</tr>
|
160
|
<tr>
|
161
|
<td>connectToMetacat</td>
|
162
|
<td>This property determines whether Harvester should connect to
|
163
|
Metacat to upload documents. It should be set to <code>true</code>
|
164
|
under most circumstances. Setting this property to <code>false</code>
|
165
|
can be useful for testing whether Harvester is able to retrieve
|
166
|
documents from a site without actually connecting to Metacat to
|
167
|
upload the documents.</td>
|
168
|
<td><code>true</code> | <code>false</code><br>
|
169
|
Default: <code>true</code>
|
170
|
</tr>
|
171
|
<tr>
|
172
|
<td>delay</td>
|
173
|
<td>The number of hours that Harvester will wait before beginning its
|
174
|
first harvest. For example, if Harvester is run at 1:00 p.m., and
|
175
|
the delay is set to 12, Harvester will begin its first harvest at
|
176
|
1:00 a.m.</td>
|
177
|
<td>Default: 0</td>
|
178
|
</tr>
|
179
|
<tr>
|
180
|
<td>harvesterAdministrator</td>
|
181
|
<td>The email address of the Harvester Administrator. Harvester will
|
182
|
send email reports to this address after every harvest.
|
183
|
</td>
|
184
|
<td>An email address</td>
|
185
|
</tr>
|
186
|
<tr>
|
187
|
<td>logPeriod</td>
|
188
|
<td>The number of days that Harvester should retain log entries of harvest
|
189
|
operations in the database. Harvester log entries record information
|
190
|
such as which documents were harvested, from which sites, and
|
191
|
whether any errors were encountered during the harvest. Log entries
|
192
|
older than <code>logPeriod</code> number of days are purged from the
|
193
|
database at the end of each harvest.</td>
|
194
|
<td>Default: 90</td>
|
195
|
</tr>
|
196
|
<tr>
|
197
|
<td>maxHarvests</td>
|
198
|
<td>The maximum number of harvests that Harvester should execute before
|
199
|
shutting down. When the Harvester program is executed, it will
|
200
|
continue running until it has executed <code>maxHarvests</code>
|
201
|
number of harvests and then the program will terminate.</td>
|
202
|
<td>Default: 30</td>
|
203
|
</tr>
|
204
|
<tr>
|
205
|
<td>period</td>
|
206
|
<td>The number of hours between harvests. Harvester will run a new
|
207
|
harvest every <code>period</code> number of hours, until the
|
208
|
<code>maxHarvests</code> number of harvests have been run.</td>
|
209
|
<td>Default: 24</td>
|
210
|
</tr>
|
211
|
<tr>
|
212
|
<td>smtpServer</td>
|
213
|
<td>The SMTP server that Harvester uses for sending email messages
|
214
|
to the Harvester Administrator and to Site Contacts.</td>
|
215
|
<td>A host name, for example: <code>somehost.institution.edu</code>
|
216
|
<br><br>
|
217
|
Default: <code>localhost</code>
|
218
|
<br><br>
|
219
|
Note that the default value will only work if the Harvester
|
220
|
host machine has been configured as a SMTP server.
|
221
|
</td>
|
222
|
</tr>
|
223
|
<tr>
|
224
|
<td>Harvester Operation Properties (GetDocError, GetDocSuccess, etc.)</td>
|
225
|
<td>This group of properties is used by Harvester to report information
|
226
|
about the operations it performs for inclusion in log
|
227
|
entries and email messages. Under most circumstances the values
|
228
|
of these properties should not be modified.</td>
|
229
|
<td> </td>
|
230
|
</tr>
|
231
|
</table>
|
232
|
<br>
|
233
|
<h5><a name="Running Harvester">Running Harvester</a></h5>
|
234
|
After Harvester has been appropriately
|
235
|
<a href="#Configuring Harvester">configured</a>,
|
236
|
it can be run as follows:
|
237
|
<ol>
|
238
|
<li>Open a system command window or terminal window.</li>
|
239
|
<li>Set the METACAT_HOME environment variable to the value of the Metacat
|
240
|
installation directory. Some examples follow:
|
241
|
<ul>
|
242
|
<li>On Windows:
|
243
|
<pre>set METACAT_HOME=C:\somePath\metacat</pre></li>
|
244
|
<li>On Linux/Unix (bash shell):
|
245
|
<pre>export METACAT_HOME=/home/somePath/metacat</pre></li>
|
246
|
</ul>
|
247
|
<li>cd to the following directory:
|
248
|
<ul>
|
249
|
<li>On Windows:
|
250
|
<pre>cd %METACAT_HOME%\lib\harvester</pre></li>
|
251
|
<li>On Linux/Unix:
|
252
|
<pre>cd $METACAT_HOME/lib/harvester</pre></li>
|
253
|
</ul>
|
254
|
<li>Run the appropriate Harvester shell script, as determined by the
|
255
|
operating system:
|
256
|
<ul>
|
257
|
<li>On Windows:
|
258
|
<pre>runHarvester.bat</pre></li>
|
259
|
<li>On Linux/Unix:
|
260
|
<pre>sh runHarvester.sh</pre></li>
|
261
|
</ul>
|
262
|
</li>
|
263
|
</ol>
|
264
|
<p>The Harvester application will start executing. It will begin its first
|
265
|
harvest after <code><b>delay</b></code> number of hours (as specified in the
|
266
|
<a href=../../lib/metacat.properties>metacat.properties</a>
|
267
|
file). The application will continue running a new harvest every
|
268
|
<code><b>period</b></code> number of hours until a <code><b>maxHarvests</b></code>
|
269
|
number of harvests have been completed.
|
270
|
</p>
|
271
|
<h5><a name="Reviewing Harvester">
|
272
|
Reviewing Harvester Reports to the Harvester Administrator</a></h5>
|
273
|
<P>
|
274
|
After every harvest, Harvester will send an email report to the Harvester
|
275
|
Administrator detailing the operations that were performed during the
|
276
|
harvest. The report will contain information about each of the Harvest Sites
|
277
|
that were harvested from, such as which EML documents were
|
278
|
harvested and whether any errors were encountered.
|
279
|
</P>
|
280
|
<p>
|
281
|
The harvest report will contain a list of log entries, where each log entry
|
282
|
describes an operation that was performed by Harvester. Log entries that
|
283
|
show a status value of 1 indicate that an error occurred during the
|
284
|
operation, while those that show a status value of 0 indicate that the
|
285
|
operation was completed successfully.
|
286
|
</p>
|
287
|
<P>The Harvester Administrator should review the report, paying particularly
|
288
|
close attention to any errors that are reported and to the accompanying error
|
289
|
messages that are displayed. When errors are reported at
|
290
|
a particular site, the Harvester Administrator should contact the Site
|
291
|
Contact to determine the source of the error and its resolution. See
|
292
|
<a href=#Reviewing>Reviewing Harvester Reports to the Site Contact</a> for a
|
293
|
description of common sources of errors at a Harvest Site.
|
294
|
</P>
|
295
|
<p>Errors that are independent of a particular site may indicate a problem
|
296
|
with Harvester itself, Metacat, or the database connection. Refer to the
|
297
|
error message to determine the source of the error and its resolution.
|
298
|
</p>
|
299
|
<h4>Managing a Harvest Site</h4>
|
300
|
A Harvest Site is managed by a Site Contact.
|
301
|
The responsibilities of a Site Contact fall into the following categories:
|
302
|
<ul>
|
303
|
<li><a href=#Registering>Registering with Harvester</a></li>
|
304
|
<li><a href=#Composing>Composing a Harvest List</a></li>
|
305
|
<li><a href=#Preparing>Preparing EML Documents for harvest</a></li>
|
306
|
<li><a href=#Reviewing>Reviewing Harvester reports to the Site Contact</a></li>
|
307
|
</ul>
|
308
|
<h5><a name="Registering">Registering with Harvester</a></h5>
|
309
|
<p>
|
310
|
A Site Contact registers a site with Harvester by logging in to the
|
311
|
Harvester Registration page and entering several items of information
|
312
|
that Harvester needs to know about the site.
|
313
|
</p>
|
314
|
<ol>
|
315
|
<li>Logging in to the Harvester Registration Page
|
316
|
<p>
|
317
|
The Harvester Registration page is accessed from Metacat. For example, if
|
318
|
the Metacat server that you wish to register with resides at the following
|
319
|
URL:
|
320
|
<pre> http://somehost.somelocation.edu:8080/knb/index.jsp</pre>
|
321
|
then the Harvester Registration page would be accessed at:
|
322
|
<pre> http://somehost.somelocation.edu:8080/knb/style/skins/knb/harvesterRegistrationLogin.html</pre>
|
323
|
</p>
|
324
|
<p>
|
325
|
After bringing up this page in your browser, login to your Metacat account
|
326
|
by entering your username and password.
|
327
|
The username should include the full LDAP specification, for example:
|
328
|
<pre>
|
329
|
Username: uid=jdoe,o=lter,dc=ecoinformatics,dc=org
|
330
|
Password: *******
|
331
|
</pre>
|
332
|
In some cases, a Site Contact may need to login to an anonymous account
|
333
|
rather than his or her personal account. For example, a LTER Information
|
334
|
Manager may need to login to a dedicated account, named with a three-letter
|
335
|
acronym, that has been set up for the LTER site. For example:
|
336
|
<pre>
|
337
|
Username: uid=GCE,o=lter,dc=ecoinformatics,dc=org
|
338
|
Password: *******
|
339
|
</pre>
|
340
|
is the account login that would be used by the LTER Information Mangager
|
341
|
at the GCE (Georgia Coastal Ecosystems) site.
|
342
|
</p>
|
343
|
</li>
|
344
|
<li>Registering with Harvester
|
345
|
<p>
|
346
|
After logging in, you will be presented with a web form that prompts you
|
347
|
to enter information about your site and how often you want to schedule
|
348
|
harvests at your site. For example:
|
349
|
</p>
|
350
|
<pre>
|
351
|
Email address: myname@institution.edu
|
352
|
Harvest List URL: http://somehost.institution.edu/~myname/harvestList.xml
|
353
|
Harvest Frequency (1-99): 2
|
354
|
Unit: ( ) day(s) (*) week(s) ( ) month(s)
|
355
|
</pre>
|
356
|
After values have been entered for each of these fields, click the Register
|
357
|
button to register your site with Harvester.
|
358
|
</p>
|
359
|
<P>
|
360
|
In the example shown above, Harvester will attempt to harvest documents from
|
361
|
the site once every 2 weeks, it will access the site's Harvest List at URL
|
362
|
"http://somehost.institution.edu/~myname/harvestList.xml", and it will send
|
363
|
email reports to the Site Contact at email address "myname@institution.edu".
|
364
|
</P>
|
365
|
</li>
|
366
|
<li>Unregistering with Harvester
|
367
|
<p>
|
368
|
At any time after you have registered with Harvester, you may discontinue
|
369
|
harvests at your site by unregistering. Simply login as described above and
|
370
|
then click the Unregister button. After doing so, Harvester will discontinue
|
371
|
harvests at the site.
|
372
|
</p>
|
373
|
</li>
|
374
|
</ol>
|
375
|
<h5><a name="Composing">Composing a Harvest List</a></h5>
|
376
|
<p>
|
377
|
A Harvest List is an XML file that holds a list of EML documents to be
|
378
|
harvested. For each EML document in the list, the following information
|
379
|
must be specified:
|
380
|
<ul>
|
381
|
<li><code>docid</code>, which consists of the:
|
382
|
<ul>
|
383
|
<li><code>scope</code>, e.g. "demoDocument". The scope is an identifier
|
384
|
that indicates which group of documents this document belongs to.
|
385
|
</li>
|
386
|
<li><code>identifier</code>, e.g. "1". The identifier is a number that
|
387
|
uniquely identifies this document within the scope.
|
388
|
</li>
|
389
|
<li><code>revision</code>, e.g. "5". The revision is a number that
|
390
|
indicates the current revision of this document.
|
391
|
</li>
|
392
|
</ul>
|
393
|
</li>
|
394
|
<li><code>documentType</code>, e.g. "eml://ecoinformatics.org/eml-2.0.0".
|
395
|
The documentType identifies the document as an EML document.</li>
|
396
|
<li><code>documentURL</code>, e.g. "http://www.lternet.edu/~dcosta/document1.xml".
|
397
|
The documentURL specifies a place where Harvester can locate
|
398
|
and retrieve the document via HTTP.</li>
|
399
|
</ul>
|
400
|
</p>
|
401
|
<p>
|
402
|
The contents of a Harvest List XML file must conform to a particular
|
403
|
XML Schema, as defined in file <a href="../../lib/harvester/harvestList.xsd">
|
404
|
harvestList.xsd</a>. The contents of a valid Harvest List
|
405
|
can best be illustrated by example. The sample Harvest List
|
406
|
below contains two <<code>document</code>> elements that specify the
|
407
|
information that Harvester needs to retrieve a pair of EML documents and
|
408
|
upload them to Metacat:
|
409
|
<pre>
|
410
|
<?xml version="1.0" encoding="UTF-8" ?>
|
411
|
<hrv:harvestList xmlns:hrv="eml://ecoinformatics.org/harvestList" >
|
412
|
<document>
|
413
|
<docid>
|
414
|
<scope>demoDocument</scope>
|
415
|
<identifier>1</identifier>
|
416
|
<revision>5</revision>
|
417
|
</docid>
|
418
|
<documentType>eml://ecoinformatics.org/eml-2.0.0</documentType>
|
419
|
<documentURL>http://www.lternet.edu/~dcosta/document1.xml</documentURL>
|
420
|
</document>
|
421
|
<document>
|
422
|
<docid>
|
423
|
<scope>demoDocument</scope>
|
424
|
<identifier>2</identifier>
|
425
|
<revision>1</revision>
|
426
|
</docid>
|
427
|
<documentType>eml://ecoinformatics.org/eml-2.0.0</documentType>
|
428
|
<documentURL>http://www.lternet.edu/~dcosta/document2.xml</documentURL>
|
429
|
</document>
|
430
|
</hrv:harvestList>
|
431
|
</pre>
|
432
|
<p>
|
433
|
After editing the Harvest List, ensure that the Harvest List XML file resides
|
434
|
at the appropriate location on disk as specified by the URL that was entered
|
435
|
during the <a href=#Registering>registration</a> process.
|
436
|
</p>
|
437
|
<h5><a name="Preparing">Preparing EML Documents for harvest</a></h5>
|
438
|
<p>
|
439
|
To prepare a set of EML documents for harvest, ensure that the following is
|
440
|
true for each document:
|
441
|
<ul>
|
442
|
<li>The document contains valid EML</li>
|
443
|
<li>The document is specified in a <document> element in the
|
444
|
site's Harvest List, as described above</li>
|
445
|
<li>The file resides at the appropriate location on disk as specified
|
446
|
by its URL in the Harvest List</li>
|
447
|
</ul>
|
448
|
</p>
|
449
|
<h5><a name="Reviewing" >Reviewing Harvester Reports to the Site Contact</a></h5>
|
450
|
<P>
|
451
|
After every scheduled harvest that takes place at a particular Harvest
|
452
|
Site, Harvester will send an email report to the Site Contact detailing the
|
453
|
operations that were performed during the harvest.
|
454
|
The report will contain information about the operations that were
|
455
|
performed by Harvester at that site, such as
|
456
|
which EML documents were harvested and whether any errors were encountered.
|
457
|
</P>
|
458
|
<P>
|
459
|
The Site Contact should review the report, paying particularly
|
460
|
close attention to any errors that are reported. Errors are indicated
|
461
|
by operations that display a status value of 1, while operations that
|
462
|
display a status value of 0 indicate that the operation completed
|
463
|
successfully.
|
464
|
</P>
|
465
|
<p>
|
466
|
When errors are reported,
|
467
|
the Site Contact should try to determine whether the source of the error
|
468
|
is something that can be corrected at the site. Common causes of errors
|
469
|
might be:
|
470
|
<ul>
|
471
|
<li>A document URL specified in the Harvest List does not match
|
472
|
the location of the actual EML file on the disk</li>
|
473
|
<li>The Harvest List does not contain valid XML as specified in
|
474
|
the <a href=../../lib/harvester/harvestList.xsd>harvestList.xsd</a> schema</li>
|
475
|
<li>The URL to the Harvest List that was specified during
|
476
|
registration with Harvester does not match the actual location of
|
477
|
the Harvest List on the disk</li>
|
478
|
<li>An EML document that Harvester attempted to upload to Metacat does
|
479
|
not contain valid EML</li>
|
480
|
</ul>
|
481
|
</P>
|
482
|
<p>
|
483
|
If the Site Contact is unable to determine the cause of the error and its
|
484
|
resolution, he or she should contact the Harvester Administrator for assistance.
|
485
|
</p>
|
486
|
<a href="./properties.html">Back</a> |
|
487
|
<a href="./metacattour.html">Home</a> |
|
488
|
<a href="./unimplem.html">Next</a>
|
489
|
</BODY>
|
490
|
</HTML>
|