Project

General

Profile

« Previous | Next » 

Revision 2330

Added by Duane Costa over 19 years ago

Minor enhancement to support multiple email addresses for harvester administrator and site contact. Each address is separated by a comma or semicolon.

View differences:

src/edu/ucsb/nceas/metacat/harvesterClient/Harvester.java
810 810
  void reportToAdministrator(String maxCodeLevel) {
811 811
    PrintStream body;
812 812
    String from = harvesterAdministrator;
813
    String[] fromArray;
813 814
    MailMessage msg;
814 815
    int siteScheduleID = 0;
815 816
    String subject = "Report from Metacat Harvester: " + timestamp;
......
821 822
      
822 823
      try {
823 824
        msg = new MailMessage(smtpServer);
824
        msg.from(from);
825
        msg.to(to);
825

  
826
        if (from.indexOf(',') > 0) {
827
          fromArray = from.split(",");
828
          
829
          for (int i = 0; i < fromArray.length; i++) {
830
            if (i == 0) {
831
              msg.from(fromArray[i]);
832
            }
833
            
834
            msg.to(fromArray[i]);            
835
          }
836
        }
837
        else if (from.indexOf(';') > 0) {
838
          fromArray = from.split(";");
839

  
840
          for (int i = 0; i < fromArray.length; i++) {
841
            if (i == 0) {
842
              msg.from(fromArray[i]);
843
            }
844
            
845
            msg.to(fromArray[i]);            
846
          }
847
        }
848
        else {
849
          msg.from(from);
850
          msg.to(to);
851
        }
852
        
826 853
        msg.setSubject(subject);
827 854
        body = msg.getPrintStream();
828 855
        printHarvestHeader(body, siteScheduleID);
src/edu/ucsb/nceas/metacat/harvesterClient/HarvestSiteSchedule.java
529 529
  void reportToSiteContact() {
530 530
    PrintStream body;
531 531
    String from = harvester.harvesterAdministrator;
532
    String[] fromArray;
532 533
    String maxCodeLevel = "info";
533 534
    MailMessage msg;
534 535
    int nErrors = 0;
535 536
    String subject = "Report from Metacat Harvester: " + harvester.timestamp;
536 537
    String to = contactEmail;
538
    String[] toArray;
537 539
    
538 540
    if (!to.equals("")) {
539 541
      System.out.println("Sending report to siteScheduleID=" + siteScheduleID +
540 542
                         " at address: " + contactEmail);
541 543
      try {
542 544
        msg = new MailMessage(harvester.smtpServer);
543
        msg.from(from);
544
        msg.to(to);
545
        msg.cc(from);
545
        
546
        if (from.indexOf(',') > 0) {
547
          fromArray = from.split(",");
548
          
549
          for (int i = 0; i < fromArray.length; i++) {
550
            if (i == 0) {
551
              msg.from(fromArray[i]);
552
            }
553
            
554
            msg.cc(fromArray[i]);
555
            
556
          }
557
        }
558
        else if (from.indexOf(';') > 0) {
559
          fromArray = from.split(";");
560

  
561
          for (int i = 0; i < fromArray.length; i++) {
562
            if (i == 0) {
563
              msg.from(fromArray[i]);
564
            }
565
            
566
            msg.cc(fromArray[i]);
567
            
568
          }
569
        }
570
        else {
571
          msg.from(from);
572
          msg.cc(from);
573
        }
574
        
575
        if (to.indexOf(',') > 0) {
576
          toArray = to.split(",");
577
          
578
          for (int i = 0; i < toArray.length; i++) {
579
            msg.to(toArray[i]);
580
          }
581
        }
582
        else if (to.indexOf(';') > 0) {
583
          toArray = to.split(";");
584
          
585
          for (int i = 0; i < toArray.length; i++) {
586
            msg.to(toArray[i]);
587
          }
588
        }
589
        else {
590
          msg.to(to);
591
        }
592
        
546 593
        msg.setSubject(subject);
547 594
        body = msg.getPrintStream();
548 595
        harvester.printHarvestHeader(body, siteScheduleID);
docs/user/harvester.html
179 179
    <tr>
180 180
      <td>harvesterAdministrator</td>
181 181
      <td>The email address of the Harvester Administrator. Harvester will
182
          send email reports to this address after every harvest.
182
          send email reports to this address after every harvest. You may
183
          enter multiple email addresses by separating each address with
184
          a comma or semicolon, for example, "name1@abc.edu,name2@abc.edu".
183 185
      </td>
184
      <td>An email address</td>
186
      <td>An email address, or multiple email addresses separated by commas
187
          or semi-colons</td>
185 188
    </tr>
186 189
    <tr>
187 190
      <td>logPeriod</td>
......
463 466
  "http://somehost.institution.edu/~myname/harvestList.xml", and it will send
464 467
  email reports to the Site Contact at email address "myname@institution.edu".
465 468
  </P>
469
  <P>
470
  Note that you may enter multiple email addresses by separating each
471
  address with a comma or a semi-colon. For example, 
472
  "myname@institution.edu,anothername@institution.edu".
473
  </P>
466 474
    </li>
467 475
    <li>Unregistering with Harvester
468 476
  <p>

Also available in: Unified diff