Project

General

Profile

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/harvester/harvester.properties>harvester.properties</a>, 
138
     located at:
139
  <pre>      METACAT_HOME/lib/harvester/harvester.properties</pre>
140
     where METACAT_HOME is the top-level directory that Metacat is 
141
     installed in.
142
  </p>
143
  <p>The Harvester Administrator should edit 
144
     <a href=../../lib/harvester/harvester.properties>harvester.properties</a>, 
145
     setting appropriate values for the Metacat URL, database driver,
146
     database connection, and other settings. The 
147
     following table is a summary of each property and its function.
148
  </p>
149
  <table border="1">
150
    <tr>
151
      <td><b>Property</b></td>
152
      <td><b>Description</b></td>
153
      <td><b>Possible or default value</b></td>
154
    </tr>
155
    <tr>
156
      <td>connectToMetacat</td>
157
      <td>This property determines whether Harvester should connect to
158
          Metacat to upload documents. It should be set to <code>true</code>
159
          under most circumstances. Setting this property to <code>false</code>
160
          can be useful for testing whether Harvester is able to retrieve 
161
          documents from a site without actually connecting to Metacat to 
162
          upload the documents.</td>
163
      <td><code>true</code> | <code>false</code><br>
164
          Default: <code>true</code>
165
    </tr>
166
    <tr>
167
      <td>database</td>
168
      <td>The backend database
169
          This setting should match the value of the <code>database</code>
170
          property as set in the 
171
          <a href=../../build.properties>build.properties</a>
172
          file in the associated Metacat installation.
173
      </td>
174
      <td><code>oracle | postgresql | sqlserver</code>
175
      </td>
176
    </tr>
177
    <tr>
178
      <td>defaultDB</td>
179
      <td>The JDBC connection string that Metacat uses to connect to the 
180
          backend database. This setting should match the value of
181
          the <code>jdbc-connect</code> property as set in the
182
          <a href=../../build.properties>build.properties</a>
183
          file in the associated Metacat installation.</td>
184
      <td>Example:<br>
185
          <code>jdbc:oracle:thin:@server.domain.com:1521:Metacat</code></td>
186
    </tr>
187
    <tr>
188
      <td>delay</td>
189
      <td>The number of hours that Harvester will wait before beginning its
190
          first harvest. For example, if Harvester is run at  1:00 p.m., and
191
          the delay is set to 12, Harvester will begin its first harvest at 
192
          1:00 a.m.</td>
193
      <td>Default: 0</td>
194
    </tr>
195
    <tr>
196
      <td>harvesterAdministrator</td>
197
      <td>The email address of the Harvester Administrator. Harvester will
198
          send email reports to this address after every harvest.
199
      </td>
200
      <td>An email address</td>
201
    </tr>
202
    <tr>
203
      <td>logPeriod</td>
204
      <td>The number of days that Harvester should retain log entries of harvest
205
          operations in the database. Harvester log entries record information
206
          such as which documents were harvested, from which sites, and
207
          whether any errors were encountered during the harvest. Log entries
208
          older than <code>logPeriod</code> number of days are purged from the 
209
          database at the end of each harvest.</td>
210
      <td>Default: 90</td>
211
    </tr>
212
    <tr>
213
      <td>maxHarvests</td>
214
      <td>The maximum number of harvests that Harvester should execute before
215
          shutting down. When the Harvester program is executed, it will
216
          continue running until it has executed <code>maxHarvests</code>
217
          number of harvests and then the program will terminate.</td>
218
      <td>Default: 30</td>
219
    </tr>
220
    <tr>
221
      <td>metacatURL</td>
222
      <td>The URL of the Metacat servlet to which Harvester should connect
223
          for uploading documents.</td>
224
      <td>Example:<br>
225
               http://somehost.institution.edu:8080/knb/servlet/metacat</td>
226
    </tr>
227
    <tr>
228
      <td>password</td>
229
      <td>The password that Harvester uses to access the backend database.
230
          This setting should match the value of the <code>password</code>
231
          property as set in the 
232
          <a href=../../build.properties>build.properties</a>
233
          file in the associated Metacat installation.
234
      </td>
235
      <td>&nbsp;</td>
236
    </tr>
237
    <tr>
238
      <td>period</td>
239
      <td>The number of hours between harvests. Harvester will run a new
240
          harvest every <code>period</code> number of hours, until the 
241
          <code>maxHarvests</code> number of harvests have been run.</td>
242
      <td>Default: 24</td>
243
    </tr>
244
    <tr>
245
      <td>smtpServer</td>
