430. EPMO Open Source Coordination Office Redaction File Detail Report

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

430.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\proxy XcaTest.java Mon Dec 4 21:35:20 2017 UTC
2 IV-eHMP_CIF.zip\IMAG_Source\VISA\Java\XCAInitiatingGatewayDataSourceProvider\main\src\java\gov\va\med\imaging\ihe\xca\proxy XcaTest.java Tue Dec 5 15:39:54 2017 UTC

430.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 8 816
Changed 7 22
Inserted 0 0
Removed 0 0

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

430.4 Active regular expressions

No regular expressions were active.

430.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: Sep  16, 2010
  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.proxy ;
  27  
  28   import gov .va.med.*;
  29   import gov .va.med.ex ceptions.R outingToke nFormatExc eption;
  30   import gov .va.med.im aging.Null OutputStre am;
  31   import gov .va.med.im aging.arti factsource .ResolvedA rtifactSou rce;
  32   import gov .va.med.im aging.chan nels.ByteS treamPump;
  33   import gov .va.med.im aging.core .interface s.exceptio ns.Connect ionExcepti on;
  34   import gov .va.med.im aging.core .interface s.exceptio ns.MethodE xception;
  35   import gov .va.med.im aging.data source.Doc umentDataS ourceSpi;
  36   import gov .va.med.im aging.data source.Doc umentSetDa taSourceSp i;
  37   import gov .va.med.im aging.data source.Pro vider;
  38   import gov .va.med.im aging.exce ptions.OID FormatExce ption;
  39   import gov .va.med.im aging.exch ange.busin ess.*;
  40   import gov .va.med.im aging.exch ange.busin ess.docume nts.Docume nt;
  41   import gov .va.med.im aging.exch ange.busin ess.docume nts.Docume ntSet;
  42   import gov .va.med.im aging.exch ange.busin ess.docume nts.Docume ntSetResul t;
  43   import gov .va.med.im aging.exch ange.stora ge.DataSou rceImageIn putStream;
  44   import gov .va.med.im aging.ihe. xca.dataso urce.confi guration.X CADataSour ceConfigur ation;
  45   import gov .va.med.im aging.tomc at.vistare alm.VistaR ealmRoles;
  46   import gov .va.med.im aging.tomc at.vistare alm.VistaR ealmPrinci pal.Authen ticationCr edentialsT ype;
  47   import gov .va.med.im aging.tran sactioncon text.Clien tPrincipal ;
  48   import gov .va.med.im aging.tran sactioncon text.Trans actionCont extFactory ;
  49   import jav a.io.IOExc eption;
  50   import jav a.io.Outpu tStream;
  51   import jav a.net.Malf ormedURLEx ception;
  52   import jav a.net.URL;
  53   import jav a.util.*;
  54  
  55   /**
  56    * This is  a dirt si mple XCA c lient driv er - this  DOES NOT c ontain JUn it tests o r any othe r unit tes ts
  57    * 
  58    * @author  vhaiswwer fej
  59    *
  60    */
  61   public cla ss XcaTest
  62   {
  63           // NCAT    IP              (this shou ld go to E volvent’s  ext IP of  67.90.191. 177)
  64           // HAIMS DIT  –  IP                (this shou ld go to E volvent’s  ext IP of  67.90.191. 176)
  65           // HAIMS DEVI NT –  IP                (this shou ld go to E volvent’s  ext IP of  67.90.191. 165)
  66  
  67           pu blic stati c final St ring LOCAL HOST = 
  68                     "xca://loc alhost: PORT ";
  69           pu blic stati c final St ring LOCAL HOST_URL =  
  70                     "xca://loc alhost: PORT /XCARespon dingGatewa y/services /Respondin gGateway_S ervice";
  71           pu blic stati c final St ring SILVE R_CVIX_URL  = 
  72                     "xca:// IP                 /XCARespon dingGatewa y/services /Respondin gGateway_S ervice";
  73           pu blic stati c final St ring SILVE R_NCAT_URL  = 
  74                    "xca ://catbhie .mont.disa .mil/Respo ndingGatew ay.svc";
  75           pu blic stati c final St ring SILVE R_HAIMS_UR L = 
  76                     "xca://sil ver.haims: PORT /XCA.WebSe rvice/Resp ondingGate way.svc";
  77           pu blic stati c final St ring SILVE R_BHIE_URL  = 
  78                     "xca://sil ver.bhie: PORT /DocSearch XcaService /Respondin gGateway_S ervice";
  79                     //"xca://l ocalhost: PORT /DocSearch XcaService /Respondin gGateway_S ervice";
  80  
  81           /* *
  82            *  @param ar gs
  83            *  @throws M ethodExcep tion 
  84            *  @throws C onnectionE xception 
  85            *  @throws R outingToke nFormatExc eption 
  86            *  @throws O IDFormatEx ception 
  87            * /
  88           pu blic stati c void mai n(String[]  args) 
  89           {
  90                    Stri ng[] patie ntIcns;
  91                    Prot ocolHandle rUtility.i nitialize( true);
  92                    
  93                    //Sy stem.out.p rintln("Ha ndler pack ages were  '" + initi alHandlerP ackages +  "' and are  now '" +  handlerPac kages + ". ");
  94                    Syst em.out.pri ntln("Java  version i s '" + Sys tem.getPro perty("jav a.specific ation.vers ion") + "' .");
  95                    Syst em.out.pri ntln("Sun  library pa th is '" +  System.ge tProperty( "sun.boot. library.pa th") + "'. ");
  96                    List <String> r oles = new  ArrayList <String>() ;
  97                    role s.add(Vist aRealmRole s.VistaUse rRole.getR oleName()) ;
  98                    Clie ntPrincipa l principa l = new Cl ientPrinci pal(
  99                                      "660", t rue, Authe nticationC redentials Type.Passw ord, 
  100                                      "boating 1", "boati ng1.", 
  101                                      "126", " IMAGPROVID ERONETWOSI X,ONETWOSI X", "84392 4956", "66 0", "Salt  lake City"
  102                                      roles, 
  103                                      new Hash Map<String , Object>( )
  104                    );
  105                    /*
  106                    Clie ntPrincipa l principa l = new Cl ientPrinci pal(
  107                                      "200", t rue, Authe nticationC redentials Type.Passw ord, 
  108                                      "3205OBX ", "silver .200", 
  109                                      "36213",  "CVIX,USE R", "12345 6777", "20 0", "Austi n", 
  110                                      roles, 
  111                                      new Hash Map<String , Object>( )
  112                    );
  113                    */
  114                    prin cipal.setA uthenticat edByVista( Boolean.TR UE);
  115                    prin cipal.setA uthenticat edByVista( Boolean.FA LSE);
  116                    Tran sactionCon textFactor y.createCl ientTransa ctionConte xt(princip al);
  117           
  118                    //Lo gger.getRo otLogger() .setLevel( Level.ERRO R);
  119                    //Lo gManager.g etLogger(" org.apache .commons.h ttpclient. Wire").set Level(Leve l.ALL);
  120                    
  121                    if(a rgs.length  > 0)
  122                             patien tIcns = ar gs;
  123                    else
  124                             patien tIcns = ne w String[] {"10061840 63V088473" };
  125                    
  126                    XCAD ataSourceC onfigurati on configu ration = n ull;
  127                    try
  128                    {
  129                             config uration =  XCADataSou rceConfigu ration.cre ate(
  130                                       "file:///V ixConfig/k eystore.xc a", "R EDACTED ",
  131                                       "file:///V ixConfig/t ruststore. xca", "R EDACTED ",
  132                                      "xcas",  7443, true
  133                             );
  134                    }
  135                    catc h (Malform edURLExcep tion x1)
  136                    {
  137                             x1.pri ntStackTra ce();
  138                             return ;
  139                    }
  140                    
  141                    try
  142                    {
  143                             XcaTes t xcaTest  = new XcaT est( creat eSourceMap () );
  144                             //Stri ng patient Icn = "100 8861107V47 5740", "10 06184063V0 88473";
  145                             xcaTes t.queryAnd RetrieveDo cuments(pa tientIcns,  true);
  146                    }
  147                    catc h (Excepti on x)
  148                    {
  149                             x.prin tStackTrac e();
  150                    }
  151           }
  152           
  153           /* *
  154            *  This map  is the sit e resoluti on table ( used in re trieve)
  155            *  @return
  156            *  @throws M alformedUR LException
  157            *  @throws O IDFormatEx ception 
  158            *  @throws R outingToke nFormatExc eption 
  159            * /
  160           pr ivate stat ic SortedM ap<Routing Token, Res olvedArtif actSource>  createSou rceMap() 
  161           th rows Malfo rmedURLExc eption, Ro utingToken FormatExce ption, OID FormatExce ption
  162           {
  163                    Sort edMap<Rout ingToken,  ResolvedAr tifactSour ce> source Map = new  TreeMap<Ro utingToken , Resolved ArtifactSo urce>();
  164                    URL  []urls = n ull;
  165                    Site  s = null;
  166                    List <URL> meta dataUrls =  null;
  167                    Reso lvedSiteIm pl site =  null;
  168                    
  169                    // c onfigure C VIX
  170                    urls  = new URL [] {new UR L(LOCALHOS T_URL)};
  171                    s =  new SiteIm pl("VA", " 660", "Was hington DC ", "WDC",  urls);
  172                    meta dataUrls =  new Array List<URL>( );
  173                    meta dataUrls.a dd(urls[0] );      
  174                    site  = Resolve dSiteImpl. create(s,  false, fal se, true,  metadataUr ls, metada taUrls);
  175                    asse rt(site !=  null);
  176                    sour ceMap.put(
  177                             Routin gTokenImpl .create( W ellKnownOI D.VA_DOCUM ENT.getCan onicalValu e(), "660"  ), 
  178                             site);
  179                    
  180                    // c onfigure B HIE
  181                    urls  = new URL [] {new UR L(SILVER_B HIE_URL)};
  182                    s =  new SiteIm pl("DoD",  "2002", "D oD", "DOD" , urls);
  183                    meta dataUrls =  new Array List<URL>( );
  184                    meta dataUrls.a dd(urls[0] );      
  185                    site  = Resolve dSiteImpl. create(s,  false, fal se, true,  metadataUr ls, metada taUrls);
  186                    asse rt (site ! = null);
  187                    sour ceMap.put(
  188                             Routin gTokenImpl .create( W ellKnownOI D.HAIMS_DO CUMENT.get CanonicalV alue(), "* " ), 
  189                             site);
  190  
  191                    // c onfigure H AIMS
  192                    urls  = new URL [] {new UR L(SILVER_H AIMS_URL)} ;
  193                    s =  new SiteIm pl("DoD",  "2003", "D oD", "DOD" , urls);
  194                    meta dataUrls =  new Array List<URL>( );
  195                    meta dataUrls.a dd(urls[0] );      
  196                    site  = Resolve dSiteImpl. create(s,  false, fal se, true,  metadataUr ls, metada taUrls);
  197                    asse rt(site !=  null);
  198                    sour ceMap.put(
  199                             Routin gTokenImpl .create( W ellKnownOI D.HAIMS_DO CUMENT.get CanonicalV alue(), "2 .16.840.1. 113883.3.1 98.2" ), 
  200                             site);
  201                    sour ceMap.put(
  202                             Routin gTokenImpl .create( W ellKnownOI D.HAIMS_DO CUMENT.get CanonicalV alue(), "c entral" ),  
  203                             site);
  204                    
  205                    // c onfigure N CAT
  206                    urls  = new URL [] {new UR L(SILVER_N CAT_URL)};
  207                    s =  new SiteIm pl("DoD",  "2004", "D oD", "DOD" , urls);
  208                    meta dataUrls =  new Array List<URL>( );
  209                    meta dataUrls.a dd(urls[0] );      
  210                    site  = Resolve dSiteImpl. create(s,  false, fal se, true,  metadataUr ls, metada taUrls);
  211                    asse rt(site !=  null);
  212                    sour ceMap.put(
  213                             Routin gTokenImpl .create( W ellKnownOI D.HAIMS_DO CUMENT.get CanonicalV alue(), "2 .16.840.1. 113883.3.1 98.1" ), 
  214                             site);
  215                    
  216                    retu rn sourceM ap;
  217           }
  218           
  219           //  ========= ========== ========== ========== ========== ========== ========== ========== ========== ======
  220           //  
  221           
  222           pr ivate fina l SortedMa p<RoutingT oken, Reso lvedArtifa ctSource>  sourceMap;
  223           pr ivate Prov ider provi der;
  224           
  225           /* *
  226            *  @param si lverBhieUr l
  227            * /
  228           pu blic XcaTe st(SortedM ap<Routing Token, Res olvedArtif actSource>  sourceMap )
  229           {
  230                    this .sourceMap  = sourceM ap;
  231           }
  232  
  233           /* *
  234            *  @return t he endpoin t
  235            * /
  236           pr otected So rtedMap<Ro utingToken , Resolved ArtifactSo urce> getS ourceMap()
  237           {
  238                    retu rn this.so urceMap;
  239           }
  240  
  241           /* *
  242            *  
  243            *  @return
  244            * /
  245           pr otected sy nchronized  Provider  getProvide r()
  246           {
  247                    if(p rovider ==  null)
  248                             provid er = new P rovider();
  249                    
  250                    retu rn provide r;
  251           }
  252           
  253           /* *
  254            *  
  255            *  @param ho meCommunit yId
  256            *  @param re positoryId
  257            *  @return
  258            *  @throws O IDFormatEx ception
  259            *  @throws R outingToke nFormatExc eption
  260            * /
  261           pr otected Re solvedArti factSource  getResolv edArtifact Source(Str ing homeCo mmunityId,  String re positoryId
  262           th rows OIDFo rmatExcept ion, Routi ngTokenFor matExcepti on
  263           {
  264                    retu rn getReso lvedArtifa ctSource(  RoutingTok enImpl.cre ate(homeCo mmunityId,  repositor yId) );
  265           }        
  266           
  267           /* *
  268            *  
  269            *  @param ro utingToken
  270            *  @return
  271            * /
  272           pr otected Re solvedArti factSource  getResolv edArtifact Source(Rou tingToken  routingTok en)
  273           {
  274                    for(  Iterator< Map.Entry< RoutingTok en, Resolv edArtifact Source>> i terator =  getSourceM ap().entry Set().iter ator();
  275                             iterat or.hasNext (); )
  276                    {
  277                             Map.En try<Routin gToken, Re solvedArti factSource > entry =  iterator.n ext();
  278                             if( en try.getKey ().isInclu ding(routi ngToken) )
  279                                      return e ntry.getVa lue();
  280                    }
  281                    retu rn null;
  282           }
  283  
  284           /* *
  285            *  
  286            *  @param pa tientIcns
  287            *  @param re trieveDocu ments
  288            *  @throws M ethodExcep tion 
  289            *  @throws C onnectionE xception 
  290            *  @throws R outingToke nFormatExc eption 
  291            *  @throws O IDFormatEx ception 
  292            * /
  293           pu blic void  queryAndRe trieveDocu ments(Stri ng[] patie ntIcns, bo olean retr ieveDocume nts) 
  294           th rows OIDFo rmatExcept ion, Routi ngTokenFor matExcepti on, Connec tionExcept ion, Metho dException
  295           {
  296                    for( String pat ientIcn :  patientIcn s)
  297                    {
  298                             Sorted Set<Docume ntSet> doc umentSets  = queryFor DocumentSe ts(patient Icn);
  299                             if(ret rieveDocum ents)
  300                                      retrieve DocumentsF romDocumen tSets(docu mentSets);
  301                    }
  302           }
  303           
  304           /* *
  305            *  
  306            *  @param qu eryEndpoin t
  307            *  @param pa tientIcns
  308            *  @param re trieveDocu ments
  309            *  @throws R outingToke nFormatExc eption 
  310            *  @throws O IDFormatEx ception 
  311            *  @throws C onnectionE xception 
  312            *  @throws M ethodExcep tion 
  313            * /
  314           pu blic Sorte dSet<Docum entSet> qu eryForDocu mentSets(S tring pati entIcn) 
  315           th rows OIDFo rmatExcept ion, Routi ngTokenFor matExcepti on, Connec tionExcept ion, Metho dException
  316           {
  317                    Reso lvedArtifa ctSource r esolvedArt ifactSourc e = 
  318                             getRes olvedArtif actSource( WellKnownO ID.VA_DOCU MENT.getCa nonicalVal ue().toStr ing(), "66 0");
  319                    Docu mentSetDat aSourceSpi  spi = get Provider() .createDoc umentSetDa taSource(r esolvedArt ifactSourc e, "xca");
  320                    Docu mentFilter  filter =  new Docume ntFilter(p atientIcn) ;
  321                    Docu mentSetRes ult docume ntSetResul t = spi.ge tPatientDo cumentSets (resolvedA rtifactSou rce.getArt ifactSourc e().create RoutingTok en(), 
  322                                      filter);
  323                    if(d ocumentSet Result ==  null)
  324                    {
  325                             System .out.print ln("\tNull  returned  from getPa tientDocum entSets(). ");
  326                             return  null;
  327                    }
  328                    else
  329                    {
  330                             Sorted Set<Docume ntSet> doc umentSets  = document SetResult. getArtifac ts();
  331                             if(doc umentSets  == null)
  332                                      System.o ut.println ("\tNo doc umentSets  returned i n document  set resul t.");
  333                             else
  334                                      System.o ut.println ("Found '"  + (docume ntSets ==  null ? "<n ull>" : In teger.toSt ring(docum entSets.si ze())) + " ' document  sets");
  335                             
  336                             return  documentS ets;
  337                    }
  338           }
  339           
  340           /* *
  341            *  
  342            *  @param do cumentSets
  343            *  @throws R outingToke nFormatExc eption
  344            *  @throws C onnectionE xception
  345            *  @throws M ethodExcep tion
  346            * /
  347           pr ivate void  retrieveD ocumentsFr omDocument Sets(Sorte dSet<Docum entSet> do cumentSets
  348           th rows Routi ngTokenFor matExcepti on, Connec tionExcept ion, Metho dException
  349           {
  350                    for( DocumentSe t document Set : docu mentSets)
  351                    {
  352                             System .out.print ln("\tFoun d '" + (do cumentSet  == null ?  "<null>" :  Integer.t oString(do cumentSet. size())) +  "' docume nts in set .");
  353                             assert (documentS et != null );
  354                             retrie veDocument sFromDocum entSet(doc umentSet);
  355                    }
  356           }
  357           
  358           pr ivate void  retrieveD ocumentsFr omDocument Set(Docume ntSet docu mentSet) 
  359           th rows Routi ngTokenFor matExcepti on, Connec tionExcept ion, Metho dException
  360           {
  361                    OID  homeCommun ityId = do cumentSet. getHomeCom munityId() ;
  362                    for( Document d ocument :  documentSe t)
  363                    {
  364                             System .out.print ln("\t\tDo cument '"  + document .getName()  + "', " +  document. getGlobalA rtifactIde ntifier()) ;
  365                             retrie veDocument (document. getGlobalA rtifactIde ntifier()) ;
  366                    }
  367           }
  368  
  369           /* *
  370            *  @param gl obalArtifa ctIdentifi er
  371            *  @throws R outingToke nFormatExc eption 
  372            *  @throws C onnectionE xception 
  373            *  @throws M ethodExcep tion 
  374            * /
  375           pr ivate void  retrieveD ocument(Gl obalArtifa ctIdentifi er globalA rtifactIde ntifier) 
  376           th rows Routi ngTokenFor matExcepti on, Connec tionExcept ion, Metho dException
  377           {
  378                    Reso lvedArtifa ctSource r esolvedArt ifactSourc e = getRes olvedArtif actSource(
  379                             Routin gTokenImpl .create(
  380                                      globalAr tifactIden tifier.get HomeCommun ityId(),
  381                                      globalAr tifactIden tifier.get Repository UniqueId()
  382                             )
  383                    );
  384                    
  385                    if(r esolvedArt ifactSourc e != null)
  386                    {
  387                             Docume ntDataSour ceSpi spi  = getProvi der().crea teDocument DataSource (resolvedA rtifactSou rce, "xca" );
  388                             ImageS treamRespo nse  isr =  spi.getDo cument(glo balArtifac tIdentifie r);
  389                             assert (isr != nu ll);
  390                             readAn dDumpImage Stream(isr );
  391                    }
  392           }
  393  
  394           /* *
  395            *  @param is r
  396            * /
  397           pr ivate void  readAndDu mpImageStr eam(ImageS treamRespo nse isr)
  398           {
  399                    Data SourceImag eInputStre am inStrea m = isr.ge tImageStre am();
  400                    asse rt( inStre am.isReada ble() );
  401                    Outp utStream b itBucket =  new NullO utputStrea m();
  402                    Byte StreamPump  pump = By teStreamPu mp.getByte StreamPump ();
  403                    try
  404                    {
  405                             System .out.print ln("There  are " + in Stream.get InputStrea m().availa ble() + "  available  bytes to s tart.");
  406                             int by tesTransfe rred = pum p.xfer(inS tream.getI nputStream (), bitBuc ket);
  407                             System .out.print ln("Sucess fully read  " + bytes Transferre d + " byte s.");
  408                    }
  409                    catc h (Illegal ArgumentEx ception x)
  410                    {
  411                             x.prin tStackTrac e();
  412                    }
  413                    catc h (IOExcep tion x)
  414                    {
  415                             x.prin tStackTrac e();
  416                    }
  417           }
  418  
  419   }