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

133.1 Files compared

# Location File Last Modified
1 IV-eHMP_CIF.zip\IMAG_Source\VISA\Java\DataSourceServiceProvider\main\src\java\gov\va\med\imaging\datasource Provider.java Mon Dec 4 21:34:38 2017 UTC
2 IV-eHMP_CIF.zip\IMAG_Source\VISA\Java\DataSourceServiceProvider\main\src\java\gov\va\med\imaging\datasource Provider.java Mon Dec 4 21:59:12 2017 UTC

133.2 Comparison summary

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

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

133.4 Active regular expressions

No regular expressions were active.

133.5 Comparison detail

  1   /**
  2    * 
  3    */
  4   package go v.va.med.i maging.dat asource;
  5  
  6   import gov .va.med.im aging.arti factsource .ResolvedA rtifactSou rce;
  7   import gov .va.med.im aging.core .interface s.DataSour ceExceptio nHandler;
  8   import gov .va.med.im aging.core .interface s.exceptio ns.Connect ionExcepti on;
  9   import gov .va.med.im aging.data source.ann otations.S PI;
  10  
  11   import jav a.io.IOExc eption;
  12   import jav a.io.Seria lizable;
  13   import jav a.net.URL;
  14   import jav a.util.*;
  15  
  16   import org .apache.lo gging.log4 j.LogManag er;
  17   import org .apache.lo gging.log4 j.Logger;
  18  
  19   /**
  20    * @author         
BECKEC
  21    * 
  22    * @see ht tp://java. sun.com/ja vase/6/doc s/api/java /util/Serv iceLoader. html
  23    * 
  24    * "A serv ice is a w ell-known  set of int erfaces an d (usually  abstract)  classes.
  25    * A servi ce provide r is a spe cific impl ementation  of a serv ice. The c lasses in
  26    * a provi der typica lly implem ent the in terfaces a nd subclas s the clas ses
  27    * defined  in the se rvice itse lf. Servic e provider s can be i nstalled i n an
  28    * impleme ntation of  the Java  platform i n the form  of extens ions, that  is, jar
  29    * files p laced into  any of th e usual ex tension di rectories.  Providers  can also
  30    * be made  available  by adding  them to t he applica tion's cla ss path or  by some
  31    * other p latform-sp ecific mea ns. For th e purpose  of loading , a servic e is
  32    * represe nted by a  single typ e, that is , a single  interface  or abstra ct class.
  33    * (A conc rete class  can be us ed, but th is is not  recommende d.) A prov ider of a
  34    * given s ervice con tains one  or more co ncrete cla sses that  extend thi s service
  35    * type wi th data an d code spe cific to t he provide r. The pro vider clas s is
  36    * typical ly not the  entire pr ovider its elf but ra ther a pro xy which c ontains
  37    * enough  informatio n to decid e whether  the provid er is able  to satisf y a
  38    * particu lar reques t together  with code  that can  create the  actual pr ovider on
  39    * demand.  The detai ls of prov ider class es tend to  be highly  service-s pecific;
  40    * no sing le class o r interfac e could po ssibly uni fy them, s o no such  type is
  41    * defined  here. The  only requ irement en forced by  this facil ity is tha t provider
  42    * classes  must have  a zero-ar gument con structor s o that the y can be
  43    * instant iated duri ng loading . A servic e provider  is identi fied by pl acing a
  44    * provide r-configur ation file  in the re source dir ectory MET A-INF/serv ices. The
  45    * file's  name is th e fully-qu alified bi nary name  of the ser vice's typ e. The
  46    * file co ntains a l ist of ful ly-qualifi ed binary  names of c oncrete pr ovider
  47    * classes , one per  line. Spac e and tab  characters  surroundi ng each na me, as
  48    * well as  blank lin es, are ig nored. The  comment c haracter i s '#' ('\u 0023',
  49    * NUMBER  SIGN); on  each line  all charac ters follo wing the f irst comme nt
  50    * charact er are ign ored. The  file must  be encoded  in UTF-8. "
  51    * 
  52    * This cl ass repres ents a "pr ovider" fo r the VIX  Facade Ser vice Provi der
  53    * Interfa ce, where  a provider  implement s some or  all parts  of VIX Dat a Sources.
  54    * Service s that a p rovider ma y implemen t include:  StudyGrap hDataSourc e (such as
  55    * VistA,  BIA or Fed eration).  UserPrefer enceDataSo urce (such  as VistA)
  56    * 
  57    * Each pr ovider has  a name an d a versio n number,  and is con figured in  each
  58    * runtime  it is ins talled in.
  59    * 
  60    */
  61   public cla ss Provide r
  62   extends Pr operties
  63   implements  DataSourc eProvider
  64   {
  65           pr ivate stat ic final l ong serial VersionUID  = 1L;
  66           st atic final  transient  Logger lo gger = Log Manager.ge tLogger(Pr ovider.cla ss);
  67           
  68           pr ivate Clas sLoader pr oviderClas sLoader;
  69           pr ivate Serv iceLoader< Provider>  providerSe rviceLoade r;
  70           pr ivate fina l Provider DataSource Factories  providerSe rviceFacto ries = new  ProviderD ataSourceF actories(t his);
  71  
  72           /* *
  73            *  The Provi derClassLo ader must  be set bef ore any ca lls to get  service
  74            *  implement ations els e an Illeg alStateExc eption wil l be throw n.
  75            *  
  76            *  @param cl assLoader
  77            * /
  78           pu blic synch ronized vo id setProv iderClassL oader(Clas sLoader cl assLoader)
  79           {
  80                    if ( providerSe rviceLoade r != null)
  81                             throw  new Illega lStateExce ption(
  82                                      "The pro vider clas s loader m ust be set  before an y calls to  acquire s ervice imp lementatio ns.");
  83                    prov iderClassL oader = cl assLoader;
  84           }
  85  
  86           /* *
  87            *  
  88            *  @return
  89            * /
  90           pu blic synch ronized bo olean isPr oviderLoad erSet()
  91           {
  92                    retu rn provide rServiceLo ader != nu ll;
  93           }
  94           
  95           /* *
  96            *  
  97            *  @return
  98            * /
  99           pr ivate sync hronized S erviceLoad er<Provide r> getProv iderLoader ()
  100           {
  101                    // T his (next)  line dete rmines whe re the pro vider pack ages will  be
  102                    // l oaded from .
  103                    // W hatever Cl assLoader  has loaded  this will  determine  the class path
  104                    // t hat
  105                    // p rovider pa ckages are  found.
  106                    // I f the prov iderClassL oader has  been set t hen that w ill be use d as the
  107                    // c lass loade r.
  108                    if ( providerSe rviceLoade r == null)
  109                    {
  110                             logger .info("Ser viceLoader  being cre ated under  context c lass loade r ["
  111                                      + (provi derClassLo ader == nu ll ? "cont ext class  loader " +  Provider. class.getC lassLoader ().toStrin g()
  112                                               : "specifi ed class l oader" + p roviderCla ssLoader.t oString())  + "].");
  113  
  114                             provid erServiceL oader = pr oviderClas sLoader ==  null ? Se rviceLoade r.load(Pro vider.clas s) : Servi ceLoader.l oad(
  115                                      Provider .class, pr oviderClas sLoader);
  116                    }
  117                    retu rn provide rServiceLo ader;
  118           }
  119           
  120           pu blic Class Loader get ProviderCl assLoader( )
  121           {
  122                    retu rn provide rClassLoad er;
  123           }
  124  
  125           /* *
  126            *  Create a  single ins tance of a  LocalData Source of  the specif ied type. 
  127            *  
  128            *  @param <S >
  129            *  @param sp iType
  130            *  @return
  131            *  @throws C onnectionE xception
  132            * /
  133           pu blic <S ex tends Loca lDataSourc eSpi> S cr eateLocalD ataSource( Class<S> s piType) 
  134           th rows Conne ctionExcep tion
  135           {
  136                    Loca lServicePr oviderFact ory<S> loc alDataSour ceFactory 
  137                             this.p roviderSer viceFactor ies.getOrC reateLocal ServicePro viderFacto ry(spiType );
  138                    if(l ocalDataSo urceFactor y == null)
  139                             throw  new Connec tionExcept ion("Faile d to creat e a data s ource fact ory produc ing instan ces of '"  + spiType. getSimpleN ame() + "' .");
  140                    S da taSource =  localData SourceFact ory.create SingletonS erviceInst ance();
  141  
  142                    retu rn dataSou rce;
  143           }
  144           
  145           pu blic <S ex tends Loca lDataSourc eSpi> S cr eateLocalD ataSource( Class<S> s piType, 
  146                             Resolv edArtifact Source res olvedArtif actSource)  
  147           th rows Conne ctionExcep tion
  148           {
  149                    Loca lServicePr oviderFact ory<S> loc alDataSour ceFactory 
  150                             this.p roviderSer viceFactor ies.getOrC reateLocal ServicePro viderFacto ry(spiType );
  151                    if(l ocalDataSo urceFactor y == null)
  152                             throw  new Connec tionExcept ion("Faile d to creat e a data s ource fact ory produc ing instan ces of '"  + spiType. getSimpleN ame() + "' .");
  153                    S da taSource =  localData SourceFact ory.create SingletonS erviceInst ance(resol vedArtifac tSource);
  154  
  155                    retu rn dataSou rce;
  156           }
  157  
  158           /* *
  159            *  Create a  List of in stances of  LocalData SourceSpi  of the spe cified typ e.
  160            *  
  161            *  @param <S >
  162            *  @param sp iType
  163            *  @return
  164            *  @throws C onnectionE xception
  165            * /
  166           pu blic <S ex tends Loca lDataSourc eSpi> List <S> create LocalDataS ources(Cla ss<S> spiT ype) 
  167           th rows Conne ctionExcep tion
  168           {
  169                    Loca lServicePr oviderFact ory<S> loc alDataSour ceFactory 
  170                             this.p roviderSer viceFactor ies.getOrC reateLocal ServicePro viderFacto ry(spiType );
  171                    if(l ocalDataSo urceFactor y == null)
  172                             throw  new Connec tionExcept ion("Faile d to creat e a data s ource fact ory produc ing instan ces of '"  + spiType. getSimpleN ame() + "' .");
  173                    List <S> dataSo urces = lo calDataSou rceFactory .createSer viceInstan ces();
  174  
  175                    retu rn dataSou rces;
  176           }
  177  
  178           /*
  179            *  (non-Java doc)
  180            *  
  181            *  @see gov. va.med.ima ging.datas ource.Data SourceProv ider#creat eSiteResol utionDataS ource()
  182            * /
  183           pu blic SiteR esolutionD ataSourceS pi createS iteResolut ionDataSou rce() 
  184           th rows Conne ctionExcep tion
  185           {
  186                    retu rn createL ocalDataSo urce(SiteR esolutionD ataSourceS pi.class);
  187           }
  188  
  189           /*
  190            *  (non-Java doc)
  191            *  
  192            *  @see gov. va.med.ima ging.datas ource.Data SourceProv ider#creat eRoutingOv errideServ ices()
  193            * /
  194           pu blic List< RoutingOve rrideSpi>  createRout ingOverrid eServices(
  195           th rows Conne ctionExcep tion
  196           {
  197                    retu rn createL ocalDataSo urces(Rout ingOverrid eSpi.class );
  198           }
  199  
  200           /*
  201            *  (non-Java doc)
  202            *  
  203            *  @see gov. va.med.ima ging.datas ource.Data SourceProv ider#creat eImageData Source(jav a.net.URL,
  204            *       gov. va.med.ima ging.core. interfaces .Localized Site)
  205            * /
  206           pu blic Image DataSource Spi create ImageDataS ource(
  207                    Reso lvedArtifa ctSource r esolvedArt ifactSourc e, 
  208                    Stri ng protoco l,
  209                    Data SourceExce ptionHandl er... data SourceExce ptionHandl ers) 
  210           th rows Conne ctionExcep tion
  211           {
  212                    retu rn createV ersionable DataSource (ImageData SourceSpi. class, res olvedArtif actSource,  protocol,  dataSourc eException Handlers);
  213           }
  214  
  215           /*
  216            *  (non-Java doc)
  217            *  
  218            *  @see gov. va.med.ima ging.datas ource.Data SourceProv ider#creat eStudyGrap hDataSourc e(java.net .URL,
  219            *       gov. va.med.ima ging.core. interfaces .Localized Site)
  220            * /
  221           pu blic Study GraphDataS ourceSpi c reateStudy GraphDataS ource(
  222                    Reso lvedArtifa ctSource r esolvedArt ifactSourc e, 
  223                    Stri ng protoco l,
  224                    Data SourceExce ptionHandl er... data SourceExce ptionHandl ers) 
  225           th rows Conne ctionExcep tion
  226           {
  227                    retu rn createV ersionable DataSource (StudyGrap hDataSourc eSpi.class , resolved ArtifactSo urce, prot ocol, data SourceExce ptionHandl ers);
  228           }
  229  
  230           /*
  231            *  (non-Java doc)
  232            *  
  233            *  @see gov. va.med.ima ging.datas ource.Data SourceProv ider#creat eImageAcce ssLoggingD ataSource( java.net.U RL,
  234            *       gov. va.med.ima ging.core. interfaces .Localized Site)
  235            * /
  236           pu blic Image AccessLogg ingSpi cre ateImageAc cessLoggin gDataSourc e(
  237                    Reso lvedArtifa ctSource r esolvedArt ifactSourc e, 
  238                    Stri ng protoco l,
  239                    Data SourceExce ptionHandl er... data SourceExce ptionHandl ers) 
  240           th rows Conne ctionExcep tion
  241           {
  242                    retu rn createV ersionable DataSource (ImageAcce ssLoggingS pi.class,  resolvedAr tifactSour ce, protoc ol, dataSo urceExcept ionHandler s);
  243           }
  244  
  245           /*
  246            *  (non-Java doc)
  247            *  
  248            *  @see gov. va.med.ima ging.datas ource.Data SourceProv ider#creat eDocumentD ataSource( java.net.U RL,
  249            *       gov. va.med.ima ging.core. interfaces .Localized Site)
  250            * /
  251           pu blic Docum entDataSou rceSpi cre ateDocumen tDataSourc e(
  252                    Reso lvedArtifa ctSource r esolvedArt ifactSourc e, 
  253                    Stri ng protoco l,
  254                    Data SourceExce ptionHandl er... data SourceExce ptionHandl ers) 
  255           th rows Conne ctionExcep tion
  256           {
  257                    retu rn createV ersionable DataSource (DocumentD ataSourceS pi.class,  resolvedAr tifactSour ce, protoc ol, dataSo urceExcept ionHandler s);
  258           }
  259  
  260           /*
  261            *  (non-Java doc)
  262            *  
  263            *  @see gov. va.med.ima ging.datas ource.Data SourceProv ider#creat eDocumentD ataSource( java.net.U RL,
  264            *       gov. va.med.ima ging.core. interfaces .Localized Site)
  265            * /
  266           pu blic Docum entSetData SourceSpi  createDocu mentSetDat aSource(
  267                    Reso lvedArtifa ctSource r esolvedArt ifactSourc e, 
  268                    Stri ng protoco l,
  269                    Data SourceExce ptionHandl er... data SourceExce ptionHandl ers) 
  270           th rows Conne ctionExcep tion
  271           {
  272                    retu rn createV ersionable DataSource (DocumentS etDataSour ceSpi.clas s, resolve dArtifactS ource, pro tocol, dat aSourceExc eptionHand lers);
  273           }
  274  
  275           /*
  276            *  (non-Java doc)
  277            *  
  278            *  @see gov. va.med.ima ging.datas ource.Data SourceProv ider#creat eUserPrefe renceDataS ource(java .net.URL,
  279            *       gov. va.med.ima ging.core. interfaces .Localized Site)
  280            * /
  281           pu blic UserP referenceD ataSourceS pi createU serPrefere nceDataSou rce(
  282                    Reso lvedArtifa ctSource r esolvedArt ifactSourc e, 
  283                    Stri ng protoco l,
  284                    Data SourceExce ptionHandl er... data SourceExce ptionHandl ers) 
  285           th rows Conne ctionExcep tion
  286           {
  287                    retu rn createV ersionable DataSource (UserPrefe renceDataS ourceSpi.c lass, reso lvedArtifa ctSource,  protocol,  dataSource ExceptionH andlers);
  288           }
  289  
  290           /*
  291            *  (non-Java doc)
  292            *  
  293            *  @see gov. va.med.ima ging.datas ource.Data SourceProv ider#creat ePatientDa taSource(j ava.net.UR L,
  294            *       gov. va.med.ima ging.core. interfaces .Localized Site)
  295            * /
  296           pu blic Patie ntDataSour ceSpi crea tePatientD ataSource(
  297                    Reso lvedArtifa ctSource r esolvedArt ifactSourc e, 
  298                    Stri ng protoco l,
  299                    Data SourceExce ptionHandl er... data SourceExce ptionHandl ers) 
  300           th rows Conne ctionExcep tion
  301           {
  302                    retu rn createV ersionable DataSource (PatientDa taSourceSp i.class, r esolvedArt ifactSourc e, protoco l, dataSou rceExcepti onHandlers );
  303           }
  304  
  305           /*
  306            *  (non-Java doc)
  307            *  
  308            *  @see gov. va.med.ima ging.datas ource.Data SourceProv ider#creat eDicomData Source(jav a.net.URL,
  309            *       gov. va.med.ima ging.core. interfaces .Localized Site)
  310            * /
  311           pu blic Dicom DataSource Spi create DicomDataS ource(
  312                    Reso lvedArtifa ctSource r esolvedArt ifactSourc e, 
  313                    Stri ng protoco l,
  314                    Data SourceExce ptionHandl er... data SourceExce ptionHandl ers) 
  315           th rows Conne ctionExcep tion
  316           {
  317                    retu rn createV ersionable DataSource (DicomData SourceSpi. class, res olvedArtif actSource,  protocol,  dataSourc eException Handlers);
  318           }
  319  
  320           /*
  321            *  (non-Java doc)
  322            *  
  323            *  @see gov. va.med.ima ging.datas ource.Data SourceProv ider#creat eDicomData Source(jav a.net.URL,
  324            *       gov. va.med.ima ging.core. interfaces .Localized Site)
  325            * /
  326           pu blic Dicom StorageDat aSourceSpi  createDic omStorageD ataSource(
  327                    Reso lvedArtifa ctSource r esolvedArt ifactSourc e, 
  328                    Stri ng protoco l,
  329                    Data SourceExce ptionHandl er... data SourceExce ptionHandl ers) 
  330           th rows Conne ctionExcep tion
  331           {
  332                    retu rn createV ersionable DataSource (DicomStor ageDataSou rceSpi.cla ss, resolv edArtifact Source, pr otocol, da taSourceEx ceptionHan dlers);
  333           }
  334  
  335           /*
  336            *  (non-Java doc)
  337            *  
  338            *  @see gov. va.med.ima ging.datas ource.Data SourceProv ider#creat eDicomData Source(jav a.net.URL,
  339            *       gov. va.med.ima ging.core. interfaces .Localized Site)
  340            * /
  341           pu blic Dicom ImporterDa taSourceSp i createDi comImporte rDataSourc e(
  342                    Reso lvedArtifa ctSource r esolvedArt ifactSourc e, 
  343                    Stri ng protoco l,
  344                    Data SourceExce ptionHandl er... data SourceExce ptionHandl ers) 
  345           th rows Conne ctionExcep tion
  346           {
  347                    retu rn createV ersionable DataSource (DicomImpo rterDataSo urceSpi.cl ass, resol vedArtifac tSource, p rotocol, d ataSourceE xceptionHa ndlers);
  348           }
  349  
  350           /*
  351            *  (non-Java doc)
  352            *  
  353            *  @see gov. va.med.ima ging.datas ource.Data SourceProv ider#creat eDicomData Source(jav a.net.URL,
  354            *       gov. va.med.ima ging.core. interfaces .Localized Site)
  355            * /
  356           pu blic WorkL istDataSou rceSpi cre ateWorkLis tDataSourc e(
  357                    Reso lvedArtifa ctSource r esolvedArt ifactSourc e, 
  358                    Stri ng protoco l,
  359                    Data SourceExce ptionHandl er... data SourceExce ptionHandl ers) 
  360           th rows Conne ctionExcep tion
  361           {
  362                    retu rn createV ersionable DataSource (WorkListD ataSourceS pi.class,  resolvedAr tifactSour ce, protoc ol, dataSo urceExcept ionHandler s);
  363           }
  364  
  365           /*
  366            *  (non-Java doc)
  367            *  
  368            *  @see gov. va.med.ima ging.datas ource.Data SourceProv ider#creat eDicomData Source(jav a.net.URL,
  369            *       gov. va.med.ima ging.core. interfaces .Localized Site)
  370            * /
  371           pu blic Stora geDataSour ceSpi crea teStorageD ataSource(
  372                    Reso lvedArtifa ctSource r esolvedArt ifactSourc e, 
  373                    Stri ng protoco l,
  374                    Data SourceExce ptionHandl er... data SourceExce ptionHandl ers) 
  375           th rows Conne ctionExcep tion
  376           {
  377                    retu rn createV ersionable DataSource (StorageDa taSourceSp i.class, r esolvedArt ifactSourc e, protoco l, dataSou rceExcepti onHandlers );
  378           }
  379  
  380           /*
  381            *  (non-Java doc)
  382            *  
  383            *  @see gov. va.med.ima ging.datas ource.Data SourceProv ider#creat eDicomData Source(jav a.net.URL,
  384            *       gov. va.med.ima ging.core. interfaces .Localized Site)
  385            * /
  386           pu blic Durab leQueueDat aSourceSpi  createDur ableQueueD ataSource(
  387                    Reso lvedArtifa ctSource r esolvedArt ifactSourc e, 
  388                    Stri ng protoco l,
  389                    Data SourceExce ptionHandl er... data SourceExce ptionHandl ers) 
  390           th rows Conne ctionExcep tion
  391           {
  392                    retu rn createV ersionable DataSource (DurableQu eueDataSou rceSpi.cla ss, resolv edArtifact Source, pr otocol, da taSourceEx ceptionHan dlers);
  393           }
  394  
  395           /*
  396            *  (non-Java doc)
  397            *  
  398            *  @see gov. va.med.ima ging.datas ource.Data SourceProv ider#creat eDicomData Source(jav a.net.URL,
  399            *       gov. va.med.ima ging.core. interfaces .Localized Site)
  400            * /
  401           pu blic Servi ceRegistra tionDataSo urceSpi cr eateServic eRegistrat ionDataSou rce(
  402                    Reso lvedArtifa ctSource r esolvedArt ifactSourc e, 
  403                    Stri ng protoco l,
  404                    Data SourceExce ptionHandl er... data SourceExce ptionHandl ers) 
  405           th rows Conne ctionExcep tion
  406           {
  407                    retu rn createV ersionable DataSource (ServiceRe gistration DataSource Spi.class,  resolvedA rtifactSou rce, proto col, dataS ourceExcep tionHandle rs);
  408           }
  409  
  410           /*
  411            *  (non-Java doc)
  412            *  
  413            *  @see gov. va.med.ima ging.datas ource.Data SourceProv ider#creat eDicomData Source(jav a.net.URL,
  414            *       gov. va.med.ima ging.core. interfaces .Localized Site)
  415            * /
  416           pu blic Veins DataSource Spi create VeinsDataS ource(
  417                    Reso lvedArtifa ctSource r esolvedArt ifactSourc e, 
  418                    Stri ng protoco l,
  419                    Data SourceExce ptionHandl er... data SourceExce ptionHandl ers) 
  420           th rows Conne ctionExcep tion
  421           {
  422                    retu rn createV ersionable DataSource (VeinsData SourceSpi. class, res olvedArtif actSource,  protocol,  dataSourc eException Handlers);
  423           }
  424  
  425           /*
  426            *  (non-Java doc)
  427            *  
  428            *  @see gov. va.med.ima ging.datas ource.Data SourceProv ider#creat eDicomData Source(jav a.net.URL,
  429            *       gov. va.med.ima ging.core. interfaces .Localized Site)
  430            * /
  431           pu blic Vista RadDataSou rceSpi cre ateVistaRa dDataSourc e(
  432                    Reso lvedArtifa ctSource r esolvedArt ifactSourc e, 
  433                    Stri ng protoco l,
  434                    Data SourceExce ptionHandl er... data SourceExce ptionHandl ers) 
  435           th rows Conne ctionExcep tion
  436           {
  437                    retu rn createV ersionable DataSource (VistaRadD ataSourceS pi.class,  resolvedAr tifactSour ce, protoc ol, dataSo urceExcept ionHandler s);
  438           }
  439  
  440           /*
  441            *  (non-Java doc)
  442            *  
  443            *  @see gov. va.med.ima ging.datas ource.Data SourceProv ider#creat eVistaRadI mageDataSo urce(java. net.URL,
  444            *       gov. va.med.ima ging.core. interfaces .Localized Site)
  445            * /
  446           @O verride
  447           pu blic Vista RadImageDa taSourceSp i createVi staRadImag eDataSourc e(
  448                    Reso lvedArtifa ctSource r esolvedArt ifactSourc e, 
  449                    Stri ng protoco l,
  450                    Data SourceExce ptionHandl er... data SourceExce ptionHandl ers) 
  451           th rows Conne ctionExcep tion
  452           {
  453                    retu rn createV ersionable DataSource (VistaRadI mageDataSo urceSpi.cl ass, resol vedArtifac tSource, p rotocol, d ataSourceE xceptionHa ndlers);
  454           }
  455  
  456           /*
  457            *  (non-Java doc)
  458            *  
  459            *  @see gov. va.med.ima ging.datas ource.Data SourceProv ider#creat ePassthrou ghDataSour ce()
  460            * /
  461           @O verride
  462           pu blic Passt hroughData SourceSpi  createPass throughDat aSource(
  463                    Reso lvedArtifa ctSource r esolvedArt ifactSourc e, 
  464                    Stri ng protoco l,
  465                    Data SourceExce ptionHandl er... data SourceExce ptionHandl ers) 
  466           th rows Conne ctionExcep tion
  467           {
  468                    retu rn createV ersionable DataSource (Passthrou ghDataSour ceSpi.clas s, resolve dArtifactS ource, pro tocol, dat aSourceExc eptionHand lers);
  469           }
  470  
  471           /*
  472            *  (non-Java doc)
  473            *  
  474            *  @see gov. va.med.ima ging.datas ource.Data SourceProv ider#creat eUserAuthe nticationD ataSource( java.net.U RL,
  475            *       gov. va.med.ima ging.core. interfaces .Localized Site)
  476            * /
  477           @O verride
  478           pu blic UserA uthenticat ionSpi cre ateUserAut henticatio nDataSourc e(
  479                    Reso lvedArtifa ctSource r esolvedArt ifactSourc e, 
  480                    Stri ng protoco l,
  481                    Data SourceExce ptionHandl er... data SourceExce ptionHandl ers) 
  482           th rows Conne ctionExcep tion
  483           {
  484                    retu rn createV ersionable DataSource (UserAuthe nticationS pi.class,  resolvedAr tifactSour ce, protoc ol, dataSo urceExcept ionHandler s);
  485           }
  486  
  487           /*
  488            *  (non-Java doc)
  489            *  
  490            *  @see gov. va.med.ima ging.datas ource.Data SourceProv ider#creat eExternalP ackageData Source(jav a.net.URL,
  491            *       gov. va.med.ima ging.core. interfaces .Localized Site)
  492            * /
  493           @O verride
  494           pu blic Exter nalPackage DataSource Spi create ExternalPa ckageDataS ource(
  495                    Reso lvedArtifa ctSource r esolvedArt ifactSourc e, 
  496                    Stri ng protoco l,
  497                    Data SourceExce ptionHandl er... data SourceExce ptionHandl ers) 
  498           th rows Conne ctionExcep tion
  499           {
  500                    retu rn createV ersionable DataSource (ExternalP ackageData SourceSpi. class, res olvedArtif actSource,  protocol,  dataSourc eException Handlers);
  501           }
  502  
  503           /*
  504            *  (non-Java doc)
  505            *  
  506            *  @see gov. va.med.ima ging.datas ource.Data SourceProv ider#creat eStudyGrap hDataSourc e(java.net .URL,
  507            *       gov. va.med.ima ging.core. interfaces .Localized Site)
  508            * /
  509           pu blic Trans actionLogg erDataSour ceSpi crea teTransact ionLoggerD ataSource(
  510           th rows Conne ctionExcep tion
  511           {
  512                    retu rn createL ocalDataSo urce(Trans actionLogg erDataSour ceSpi.clas s);
  513           }
  514  
  515           @O verride
  516           pu blic Exter nalSystemO perationsD ataSourceS pi createE xternalSys temOperati onsDataSou rce(
  517                             Resolv edArtifact Source res olvedArtif actSource,  
  518                             String  protocol,
  519                             DataSo urceExcept ionHandler ... dataSo urceExcept ionHandler s)
  520           th rows Conne ctionExcep tion
  521           {
  522                    retu rn createV ersionable DataSource (ExternalS ystemOpera tionsDataS ourceSpi.c lass, reso lvedArtifa ctSource,  protocol,  dataSource ExceptionH andlers);
  523           }
  524  
  525           @O verride
  526           pu blic Patie ntArtifact DataSource Spi create PatientArt ifactDataS ource(
  527                             Resolv edArtifact Source res olvedArtif actSource,  String pr otocol,
  528                             DataSo urceExcept ionHandler ... dataSo urceExcept ionHandler s)
  529           th rows Conne ctionExcep tion
  530           {
  531                    retu rn createV ersionable DataSource (
  532                             Patien tArtifactD ataSourceS pi.class, 
  533                             resolv edArtifact Source, 
  534                             protoc ol, 
  535                             dataSo urceExcept ionHandler s);
  536           }
  537           
  538           /*
  539            *  (non-Java doc)
  540            *  
  541            *  @see gov. va.med.ima ging.datas ource.Data SourceProv ider#creat eDicomData Source(jav a.net.URL,
  542            *       gov. va.med.ima ging.core. interfaces .Localized Site)
  543            * /
  544           pu blic Event LoggingDat aSourceSpi  createEve ntLoggingD ataSource(
  545                    Reso lvedArtifa ctSource r esolvedArt ifactSourc e, 
  546                    Stri ng protoco l,
  547                    Data SourceExce ptionHandl er... data SourceExce ptionHandl ers) 
  548           th rows Conne ctionExcep tion
  549           {
  550                    Even tLoggingDa taSourceSp i dataSour ce = creat eVersionab leDataSour ce(
  551                             EventL oggingData SourceSpi. class, 
  552                             resolv edArtifact Source, 
  553                             protoc ol, 
  554                             dataSo urceExcept ionHandler s);
  555                    
  556                    retu rn dataSou rce;
  557           }
  558           
  559  
  560  
  561           /*  (non-Java doc)
  562            *  @see gov. va.med.ima ging.datas ource.Data SourceProv ider#creat eDicomQuer yRetrieveD ataSource( gov.va.med .imaging.a rtifactsou rce.Resolv edArtifact Source, ja va.lang.St ring, gov. va.med.ima ging.core. interfaces .DataSourc eException Handler[])
  563            * /
  564           @O verride
  565           pu blic Dicom QueryRetri eveDataSou rceSpi cre ateDicomQu eryRetriev eDataSourc e(
  566                    Reso lvedArtifa ctSource r esolvedArt ifactSourc e, String  protocol,
  567                    Data SourceExce ptionHandl er... data SourceExce ptionHandl ers) 
  568           th rows Conne ctionExcep tion
  569           {                 
  570                    retu rn createV ersionable DataSource (
  571                             DicomQ ueryRetrie veDataSour ceSpi.clas s, 
  572                             resolv edArtifact Source, 
  573                             protoc ol, 
  574                             dataSo urceExcept ionHandler s
  575                    );
  576           }
  577  
  578           
  579           @O verride
  580           pu blic Dicom QueryRetri eveDataSou rceSpi cre ateLocalDi comQueryRe trieveData Source(Res olvedArtif actSource  resolvedAr tifactSour ce)
  581           th rows Conne ctionExcep tion 
  582           {
  583                    retu rn createL ocalDataSo urce(Dicom QueryRetri eveDataSou rceSpi.cla ss, resolv edArtifact Source);
  584           }
  585  
  586           @O verride
  587           pu blic Dicom StorageDat aSourceSpi  createLoc alDicomSto rageDataSo urce(
  588                             Resolv edArtifact Source res olvedArtif actSource)
  589           th rows Conne ctionExcep tion 
  590           {
  591                    retu rn createL ocalDataSo urce(Dicom StorageDat aSourceSpi .class, re solvedArti factSource );
  592           }
  593  
  594           @O verride
  595           pu blic Dicom Applicatio nEntityDat aSourceSpi  createLoc alDicomApp licationEn tityDataSo urce(
  596                             Resolv edArtifact Source res olvedArtif actSource)
  597           th rows Conne ctionExcep tion 
  598           {
  599                    retu rn createL ocalDataSo urce(Dicom Applicatio nEntityDat aSourceSpi .class, re solvedArti factSource );
  600           }
  601  
  602           @O verride
  603           pu blic Dicom DataSource Spi create LocalDicom DataSource (
  604                             Resolv edArtifact Source res olvedArtif actSource)
  605           th rows Conne ctionExcep tion 
  606           {
  607                    retu rn createL ocalDataSo urce(Dicom DataSource Spi.class,  resolvedA rtifactSou rce);
  608           }
  609  
  610           @O verride
  611           pu blic Dicom ImporterDa taSourceSp i createLo calDicomIm porterData Source(
  612                             Resolv edArtifact Source res olvedArtif actSource)
  613           th rows Conne ctionExcep tion 
  614           {
  615                    retu rn createL ocalDataSo urce(Dicom ImporterDa taSourceSp i.class, r esolvedArt ifactSourc e);
  616           }
  617  
  618           /*  (non-Java doc)
  619            *  @see gov. va.med.ima ging.datas ource.Data SourceProv ider#creat eDicomQuer yRetrieveD ataSource( gov.va.med .imaging.a rtifactsou rce.Resolv edArtifact Source, ja va.lang.St ring, gov. va.med.ima ging.core. interfaces .DataSourc eException Handler[])
  620            * /
  621           @O verride
  622           pu blic Dicom Applicatio nEntityDat aSourceSpi  createDic omApplicat ionEntityD ataSource(
  623                    Reso lvedArtifa ctSource r esolvedArt ifactSourc e, String  protocol,
  624                    Data SourceExce ptionHandl er... data SourceExce ptionHandl ers) 
  625           th rows Conne ctionExcep tion
  626           {
  627                    retu rn createV ersionable DataSource (
  628                             DicomA pplication EntityData SourceSpi. class, 
  629                             resolv edArtifact Source, 
  630                             protoc ol, 
  631                             dataSo urceExcept ionHandler s
  632                    );
  633           }
  634           
  635           @O verride
  636           pu blic UserD ataSourceS pi createU serDataSou rce(
  637                             Resolv edArtifact Source res olvedArtif actSource,  String pr otocol,
  638                             DataSo urceExcept ionHandler ... dataSo urceExcept ionHandler s)
  639                             throws  Connectio nException
  640           {
  641                    retu rn createV ersionable DataSource (
  642                                      UserData SourceSpi. class, 
  643                                      resolved ArtifactSo urce, 
  644                                      protocol
  645                                      dataSour ceExceptio nHandlers
  646                             );
  647           }
  648  
  649           /* *
  650            *  Create an  instance  of the ver sionable d ata source  of the ty pe specifi ed,
  651            *  capable o f contacti ng the giv en data so urce over  the specif ied protoc ol.
  652            *  
  653            *  @param <S >
  654            *  @param sp iType
  655            *  @return
  656            *  @throws C onnectionE xception
  657            * /
  658           pu blic <S ex tends Vers ionableDat aSourceSpi > S create Versionabl eDataSourc e(
  659                    Clas s<S> spiTy pe,
  660                    Reso lvedArtifa ctSource r esolvedArt ifactSourc e, 
  661                    Stri ng protoco l,
  662                    Data SourceExce ptionHandl er... data SourceExce ptionHandl ers)
  663           th rows Conne ctionExcep tion
  664           {
  665                    Vers ionableSer viceProvid erFactory< S> version ableDataSo urceFactor y = 
  666                             this.p roviderSer viceFactor ies.getOrC reateVersi onableServ iceProvide rFactory(s piType);
  667                    if(v ersionable DataSource Factory ==  null)
  668                             throw  new Connec tionExcept ion("Faile d to creat e a data s ource fact ory produc ing instan ces of '"  + spiType. getSimpleN ame() + "' .");
  669                    S da taSource =  versionab leDataSour ceFactory. createData Source(res olvedArtif actSource,  protocol,  dataSourc eException Handlers);
  670  
  671                    retu rn dataSou rce;
  672           }
  673  
  674           /* *
  675            *  Find a se rvice prov ider of th e given ty pe, over t he given p rotocol an d
  676            *  specific  protocol v ersion. Fo r example:
  677            *  findProvi derService ("Service. StudyGraph DataSource ", "vista" , 1.0f) wi ll
  678            *  return an  Provider. Service in stance
  679            *  
  680            *  @param ty pe -
  681            *              if type  is not a v alid Strin g form of  a DataSour ceServices
  682            *              then a n ull pointe r exceptio n will be  thrown
  683            *  @param pr otocol
  684            *  @param pr otocolVers ion -
  685            *              if the v ersion is  <= 0.0f th e most fir st service
  686            *              implemen tation of  the type a nd protoco l specifie d will be
  687            *              returned . By defau lt this is  the highe st numbere d protocol
  688            *              version.
  689            *  @return
  690            * /
  691           
  692           /* *
  693            *  Return th e service  implementa tion where : 1.) the  service im plemented  is
  694            *  of the sp ecified ty pe 2.) the  service i mplemented  communica tes over t he
  695            *  url's pro tocol 3.)  the protoc ol version  is the mo st recent
  696            *  
  697            *  @param se rviceType
  698            *  @param ur l
  699            *  @return
  700            * /
  701           pu blic Provi derService  findProvi derService WithLatest ProtocolVe rsion(
  702                    Clas s<? extend s DataSour ceSpi> spi Type,
  703                    URL  url)
  704           {
  705                    logg er.info("S earching i nstalled p roviders f or service  [" + spiT ype.getSim pleName()  + ", "
  706                             + url. toExternal Form() + " ]");
  707                    Serv iceLoader< Provider>  loader = g etProvider Loader();
  708                    for  (Provider  provider :  loader)
  709                    {
  710                             logger .info("Sea rching pro vider [" +  provider. getName()  + "]");
  711  
  712                             Provid erService  service =  provider.g etService( spiType, u rl);
  713                             if (se rvice != n ull)
  714                                      return s ervice;
  715                    }
  716                    retu rn null;
  717           }
  718  
  719           /* *
  720            *  Find a se rvice prov ider of th e given ty pe, over t he given p rotocol an d
  721            *  specific  protocol v ersion. Fo r example:
  722            *  findProvi derService (Service.S tudyGraphD ataSource,  "vista",  1.0f) will
  723            *  return an  Provider. Service in stance
  724            *  
  725            *  @param se rviceType
  726            *  @param pr otocol
  727            *  @param pr otocolVers ion
  728            *  @return
  729            * /
  730           pu blic Provi derService  findProvi derService (
  731                    Clas s<? extend s DataSour ceSpi> spi Type, 
  732                    Stri ng protoco l,
  733                    floa t protocol Version)
  734           {
  735                    Serv iceLoader< Provider>  loader = g etProvider Loader();
  736                    for  (Provider  provider :  loader)
  737                    {
  738                             Provid erService  service =  provider.g etService( spiType, p rotocol, p rotocolVer sion);
  739                             if (se rvice != n ull)
  740                                      return s ervice;
  741                    }
  742                    retu rn null;
  743           }
  744  
  745           /* *
  746            *  Return a  sorted set  of all se rvice impl ementation s where: 1 .) the ser vice
  747            *  implement ed is of t he specifi ed type 2. ) the serv ice implem ented
  748            *  communica tes over t he url's p rotocol 3. ) the prot ocol versi on is any
  749            *  value
  750            *  
  751            *  @param se rviceType
  752            *  @param ur l
  753            *  @return
  754            * /
  755           pu blic Sorte dSet<Provi derService > findProv iderServic es(
  756                    Clas s<? extend s DataSour ceSpi> spi Type, 
  757                    Stri ng protoco l)
  758           {
  759                    if ( spiType ==  null)
  760                             return  null;
  761  
  762                    logg er.info("S earching i nstalled p roviders f or service s [" + spi Type.getSi mpleName()  + ", "
  763                             + prot ocol + "]" );
  764  
  765                    // w ill contai n the list  of all ap plicable s ervice imp lementatio ns
  766                    Sort edSet<Prov iderServic e> applica bleService s = new Tr eeSet<Prov iderServic e>();
  767  
  768                    // f or each kn own provid er, see if  it implem ents a ser vice of th e
  769                    // r equested t ype
  770                    Serv iceLoader< Provider>  loader = g etProvider Loader();
  771                    for  (Provider  provider :  loader)
  772                    {
  773                             logger .debug("Se arching pr ovider ["  + provider .getName()  + 
  774                                      "] for s ervice typ e [" + spi Type.getSi mpleName()  + ", "
  775                                      + protoc ol +"].");
  776  
  777                             Sorted Set<Provid erService>  providerS ervices =  provider.g etServices (spiType,  protocol);
  778                             if (pr oviderServ ices != nu ll)
  779                                      applicab leServices .addAll(pr oviderServ ices);
  780                    }
  781                    retu rn applica bleService s.size() >  0 ? appli cableServi ces : null ;
  782           }
  783  
  784           /* *
  785            *  
  786            *  @param se rviceType
  787            *  @return
  788            * /
  789           pu blic Sorte dSet<Provi derService > findProv iderLocalS ervices(Cl ass<? exte nds DataSo urceSpi> s piType)
  790           {
  791                    if ( spiType ==  null)
  792                             return  null;
  793  
  794                    logg er.info("S earching i nstalled p roviders f or service s [" + spi Type.getSi mpleName()  + "]");
  795  
  796                    // w ill contai n the list  of all ap plicable s ervice imp lementatio ns
  797                    Sort edSet<Prov iderServic e> applica bleService s = new Tr eeSet<Prov iderServic e>();
  798  
  799                    // f or each kn own provid er, see if  it implem ents a ser vice of th e
  800                    // r equested t ype
  801                    Serv iceLoader< Provider>  loader = g etProvider Loader();
  802                    for  (Provider  provider :  loader)
  803                    {
  804                             logger .info("Sea rching pro vider [" +  provider. getName()  + "] for L OCAL servi ces of typ e "
  805                                      + spiTyp e.getSimpl eName() +  ".");
  806  
  807                             Sorted Set<Provid erService>  providerS ervices =  provider.g etLocalSer vices(spiT ype);
  808                             if (pr oviderServ ices != nu ll)
  809                             {
  810                                      logger.i nfo("Provi der [" + p rovider.ge tName() +  "] impleme nts " + pr oviderServ ices.size( )
  811                                               + " LOCAL  services o f type " +  spiType.g etSimpleNa me() + "." );
  812                                      applicab leServices .addAll(pr oviderServ ices);
  813                                      logger.i nfo("There  are now "  + applica bleService s.size()
  814                                               + " cumula tive imple mentions o f LOCAL se rvices typ e " + spiT ype.getSim pleName()  + ".");
  815                             }
  816                             else
  817                                      logger.i nfo("Provi der [" + p rovider.ge tName() +  "] impleme nts no LOC AL service s of type  "
  818                                               + spiType. getSimpleN ame() + ". ");
  819                    }
  820                    retu rn applica bleService s;
  821           }
  822  
  823           //  ========= ========== ========== ========== ========== ========== ========== ========== ========== ==
  824           //  Instance  Fields and  Methods
  825           //  ========= ========== ========== ========== ========== ========== ========== ========== ========== ==
  826           pr ivate fina l String n ame;
  827           pr ivate fina l double v ersion;
  828           pr ivate fina l String i nfo;
  829  
  830           /* *
  831            *  Create a  Provider u sing the c urrent cla ss loader  to load se rvices.
  832            * /
  833           pu blic Provi der()
  834           {
  835                    this ( "Core Ab stract Pro vider", 1. 0, "The ab stract Dat aSourcePro vider impl ementation .  Provide s access t o the real ized provi ders." );
  836           }
  837  
  838           /* *
  839            *  Sets the  service cl ass loader , which de fines wher e the serv ice provid ers will b e
  840            *  loaded fr om.
  841            *  
  842            *  @param se rviceClass Loader
  843            * /
  844           pu blic Provi der(ClassL oader serv iceClassLo ader)
  845           {
  846                    this ( "Core Ab stract Pro vider", 1. 0, "The ab stract Dat aSourcePro vider impl ementation .  Provide s access t o the real ized provi ders." );
  847                    this .setProvid erClassLoa der(servic eClassLoad er);
  848           }
  849           
  850           /* *
  851            *  
  852            *  @param na me
  853            *  @param ve rsion
  854            *  @param in fo
  855            * /
  856           pr otected Pr ovider(Str ing name,  double ver sion, Stri ng info)
  857           {
  858                    this .name = na me;
  859                    this .version =  version;
  860                    this .info = in fo;
  861           }
  862  
  863           pu blic Strin g getName( )
  864           {
  865                    retu rn name;
  866           }
  867  
  868           pu blic doubl e getVersi on()
  869           {
  870                    retu rn version ;
  871           }
  872  
  873           pu blic Strin g getInfo( )
  874           {
  875                    retu rn info;
  876           }
  877  
  878           //  ========= ========== ========== ========== ========== ========== ========== ==========
  879           //  Provider  Service
  880           //  ========= ========== ========== ========== ========== ========== ========== ==========
  881  
  882           /* *
  883            *  Return th e first im plementati on of a Da taSourceSe rvices ove r the prot ocol
  884            *  specified  by the UR L that a P rovider pr ovides. Th e Provider  derivatio n
  885            *  should or der the se rvice impl ementation s from new est to old est versio n.
  886            *  
  887            *  @see #get Service(Da taSourceSe rvices, St ring, floa t)
  888            *  
  889            *  @param ty pe
  890            *  @param ur l
  891            *  @return
  892            * /
  893           pu blic Provi derService  getServic e(Class<?  extends Da taSourceSp i> spiType , URL url)
  894           {
  895                    if ( spiType ==  null || u rl == null )
  896                             return  null;
  897  
  898                    Stri ng request edProtocol  = url.get Protocol() ;
  899  
  900                    retu rn getServ ice(spiTyp e, request edProtocol , -1.0f);
  901           }
  902  
  903           /* *
  904            *  Return a  SortedSet  of all ser vices impl emented by  this prov ider of th e
  905            *  specified  type and  communicat ing over t he given u rl's proto col.
  906            *  
  907            *  @param da taSourceSe rviceType
  908            *  @param re questedPro tocol
  909            *  @return a  list of a pplicable  service im plementati ons, an em pty list i f no
  910            *          a pplicable  services a re found,  null if ei ther
  911            *          d ataSourceS erviceType  or reques tedProtoco l are null
  912            * /
  913           pu blic Sorte dSet<Provi derService > getServi ces(
  914                    Clas s<? extend s DataSour ceSpi> spi Type, 
  915                    Stri ng request edProtocol )
  916           {
  917                    Sort edSet<Prov iderServic e> applica bleService s = new Tr eeSet<Prov iderServic e>();
  918  
  919                    if ( spiType ==  null || r equestedPr otocol ==  null)
  920                             return  null;
  921  
  922                    Sort edSet<Prov iderServic e> provide rServices  = getServi ces();
  923                    if ( providerSe rvices ==  null) // i f no servi ces are de fined by t he
  924                                                                                           // Provide r then log  a warning
  925                             logger .warn("Pro vider '" +  this.getN ame() + ". " + this.g etVersion( )
  926                                      + " defi nes no ser vices, thi s is proba bly not in tentional. ");
  927                    else
  928                             for (P roviderSer vice servi ce : provi derService s)
  929                                      if (spiT ype.equals (service.g etSpiType( )) && requ estedProto col.equals (service.g etProtocol ()))
  930                                               applicable Services.a dd(service );
  931  
  932                    retu rn applica bleService s;
  933           }
  934  
  935           /* *
  936            *  Return a  SortedSet  of all ser vices impl emented by  this prov ider of th e
  937            *  specified  type with  NO (null)  protocol.
  938            *  
  939            *  @param da taSourceSe rviceType
  940            *  @return
  941            * /
  942           pu blic Sorte dSet<Provi derService > getLocal Services(C lass<? ext ends DataS ourceSpi>  spiType)
  943           {
  944                    Sort edSet<Prov iderServic e> applica bleService s = new Tr eeSet<Prov iderServic e>();
  945  
  946                    if ( spiType ==  null)
  947                             return  null;
  948  
  949                    Sort edSet<Prov iderServic e> provide rServices  = getServi ces();
  950                    
  951                     //  if no serv ices are d efined by  the Provid er then lo g a warnin g
  952                    if ( providerSe rvices ==  null || pr oviderServ ices.size( ) == 0)
  953                             logger .warn("Pro vider '" +  this.getN ame() + ". " + this.g etVersion( ) + " defi nes no ser vices, thi s is proba bly not in tentional. ");
  954                    else
  955                             for (P roviderSer vice servi ce : provi derService s)
  956                                      if (spiT ype.equals (service.g etSpiType( )) && serv ice.getPro tocol() ==  null
  957                                               && service .getProtoc olVersion( ) == 0.0f)
  958                                               applicable Services.a dd(service );
  959  
  960                    retu rn applica bleService s;
  961           }
  962  
  963           /* *
  964            *  Return an  instance  of Provide r.Service  describing  a service
  965            *  implement ation appl icable to  the type,  protocol a nd version . Type and
  966            *  protocol  must not b e null. If  protocolV ersion is  <= 0.0 the n the firs t
  967            *  service i mplementat ion implem enting the  type and  protocol w ill be
  968            *  returned.  The servi ce Provide r implemen tations sh ould rely  on the nat ural
  969            *  ordering  of Provide r.Service.
  970            *  
  971            *  @param ty pe
  972            *  @param ur l
  973            *  @param pr otocolVers ion
  974            *  @return
  975            * /
  976           pu blic Provi derService  getServic e(Class<?  extends Da taSourceSp i> spiType , String r equestedPr otocol, fl oat protoc olVersion)
  977           {
  978                    if ( spiType ==  null || r equestedPr otocol ==  null)
  979                             return  null;
  980  
  981                    for  (ProviderS ervice ser vice : get Services() )
  982                    {
  983                             if (sp iType.equa ls(service .getSpiTyp e()) && re questedPro tocol.equa ls(service .getProtoc ol())
  984                                      && proto colVersion  <= 0.0f | | protocol Version ==  service.g etProtocol Version())
  985                                      return s ervice;
  986                    }
  987  
  988                    retu rn null;
  989           }
  990  
  991           /* *
  992            *  A "local"  service i s one that  does NOT  require co mmunicatio n and
  993            *  therefore  must NOT  specify a  protocol o r a protoc olVersion  (other tha n
  994            *  0.0F). No rmal servi ces, those  that retr ieve data  from a rem ote box, w ill
  995            *  not be fo und using  this metho d.
  996            *  
  997            *  @param se rviceType
  998            *  @return
  999            * /
  1000           pu blic Provi derService  getLocalS ervice(Cla ss<? exten ds DataSou rceSpi> sp iType)
  1001           {
  1002                    if ( spiType ==  null)
  1003                             return  null;
  1004  
  1005                    for  (ProviderS ervice ser vice : get Services() )
  1006                    {
  1007                             if (sp iType.equa ls(service .getSpiTyp e()) && se rvice.getP rotocol()  == null
  1008                                      && servi ce.getProt ocolVersio n() == 0.0 F)
  1009                                      return s ervice;
  1010                    }
  1011  
  1012                    retu rn null;
  1013           }
  1014  
  1015           /* *
  1016            *  Get an un modifiable  Set of al l services  supported  by this P rovider. T he
  1017            *  service P rovider im plementati ons should  rely on t he natural  ordering  of
  1018            *  Provider. Service.
  1019            *  
  1020            *  This (the  base Prov ider) does  not provi de any SPI  implement ations.
  1021            *  
  1022            *  @return
  1023            * /
  1024           pu blic Sorte dSet<Provi derService > getServi ces()
  1025           {
  1026                    retu rn (Sorted Set<Provid erService> ) null;
  1027           }
  1028  
  1029           /* *
  1030            *  Gets a Se t of all o f the SPI  classes th at are cur rently ins talled,
  1031            *  
  1032            *  @return
  1033            * /
  1034           @S uppressWar nings("unc hecked")
  1035           pu blic final  Set<Class <? extends  DataSourc eSpi>> get AllInstall edSpiTypes ()
  1036           {
  1037                    Set< Class<? ex tends Data SourceSpi> > spiTypes  = new Has hSet<Class <? extends  DataSourc eSpi>>(); 
  1038                    Sort edSet<Prov iderServic e> service s = getAll InstalledS ervices(nu ll);
  1039                    
  1040                    Clas s<? extend s DataSour ceSpi> las tSpiType =  null;
  1041                    for( ProviderSe rvice serv ice : serv ices)
  1042                             if( la stSpiType  == null ||  !lastSpiT ype.equals (service.g etSpiType( )) )
  1043                             {
  1044                                      lastSpiT ype = (Cla ss<? exten ds DataSou rceSpi>)se rvice.getS piType();
  1045                                      spiTypes .add(lastS piType);
  1046                             }
  1047                    
  1048                    retu rn spiType s;
  1049           }
  1050           
  1051           /* *
  1052            *  Get an un modifiable  Set of al l services  supported  by all in stalled Pr ovider.
  1053            *  
  1054            *  @return
  1055            * /
  1056           pu blic final  SortedSet <ProviderS ervice> ge tAllInstal ledService s()
  1057           {
  1058                    retu rn getAllI nstalledSe rvices(nul l);
  1059           }
  1060           
  1061           /* *
  1062            *  @param ds s
  1063            *  @return
  1064            * /
  1065           pu blic final  SortedSet <ProviderS ervice> ge tAllInstal ledService s(Class<?  extends Da taSourceSp i> spiType )
  1066           {
  1067                    // w ill contai n the list  of all ap plicable s ervice imp lementatio ns
  1068                    Sort edSet<Prov iderServic e> service s = new Tr eeSet<Prov iderServic e>();
  1069  
  1070                    // f or each kn own provid er, see if  it implem ents a ser vice of th e
  1071                    // r equested t ype
  1072                    Serv iceLoader< Provider>  loader = g etProvider Loader();
  1073                    for  (Provider  provider :  loader)
  1074                    {
  1075                             Sorted Set<Provid erService>  providerS ervices =  provider.g etServices ();
  1076                             if (pr oviderServ ices != nu ll)
  1077                                      for(Prov iderServic e provider Service :  providerSe rvices)
  1078                                               // if the  requested  type is nu ll, return  all
  1079                                               if(spiType  == null | | spiType. equals(pro viderServi ce.getSpiT ype()))
  1080                                                       se rvices.add (providerS ervice);
  1081                    }
  1082                    
  1083                    retu rn service s.size() >  0 ? Colle ctions.unm odifiableS ortedSet(s ervices) :  null;
  1084           }
  1085  
  1086           pr ivate Prov iderConfig uration<Se rializable > provider Configurat ion = null ;
  1087           
  1088           pr ivate sync hronized P roviderCon figuration <Serializa ble> getPr oviderConf iguration( )
  1089           {
  1090                    if(p roviderCon figuration  == null)
  1091                             provid erConfigur ation = ne w Provider Configurat ion<Serial izable>(ge tName(), g etVersion( ));
  1092                    
  1093                    retu rn provide rConfigura tion;
  1094           }
  1095           
  1096           pr otected Se rializable  loadConfi guration()
  1097           {
  1098                    try
  1099                    {
  1100                             return  getProvid erConfigur ation().lo adConfigur ation();
  1101                    }
  1102                    catc h (IOExcep tion x)
  1103                    {
  1104                             logger .error(x);
  1105                             return  null;
  1106                    }
  1107           }
  1108  
  1109           pr otected vo id storeCo nfiguratio n(Serializ able confi guration)
  1110           {
  1111                    try
  1112                    {
  1113                             getPro viderConfi guration() .store(con figuration );
  1114                    }
  1115                    catc h (IOExcep tion x)
  1116                    {
  1117                             logger .error(x);
  1118                    }
  1119           }
  1120           
  1121           /* *
  1122            *  No config uration fo r this def ault imple mentation 
  1123            * /
  1124           pu blic void  storeConfi guration()
  1125           {
  1126                    Seri alizable c onfig = ge tInstanceC onfigurati on();
  1127                    if(c onfig != n ull)
  1128                             storeC onfigurati on(config) ;              
  1129                    
  1130                    retu rn;
  1131           }
  1132           
  1133           pr otected Se rializable  getInstan ceConfigur ation()
  1134           {
  1135                    retu rn null;
  1136           }
  1137           
  1138           pr otected St ring getCo nfiguratio nFileName( ){return g etProvider Configurat ion().getC onfigurati onFileName ();}
  1139  
  1140           /*  (non-Java doc)
  1141            *  @see java .util.Hash table#toSt ring()
  1142            * /
  1143           @O verride
  1144           pu blic synch ronized St ring toStr ing()
  1145           {
  1146                    retu rn this.ge tInfo();
  1147           }
  1148  
  1149           /*  (non-Java doc)
  1150            *  @see gov. va.med.ima ging.datas ource.Data SourceProv ider#getIn stalledPro viderDescr iptions()
  1151            * /
  1152           @O verride
  1153           pu blic Strin g[] getIns talledProv iderDescri ptions()
  1154           {
  1155                    // f or each kn own provid er, see if  it implem ents a ser vice of th e
  1156                    // r equested t ype
  1157                    Serv iceLoader< Provider>  loader = g etProvider Loader();
  1158                    Set< Provider>  providers  = new Hash Set<Provid er>();
  1159                    
  1160                    for  (Provider  provider :  loader)
  1161                             provid ers.add(pr ovider);
  1162  
  1163                    Stri ng[] resul t = new St ring[provi ders.size( )];
  1164                    int  index = 0;
  1165                    for  (Provider  provider :  providers )
  1166                             result [index++]  = provider .getInfo() ;
  1167                    
  1168                    retu rn result;
  1169           }
  1170  
  1171           /* *
  1172            *  @see gov. va.med.ima ging.datas ource.Data SourceProv ider#getIn stalledSer viceProvid erDescript ions()
  1173            * /
  1174           @O verride
  1175           pu blic Strin g[] getIns talledServ iceImpleme ntationDes criptions( )
  1176           {
  1177                    Sort edSet<Prov iderServic e> install edServices  = getAllI nstalledSe rvices();
  1178                    Stri ng[] resul t = new St ring[insta lledServic es.size()] ;
  1179                    int  index=0;
  1180                    for(  ProviderS ervice ser ver : inst alledServi ces )
  1181                             result [index++]  = server.t oString();
  1182                    
  1183                    retu rn result;
  1184           }
  1185           
  1186           /* *
  1187            *  @see gov. va.med.ima ging.datas ource.Data SourceProv ider#getIn stalledSer viceDescri ptions()
  1188            * /
  1189           @O verride
  1190           pu blic Strin g[] getIns talledServ iceDescrip tions()
  1191           {
  1192                    Set< Class<? ex tends Data SourceSpi> > installe dSpiTypes  = getAllIn stalledSpi Types();
  1193                    Stri ng[] resul t;
  1194                    if(i nstalledSp iTypes !=  null)
  1195                    {
  1196                             result  = new Str ing[instal ledSpiType s.size()];
  1197                             int in dex=0;
  1198                             for( C lass<? ext ends DataS ourceSpi>  spiClass :  installed SpiTypes )
  1199                             {
  1200                                      SPI spiA nnotation  = spiClass .getAnnota tion(SPI.c lass);
  1201                                      result[i ndex++] =  spiClass.g etName() +  (spiAnnot ation != n ull ? spiA nnotation. descriptio n() : "");
  1202                             }
  1203                    }
  1204                    else
  1205                             result  = new Str ing[0];
  1206                    
  1207                    retu rn result;
  1208           }
  1209   }