246
      <td>The SMTP server that Harvester uses for sending email messages
247
          to the Harvester Administrator and to Site Contacts.</td>
248
      <td>A host name, for example: <code>somehost.institution.edu</code>
249
          <br><br>
250
          Default: <code>localhost</code>
251
          <br><br>
252
          Note that the default value will only work if the Harvester 
253
          host machine has been configured as a SMTP server.
254
      </td>
255
    </tr>
256
    <tr>
257
      <td>user</td>
258
      <td>The username that Metacat uses to access the backend database.
259
          This setting should match the <code>user</code> value as set in the 
260
          <a href=../../build.properties>build.properties</a>
261
          file in the associated Metacat installation.
262
      </td>
263
      <td>&nbsp;</td>
264
    </tr>
265
    <tr>
266
      <td>Harvester Operation Properties (GetDocError, GetDocSuccess, etc.)</td>
267
      <td>This group of properties is used by Harvester to report information
268
          about the operations it performs for inclusion in log
269
          entries and email messages. Under most circumstances the values 
270
          of these properties should not be modified.</td>
271
      <td>&nbsp;</td>
272
    </tr>
273
  </table>
274
  <br>
275
  <h5><a name="Running Harvester">Running Harvester</a></h5>
276
  After Harvester has been appropriately 
277
  <a href="#Configuring Harvester">configured</a>, 
278
  it can be run as follows:
279
  <ol>
280
  <li>Open a system command window or terminal window.</li>
281
  <li>Set the METACAT_HOME environment variable to the value of the Metacat
282
      installation directory. Some examples follow:
283
      <ul>
284
        <li>On Windows:
285
        <pre>set METACAT_HOME=C:\somePath\metacat</pre></li>
286
        <li>On Linux/Unix (bash shell):
287
        <pre>export METACAT_HOME=/home/somePath/metacat</pre></li>
288
      </ul>
289
  <li>cd to the following directory:
290
      <ul>
291
        <li>On Windows:
292
        <pre>cd %METACAT_HOME%\lib\harvester</pre></li>
293
        <li>On Linux/Unix:
294
        <pre>cd $METACAT_HOME/lib/harvester</pre></li>
295
      </ul>
296
  <li>Run the appropriate Harvester shell script, as determined by the
297
      operating system:
298
      <ul>
299
        <li>On Windows:
300
        <pre>runHarvester.bat</pre></li>
301
        <li>On Linux/Unix:
302
        <pre>sh runHarvester.sh</pre></li>
303
      </ul>
304
  </li>
305
  </ol>
306
  <p>The Harvester application will start executing. It will begin its first
307
  harvest after <code><b>delay</b></code> number of hours (as specified in the
308
  <a href=../../lib/harvester/harvester.properties>harvester.properties</a>
309
  file). The application will continue running a new harvest every
310
  <code><b>period</b></code> number of hours until a <code><b>maxHarvests</b></code>
311
  number of harvests have been completed.
312
  </p>
313
  <h5><a name="Reviewing Harvester">
314
  Reviewing Harvester Reports to the Harvester Administrator</a></h5>
315
  <P>
316
  After every harvest, Harvester will send an email report to the Harvester
317
  Administrator detailing the operations that were performed during the
318
  harvest. The report will contain information about each of the Harvest Sites
319
  that were harvested from, such as which EML documents were
320
  harvested and whether any errors were encountered.
321
  </P>
322
  <p>
323
  The harvest report will contain a list of log entries, where each log entry
324
  describes an operation that was performed by Harvester. Log entries that
325
  show a status value of 1 indicate that an error occurred during the
326
  operation, while those that show a status value of 0 indicate that the
327
  operation was completed successfully.
328
  </p>
329
  <P>The Harvester Administrator should review the report, paying particularly 
330
  close attention to any errors that are reported and to the accompanying error
331
  messages that are displayed. When errors are reported at
332
  a particular site, the Harvester Administrator should contact the Site
333
  Contact to determine the source of the error and its resolution. See 
334
  <a href=#Reviewing>Reviewing Harvester Reports to the Site Contact</a> for a
335
  description of common sources of errors at a Harvest Site.
336
  </P>
337
  <p>Errors that are independent of a particular site may indicate a problem 
338
  with Harvester itself, Metacat, or the database connection. Refer to the
339
  error message to determine the source of the error and its resolution.
340
  </p>
341
  <h4>Managing a Harvest Site</h4>
342
  A Harvest Site is managed by a Site Contact.
343
  The responsibilities of a Site Contact fall into the following categories:
344
    <ul>
345
      <li><a href=#Registering>Registering with Harvester</a></li>
