778. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 10/18/2018 2:02:19 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.

778.1 Files compared

# Location File Last Modified
1 VIX_SIV_v3_0_patch_201_build_8.zip\v3.0_patch_201_build_8\VISA\Java\ImagingDicomDCFSCP\main\src\java\gov\va\med\imaging\dicom\dcftoolkit\startup DicomEngineAdapter.java Thu Oct 11 13:30:13 2018 UTC
2 VIX_SIV_v3_0_patch_201_build_8.zip\v3.0_patch_201_build_8\VISA\Java\ImagingDicomDCFSCP\main\src\java\gov\va\med\imaging\dicom\dcftoolkit\startup DicomEngineAdapter.java Wed Oct 17 18:54:16 2018 UTC

778.2 Comparison summary

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

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

778.4 Active regular expressions

No regular expressions were active.

778.5 Comparison detail

  1   /**
  2    * Package : MAG - Vi stA Imagin g
  3    * WARNING : Per VHA  Directive  2004-038,  this routi ne should  not be mod ified.
  4    * @date M ay 12, 201 0
  5    * Site Na me:  Washi ngton OI F ield Offic e, Silver  Spring, MD
  6    * @author   PII
  7    * @versio n 1.0
  8    *
  9    * ------- ---------- ---------- ---------- ---------- ---------- -------
  10    * Propert y of the U S Governme nt.
  11    * No perm ission to  copy or re distribute  this soft ware is gi ven.
  12    * Use of  unreleased  versions  of this so ftware req uires the  user
  13    * to exec ute a writ ten test a greement w ith the Vi stA Imagin g
  14    * Develop ment Offic e of the D epartment  of Veteran s Affairs,
  15    * telepho ne (301) 7 34-0100.
  16    * 
  17    * The Foo d and Drug  Administr ation clas sifies thi s software  as
  18    * a Class  II medica l device.   As such,  it may not  be change d
  19    * in any  way.  Modi fications  to this so ftware may  result in  an
  20    * adulter ated medic al device  under 21CF R820, the  use of whi ch
  21    * is cons idered to  be a viola tion of US  Federal S tatutes.
  22    * ------- ---------- ---------- ---------- ---------- ---------- -------
  23    */
  24  
  25   package go v.va.med.i maging.dic om.dcftool kit.startu p;
  26  
  27   import gov .va.med.im aging.core .interface s.exceptio ns.Connect ionExcepti on;
  28   import gov .va.med.im aging.core .interface s.exceptio ns.MethodE xception;
  29   import gov .va.med.im aging.core .router.fa cade.Inter nalContext ;
  30   import gov .va.med.im aging.core .router.st orage.Stor ageConfigu rationData Source;
  31   import gov .va.med.im aging.core .router.st orage.prov iders.Stor ageProvide rFactory;
  32   import gov .va.med.im aging.dico m.DicomCon text;
  33   import gov .va.med.im aging.dico m.DicomRou ter;
  34   import gov .va.med.im aging.dico m.common.s pring.Spri ngContext;
  35   import gov .va.med.im aging.dico m.common.s tats.Dicom ServiceSta ts;
  36   import gov .va.med.im aging.dico m.dcftoolk it.common. license.in fo.DCFLice nseInfo;
  37   import gov .va.med.im aging.dico m.dcftoolk it.listen. CINFO;
  38   import gov .va.med.im aging.dico m.dcftoolk it.listen. DicomDataS ervice_a;
  39   import gov .va.med.im aging.dico m.dcftoolk it.listen. Listen;
  40   import gov .va.med.im aging.dico m.dcftoolk it.listen. Log4JOutpu t;
  41   import gov .va.med.im aging.exch ange.busin ess.AuditE vent;
  42   import gov .va.med.im aging.exch ange.busin ess.dicom. DGWEmailIn fo;
  43   import gov .va.med.im aging.exch ange.busin ess.dicom. DicomServe rConfigura tion;
  44   import gov .va.med.im aging.exch ange.busin ess.dicom. Instrument Config;
  45   import gov .va.med.im aging.exch ange.busin ess.dicom. ModalityCo nfig;
  46   import gov .va.med.im aging.exch ange.busin ess.dicom. UIDActionC onfig;
  47   import gov .va.med.im aging.exch ange.busin ess.storag e.StorageS erverDatab aseConfigu ration;
  48   import gov .va.med.im aging.noti fications. Notificati onFacade;
  49   import gov .va.med.im aging.noti fications. Notificati onTypes;
  50   import gov .va.med.im aging.tran sactioncon text.Inval idTransact ionContext MementoExc eption;
  51   import gov .va.med.im aging.tran sactioncon text.Trans actionCont extFactory ;
  52   import gov .va.med.im aging.tran sactioncon text.Trans actionCont extMemento ;
  53   import gov .va.med.se rver.Serve rAgnosticE ngine;
  54   import gov .va.med.se rver.Serve rAgnosticE ngineAdapt er;
  55   import gov .va.med.se rver.Serve rLifecycle Event;
  56  
  57   import jav a.io.Buffe redReader;
  58   import jav a.io.IOExc eption;
  59   import jav a.io.Input StreamRead er;
  60   import jav a.security .Principal ;
  61   import jav a.util.Arr ayList;
  62   import jav a.util.Lis t;
  63  
  64   import jav ax.naming. NamingExce ption;
  65  
  66   import org .apache.ca talina.Ser ver;
  67   import org .apache.ca talina.cor e.Standard Server;
  68   import org .apache.lo gging.log4 j.LogManag er;
  69   import org .apache.lo gging.log4 j.Logger;
  70   import org .springfra mework.con text.Appli cationCont ext;
  71   import org .springfra mework.con text.suppo rt.ClassPa thXmlAppli cationCont ext;
  72  
  73   import com .lbs.APC.A PCExceptio n;
  74   import com .lbs.APC_a .AppContro l_a;
  75   import com .lbs.CDS.C DSExceptio n;
  76   import com .lbs.CDS_a .CFGDB_a;
  77   import com .lbs.DCF.D CFVersion;
  78   import com .lbs.DCS.D CSExceptio n;
  79   import com .lbs.DDS.D DSExceptio n;
  80   import com .lbs.LOG.L OGClient;
  81   import com .lbs.LOG_a .LOGClient _a;
  82  
  83   /**
  84    * This is  a test im plementati on of a Se rverAgnost icEngine,  useful onl y for test ing
  85    * the Ser verAgnosti cEngineAda pter.
  86    * 
  87    * @author   PII
  88    *
  89    */
  90   public cla ss DicomEn gineAdapte r
  91   implements  ServerAgn osticEngin e
  92   {
  93           pr ivate stat ic Logger  logger = L ogManager. getLogger( DicomEngin eAdapter.c lass);
  94       privat e static L ogger simp leLogger =  LogManage r.getLogge r("Summary ");
  95           pr ivate stat ic ServerA gnosticEng ineAdapter  engineAda pter;
  96  
  97           pr ivate stat ic Applica tionContex t springFa ctoryConte xt = null;
  98           
  99           pr ivate stat ic List<Li sten> dico mListeners  = new Arr ayList<Lis ten>();
  100           pr ivate stat ic DicomEn gineAdapte r dicomEng ineAdapter ;
  101           
  102           @O verride
  103           pu blic void  serverEven t(ServerLi fecycleEve nt event)
  104           {
  105                    // O nly respon d to event s if DICOM  support i s enabled. ..
  106                    if ( DicomServe rConfigura tion.getCo nfiguratio n().isDico mEnabled() )
  107                    {
  108                             // If  this is th e after-st art event  for the co ntainer,
  109                             // sta rt up the  DICOM serv er
  110                             if (ev ent.getEve ntType().e quals(Serv erLifecycl eEvent.Eve ntType.STA RT))
  111                             {
  112                                      try
  113                                      {
  114                                               dicomEngin eAdapter =  this;
  115                                               initialize Spring();
  116                                               initialize Dcf();
  117                                               startDicom Services() ;
  118  
  119                                      }
  120                                      catch (E xception e )
  121                                      {
  122                                               logger.err or("An err or occurre d during D ICOM initi alization. ", e);
  123                                      }
  124                             }
  125  
  126                             // If  this is th e before-s top event  for the co ntainer,
  127                             // shu t down the  DICOM ser ver.
  128                             if (ev ent.getEve ntType().e quals(Serv erLifecycl eEvent.Eve ntType.STO P))
  129                             {
  130                                      logger.i nfo("Stopp ing the DI COM Engine  and Liste ners in VI SA.");
  131                                      
  132                                      stopList eners();
  133                             }
  134                    } 
  135                    else  
  136                    {
  137                             Transa ctionConte xtMemento  memento =  Transactio nContextFa ctory.get( ).getMemen to();
  138                             try
  139                             {
  140                                      DicomSer verConfigu ration con fig = Dico mServerCon figuration .getConfig uration();
  141                                      if (conf ig.isDicom DebugDumpE nabled()) 
  142                                      {
  143                                               config.set DicomDebug DumpStartM illies(Sys tem.curren tTimeMilli s());
  144                                      }
  145  
  146                                      logger.i nfo("Start ing Author ization pr ocess.");
  147                                      engineAd apter.auth enticate(c onfig.getA ccessCodeS tring(), c onfig.getV erifyCodeS tring().ge tBytes());
  148                                      loadPart ialDicomCo nfiguratio n(); // th is is need ed for Ico n creation  when List ener is no t started
  149                             } 
  150                             catch  (Exception  e)
  151                             {
  152                                      logger.e rror("An e rror occur red while  loading pa rtial DICO M Configur ation.", e );
  153                             }
  154                             finall y
  155                             {
  156                                      Transact ionContext Factory.re storeTrans actionCont ext(mement o);
  157                             }
  158                    }
  159           }
  160  
  161           pu blic stati c void sta rtDicomSer vices() th rows Metho dException , Connecti onExceptio n, DCSExce ption, CDS Exception
  162           {
  163                    Tran sactionCon textMement o memento  = Transact ionContext Factory.ge t().getMem ento();
  164                    try
  165                    {
  166                             DicomS erverConfi guration c onfig = Di comServerC onfigurati on.getConf iguration( );
  167  
  168                             // Aut henticate  on the mai n thread.
  169                             Princi pal princi pal = engi neAdapter. authentica te(config. getAccessC odeString( ), config. getVerifyC odeString( ).getBytes ());
  170                             
  171                             // If  a principa l was retu rned, auth entication  was succe ssful, so  we can 
  172                             // go  ahead and  start the  DICOM list eners. If  it's null,  however,  the 
  173                             // cre dentials w ere invali d. 
  174                             if (pr incipal !=  null)
  175                             {
  176                                      logger.i nfo("Start ing the DI COM Engine  and Liste ners in VI SA.");
  177                                      simpleLo gger.info( "Starting  DICOM list eners.");
  178                                      
  179                                      // Clear  the list  of listene rs, in cas e this is  a restart.
  180                                      dicomLis teners.cle ar();
  181                    
  182                                      logger.i nfo("Dicom  Toolkit L ayer: " +  "...Starti ng Authori zation pro cess.");
  183                                              
  184                                      if(confi g.isLoadFa lseStats() ){
  185                                               DicomServi ceStats.ge tInstance( ).loadFals eStatistic s();
  186                                      }
  187                                              
  188                                      if (conf ig.isDicom DebugDumpE nabled()) 
  189                                      {
  190                                               config.set DicomDebug DumpStartM illies(Sys tem.curren tTimeMilli s());
  191                                      }
  192                    
  193                                      loadDico mGatewayCo nfig();
  194                                      
  195                                      // Loop  over all t he instrum ents and c reate a li stener on  each confi gured port
  196                                      for (Ins trumentCon fig instru ment : Dic omServerCo nfiguratio n.getConfi guration() .getInstru ments())
  197                                      {
  198                                               DicomServi ceStats.ge tInstance( ).setCurre ntPortStat us(instrum ent.getPor t(), Dicom ServiceSta ts.DOWN);
  199                                               dicomListe ners.add(c reateListe ner(instru ment));
  200                                      }
  201                    
  202                                      //P116 - Have Q/R i solated to  a differe nt port#.   
  203                                      //       Use entry  from Dicom ServiceCon figuration  to set th e Port#, S ite ID, an d hostname .
  204                                      Instrume ntConfig h DIGListene r = new In strumentCo nfig();
  205                                      hDIGList ener.setPo rt(DicomSe rverConfig uration.ge tConfigura tion().get DicomListe nerPort()) ;
  206                                      hDIGList ener.setDe scription( "Primary H DIG Listen er -- for  non-Store  SCP Servic e Role(s). ");
  207                                      hDIGList ener.setSi teId(Dicom ServerConf iguration. getConfigu ration().g etSiteId() );
  208                                      hDIGList ener.setHo stName(Dic omServerCo nfiguratio n.getConfi guration() .getHostNa me());
  209                                      hDIGList ener.setSe rvice("All ");
  210                                      DicomSer viceStats. getInstanc e().setCur rentPortSt atus(hDIGL istener.ge tPort(), D icomServic eStats.DOW N);
  211                                      dicomLis teners.add (createLis tener(hDIG Listener)) ;
  212                    
  213                                      //Load u p the stor age server  configura tion now a s well
  214                                      StorageS erverDatab aseConfigu ration.set Configurat ionDataSou rce(new St orageConfi gurationDa taSource() );
  215                                      StorageS erverDatab aseConfigu ration.set ProviderFa ctory(new  StoragePro viderFacto ry());
  216                                      StorageS erverDatab aseConfigu ration.get Configurat ion();
  217  
  218                                      config.s etDicomSta rted(true) ;
  219                             try 
  220                             {
  221                                      String m essage = " Starting D ICOM Serve r.";
  222                                               InternalCo ntext.getR outer().po stAuditEve nt(
  223                                                                null ,
  224                                                                new  AuditEvent (AuditEven t.STARTUP,
  225                                                                Dico mServerCon figuration .getConfig uration(). getHostNam e(),
  226                                                                Dico mServerCon figuration .getConfig uration(). getApplica tionName() ,
  227                                                                mess age));
  228                                      }   
  229                             catch  (Connectio nException  cX) {
  230                                 lo gger.error (cX.getMes sage());
  231                                 lo gger.error ("Exceptio n thrown p osting to  Audit Log. ");                       
  232                                      } 
  233                                 ca tch (Metho dException  mX) {
  234                                 lo gger.error (mX.getMes sage());
  235                                 lo gger.error ("Exceptio n thrown p osting to  Audit Log. ");                       
  236                                      }
  237                             }
  238                             else
  239                             {
  240                                      // Send  notificati on
  241                                      String s ubject = " DICOM list ener start up failure : invalid  service ac count cred entials";
  242                                      String m essage = " The system  was unabl e to start  DICOM lis teners bec ause the s ervice acc ount crede ntials" +
  243                                                                          " are  invalid." ;
  244                                      Notifica tionFacade .sendNotif ication(No tification Types.Inva lidService AccountCre dentials,  subject, m essage);
  245                             }
  246                    }
  247                    fina lly
  248                    {
  249                             Transa ctionConte xtFactory. restoreTra nsactionCo ntext(meme nto);
  250                    }
  251  
  252           }
  253           pu blic stati c void sto pListeners ()
  254           {
  255                    simp leLogger.i nfo("Stopp ing DICOM  listeners. ");
  256                    Dico mServerCon figuration .getConfig uration(). setDicomSt arted(fals e);
  257                    
  258                    // F irst, shut  down each  of the li steners
  259                    for  (Listen di comListene r : dicomL isteners) 
  260                    {
  261                             try 
  262                             {
  263                                      dicomLis tener.shut downServer ();
  264                             } 
  265                             catch  (Exception  e) 
  266                             {
  267                                      logger.e rror("An e rror occur red while  shutting d own a DICO M listener .", e);
  268                             }
  269                             
  270                    }
  271  
  272                    // N ow attempt  to write  out the ap plication  log entry  for the sh utdown eve nt. First
  273                    // a uthenticat e on the m ain thread , and clea r the cont ext when d one. Note  that if th is
  274                    // i s being ca lled due t o the dete ction of i nvalid use r credenti als, we wo n't be abl e to
  275                    // w rite the e vent log e ntry...
  276                    Tran sactionCon textMement o memento  = Transact ionContext Factory.ge t().getMem ento();
  277                    try
  278                    {
  279                             // Aut henticate  on the mai n thread.
  280                             DicomS erverConfi guration c onfig = Di comServerC onfigurati on.getConf iguration( );
  281                             Princi pal princi pal = engi neAdapter. authentica te(config. getAccessC odeString( ), config. getVerifyC odeString( ).getBytes ());
  282                             
  283                             // If  a principa l was retu rned, auth entication  was succe ssful, so  we can 
  284                             // mak e the call  to the au dit log. 
  285                             if (pr incipal !=  null)
  286                             {
  287                                      String m essage = " Shutdown D ICOM Serve r.";
  288                                      AuditEve nt auditEv ent = new  AuditEvent (
  289                                                       Au ditEvent.S HUTDOWN,
  290                                                       Di comServerC onfigurati on.getConf iguration( ).getHostN ame(),
  291                                                       Di comServerC onfigurati on.getConf iguration( ).getAppli cationName (), messag e);
  292                                              
  293                                      Internal Context.ge tRouter(). postAuditE vent(null,  auditEven t);
  294                             }
  295                    }
  296                    catc h (Connect ionExcepti on cX) 
  297                    {
  298                             logger .error(cX. getMessage ());
  299                             logger .error("Ex ception th rown posti ng to Audi t Log.", c X);
  300                    } 
  301                    catc h (MethodE xception m X) 
  302                    {
  303                             logger .error(mX. getMessage ());
  304                             logger .error("Ex ception th rown posti ng to Audi t Log.", m X);
  305                    }
  306                    fina lly
  307                    {
  308                             // Mak e sure we  always res tore the t ransaction  context
  309                             Transa ctionConte xtFactory. restoreTra nsactionCo ntext(meme nto);
  310                    }
  311           }
  312           pr ivate stat ic Listen  createList ener(Instr umentConfi g instrume nt) throws  DCSExcept ion, CDSEx ception
  313           {
  314                    // C reate a DI COM listen er on the  configured  port and  start list ening
  315                    // o n a separa te thread.
  316                    logg er.info("S tarting a  listener o n port " +  instrumen t.getPort(
  317                                      + " for  instrument  '" + inst rument.get Descriptio n() + "' ( " + instru ment.getNi ckName() +  ")"
  318                                      + " loca ted at sit e '" + ins trument.ge tSite() +  "' (" + in strument.g etSiteId()  + ")");
  319  
  320                    List en dicomLi stener = n ew Listen( instrument , engineAd apter);
  321                    Thre ad listene rThread =  new Thread (dicomList ener, "DIC OM Listene r on port  " + instru ment.getPo rt() + ":  " + instru ment.getDe scription( ) + "' ("  + instrume nt.getNick Name() + " )");
  322                    list enerThread .start();
  323  
  324                    // r eturn the  listener i nstance so  it can be  stored fo r later re ference
  325                    retu rn dicomLi stener;
  326  
  327           }
  328  
  329           /* *
  330            *  Initializ e Spring
  331            * /
  332           pr ivate void  initializ eSpring()
  333           {
  334                    // L oad spring  configura tion from  the VixCon fig direct ory
  335                    Stri ng SpringX MLFile = " dicomConte xt.xml";
  336                    logg er.info("D icom Toolk it Layer:  " + "...lo ading Spri ngFactoryC ontext usi ng " + Spr ingXMLFile  + ".");
  337                    spri ngFactoryC ontext = n ew ClassPa thXmlAppli cationCont ext(Spring XMLFile);
  338                    Spri ngContext. setContext (springFac toryContex t);
  339           }
  340  
  341           /* *
  342            *  Setup all  DCF Adapt ers necess ary.  This  includes  Configurat ion and Lo g Adapters .  This
  343            *  method mu st be call ed before  the create Listener m ethod in t his object .
  344            *  @throws M ethodExcep tion 
  345            *  @throws A PCExceptio
  346            *  @throws C DSExceptio
  347            *   
  348            * /
  349           pr ivate void  initializ eDcf() thr ows Method Exception,  APCExcept ion, CDSEx ception, D DSExceptio n
  350           {
  351                    this .logProper ties();
  352                    if ( !this.isDC FLicenseVa lid())
  353                    {
  354                             throw  new Method Exception( "Invalid D CF License .");
  355                    }
  356                    
  357                    //Fo r JMX
  358                    DCFL icenseInfo .getInstan ce();
  359                    Dico mServiceSt ats.getIns tance();
  360                    
  361                    Stri ng[] empty Args = new  String[0] ;
  362  
  363                    //Th e followin g is a bas ic setup n ecessary f or DCF to  become ope rational.
  364                    logg er.debug(" Setting up  basic ser vices");
  365                    AppC ontrol_a.s etupORB(em ptyArgs);
  366                    CFGD B_a.setFSy sMode(true );
  367  
  368                    logg er.debug(" Setting up  DCF Confi guration A dapter.");
  369                    CFGD B_a.setup( emptyArgs) ;
  370  
  371                    logg er.debug(" Setting up  DCF AppCo ntrol Adap ter.");
  372                    AppC ontrol_a.s etup(empty Args, CINF O.instance ());
  373                    LOGC lient_a.se tConsoleMo de(false);
  374  
  375                    logg er.debug(" Setting up  DCF LOGCl ient Adapt er.");
  376                    LOGC lient_a.se tup(emptyA rgs);
  377                    LOGC lient.inst ance().add LOGOutput( new Log4JO utput());
  378                    
  379                    logg er.debug(" Setting up  DCF Data  Service Ad apter." );
  380           // Setup the  DicomDataS ervice ada pter.  Thi s is where  DCF Toolk it invokes
  381           //   VA imple mented cod e, via an  DCF Interf ace, for h andling of  DICOM
  382           //   Services .
  383           Di comDataSer vice_a.set up(emptyAr gs);
  384           }
  385           /* *
  386            *  Populate  the DicomG atewayConf ig informa tion 
  387            * /
  388           pr ivate stat ic void lo adDicomGat ewayConfig () throws  MethodExce ption, Con nectionExc eption
  389           {
  390  
  391                    Dico mRouter ro uter = Dic omContext. getRouter( );
  392  
  393                    // L oad DICOM  Gateway Co nfiguratio n from Vis ta HIS.
  394                    try  {
  395                             router .getDicomG atewayConf ig();
  396                    } ca tch (Excep tion e) {
  397                             logger .error("Fa iled to lo ad Legacy  DICOM Gate way Config uration.\n "
  398                                               +"This wil l hinder t he attempt  to recons titute CT  objects.") ;
  399                    }
  400                                      
  401                    Stri ng hostNam e = DicomS erverConfi guration.g etConfigur ation().ge tHostName( );
  402  
  403                    List <Instrumen tConfig> i nstruments  = router. getDgwInst rumentList (hostName) ;
  404                    logg er.info("L oading DIC OM instrum ent config uration. F ound " + i nstruments .size() +  " entries. ");
  405                    // T ODO: check  if number  of instru ments defi ned is gre ater > 0!  If not shu t down thi s app.
  406                    if ( instrument s.size() <  1) {
  407                             simple Logger.err or("There  are no DIC OM instrum ents defin ed.");
  408                             throw  new Method Exception( "DICOM ins trument co nfiguratio n is empty ");
  409                    }
  410  
  411                    List <ModalityC onfig> mod alities =  router.get DgwModalit yList(host Name);
  412                    logg er.info("L oading DIC OM modalit y configur ation. Fou nd " + mod alities.si ze() + " e ntries.");
  413                    
  414                    DGWE mailInfo d gwEmailInf o = router .getDgwEma ilInfo(hos tName);
  415                    logg er.info("L oading DGW  E-mail/co nfig Info.  Found " +  ((dgwEmai lInfo.getD gwSiteID() .length()  < 1)?"NO": "1") + " e ntry.");
  416                    // c heck if si te entered  on M side  and Java  side match ! If not s hut down t his app.
  417                    //FI XME This s hould not  be compari ng to the  Email obje ct.  It sh ould be be tween the  DicomServe rConfigura tion and t he legacy  DGW.
  418                    if ( !DicomServ erConfigur ation.getC onfigurati on().getSi teId().equ alsIgnoreC ase(dgwEma ilInfo.get DgwSiteID( ))) {
  419                             throw  new Method Exception( "HDIG site  ID=" + Di comServerC onfigurati on.getConf iguration( ).getSiteI d() + 
  420                                               " does not  match DGW  site ID="  + dgwEmai lInfo.getD gwSiteID() );
  421                    }
  422  
  423                    List <UIDAction Config> ac tions = ro uter.getDg wUIDAction Table("SOP  Class", " Storage",  "Storage S CP");
  424                    logg er.info("L oading the  DICOM SOP  Class UID  Actions c onfigurati on. Found  " + action s.size() +  " entries .");
  425                    
  426                    Dico mServerCon figuration .getConfig uration(). setInstrum ents(instr uments);
  427                    Dico mServerCon figuration .getConfig uration(). setModalit ies(modali ties);
  428                    Dico mServerCon figuration .getConfig uration(). setDgwEmai lInfo(dgwE mailInfo);
  429                    Dico mServerCon figuration .getConfig uration(). setModalit ies(modali ties);
  430                    Dico mServerCon figuration .getConfig uration(). setUidActi ons(action s);
  431           }
  432  
  433           /* *
  434            *  Load the  SOP Class  UID Action s Configur ation to m emory 
  435            * /
  436           pr ivate void  loadParti alDicomCon figuration () throws  MethodExce ption, Con nectionExc eption
  437           {
  438                    Dico mRouter ro uter = Dic omContext. getRouter( );
  439  
  440                    List <UIDAction Config> ac tions = ro uter.getDg wUIDAction Table("SOP  Class", " Storage",  "Storage S CP");
  441                    logg er.info("L oading the  DICOM SOP  Class UID  Actions c onfigurati on. Found  " + action s.size() +  " entries .");
  442                    
  443                    Dico mServerCon figuration .getConfig uration(). setUidActi ons(action s);
  444           }
  445  
  446           pr ivate void  logProper ties()
  447           {
  448                    //Ge t the Java  version f rom proper ties and p ut it in t he Logger.
  449                    //   This lets  us make su re which v ersion the  site is r unning be  looking at  the log.
  450                    java .util.Prop erties p =  System.ge tPropertie s();
  451                    Stri ng javaNam e = p.getP roperty("j ava.runtim e.name");
  452                    Stri ng javaVer sion = p.g etProperty ("java.run time.versi on");
  453                    Stri ng classPa th = p.get Property(" java.class .path");
  454                    Stri ng osName  = p.getPro perty("os. name");
  455                    Stri ng osVersi on = p.get Property(" os.version ");
  456  
  457                    logg er.debug(" Java Runti me Name= "  + javaNam e);
  458                    logg er.debug(" Java Runti me Version = " + java Version);
  459                    logg er.debug(" OS Name= "  + osName) ;
  460                    logg er.debug(" OS Version = " + osVe rsion);
  461                    logg er.debug(" Java Class path= " +  classPath) ;
  462  
  463                    logg er.debug(" DCF Versio n= " + DCF Version.ve rsion());
  464                    logg er.debug(" DCF BuildN umber= " +  DCFVersio n.buildNum ber());
  465  
  466                    simp leLogger.d ebug("Java  Runtime N ame= " + j avaName);
  467                    simp leLogger.d ebug("Java  Runtime V ersion= "  + javaVers ion);
  468                    simp leLogger.d ebug("OS N ame= " + o sName);
  469                    simp leLogger.d ebug("OS V ersion= "  + osVersio n);
  470                    simp leLogger.d ebug("Java  Classpath = " + clas sPath);
  471                    simp leLogger.d ebug("DCF  Version= "  + DCFVers ion.versio n());
  472                    simp leLogger.d ebug("DCF  BuildNumbe r= " + DCF Version.bu ildNumber( ));
  473  
  474           }
  475  
  476           pu blic boole an isDCFLi censeValid ()
  477           {
  478                    // A  Runtime o bject has  methods fo r dealing  with the O S
  479                    Runt ime r = Ru ntime.getR untime();
  480                    Buff eredReader  is = null ;
  481                    Stri ng aLine =  "";
  482  
  483                    // A  process o bject trac ks one ext ernal runn ing proces s
  484                    Proc ess p = nu ll;
  485  
  486                    // f ile contai ns unsorte d data
  487                    try
  488                    {
  489                             p = r. exec("dcf_ info -c");
  490  
  491                             // get InputStrea m gives an  Input str eam connec ted to
  492                             // the  process p 's standar d output ( and vice v ersa). We  use
  493                             // tha t to const ruct a Buf feredReade r so we ca n readLine () it.
  494                             is = n ew Buffere dReader(ne w InputStr eamReader( p.getInput Stream())) ;
  495  
  496                             aLine  = is.readL ine();
  497                    }
  498                    catc h (IOExcep tion e)
  499                    {
  500                             logger .error("Co uld not de termine if  DCF Licen se is vali d.", e);
  501                    }
  502                    
  503                    logg er.info("D CF License  Check: "  + aLine);
  504                    simp leLogger.i nfo("DCF L icense Che ck: " + aL ine);
  505                    if ( aLine.equa lsIgnoreCa se("valid" ))
  506                    {
  507                             return  true;
  508                    }
  509                    retu rn false;
  510           }
  511  
  512           @O verride
  513           pu blic void  setServerA gnosticEng ineAdapter (ServerAgn osticEngin eAdapter e ngineAdapt er)
  514           {
  515                    this .engineAda pter = eng ineAdapter ;              
  516           }
  517  
  518           pu blic Serve rAgnosticE ngineAdapt er getEngi neAdapter(
  519           {
  520                    retu rn engineA dapter;
  521           }
  522           
  523           /* *
  524            *  Checks to  see if th e currentl y configur ed Access/ Verify cod es (in Dic omServerCo nfig) are  valid
  525            *  @return
  526            * /
  527           pu blic stati c boolean  isValidCre dentials()
  528           {
  529                    Dico mServerCon figuration  config =  DicomServe rConfigura tion.getCo nfiguratio n();
  530                    retu rn isValid Credential s(config.g etAccessCo deString() , config.g etVerifyCo deString() );
  531           }
  532  
  533           /* *
  534            *  Checks to  see if a  set of acc ess and ve rify codes  are valid
  535            *  @param ac cessCode
  536            *  @param ve rifyCode
  537            *  @return
  538            * /
  539           pu blic stati c boolean  isValidCre dentials(S tring acce ssCode, St ring verif yCode)
  540           {
  541                    Tran sactionCon textMement o memento  = Transact ionContext Factory.ge t().getMem ento();
  542                    try
  543                    {
  544                             Princi pal princi pal = engi neAdapter. authentica te(accessC ode, verif yCode.getB ytes());
  545                             return  (principa l != null) ;
  546                    }
  547                    fina lly
  548           {
  549                             Transa ctionConte xtFactory. restoreTra nsactionCo ntext(meme nto);
  550           }
  551  
  552           }
  553  
  554   }