759. EPMO Open Source Coordination Office Redaction File Detail Report

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

759.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\DataSourceServiceProvider\main\src\java\gov\va\med\imaging\datasource Provider.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\DataSourceServiceProvider\main\src\java\gov\va\med\imaging\datasource Provider.java Wed Oct 17 18:47:33 2018 UTC

759.2 Comparison summary

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

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

759.4 Active regular expressions

No regular expressions were active.

759.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   PI I
  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           @O verride
  675           pu blic Dicom ServicesDa taSourceSp i createDi comService sDataSourc e(
  676                             Resolv edArtifact Source res olvedArtif actSource,
  677                             String  protocol,  
  678                             DataSo urceExcept ionHandler ... dataSo urceExcept ionHandler s) 
  679                                               throws Con nectionExc eption {
  680                    retu rn createV ersionable DataSource (DicomServ icesDataSo urceSpi.cl ass, resol vedArtifac tSource, p rotocol, d ataSourceE xceptionHa ndlers);
  681           }
  682  
  683           @O verride
  684           pu blic Viewe rServicesD ataSourceS pi createV iewerServi cesDataSou rce(
  685                             Resolv edArtifact Source res olvedArtif actSource,
  686                             String  protocol,  
  687                             DataSo urceExcept ionHandler ... dataSo urceExcept ionHandler s) 
  688                                               throws Con nectionExc eption {
  689                    retu rn createV ersionable DataSource (ViewerSer vicesDataS ourceSpi.c lass, reso lvedArtifa ctSource,  protocol,  dataSource ExceptionH andlers);
  690           }
  691  
  692  
  693           /* *
  694            *  Find a se rvice prov ider of th e given ty pe, over t he given p rotocol an d
  695            *  specific  protocol v ersion. Fo r example:
  696            *  findProvi derService ("Service. StudyGraph DataSource ", "vista" , 1.0f) wi ll
  697            *  return an  Provider. Service in stance
  698            *  
  699            *  @param ty pe -
  700            *              if type  is not a v alid Strin g form of  a DataSour ceServices
  701            *              then a n ull pointe r exceptio n will be  thrown
  702            *  @param pr otocol
  703            *  @param pr otocolVers ion -
  704            *              if the v ersion is  <= 0.0f th e most fir st service
  705            *              implemen tation of  the type a nd protoco l specifie d will be
  706            *              returned . By defau lt this is  the highe st numbere d protocol
  707            *              version.
  708            *  @return
  709            * /
  710           
  711           /* *
  712            *  Return th e service  implementa tion where : 1.) the  service im plemented  is
  713            *  of the sp ecified ty pe 2.) the  service i mplemented  communica tes over t he
  714            *  url's pro tocol 3.)  the protoc ol version  is the mo st recent
  715            *  
  716            *  @param se rviceType
  717            *  @param ur l
  718            *  @return
  719            * /
  720           pu blic Provi derService  findProvi derService WithLatest ProtocolVe rsion(
  721                    Clas s<? extend s DataSour ceSpi> spi Type,
  722                    URL  url)
  723           {
  724                    logg er.info("S earching i nstalled p roviders f or service  [" + spiT ype.getSim pleName()  + ", "
  725                             + url. toExternal Form() + " ]");
  726                    Serv iceLoader< Provider>  loader = g etProvider Loader();
  727                    for  (Provider  provider :  loader)
  728                    {
  729                             logger .info("Sea rching pro vider [" +  provider. getName()  + "]");
  730  
  731                             Provid erService  service =  provider.g etService( spiType, u rl);
  732                             if (se rvice != n ull)
  733                                      return s ervice;
  734                    }
  735                    retu rn null;
  736           }
  737  
  738           /* *
  739            *  Find a se rvice prov ider of th e given ty pe, over t he given p rotocol an d
  740            *  specific  protocol v ersion. Fo r example:
  741            *  findProvi derService (Service.S tudyGraphD ataSource,  "vista",  1.0f) will
  742            *  return an  Provider. Service in stance
  743            *  
  744            *  @param se rviceType
  745            *  @param pr otocol
  746            *  @param pr otocolVers ion
  747            *  @return
  748            * /
  749           pu blic Provi derService  findProvi derService (
  750                    Clas s<? extend s DataSour ceSpi> spi Type, 
  751                    Stri ng protoco l,
  752                    floa t protocol Version)
  753           {
  754                    Serv iceLoader< Provider>  loader = g etProvider Loader();
  755                    for  (Provider  provider :  loader)
  756                    {
  757                             Provid erService  service =  provider.g etService( spiType, p rotocol, p rotocolVer sion);
  758                             if (se rvice != n ull)
  759                                      return s ervice;
  760                    }
  761                    retu rn null;
  762           }
  763  
  764           /* *
  765            *  Return a  sorted set  of all se rvice impl ementation s where: 1 .) the ser vice
  766            *  implement ed is of t he specifi ed type 2. ) the serv ice implem ented
  767            *  communica tes over t he url's p rotocol 3. ) the prot ocol versi on is any
  768            *  value
  769            *  
  770            *  @param se rviceType
  771            *  @param ur l
  772            *  @return
  773            * /
  774           pu blic Sorte dSet<Provi derService > findProv iderServic es(
  775                    Clas s<? extend s DataSour ceSpi> spi Type, 
  776                    Stri ng protoco l)
  777           {
  778                    if ( spiType ==  null)
  779                             return  null;
  780  
  781                    logg er.info("S earching i nstalled p roviders f or service s [" + spi Type.getSi mpleName()  + ", "
  782                             + prot ocol + "]" );
  783  
  784                    // w ill contai n the list  of all ap plicable s ervice imp lementatio ns
  785                    Sort edSet<Prov iderServic e> applica bleService s = new Tr eeSet<Prov iderServic e>();
  786  
  787                    // f or each kn own provid er, see if  it implem ents a ser vice of th e
  788                    // r equested t ype
  789                    Serv iceLoader< Provider>  loader = g etProvider Loader();
  790                    for  (Provider  provider :  loader)
  791                    {
  792                             logger .trace("Se arching pr ovider ["  + provider .getName()  + 
  793                                      "] for s ervice typ e [" + spi Type.getSi mpleName()  + ", "
  794                                      + protoc ol +"].");
  795  
  796                             Sorted Set<Provid erService>  providerS ervices =  provider.g etServices (spiType,  protocol);
  797                             if (pr oviderServ ices != nu ll)
  798                                      applicab leServices .addAll(pr oviderServ ices);
  799                    }
  800                    retu rn applica bleService s.size() >  0 ? appli cableServi ces : null ;
  801           }
  802  
  803           /* *
  804            *  
  805            *  @param se rviceType
  806            *  @return
  807            * /
  808           pu blic Sorte dSet<Provi derService > findProv iderLocalS ervices(Cl ass<? exte nds DataSo urceSpi> s piType)
  809           {
  810                    if ( spiType ==  null)
  811                             return  null;
  812  
  813                    logg er.info("S earching i nstalled p roviders f or service s [" + spi Type.getSi mpleName()  + "]");
  814  
  815                    // w ill contai n the list  of all ap plicable s ervice imp lementatio ns
  816                    Sort edSet<Prov iderServic e> applica bleService s = new Tr eeSet<Prov iderServic e>();
  817  
  818                    // f or each kn own provid er, see if  it implem ents a ser vice of th e
  819                    // r equested t ype
  820                    Serv iceLoader< Provider>  loader = g etProvider Loader();
  821                    for  (Provider  provider :  loader)
  822                    {
  823                             logger .info("Sea rching pro vider [" +  provider. getName()  + "] for L OCAL servi ces of typ e "
  824                                      + spiTyp e.getSimpl eName() +  ".");
  825  
  826                             Sorted Set<Provid erService>  providerS ervices =  provider.g etLocalSer vices(spiT ype);
  827                             if (pr oviderServ ices != nu ll)
  828                             {
  829                                      logger.i nfo("Provi der [" + p rovider.ge tName() +  "] impleme nts " + pr oviderServ ices.size( )
  830                                               + " LOCAL  services o f type " +  spiType.g etSimpleNa me() + "." );
  831                                      applicab leServices .addAll(pr oviderServ ices);
  832                                      logger.i nfo("There  are now "  + applica bleService s.size()
  833                                               + " cumula tive imple mentions o f LOCAL se rvices typ e " + spiT ype.getSim pleName()  + ".");
  834                             }
  835                             else
  836                                      logger.i nfo("Provi der [" + p rovider.ge tName() +  "] impleme nts no LOC AL service s of type  "
  837                                               + spiType. getSimpleN ame() + ". ");
  838                    }
  839                    retu rn applica bleService s;
  840           }
  841  
  842           //  ========= ========== ========== ========== ========== ========== ========== ========== ========== ==
  843           //  Instance  Fields and  Methods
  844           //  ========= ========== ========== ========== ========== ========== ========== ========== ========== ==
  845           pr ivate fina l String n ame;
  846           pr ivate fina l double v ersion;
  847           pr ivate fina l String i nfo;
  848  
  849           /* *
  850            *  Create a  Provider u sing the c urrent cla ss loader  to load se rvices.
  851            * /
  852           pu blic Provi der()
  853           {
  854                    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." );
  855           }
  856  
  857           /* *
  858            *  Sets the  service cl ass loader , which de fines wher e the serv ice provid ers will b e
  859            *  loaded fr om.
  860            *  
  861            *  @param se rviceClass Loader
  862            * /
  863           pu blic Provi der(ClassL oader serv iceClassLo ader)
  864           {
  865                    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." );
  866                    this .setProvid erClassLoa der(servic eClassLoad er);
  867           }
  868           
  869           /* *
  870            *  
  871            *  @param na me
  872            *  @param ve rsion
  873            *  @param in fo
  874            * /
  875           pr otected Pr ovider(Str ing name,  double ver sion, Stri ng info)
  876           {
  877                    this .name = na me;
  878                    this .version =  version;
  879                    this .info = in fo;
  880           }
  881  
  882           pu blic Strin g getName( )
  883           {
  884                    retu rn name;
  885           }
  886  
  887           pu blic doubl e getVersi on()
  888           {
  889                    retu rn version ;
  890           }
  891  
  892           pu blic Strin g getInfo( )
  893           {
  894                    retu rn info;
  895           }
  896  
  897           //  ========= ========== ========== ========== ========== ========== ========== ==========
  898           //  Provider  Service
  899           //  ========= ========== ========== ========== ========== ========== ========== ==========
  900  
  901           /* *
  902            *  Return th e first im plementati on of a Da taSourceSe rvices ove r the prot ocol
  903            *  specified  by the UR L that a P rovider pr ovides. Th e Provider  derivatio n
  904            *  should or der the se rvice impl ementation s from new est to old est versio n.
  905            *  
  906            *  @see #get Service(Da taSourceSe rvices, St ring, floa t)
  907            *  
  908            *  @param ty pe
  909            *  @param ur l
  910            *  @return
  911            * /
  912           pu blic Provi derService  getServic e(Class<?  extends Da taSourceSp i> spiType , URL url)
  913           {
  914                    if ( spiType ==  null || u rl == null )
  915                             return  null;
  916  
  917                    Stri ng request edProtocol  = url.get Protocol() ;
  918  
  919                    retu rn getServ ice(spiTyp e, request edProtocol , -1.0f);
  920           }
  921  
  922           /* *
  923            *  Return a  SortedSet  of all ser vices impl emented by  this prov ider of th e
  924            *  specified  type and  communicat ing over t he given u rl's proto col.
  925            *  
  926            *  @param da taSourceSe rviceType
  927            *  @param re questedPro tocol
  928            *  @return a  list of a pplicable  service im plementati ons, an em pty list i f no
  929            *          a pplicable  services a re found,  null if ei ther
  930            *          d ataSourceS erviceType  or reques tedProtoco l are null
  931            * /
  932           pu blic Sorte dSet<Provi derService > getServi ces(
  933                    Clas s<? extend s DataSour ceSpi> spi Type, 
  934                    Stri ng request edProtocol )
  935           {
  936                    Sort edSet<Prov iderServic e> applica bleService s = new Tr eeSet<Prov iderServic e>();
  937  
  938                    if ( spiType ==  null || r equestedPr otocol ==  null)
  939                             return  null;
  940  
  941                    Sort edSet<Prov iderServic e> provide rServices  = getServi ces();
  942                    if ( providerSe rvices ==  null) // i f no servi ces are de fined by t he
  943                                                                                           // Provide r then log  a warning
  944                             logger .warn("Pro vider '" +  this.getN ame() + ". " + this.g etVersion( )
  945                                      + " defi nes no ser vices, thi s is proba bly not in tentional. ");
  946                    else
  947                             for (P roviderSer vice servi ce : provi derService s)
  948                                      if (spiT ype.equals (service.g etSpiType( )) && requ estedProto col.equals (service.g etProtocol ()))
  949                                               applicable Services.a dd(service );
  950  
  951                    retu rn applica bleService s;
  952           }
  953  
  954           /* *
  955            *  Return a  SortedSet  of all ser vices impl emented by  this prov ider of th e
  956            *  specified  type with  NO (null)  protocol.
  957            *  
  958            *  @param da taSourceSe rviceType
  959            *  @return
  960            * /
  961           pu blic Sorte dSet<Provi derService > getLocal Services(C lass<? ext ends DataS ourceSpi>  spiType)
  962           {
  963                    Sort edSet<Prov iderServic e> applica bleService s = new Tr eeSet<Prov iderServic e>();
  964  
  965                    if ( spiType ==  null)
  966                             return  null;
  967  
  968                    Sort edSet<Prov iderServic e> provide rServices  = getServi ces();
  969                    
  970                     //  if no serv ices are d efined by  the Provid er then lo g a warnin g
  971                    if ( providerSe rvices ==  null || pr oviderServ ices.size( ) == 0)
  972                             logger .warn("Pro vider '" +  this.getN ame() + ". " + this.g etVersion( ) + " defi nes no ser vices, thi s is proba bly not in tentional. ");
  973                    else
  974                             for (P roviderSer vice servi ce : provi derService s)
  975                                      if (spiT ype.equals (service.g etSpiType( )) && serv ice.getPro tocol() ==  null
  976                                               && service .getProtoc olVersion( ) == 0.0f)
  977                                               applicable Services.a dd(service );
  978  
  979                    retu rn applica bleService s;
  980           }
  981  
  982           /* *
  983            *  Return an  instance  of Provide r.Service  describing  a service
  984            *  implement ation appl icable to  the type,  protocol a nd version . Type and
  985            *  protocol  must not b e null. If  protocolV ersion is  <= 0.0 the n the firs t
  986            *  service i mplementat ion implem enting the  type and  protocol w ill be
  987            *  returned.  The servi ce Provide r implemen tations sh ould rely  on the nat ural
  988            *  ordering  of Provide r.Service.
  989            *  
  990            *  @param ty pe
  991            *  @param ur l
  992            *  @param pr otocolVers ion
  993            *  @return
  994            * /
  995           pu blic Provi derService  getServic e(Class<?  extends Da taSourceSp i> spiType , String r equestedPr otocol, fl oat protoc olVersion)
  996           {
  997                    if ( spiType ==  null || r equestedPr otocol ==  null)
  998                             return  null;
  999  
  1000                    for  (ProviderS ervice ser vice : get Services() )
  1001                    {
  1002                             if (sp iType.equa ls(service .getSpiTyp e()) && re questedPro tocol.equa ls(service .getProtoc ol())
  1003                                      && proto colVersion  <= 0.0f | | protocol Version ==  service.g etProtocol Version())
  1004                                      return s ervice;
  1005                    }
  1006  
  1007                    retu rn null;
  1008           }
  1009  
  1010           /* *
  1011            *  A "local"  service i s one that  does NOT  require co mmunicatio n and
  1012            *  therefore  must NOT  specify a  protocol o r a protoc olVersion  (other tha n
  1013            *  0.0F). No rmal servi ces, those  that retr ieve data  from a rem ote box, w ill
  1014            *  not be fo und using  this metho d.
  1015            *  
  1016            *  @param se rviceType
  1017            *  @return
  1018            * /
  1019           pu blic Provi derService  getLocalS ervice(Cla ss<? exten ds DataSou rceSpi> sp iType)
  1020           {
  1021                    if ( spiType ==  null)
  1022                             return  null;
  1023  
  1024                    for  (ProviderS ervice ser vice : get Services() )
  1025                    {
  1026                             if (sp iType.equa ls(service .getSpiTyp e()) && se rvice.getP rotocol()  == null
  1027                                      && servi ce.getProt ocolVersio n() == 0.0 F)
  1028                                      return s ervice;
  1029                    }
  1030  
  1031                    retu rn null;
  1032           }
  1033  
  1034           /* *
  1035            *  Get an un modifiable  Set of al l services  supported  by this P rovider. T he
  1036            *  service P rovider im plementati ons should  rely on t he natural  ordering  of
  1037            *  Provider. Service.
  1038            *  
  1039            *  This (the  base Prov ider) does  not provi de any SPI  implement ations.
  1040            *  
  1041            *  @return
  1042            * /
  1043           pu blic Sorte dSet<Provi derService > getServi ces()
  1044           {
  1045                    retu rn (Sorted Set<Provid erService> ) null;
  1046           }
  1047  
  1048           /* *
  1049            *  Gets a Se t of all o f the SPI  classes th at are cur rently ins talled,
  1050            *  
  1051            *  @return
  1052            * /
  1053           @S uppressWar nings("unc hecked")
  1054           pu blic final  Set<Class <? extends  DataSourc eSpi>> get AllInstall edSpiTypes ()
  1055           {
  1056                    Set< Class<? ex tends Data SourceSpi> > spiTypes  = new Has hSet<Class <? extends  DataSourc eSpi>>(); 
  1057                    Sort edSet<Prov iderServic e> service s = getAll InstalledS ervices(nu ll);
  1058                    
  1059                    Clas s<? extend s DataSour ceSpi> las tSpiType =  null;
  1060                    for( ProviderSe rvice serv ice : serv ices)
  1061                             if( la stSpiType  == null ||  !lastSpiT ype.equals (service.g etSpiType( )) )
  1062                             {
  1063                                      lastSpiT ype = (Cla ss<? exten ds DataSou rceSpi>)se rvice.getS piType();
  1064                                      spiTypes .add(lastS piType);
  1065                             }
  1066                    
  1067                    retu rn spiType s;
  1068           }
  1069           
  1070           /* *
  1071            *  Get an un modifiable  Set of al l services  supported  by all in stalled Pr ovider.
  1072            *  
  1073            *  @return
  1074            * /
  1075           pu blic final  SortedSet <ProviderS ervice> ge tAllInstal ledService s()
  1076           {
  1077                    retu rn getAllI nstalledSe rvices(nul l);
  1078           }
  1079           
  1080           /* *
  1081            *  @param ds s
  1082            *  @return
  1083            * /
  1084           pu blic final  SortedSet <ProviderS ervice> ge tAllInstal ledService s(Class<?  extends Da taSourceSp i> spiType )
  1085           {
  1086                    // w ill contai n the list  of all ap plicable s ervice imp lementatio ns
  1087                    Sort edSet<Prov iderServic e> service s = new Tr eeSet<Prov iderServic e>();
  1088  
  1089                    // f or each kn own provid er, see if  it implem ents a ser vice of th e
  1090                    // r equested t ype
  1091                    Serv iceLoader< Provider>  loader = g etProvider Loader();
  1092                    for  (Provider  provider :  loader)
  1093                    {
  1094                             Sorted Set<Provid erService>  providerS ervices =  provider.g etServices ();
  1095                             if (pr oviderServ ices != nu ll)
  1096                                      for(Prov iderServic e provider Service :  providerSe rvices)
  1097                                               // if the  requested  type is nu ll, return  all
  1098                                               if(spiType  == null | | spiType. equals(pro viderServi ce.getSpiT ype()))
  1099                                                       se rvices.add (providerS ervice);
  1100                    }
  1101                    
  1102                    retu rn service s.size() >  0 ? Colle ctions.unm odifiableS ortedSet(s ervices) :  null;
  1103           }
  1104  
  1105           pr ivate Prov iderConfig uration<Se rializable > provider Configurat ion = null ;
  1106           
  1107           pr ivate sync hronized P roviderCon figuration <Serializa ble> getPr oviderConf iguration( )
  1108           {
  1109                    if(p roviderCon figuration  == null)
  1110                             provid erConfigur ation = ne w Provider Configurat ion<Serial izable>(ge tName(), g etVersion( ));
  1111                    
  1112                    retu rn provide rConfigura tion;
  1113           }
  1114           
  1115           pr otected Se rializable  loadConfi guration()
  1116           {
  1117                    try
  1118                    {
  1119                             return  getProvid erConfigur ation().lo adConfigur ation();
  1120                    }
  1121                    catc h (IOExcep tion x)
  1122                    {
  1123                             logger .error(x);
  1124                             return  null;
  1125                    }
  1126           }
  1127  
  1128           pr otected vo id storeCo nfiguratio n(Serializ able confi guration)
  1129           {
  1130                    try
  1131                    {
  1132                             getPro viderConfi guration() .store(con figuration );
  1133                    }
  1134                    catc h (IOExcep tion x)
  1135                    {
  1136                             logger .error(x);
  1137                    }
  1138           }
  1139           
  1140           /* *
  1141            *  No config uration fo r this def ault imple mentation 
  1142            * /
  1143           pu blic void  storeConfi guration()
  1144           {
  1145                    Seri alizable c onfig = ge tInstanceC onfigurati on();
  1146                    if(c onfig != n ull)
  1147                             storeC onfigurati on(config) ;              
  1148                    
  1149                    retu rn;
  1150           }
  1151           
  1152           pr otected Se rializable  getInstan ceConfigur ation()
  1153           {
  1154                    retu rn null;
  1155           }
  1156           
  1157           pr otected St ring getCo nfiguratio nFileName( ){return g etProvider Configurat ion().getC onfigurati onFileName ();}
  1158  
  1159           /*  (non-Java doc)
  1160            *  @see java .util.Hash table#toSt ring()
  1161            * /
  1162           @O verride
  1163           pu blic synch ronized St ring toStr ing()
  1164           {
  1165                    retu rn this.ge tInfo();
  1166           }
  1167  
  1168           /*  (non-Java doc)
  1169            *  @see gov. va.med.ima ging.datas ource.Data SourceProv ider#getIn stalledPro viderDescr iptions()
  1170            * /
  1171           @O verride
  1172           pu blic Strin g[] getIns talledProv iderDescri ptions()
  1173           {
  1174                    // f or each kn own provid er, see if  it implem ents a ser vice of th e
  1175                    // r equested t ype
  1176                    Serv iceLoader< Provider>  loader = g etProvider Loader();
  1177                    Set< Provider>  providers  = new Hash Set<Provid er>();
  1178                    
  1179                    for  (Provider  provider :  loader)
  1180                             provid ers.add(pr ovider);
  1181  
  1182                    Stri ng[] resul t = new St ring[provi ders.size( )];
  1183                    int  index = 0;
  1184                    for  (Provider  provider :  providers )
  1185                             result [index++]  = provider .getInfo() ;
  1186                    
  1187                    retu rn result;
  1188           }
  1189  
  1190           /* *
  1191            *  @see gov. va.med.ima ging.datas ource.Data SourceProv ider#getIn stalledSer viceProvid erDescript ions()
  1192            * /
  1193           @O verride
  1194           pu blic Strin g[] getIns talledServ iceImpleme ntationDes criptions( )
  1195           {
  1196                    Sort edSet<Prov iderServic e> install edServices  = getAllI nstalledSe rvices();
  1197                    Stri ng[] resul t = new St ring[insta lledServic es.size()] ;
  1198                    int  index=0;
  1199                    for(  ProviderS ervice ser ver : inst alledServi ces )
  1200                             result [index++]  = server.t oString();
  1201                    
  1202                    retu rn result;
  1203           }
  1204           
  1205           /* *
  1206            *  @see gov. va.med.ima ging.datas ource.Data SourceProv ider#getIn stalledSer viceDescri ptions()
  1207            * /
  1208           @O verride
  1209           pu blic Strin g[] getIns talledServ iceDescrip tions()
  1210           {
  1211                    Set< Class<? ex tends Data SourceSpi> > installe dSpiTypes  = getAllIn stalledSpi Types();
  1212                    Stri ng[] resul t;
  1213                    if(i nstalledSp iTypes !=  null)
  1214                    {
  1215                             result  = new Str ing[instal ledSpiType s.size()];
  1216                             int in dex=0;
  1217                             for( C lass<? ext ends DataS ourceSpi>  spiClass :  installed SpiTypes )
  1218                             {
  1219                                      SPI spiA nnotation  = spiClass .getAnnota tion(SPI.c lass);
  1220                                      result[i ndex++] =  spiClass.g etName() +  (spiAnnot ation != n ull ? spiA nnotation. descriptio n() : "");
  1221                             }
  1222                    }
  1223                    else
  1224                             result  = new Str ing[0];
  1225                    
  1226                    retu rn result;
  1227           }
  1228  
  1229   }