346
      <li><a href=#Composing>Composing a Harvest List</a></li>
347
      <li><a href=#Preparing>Preparing EML Documents for harvest</a></li>
348
      <li><a href=#Reviewing>Reviewing Harvester reports to the Site Contact</a></li>
349
    </ul>
350
    <h5><a name="Registering">Registering with Harvester</a></h5>
351
  <p>
352
  A Site Contact registers a site with Harvester by logging in to the
353
  Harvester Registration page and entering several items of information
354
  that Harvester needs to know about the site.
355
  </p>
356
  <ol>
357
    <li>Logging in to the Harvester Registration Page
358
  <p>
359
  The Harvester Registration page is accessed from Metacat. For example, if
360
  the Metacat server that you wish to register with resides at the following 
361
  URL:
362
  <pre>  http://somehost.somelocation.edu:8080/knb/index.jsp</pre>
363
  then the Harvester Registration page would be accessed at:
364
  <pre>  http://somehost.somelocation.edu:8080/knb/style/skins/dev/harvesterRegistrationLogin.html</pre>
365
  </p>
366
  <p>
367
  After bringing up this page in your browser, login to your Metacat account 
368
  by entering your username and password.
369
  The username should include the full LDAP specification, for example:
370
  <pre>
371
  Username:   uid=jdoe,o=lter,dc=ecoinformatics,dc=org
372
  Password:   *******
373
  </pre>
374
  In some cases, a Site Contact may need to login to an anonymous account
375
  rather than his or her personal account. For example, a LTER Information 
376
  Manager may need to login to a dedicated account, named with a three-letter 
377
  acronym, that has been set up for the LTER site. For example:
378
  <pre>
379
  Username:   uid=GCE,o=lter,dc=ecoinformatics,dc=org
380
  Password:   *******
381
  </pre>
382
  is the account login that would be used by the LTER Information Mangager
383
  at the GCE (Georgia Coastal Ecosystems) site.
384
  </p>
385
    </li>
386
    <li>Registering with Harvester
387
  <p>
388
  After logging in, you will be presented with a web form that prompts you
389
  to enter information about your site and how often you want to schedule
390
  harvests at your site. For example:
391
  </p>
392
  <pre>
393
  Email address:            myname@institution.edu
394
  Harvest List URL:         http://somehost.institution.edu/~myname/harvestList.xml
395
  Harvest Frequency (1-99): 2
396
  Unit:                     ( ) day(s)    (*) week(s)   ( ) month(s)
397
  </pre>
398
  After values have been entered for each of these fields, click the Register 
399
  button to register your site with Harvester.
400
  </p>
401
  <P>
402
  In the example shown above, Harvester will attempt to harvest documents from 
403
  the site once every 2 weeks, it will access the site's Harvest List at URL
404
  "http://somehost.institution.edu/~myname/harvestList.xml", and it will send
405
  email reports to the Site Contact at email address "myname@institution.edu".
406
  </P>
407
    </li>
408
    <li>Unregistering with Harvester
409
  <p>
410
  At any time after you have registered with Harvester, you may discontinue 
411
  harvests at your site by unregistering. Simply login as described above and 
412
  then click the Unregister button. After doing so, Harvester will discontinue 
413
  harvests at the site.
414
  </p>
415
    </li>
416
  </ol>
417
  <h5><a name="Composing">Composing a Harvest List</a></h5>
418
  <p>
419
  A Harvest List is an XML file that holds a list of EML documents to be
420
  harvested. For each EML document in the list, the following information
421
  must be specified:
422
  <ul>
423
    <li><code>docid</code>, which consists of the:
424
      <ul>
425
        <li><code>scope</code>, e.g. "demoDocument". The scope is an identifier 
426
            that indicates which group of documents this document belongs to.
427
        </li>
428
        <li><code>identifier</code>, e.g. "1". The identifier is a number that 
429
            uniquely identifies this document within the scope.
430
        </li>
431
        <li><code>revision</code>, e.g. "5". The revision is a number that 
432
            indicates the current revision of this document.
433
        </li>
434
      </ul>
435
    </li>
436
    <li><code>documentType</code>, e.g. "eml://ecoinformatics.org/eml-2.0.0".
437
        The documentType identifies the document as an EML document.</li>
438
    <li><code>documentURL</code>, e.g. "http://www.lternet.edu/~dcosta/document1.xml".
439
        The documentURL specifies a place where Harvester can locate 
440
        and retrieve the document via HTTP.</li>
441
  </ul>
442
  </p>
443
  <p>
