119. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 3/13/2019 2:49:45 PM Central Daylight Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.

119.1 Files compared

# Location File Last Modified
1 C:\AraxisMergeCompare\Pri_un\DSM\Direct Implementation\java\xd\src\main\java\org\nhind\xdm\impl SmtpMailClient.java Tue Mar 12 21:55:58 2019 UTC
2 C:\AraxisMergeCompare\Pri_re\DSM-scrubbed\Direct Implementation\java\xd\src\main\java\org\nhind\xdm\impl SmtpMailClient.java Wed Mar 13 04:30:44 2019 UTC

119.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 2 296
Changed 1 4
Inserted 0 0
Removed 0 0

119.3 Comparison options

Whitespace
Character case Differences in character case are significant
Line endings Differences in line endings (CR and LF characters) are ignored
CR/LF characters Not shown in the comparison detail

119.4 Active regular expressions

No regular expressions were active.

119.5 Comparison detail

  1   /* 
  2   Copyright  (c) 2010,  NHIN Direc t Project
  3   All rights  reserved.
  4  
  5   Authors:
  6      Vincent  Lewis      vincent.l ewis@gsihe alth.com
  7    
  8   Redistribu tion and u se in sour ce and bin ary forms,  with or w ithout mod ification,  are permi tted provi ded that t he followi ng conditi ons are me t:
  9  
  10   Redistribu tions of s ource code  must reta in the abo ve copyrig ht notice,  this list  of condit ions and t he followi ng disclai mer.
  11   Redistribu tions in b inary form  must repr oduce the  above copy right noti ce, this l ist of con ditions an d the foll owing disc laimer 
  12   in the doc umentation  and/or ot her materi als provid ed with th e distribu tion.  Nei ther the n ame of the  The NHIN  Direct Pro ject (nhin direct.org ). 
  13   nor the na mes of its  contribut ors may be  used to e ndorse or  promote pr oducts der ived from  this softw are withou t specific  prior wri tten permi ssion.
  14   THIS SOFTW ARE IS PRO VIDED BY T HE COPYRIG HT HOLDERS  AND CONTR IBUTORS "A S IS" AND  ANY EXPRES S OR IMPLI ED WARRANT IES, INCLU DING, BUT  NOT LIMITE D TO, 
  15   THE IMPLIE D WARRANTI ES OF MERC HANTABILIT Y AND FITN ESS FOR A  PARTICULAR  PURPOSE A RE DISCLAI MED. IN NO  EVENT SHA LL THE COP YRIGHT HOL DER OR CON TRIBUTORS 
  16   BE LIABLE  FOR ANY DI RECT, INDI RECT, INCI DENTAL, SP ECIAL, EXE MPLARY, OR  CONSEQUEN TIAL DAMAG ES (INCLUD ING, BUT N OT LIMITED  TO, PROCU REMENT OF  SUBSTITUTE  
  17   GOODS OR S ERVICES; L OSS OF USE , DATA, OR  PROFITS;  OR BUSINES S INTERRUP TION) HOWE VER CAUSED  AND ON AN Y THEORY O F LIABILIT Y, WHETHER  IN CONTRA CT, 
  18   STRICT LIA BILITY, OR  TORT (INC LUDING NEG LIGENCE OR  OTHERWISE ) ARISING  IN ANY WAY  OUT OF TH E USE OF T HIS SOFTWA RE, EVEN I F ADVISED  OF 
  19   THE POSSIB ILITY OF S UCH DAMAGE .
  20   */
  21  
  22   package or g.nhind.xd m.impl;
  23  
  24   import jav a.io.IOExc eption;
  25   import jav a.util.Pro perties;
  26  
  27   import jav ax.activat ion.DataHa ndler;
  28   import jav ax.mail.Au thenticato r;
  29   import jav ax.mail.Me ssage;
  30   import jav ax.mail.Me ssagingExc eption;
  31   import jav ax.mail.Mu ltipart;
  32   import jav ax.mail.Pa sswordAuth entication ;
  33   import jav ax.mail.Se ssion;
  34   import jav ax.mail.Tr ansport;
  35   import jav ax.mail.in ternet.Int ernetAddre ss;
  36   import jav ax.mail.in ternet.Mim eBodyPart;
  37   import jav ax.mail.in ternet.Mim eMessage;
  38   import jav ax.mail.in ternet.Mim eMultipart ;
  39  
  40   import org .apache.co mmons.lang .StringUti ls;
  41   import org .nhind.xdm .MailClien t;
  42   import org .nhindirec t.xd.commo n.DirectMe ssage;
  43  
  44   /**
  45    * This cl ass handle s the pack aging and  sending of  XDM data  over SMTP.
  46    * 
  47    * @author  vlewis
  48    */
  49   public cla ss SmtpMai lClient im plements M ailClient
  50   {
  51       final  static int  BUFFER =  2048;
  52       
  53       privat e MimeMess age mmessa ge;
  54       privat e Multipar t mailBody ;
  55       privat e MimeBody Part mainB ody;
  56       privat e MimeBody Part mimeA ttach;
  57      
  58       privat e String h ostname =  null;
  59         private St ring usern ame =  AI    ;
  60         private St ring passw ord =  AI    ;
  61       
  62       public  SmtpMailC lient(Stri ng hostnam e, String  username,  String pas sword)
  63       {
  64           if  (StringUt ils.isBlan k(hostname ) || Strin gUtils.isB lank(usern ame) || St ringUtils. isBlank(pa ssword))
  65                throw ne w IllegalA rgumentExc eption("Ho stname, us ername, an d password  must be p rovided.") ;
  66           
  67           th is.hostnam e = hostna me;
  68           th is.usernam e = userna me;
  69           th is.passwor d = passwo rd;
  70       }
  71  
  72       /*
  73        * (no n-Javadoc)
  74        * 
  75        * @se e org.nhin d.xdm.Mail Client#pos tMail(org. nhindirect .xd.common .DirectMes sage, java .lang.Stri ng)
  76        */
  77       public  void mail (DirectMes sage messa ge, String  messageId , String s uffix) thr ows Messag ingExcepti on
  78       {
  79           bo olean debu g = false;
  80           ja va.securit y.Security .addProvid er(new com .sun.net.s sl.interna l.ssl.Prov ider());
  81  
  82           //  Set the h ost SMTP a ddress
  83           Pr operties p rops = new  Propertie s();
  84           pr ops.put("m ail.transp ort.protoc ol", "smtp ");
  85           pr ops.put("m ail.smtp.s tarttls.en able", "tr ue");
  86           pr ops.put("m ail.smtp.h ost", host name);
  87           pr ops.put("m ail.smtp.a uth", "tru e");
  88  
  89           Au thenticato r auth = n ew SMTPAut henticator ();
  90           Se ssion sess ion = Sess ion.getIns tance(prop s, auth);
  91  
  92           se ssion.setD ebug(debug );
  93  
  94           In ternetAddr ess addres sFrom = ne w Internet Address(me ssage.getS ender());
  95  
  96           In ternetAddr ess[] addr essTo = ne w Internet Address[me ssage.getR eceivers() .size()];
  97           in t i = 0;
  98           fo r (String  recipient  : message. getReceive rs())
  99           {
  100                addressT o[i++] = n ew Interne tAddress(r ecipient);
  101           }
  102  
  103           //  Build mes sage objec t
  104           mm essage = n ew MimeMes sage(sessi on);
  105           mm essage.set From(addre ssFrom);
  106           mm essage.set Recipients (Message.R ecipientTy pe.TO, add ressTo);
  107           mm essage.set Subject(me ssage.getS ubject());
  108  
  109           ma ilBody = n ew MimeMul tipart();
  110  
  111           ma inBody = n ew MimeBod yPart();
  112           ma inBody.set DataHandle r(new Data Handler(me ssage.getB ody(), "te xt/plain") );
  113           ma ilBody.add BodyPart(m ainBody);
  114  
  115           tr y
  116           {
  117                mimeAtta ch = new M imeBodyPar t();
  118                mimeAtta ch.attachF ile(messag e.getDirec tDocuments ().toXdmPa ckage(mess ageId).toF ile());
  119           }
  120           ca tch (IOExc eption e)
  121           {
  122                throw ne w Messagin gException ("Unable t o create/a ttach xdm  zip file",  e);
  123           }
  124           
  125           ma ilBody.add BodyPart(m imeAttach) ;
  126  
  127           mm essage.set Content(ma ilBody);
  128           Tr ansport.se nd(mmessag e);
  129       }
  130  
  131       /**
  132        * Sim pleAuthent icator is  used to do  simple au thenticati on when th e SMTP
  133        * ser ver requir es it.
  134        */
  135       privat e class SM TPAuthenti cator exte nds javax. mail.Authe nticator
  136       {
  137  
  138           /*
  139            *  (non-Java doc)
  140            *  
  141            *  @see java x.mail.Aut henticator #getPasswo rdAuthenti cation()
  142            * /
  143           @O verride
  144           pu blic Passw ordAuthent ication ge tPasswordA uthenticat ion()
  145           {
  146                return n ew Passwor dAuthentic ation(user name, pass word);
  147           }
  148       }
  149  
  150   }