427. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 12/5/2017 12:06:51 PM Central Standard 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.

427.1 Files compared

# Location File Last Modified
1 IV-eHMP_CIF.zip\IMAG_Source\VISA\Java\XCAInitiatingGatewayDataSourceProvider\main\src\java\gov\va\med\imaging\ihe\xca\datasource\configuration XCADataSourceConfiguration.java Mon Dec 4 21:35:30 2017 UTC
2 IV-eHMP_CIF.zip\IMAG_Source\VISA\Java\XCAInitiatingGatewayDataSourceProvider\main\src\java\gov\va\med\imaging\ihe\xca\datasource\configuration XCADataSourceConfiguration.java Tue Dec 5 15:38:13 2017 UTC

427.2 Comparison summary

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

427.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

427.4 Active regular expressions

No regular expressions were active.

427.5 Comparison detail

  1   /**
  2    * 
  3     Package:  MAG - Vis tA Imaging
  4     WARNING:  Per VHA D irective 2 004-038, t his routin e should n ot be modi fied.
  5     Date Cre ated: Jun  24, 2009
  6     Site Nam e:  Washin gton OI Fi eld Office , Silver S pring, MD
  7     Develope r:  vhaisw werfej
  8     Descript ion: 
  9  
  10           ;;  +-------- ---------- ---------- ---------- ---------- ---------- ---------- +
  11           ;;  Property  of the US  Government .
  12           ;;  No permis sion to co py or redi stribute t his softwa re is give n.
  13           ;;  Use of un released v ersions of  this soft ware requi res the us er
  14           ;;   to execu te a writt en test ag reement wi th the Vis tA Imaging
  15           ;;   Developm ent Office  of the De partment o f Veterans  Affairs,
  16           ;;   telephon e (301) 73 4-0100.
  17           ;;
  18           ;;  The Food  and Drug A dministrat ion classi fies this  software a s
  19           ;;  a Class I I medical  device.  A s such, it  may not b e changed
  20           ;;  in any wa y.  Modifi cations to  this soft ware may r esult in a n
  21           ;;  adulterat ed medical  device un der 21CFR8 20, the us e of which
  22           ;;  is consid ered to be  a violati on of US F ederal Sta tutes.
  23           ;;  +-------- ---------- ---------- ---------- ---------- ---------- ---------- +
  24  
  25    */
  26   package go v.va.med.i maging.ihe .xca.datas ource.conf iguration;
  27  
  28   import gov .va.med.OI D;
  29   import gov .va.med.Ro utingToken ;
  30   import gov .va.med.Ro utingToken Impl;
  31   import gov .va.med.ex ceptions.R outingToke nFormatExc eption;
  32   import gov .va.med.im aging.arti factsource .ResolvedA rtifactSou rce;
  33   import gov .va.med.im aging.arti factsource .ResolvedA rtifactSou rceImpl;
  34   import gov .va.med.im aging.core .interface s.exceptio ns.MethodE xception;
  35   import gov .va.med.im aging.ihe. xca.dataso urce.XCADo cumentSetD ataSourceS ervice;
  36   import jav a.io.Seria lizable;
  37   import jav a.net.Malf ormedURLEx ception;
  38   import jav a.net.URL;
  39   import jav a.util.Arr ayList;
  40   import jav a.util.Lis t;
  41   import jav a.util.Sor tedSet;
  42   import jav a.util.Tre eSet;
  43   import org .apache.lo gging.log4 j.LogManag er;
  44   import org .apache.lo gging.log4 j.Logger;
  45  
  46   /**
  47    * @author  vhaiswwer fej
  48    *
  49    */
  50   public cla ss XCAData SourceConf iguration
  51   implements  Serializa ble
  52   {
  53           pr ivate stat ic final l ong serial VersionUID  = -781488 6810785999 850L;
  54           
  55           pu blic final  static St ring defau ltKeystore Url = "fil e:///c:/Vi xConfig/xc a.keystore ";
  56           pu blic final  static St ring defau ltTruststo reUrl = "f ile:///c:/ vixconfig/ xca.trusts tore";
  57           pu blic final  static St ring defau ltTLSProto col = "xca s";
  58           pu blic final  static in t defaultT LSPort =  PORT ;
  59           
  60           pu blic final  static in t defaultQ ueryTimeou t = 45000;
  61           pu blic final  static in t defaultR etrieveTim eout = 120 000;
  62           
  63           /* *
  64            *  Create a  configurat ion with t he minimum  default v alues
  65            *  @return
  66            *  @throws M alformedUR LException
  67            * /
  68           pu blic stati c XCADataS ourceConfi guration c reate()
  69           th rows Malfo rmedURLExc eption 
  70           {
  71                    retu rn new XCA DataSource Configurat ion(
  72                             null,  null, null , null, nu ll, 443, t rue, defau ltQueryTim eout, defa ultRetriev eTimeout
  73                    );
  74           }
  75           
  76           pu blic stati c XCADataS ourceConfi guration c reate(
  77                    Stri ng keystor ePassword,  String tr uststorePa ssword)
  78           th rows Malfo rmedURLExc eption 
  79           {
  80                    retu rn XCAData SourceConf iguration. create(
  81                             defaul tKeystoreU rl, 
  82                             keysto rePassword
  83                             defaul tTruststor eUrl, 
  84                             trusts torePasswo rd);
  85           }
  86           
  87           pu blic stati c XCADataS ourceConfi guration c reate(
  88                    Stri ng keystor eUrl, 
  89                    Stri ng keystor ePassword,  
  90                    Stri ng trustst oreUrl, 
  91                    Stri ng trustst orePasswor d)
  92           th rows Malfo rmedURLExc eption 
  93           {
  94                    retu rn XCAData SourceConf iguration. create(
  95                             keysto reUrl, 
  96                             keysto rePassword
  97                             trusts toreUrl, 
  98                             trusts torePasswo rd, 
  99                             defaul tTLSProtoc ol,
  100                             defaul tTLSPort,
  101                             XCADat aSourcePro xyConfigur ation.DEFA ULT_ALLOWP ARTIALSUCC ESS.boolea nValue());
  102           }
  103           
  104           pu blic stati c XCADataS ourceConfi guration c reate(
  105                    Stri ng keystor eUrl, 
  106                    Stri ng keystor ePassword,  
  107                    Stri ng trustst oreUrl, 
  108                    Stri ng trustst orePasswor d, 
  109                    Stri ng federat ionSslProt ocol,
  110                    int  tlsPort,
  111                    bool ean allowP artialSucc ess)
  112           th rows Malfo rmedURLExc eption 
  113           {
  114                    if(k eystoreUrl  == null)
  115                             keysto reUrl = de faultKeyst oreUrl;
  116                    if(t ruststoreU rl == null )
  117                             trusts toreUrl =  defaultTru ststoreUrl ;
  118                    if(f ederationS slProtocol  == null)
  119                             federa tionSslPro tocol = de faultTLSPr otocol;
  120                    if(t lsPort <=  0)
  121                             tlsPor t = defaul tTLSPort;
  122                    
  123                    retu rn new XCA DataSource Configurat ion(
  124                             keysto reUrl, 
  125                             keysto rePassword
  126                             trusts toreUrl, 
  127                             trusts torePasswo rd, 
  128                             federa tionSslPro tocol,
  129                             tlsPor t, 
  130                             allowP artialSucc ess,
  131                             defaul tQueryTime out, 
  132                             defaul tRetrieveT imeout
  133                    );
  134           }
  135  
  136           //  ========= ========== ========== ========== ========== ========== ========== ========== =====
  137           pr ivate Sort edSet<XCAS iteConfigu ration> ar tifactSour ceConfigur ations = 
  138                    new  TreeSet<XC ASiteConfi guration>( new XCASit eConfigura tionCompar ator()); 
  139           pr ivate bool ean useCer tificate =  false;
  140           pr ivate TLSC onfigurati on tlsConf iguration;
  141           pr ivate XCAD ataSourceP roxyConfig uration pr oxyConfigu ration;
  142           pr ivate tran sient Logg er logger  = LogManag er.getLogg er(this.ge tClass());
  143           pr ivate Inte ger queryT imeout;
  144           pr ivate Inte ger retrie veTimeout;
  145           
  146           /* *
  147            *  @return t he logger
  148            * /
  149           pr otected sy nchronized  Logger ge tLogger()
  150           {
  151                    if(l ogger == n ull)
  152                             logger  = LogMana ger.getLog ger(this.g etClass()) ;
  153                    retu rn this.lo gger;
  154           }
  155  
  156           /* *
  157            *  @param si teConfigur ations the  siteConfi gurations  to set
  158            * /
  159           // public voi d setSiteC onfigurati ons(List<X CASiteConf iguration>  siteConfi gurations)  {
  160           //       this .siteConfi gurations  = siteConf igurations ;
  161           // }
  162           
  163           /* *
  164            *  
  165            *  @param tr uststoreUr l
  166            *  @param ke ystoreUrl
  167            *  @param ke ystorePass word
  168            *  @param tr uststorePa ssword
  169            *  @param fe derationSs lProtocol
  170            *  @throws M alformedUR LException  
  171            * /
  172           pr ivate XCAD ataSourceC onfigurati on(
  173                    Stri ng keystor eUrl,
  174                    Stri ng keystor ePassword,  
  175                    Stri ng trustst oreUrl, 
  176                    Stri ng trustst orePasswor d, 
  177                    Stri ng tlsProt ocol,
  178                    int  tlsPort,
  179                    bool ean allowP artialSucc ess,
  180                    int  queryTimeo ut,
  181                    int  retrieveTi meout) 
  182           th rows Malfo rmedURLExc eption 
  183           {
  184                    supe r();
  185                    this .tlsConfig uration =  TLSConfigu ration.cre ate(
  186                             keysto reUrl, key storePassw ord, 
  187                             trusts toreUrl, t ruststoreP assword,
  188                             tlsPro tocol, tls Port);
  189                    this .proxyConf iguration  = new XCAD ataSourceP roxyConfig uration( n ew Boolean (allowPart ialSuccess ) );
  190                    this .queryTime out = quer yTimeout;
  191                    this .retrieveT imeout = r etrieveTim eout;
  192           }
  193           
  194           /* *
  195            *  @return t he tlsConf iguration
  196            * /
  197           pu blic TLSCo nfiguratio n getTlsCo nfiguratio n()
  198           {
  199                    retu rn this.tl sConfigura tion;
  200           }
  201  
  202           /* *
  203            *  @param tl sConfigura tion the t lsConfigur ation to s et
  204            * /
  205           pu blic void  setTlsConf iguration( TLSConfigu ration tls Configurat ion)
  206           {
  207                    this .tlsConfig uration =  tlsConfigu ration;
  208           }
  209  
  210           /* *
  211            *  @return t he trustst oreUrl
  212            * /
  213           pu blic Strin g getTrust storeUrl()  
  214           {
  215                    retu rn getTlsC onfigurati on().getTr uststoreUr l().toStri ng();
  216           }
  217  
  218           /* *
  219            *  @param tr uststoreUr l the trus tstoreUrl  to set
  220            *  @throws M alformedUR LException  
  221            * /
  222           pu blic void  setTrustst oreUrl(Str ing trusts toreUrl) 
  223           th rows Malfo rmedURLExc eption 
  224           {
  225                    getT lsConfigur ation().se tTruststor eUrl(new U RL(trustst oreUrl));
  226           }
  227  
  228           /* *
  229            *  @return t he keystor eUrl
  230            * /
  231           pu blic Strin g getKeyst oreUrl() 
  232           {
  233                    retu rn getTlsC onfigurati on().getKe ystoreUrl( ).toString ();
  234           }
  235  
  236           /* *
  237            *  @param ke ystoreUrl  the keysto reUrl to s et
  238            *  @throws M alformedUR LException  
  239            * /
  240           pu blic void  setKeystor eUrl(Strin g keystore Url) 
  241           th rows Malfo rmedURLExc eption 
  242           {
  243                    getT lsConfigur ation().se tKeystoreU rl(new URL (keystoreU rl));
  244           }
  245  
  246           /* *
  247            *  @return t he keystor ePassword
  248            * /
  249           pu blic Strin g getKeyst orePasswor d() 
  250           {
  251                    retu rn getTlsC onfigurati on().getKe ystorePass word();
  252           }
  253  
  254           /* *
  255            *  @param ke ystorePass word the k eystorePas sword to s et
  256            * /
  257           pu blic void  setKeystor ePassword( String key storePassw ord) 
  258           {
  259                    getT lsConfigur ation().se tKeystoreP assword(ke ystorePass word);
  260           }
  261  
  262           /* *
  263            *  The alias  of the ce rtificate  to use as  the creden tials.
  264            *  
  265            *  @param st ring
  266            * /
  267           pu blic Strin g getKeyst oreAlias()
  268           {
  269                    retu rn getTlsC onfigurati on().getAl ias();
  270           }
  271           
  272           pu blic void  setKeystor eAlias(Str ing alias)
  273           {
  274                    getT lsConfigur ation().se tAlias(ali as);
  275           }
  276           
  277           /* *
  278            *  @return t he trustst orePasswor d
  279            * /
  280           pu blic Strin g getTrust storePassw ord() 
  281           {
  282                    retu rn getTlsC onfigurati on().getTr uststorePa ssword();
  283           }
  284  
  285           /* *
  286            *  @param tr uststorePa ssword the  truststor ePassword  to set
  287            * /
  288           pu blic void  setTrustst orePasswor d(String t ruststoreP assword) 
  289           {
  290                    getT lsConfigur ation().se tTruststor ePassword( truststore Password);
  291           }
  292  
  293           /* *
  294            *  @return t he useCert ificate
  295            * /
  296           pu blic boole an isUseCe rtificate(
  297           {
  298                    retu rn useCert ificate;
  299           }
  300  
  301           /* *
  302            *  @param us eCertifica te the use Certificat e to set
  303            * /
  304           pu blic void  setUseCert ificate(bo olean useC ertificate
  305           {
  306                    this .useCertif icate = us eCertifica te;
  307           }
  308           
  309           pu blic Integ er getQuer yTimeout()
  310           {
  311                    retu rn queryTi meout;
  312           }
  313  
  314           pu blic void  setQueryTi meout(Inte ger queryT imeout)
  315           {
  316                    this .queryTime out = quer yTimeout;
  317           }
  318  
  319           pu blic Integ er getRetr ieveTimeou t()
  320           {
  321                    retu rn retriev eTimeout;
  322           }
  323  
  324           pu blic void  setRetriev eTimeout(I nteger ret rieveTimeo ut)
  325           {
  326                    this .retrieveT imeout = r etrieveTim eout;
  327           }
  328  
  329           /* *
  330            *  @return t he tlsProt ocol
  331            * /
  332           pu blic Strin g getTLSPr otocol()
  333           {
  334                    retu rn getTlsC onfigurati on().getPr otocol();
  335           }
  336  
  337           /* *
  338            *  @return t he tlsPort
  339            * /
  340           pu blic int g etTLSPort( )
  341           {
  342                    retu rn getTlsC onfigurati on().getPo rt();
  343           }
  344  
  345           /* *
  346            *  @param tl sProtocol  the tlsPro tocol to s et
  347            * /
  348           pu blic void  setTLSProt ocol(Strin g protocol )
  349           {
  350                    getT lsConfigur ation().se tProtocol( protocol);
  351           }
  352  
  353           /* *
  354            *  @param tl sPort the  tlsPort to  set
  355            * /
  356           pu blic void  setTLSPort (int port)
  357           {
  358                    getT lsConfigur ation().se tPort(port );
  359           }
  360  
  361           /* *
  362            *  @return t he proxyCo nfiguratio n
  363            * /
  364           pu blic XCADa taSourcePr oxyConfigu ration get ProxyConfi guration()
  365           {
  366                    retu rn this.pr oxyConfigu ration;
  367           }
  368  
  369           /* *
  370            *  @param pr oxyConfigu ration the  proxyConf iguration  to set
  371            * /
  372           pu blic void  setProxyCo nfiguratio n(XCADataS ourceProxy Configurat ion proxyC onfigurati on)
  373           {
  374                    this .proxyConf iguration  = proxyCon figuration ;
  375           }
  376  
  377           /* *
  378            *  
  379            * /
  380           pu blic void  clear()
  381           {
  382                    getT lsConfigur ation().cl ear();
  383                    arti factSource Configurat ions.clear ();
  384                    getP roxyConfig uration(). clear();
  385           }
  386           
  387           //  ========= ========== ========== ========== ========== ========== ========== ========
  388           /* *
  389            *  
  390            *  @param co nfiguratio n
  391            *  @param si te
  392            *  @return
  393            *  @throws M ethodExcep tion
  394            * /
  395           pu blic XCASi teConfigur ation find SiteConfig uration(Re solvedArti factSource  resolvedA rtifactSou rce)
  396           th rows Metho dException
  397           {
  398                    if(r esolvedArt ifactSourc e == null  || resolve dArtifactS ource.getA rtifactSou rce() == n ull)
  399                    {
  400                             String  msg = "Ei ther resol vedArtifac tSource or  resolvedA rtifactSou rce.getArt ifactSourc e() are nu ll.";
  401                             getLog ger().erro r(msg);
  402                             return  null;
  403                    }
  404                    
  405                    OID  homeCommun ityId = re solvedArti factSource .getArtifa ctSource() .getHomeCo mmunityId( );
  406                    Stri ng reposit oryId = re solvedArti factSource .getArtifa ctSource() .getReposi toryId();
  407                    
  408                    XCAS iteConfigu ration sit eConfigura tion;
  409                    try
  410                    {
  411                             siteCo nfiguratio n = get(ho meCommunit yId, repos itoryId);
  412                             if(sit eConfigura tion == nu ll)
  413                             {
  414                                      String m sg = "Coul d not find  XCA gatew ay site co nfiguratio n for arti fact sourc e '" + res olvedArtif actSource. toString()  + "'.";
  415                                      getLogge r().info(m sg);
  416                                      return n ull;
  417                             }
  418                             
  419                             return  siteConfi guration;
  420                    }
  421                    catc h (Routing TokenForma tException  x)
  422                    {
  423                             throw  new Method Exception( "Exception  thrown wh ile findin g site con figuration  for " + r esolvedArt ifactSourc e.toString () + ".",  x);
  424                    }
  425           }
  426           
  427           /* *
  428            *  Replaces  the URL wi th the spe cified pro tocol with  a URL for med from t he
  429            *  path.  Th e resultin g Resolved ArtifactSo urce will  have only  one query  and
  430            *  one retri eve URL, w hich will  be the one s to use f or XCA.  A ny compone nt
  431            *  of the UR L may be c hanged by  the URLCom ponentMerg er.
  432            *  
  433            *  @param re solvedArti factSource
  434            *  @param si teConfigur ation
  435            *  @return
  436            *  @throws M alformedUR LException  
  437            * /
  438           pu blic Resol vedArtifac tSource fi xupURLPath s(
  439                    Reso lvedArtifa ctSource r esolvedArt ifactSourc e,
  440                    XCAS iteConfigu ration sit eConfigura tion) 
  441           th rows Malfo rmedURLExc eption
  442           {
  443                    if(s iteConfigu ration ==  null)
  444                             return  resolvedA rtifactSou rce;
  445                    
  446                    List <URL> fixe dUpQueryUr ls = new A rrayList<U RL>();
  447                    for(  URL metad ataUrl : r esolvedArt ifactSourc e.getMetad ataUrls()  )
  448                             if( XC ADocumentS etDataSour ceService. SUPPORTED_ PROTOCOL.e quals(meta dataUrl.ge tProtocol( )) )
  449                             {
  450                                      URL fixe dUpUrl = s iteConfigu ration.get QueryCompo nentMerger ().merge(m etadataUrl );
  451                                      fixedUpQ ueryUrls.a dd(fixedUp Url); 
  452                             }
  453                    
  454                    List <URL> fixe dUpRetriev eUrls = ne w ArrayLis t<URL>();
  455                    for(  URL retri eveUrl : r esolvedArt ifactSourc e.getArtif actUrls()  )
  456                             if( XC ADocumentS etDataSour ceService. SUPPORTED_ PROTOCOL.e quals(retr ieveUrl.ge tProtocol( )) )
  457                             {
  458                                      URL fixe dUpUrl = s iteConfigu ration.get RetrieveCo mponentMer ger().merg e(retrieve Url);
  459                                      fixedUpR etrieveUrl s.add(fixe dUpUrl); 
  460                             }
  461                    
  462                    Reso lvedArtifa ctSourceIm pl result  = Resolved ArtifactSo urceImpl.c reate(
  463                             resolv edArtifact Source.get ArtifactSo urce(), fi xedUpQuery Urls, fixe dUpRetriev eUrls
  464                    );
  465                    
  466                    retu rn result;
  467           }
  468           
  469           /* *
  470            *  @param si teConfigur ation
  471            * /
  472           pu blic void  add(XCASit eConfigura tion siteC onfigurati on)
  473           {
  474                    sync hronized(a rtifactSou rceConfigu rations)
  475                    {
  476                             artifa ctSourceCo nfiguratio ns.add(sit eConfigura tion);
  477                    }
  478           }
  479           
  480           /* *
  481            *  
  482            *  @param si teNumber
  483            *  @return
  484            *  @throws R outingToke nFormatExc eption 
  485            * /
  486           pu blic XCASi teConfigur ation get( OID homeCo mmunityId,  String re positoryId
  487           th rows Routi ngTokenFor matExcepti on
  488           {
  489                    if(h omeCommuni tyId == nu ll || repo sitoryId = = null)
  490                             return  null;
  491                    
  492                    retu rn get(Rou tingTokenI mpl.create (homeCommu nityId, re positoryId ));
  493           }
  494           
  495           pu blic XCASi teConfigur ation get( RoutingTok en target)  
  496           th rows Routi ngTokenFor matExcepti on
  497           {
  498                    sync hronized(a rtifactSou rceConfigu rations)
  499                    {
  500                             for(XC ASiteConfi guration s iteConfig  : artifact SourceConf igurations )
  501                                      if( targ et.equals( siteConfig .getRoutin gToken())  )
  502                                               return sit eConfig;
  503                    }
  504                    retu rn null;
  505           }
  506           
  507           /* *
  508            *  
  509            *  @param si teNumber
  510            *  @throws R outingToke nFormatExc eption 
  511            * /
  512           pu blic void  remove(OID  homeCommu nityId, St ring repos itoryId) 
  513           th rows Routi ngTokenFor matExcepti on
  514           {
  515                    if(h omeCommuni tyId == nu ll || repo sitoryId = = null)
  516                             return ;
  517                    remo ve(Routing TokenImpl. create(hom eCommunity Id, reposi toryId));
  518           }
  519           
  520           pu blic void  remove(Rou tingToken  target) 
  521           th rows Routi ngTokenFor matExcepti on
  522           {        
  523                    sync hronized(a rtifactSou rceConfigu rations)
  524                    {
  525                             XCASit eConfigura tion siteT oRemove =  get(target );
  526                             
  527                             if(sit eToRemove  != null)
  528                                      artifact SourceConf igurations .remove(si teToRemove );
  529                    }
  530           }
  531           
  532           /* *
  533            *  
  534            * /
  535           @O verride
  536           pu blic Strin g toString ()
  537           {
  538                    Stri ngBuilder  sb = new S tringBuild er();
  539                    
  540                    sb.a ppend("BEG IN " + thi s.getClass ().getName () + " \n" );
  541                    for( XCASiteCon figuration  site : ar tifactSour ceConfigur ations)
  542                    {
  543                             sb.app end('\t');
  544                             sb.app end(site.t oString()) ;
  545                             sb.app end('\n');
  546                    }
  547                    sb.a ppend("END  " + this. getClass() .getName()  + " \n");
  548                    
  549                    retu rn sb.toSt ring();
  550           }
  551   }