444
  The contents of a Harvest List XML file must conform to a particular
445
  XML Schema, as defined in file <a href="../../lib/harvester/harvestList.xsd">
446
  harvestList.xsd</a>. The contents of a valid Harvest List 
447
  can best be illustrated by example. The sample Harvest List
448
  below contains two &lt;<code>document</code>&gt; elements that specify the 
449
  information that Harvester needs to retrieve a pair of EML documents and 
450
  upload them to Metacat:
451
  <pre>
452
&lt;?xml version="1.0" encoding="UTF-8" ?&gt;
453
&lt;hrv:harvestList xmlns:hrv="eml://ecoinformatics.org/harvestList" &gt;
454
    &lt;document&gt;
455
        &lt;docid&gt;
456
            &lt;scope&gt;demoDocument&lt;/scope&gt;
457
            &lt;identifier&gt;1&lt;/identifier&gt;
458
            &lt;revision&gt;5&lt;/revision&gt;
459
        &lt;/docid&gt;
460
        &lt;documentType&gt;eml://ecoinformatics.org/eml-2.0.0&lt;/documentType&gt;
461
        &lt;documentURL&gt;http://www.lternet.edu/~dcosta/document1.xml&lt;/documentURL&gt;
462
    &lt;/document&gt;
463
    &lt;document&gt;
464
        &lt;docid&gt;
465
            &lt;scope&gt;demoDocument&lt;/scope&gt;
466
            &lt;identifier&gt;2&lt;/identifier&gt;
467
            &lt;revision&gt;1&lt;/revision&gt;
468
        &lt;/docid&gt;
469
        &lt;documentType&gt;eml://ecoinformatics.org/eml-2.0.0&lt;/documentType&gt;
470
        &lt;documentURL&gt;http://www.lternet.edu/~dcosta/document2.xml&lt;/documentURL&gt;
471
    &lt;/document&gt;
472
&lt;/hrv:harvestList&gt;
473
  </pre>
474
  <p>
475
  After editing the Harvest List, ensure that the Harvest List XML file resides
476
  at the appropriate location on disk as specified by the URL that was entered
477
  during the <a href=#Registering>registration</a> process.
478
  </p>
479
    <h5><a name="Preparing">Preparing EML Documents for harvest</a></h5>
480
  <p>
481
  To prepare a set of EML documents for harvest, ensure that the following is 
482
  true for each document:
483
  <ul>
484
    <li>The document contains valid EML</li>
485
    <li>The document is specified in a &lt;document&gt; element in the 
486
        site's Harvest List, as described above</li>
487
    <li>The file resides at the appropriate location on disk as specified
488
        by its URL in the Harvest List</li>
489
  </ul>
490
  </p>
491
    <h5><a name="Reviewing" >Reviewing Harvester Reports to the Site Contact</a></h5>
492
  <P>
493
  After every scheduled harvest that takes place at a particular Harvest
494
  Site, Harvester will send an email report to the Site Contact detailing the 
495
  operations that were performed during the harvest.
496
  The report will contain information about the operations that were
497
  performed by Harvester at that site, such as 
498
  which EML documents were harvested and whether any errors were encountered.
499
  </P>
500
  <P>
501
  The Site Contact should review the report, paying particularly 
502
  close attention to any errors that are reported. Errors are indicated
503
  by operations that display a status value of 1, while operations that
504
  display a status value of 0 indicate that the operation completed
505
  successfully.
506
  </P>
507
  <p>
508
  When errors are reported,
509
  the Site Contact should try to determine whether the source of the error
510
  is something that can be corrected at the site. Common causes of errors 
511
  might be:
512
  <ul>
513
    <li>A document URL specified in the Harvest List does not match
514
        the location of the actual EML file on the disk</li>
515
    <li>The Harvest List does not contain valid XML as specified in
516
        the <a href=../../lib/harvester/harvestList.xsd>harvestList.xsd</a> schema</li>
517
    <li>The URL to the Harvest List that was specified during
518
        registration with Harvester does not match the actual location of
519
        the Harvest List on the disk</li>
520
    <li>An EML document that Harvester attempted to upload to Metacat does
521
        not contain valid EML</li>
522
  </ul>
523
  </P> 
524
  <p>
525
  If the Site Contact is unable to determine the cause of the error and its
526
  resolution, he or she should contact the Harvester Administrator for assistance.
527
  </p>
528
  <a href="./properties.html">Back</a> | 
529
  <a href="./metacattour.html">Home</a> | 
530
  <a href="./unimplem.html">Next</a>
531
</BODY>
532
</HTML>
(14-14/47)