156. EPMO Open Source Coordination Office Redaction File Detail Report

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

156.1 Files compared

# Location File Last Modified
1 IV-eHMP_CIF.zip\IMAG_Source\VISA\Java\DicomServiceProvider\main\src\java\gov\va\med\imaging\dicom DicomServiceProvider.java Mon Dec 4 21:34:42 2017 UTC
2 IV-eHMP_CIF.zip\IMAG_Source\VISA\Java\DicomServiceProvider\main\src\java\gov\va\med\imaging\dicom DicomServiceProvider.java Mon Dec 4 21:59:31 2017 UTC

156.2 Comparison summary

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

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

156.4 Active regular expressions

No regular expressions were active.

156.5 Comparison detail

  1   package go v.va.med.i maging.dic om;
  2  
  3   import gov .va.med.im aging.dico m.spi.Dico mSPI;
  4  
  5   import jav a.util.Has hMap;
  6   import jav a.util.Ite rator;
  7   import jav a.util.Map ;
  8   import jav a.util.Ser viceLoader ;
  9   import jav a.util.Sor tedSet;
  10   import jav a.util.Tre eSet;
  11   import org .apache.lo gging.log4 j.LogManag er;
  12   import org .apache.lo gging.log4 j.Logger;
  13  
  14   /**
  15    * 
  16    * @author         
BECKEC
  17    *
  18    */
  19   public cla ss DicomSe rviceProvi der
  20   {
  21       privat e Logger l ogger = Lo gManager.g etLogger(" DicomServi ceProvider ");
  22       
  23       // === ========== ========== ========== ========== ========== ========== ========== ========== ========== ========== ========== =
  24       // Sin gleton Imp lementatio n
  25       // === ========== ========== ========== ========== ========== ========== ========== ========== ========== ========== ========== =
  26       privat e static D icomServic eProvider  singleton  = null;
  27       public  static sy nchronized  DicomServ iceProvide r getSingl eton()
  28       {
  29           if (singleton  == null)
  30                singleto n = new Di comService Provider() ;
  31           
  32           re turn singl eton;
  33       }
  34       
  35       // === ========== ========== ========== ========== ========== ========== ========== ========== ========== ========== ========== =
  36       // Ser vice Loade r
  37       // === ========== ========== ========== ========== ========== ========== ========== ========== ========== ========== ========== =
  38       privat e final Ob ject servi ceLoaderSy nch = new  Object();      // use d for its  monitor on ly 
  39       privat e ServiceL oader<? ex tends Dico mServicePr ovider> se rviceLoade r;
  40       privat e SortedSe t<DicomSer viceDescri ption<?>>  availableS ervices;
  41  
  42       /**
  43        * 
  44        * @re turn
  45        */
  46       privat e final Se rviceLoade r<? extend s DicomSer viceProvid er> getSer viceLoader ()
  47       {
  48           sy nchronized  (serviceL oaderSynch )
  49           {
  50                if(servi ceLoader = = null)
  51                    serv iceLoader  = ServiceL oader.load (DicomServ iceProvide r.class);
  52           }
  53           re turn servi ceLoader;
  54       }
  55       
  56       /**
  57        * 
  58        * @re turn
  59        */
  60       privat e final So rtedSet<?  extends Di comService Descriptio n<?>> getA llServices ()
  61       {
  62           sy nchronized  (serviceL oaderSynch )
  63           {
  64                if(this. availableS ervices ==  null)
  65                {
  66                    this .available Services =  new TreeS et<DicomSe rviceDescr iption<?>> ();
  67                    for( Iterator<?  extends D icomServic eProvider>  providerI ter = getS erviceLoad er().itera tor();
  68                         providerIt er.hasNext (); )
  69                    {
  70                         DicomServi ceProvider  provider  = provider Iter.next( );
  71                         logger.inf o("Initial izing prov ider " + p rovider.ge tName() +  " - " + pr ovider.get Version()) ;
  72                        
  73                         // if the  provider i nitializes  correctly  then add  its servic es to the  available  set
  74                         if( provid er.initial ize() )
  75                         {
  76                             this.a vailableSe rvices.add All( provi der.getSer vices() );
  77                             logger .warn("Ini tialized p rovider "  + provider .getName()  + " - " +  provider. getVersion ());
  78                         }
  79                         else
  80                             logger .warn("Fai led to ini tialize pr ovider " +  provider. getName()  + " - " +  provider.g etVersion( ));
  81                    }
  82                }
  83           }         
  84           re turn this. availableS ervices;
  85       }
  86       
  87       /**
  88        * 
  89        * @pa ram <S>
  90        * @pa ram spiTyp e
  91        * @re turn
  92        */
  93       @Suppr essWarning s("uncheck ed")
  94       privat e final <S  extends D icomSPI> S ortedSet<D icomServic eDescripti on<S>> get ServicesOf Type(Class <S> spiTyp e)
  95       {
  96           So rtedSet<Di comService Descriptio n<S>> serv ices = new  TreeSet<D icomServic eDescripti on<S>>();
  97           
  98           fo r(DicomSer viceDescri ption<?> s erviceDesc ription :  getAllServ ices())
  99           {
  100                if(spiTy pe == serv iceDescrip tion.getIm plementedS pi())
  101                    serv ices.add(( DicomServi ceDescript ion<S>) se rviceDescr iption);
  102           }
  103           
  104           re turn servi ces;
  105       }
  106       
  107       // === ========== ========== ========== ========== ========== ========== ========== ========== ========== ========== ========== =
  108       // Ser vice Avail ability Me thods
  109       // === ========== ========== ========== ========== ========== ========== ========== ========== ========== ========== ========== =
  110       privat e Map<Clas s<? extend s DicomSPI >, DicomSe rviceFacto ry<? exten ds DicomSP I>> factor yMap = nul l;
  111       
  112       /**
  113        * 
  114        * @pa ram <S>
  115        * @pa ram spiCla ss
  116        * @re turn
  117        */
  118       privat e <S exten ds DicomSP I> DicomSe rviceFacto ry<S> getO rCreateFac tory(Class <S> spiCla ss)
  119       {
  120           sy nchronized  (serviceL oaderSynch )
  121           {
  122                if(facto ryMap == n ull)
  123                    fact oryMap = n ew HashMap <Class<? e xtends Dic omSPI>, Di comService Factory<?  extends Di comSPI>>() ;
  124                
  125                @Suppres sWarnings( "unchecked ")
  126                DicomSer viceFactor y<S> facto ry = (Dico mServiceFa ctory<S>)  factoryMap .get(spiCl ass);
  127                if(facto ry == null )
  128                {
  129                    fact ory = new  DicomServi ceFactory< S>(getServ icesOfType (spiClass) );
  130                    fact oryMap.put (spiClass,  factory);
  131                }
  132                return f actory;
  133           }
  134       }
  135       
  136       /**
  137        * 
  138        * @pa ram <S>
  139        * @pa ram spiCla ss
  140        * @re turn
  141        * @th rows Dicom ServiceCre ationExcep tion
  142        */
  143       public  <S extend s DicomSPI > S create (Class<S>  spiClass) 
  144       throws  DicomServ iceCreatio nException
  145       {
  146           Di comService Factory<S>  factory =  getOrCrea teFactory( spiClass);
  147           re turn facto ry.create( );
  148       }
  149       
  150       /**
  151        * 
  152        */
  153       public  final voi d reloadSe rvices()
  154       {
  155           sy nchronized  (serviceL oaderSynch )
  156           {
  157                this.ser viceLoader  = null;
  158                this.ava ilableServ ices = nul l;
  159                this.fac toryMap =  null;
  160           }
  161       }
  162       
  163       // === ========== ========== ========== ========== ========== ========== ========== ========== ========== ========== ========== =
  164       // Mem bers that  should be  overridden  by derive d classes
  165       // === ========== ========== ========== ========== ========== ========== ========== ========== ========== ========== ========== =
  166       privat e static f inal Strin g PROVIDER _NAME = "R ootDicomPr ovider";
  167       privat e static f inal float  PROVIDER_ VERSION =  1.0f;
  168       privat e static f inal Strin g PROVIDER _INFO = "N o SPI impl ementation  provided" ;
  169  
  170       privat e final St ring name;  
  171       privat e final fl oat versio n;
  172       privat e final St ring info;
  173       
  174       /**
  175        * The  public "n ullary" co nstructor  that is us ed by the  ServiceLoa der class
  176        * to  create ins tances.
  177        */
  178       privat e DicomSer viceProvid er()
  179       {
  180           th is(PROVIDE R_NAME, PR OVIDER_VER SION, PROV IDER_INFO) ;
  181       }
  182  
  183       /**
  184        * 
  185        * @pa ram name
  186        * @pa ram versio n
  187        * @pa ram info
  188        */
  189       protec ted DicomS erviceProv ider(Strin g name, fl oat versio n, String  info)
  190       {
  191           th is.name =  name;
  192           th is.version  = version ;
  193           th is.info =  info;
  194       }
  195  
  196       public  String ge tName()
  197       {
  198           re turn name;
  199       }
  200  
  201       public  float get Version()
  202       {
  203           re turn versi on;
  204       }
  205  
  206       public  String ge tInfo()
  207       {
  208           re turn info;
  209       }
  210       
  211       /**
  212        * 
  213        * @re turn
  214        */
  215       protec ted Sorted Set<DicomS erviceDesc ription<?> > getServi ces()
  216       {
  217           re turn null;
  218       }
  219  
  220       /**
  221        * 
  222        * @re turn
  223        */
  224       public  boolean i nitialize( )
  225       {
  226           re turn false ;
  227       }
  228   }