46. EPMO Open Source Coordination Office Redaction File Detail Report

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

46.1 Files compared

# Location File Last Modified
1 IV-eHMP_CIF.zip\IMAG_Source\VISA\Java\CacheImpl\main\src\java\gov\va\med\imaging\storage\cache\impl\filesystem FileSystemByteChannelFactory.java Mon Dec 4 21:35:28 2017 UTC
2 IV-eHMP_CIF.zip\IMAG_Source\VISA\Java\CacheImpl\main\src\java\gov\va\med\imaging\storage\cache\impl\filesystem FileSystemByteChannelFactory.java Mon Dec 4 21:57:37 2017 UTC

46.2 Comparison summary

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

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

46.4 Active regular expressions

No regular expressions were active.

46.5 Comparison detail

  1   /**
  2    * 
  3    */
  4   package go v.va.med.i maging.sto rage.cache .impl.file system;
  5  
  6  
  7   import gov .va.med.im aging.chan nels.Check sumFactory ;
  8   import gov .va.med.im aging.stor age.cache. *;
  9   import gov .va.med.im aging.stor age.cache. exceptions .CacheExce ption;
  10   import gov .va.med.im aging.stor age.cache. exceptions .Persisten ceIOExcept ion;
  11   import gov .va.med.im aging.stor age.cache. impl.Abstr actByteCha nnelFactor y;
  12   import gov .va.med.im aging.stor age.cache. memento.By teChannelF actoryMeme nto;
  13  
  14   import jav a.io.File;
  15   import jav a.io.IOExc eption;
  16   import jav a.util.zip .Checksum;
  17  
  18   import jav ax.managem ent.Dynami cMBean;
  19  
  20   import org .apache.lo gging.log4 j.LogManag er;
  21   import org .apache.lo gging.log4 j.Logger;
  22  
  23   /**
  24    * @author         
BECKEC
  25    *
  26    * A facto ry class t hat provid es some ma nagement o f instance  file chan nels.
  27    * 
  28    */
  29   public cla ss FileSys temByteCha nnelFactor y
  30   extends Ab stractByte ChannelFac tory<File>
  31   implements  InstanceB yteChannel Factory<Fi le>, Dynam icMBean, C acheLifecy cleListene r
  32   {
  33           pu blic stati c final lo ng default MaxChannel OpenDurati on = 30000 0L;        // default  to 5 minu tes (for r emote juke boxes)
  34           pu blic stati c final lo ng default SweepTime  = 10000L;
  35           pu blic stati c final bo olean defa ultTraceCh annelInsta ntiation =  true;
  36           pu blic stati c final St ring defau ltChecksum AlgorithmN ame = "Adl er32";
  37           
  38           pr ivate Logg er log = L ogManager. getLogger( this.getCl ass());
  39           
  40           //  ========= ========== ========== ========== ========== ========== ========== ========== ========== ========== ========== ======
  41           //  Factory M ethods
  42           //  ========= ========== ========== ========== ========== ========== ========== ========== ========== ========== ========== ======
  43           pu blic stati c FileSyst emByteChan nelFactory  create()
  44           {
  45                    retu rn new Fil eSystemByt eChannelFa ctory(defa ultMaxChan nelOpenDur ation, def aultSweepT ime, defau ltChecksum AlgorithmN ame);
  46           }
  47           
  48           pu blic stati c FileSyst emByteChan nelFactory  create(By teChannelF actoryMeme nto mement o)
  49           {
  50                    retu rn new Fil eSystemByt eChannelFa ctory(meme nto);
  51           }
  52           
  53           pu blic stati c FileSyst emByteChan nelFactory  create(Lo ng maxChan nelOpenDur ation, Lon g sweepTim e, String  checksumCl assname)
  54           {
  55                    retu rn new Fil eSystemByt eChannelFa ctory(maxC hannelOpen Duration,  sweepTime,  checksumC lassname);
  56           }
  57           
  58           /* *
  59            *  
  60            *  @param me mento
  61            * /
  62           pr ivate File SystemByte ChannelFac tory(ByteC hannelFact oryMemento  memento)
  63           {
  64                    this (
  65                             mement o == null  ? defaultM axChannelO penDuratio n : mement o.getMaxCh annelOpenD uration(),  
  66                             mement o == null  ? defaultS weepTime :  memento.g etSweepTim e(),
  67                             mement o == null  ? null : m emento.get ChecksumAl gorithmNam e()
  68                    );
  69           }
  70           
  71           /* *
  72            *  
  73            *  @param ma xChannelOp enDuration  - the max imum time  a channel  is allowed  to be ope n
  74            *  @param sw eepTime -  the delay  in the bac kground th read that  looks for  open chann els
  75            * /
  76           pr ivate File SystemByte ChannelFac tory(Long  maxChannel OpenDurati on, Long s weepTime,  String che cksumClass name)
  77           {
  78                    supe r(maxChann elOpenDura tion, swee pTime, che cksumClass name);
  79           }
  80  
  81  
  82           //  ========= ========== ========== ========== ========== ========== ========== ========== ========== =========
  83           //  InstanceB yteChannel Factory Im plementati on
  84           //  Business  Methods
  85           //  ========= ========== ========== ========== ========== ========== ========== ========== ========== =========
  86           /*  (non-Java doc)
  87            *  @see gov. va.med.ima ging.stora ge.cache.f ilesystem. InstanceBy teChannelF actory#get InstanceRe adableByte Channel(ja va.io.File )
  88            * /
  89           pu blic Insta nceReadabl eByteChann el getInst anceReadab leByteChan nel(File i nstanceFil e, Instanc eByteChann elListener  timeoutLi stener)
  90           th rows Persi stenceIOEx ception, C acheExcept ion
  91           {
  92                    try
  93                    {
  94                             Checks um checksu m = null;
  95                             try
  96                             {
  97                                      checksum  = Checksu mFactory.g etFactory( ).get(getC hecksumCla ssname());
  98                             } 
  99                             catch( Exception  x)
  100                             {
  101                                      log.erro r("Unable  to create  checksum i nstance of  class '"  + getCheck sumClassna me() + "'. ");
  102                                      checksum  = null;
  103                             }
  104                             Instan ceReadable ByteChanne lImpl read able = new  InstanceR eadableByt eChannelIm pl(this, i nstanceFil e, checksu m);
  105                             if(tim eoutListen er != null )
  106                                      this.put ReadableCh annel(read able, time outListene r);
  107                                      
  108                             return  readable;
  109                    } 
  110                    catc h (IOExcep tion ioX)
  111                    {
  112                             throw  new Persis tenceIOExc eption(ioX );
  113                    }
  114           }
  115           
  116           /*  (non-Java doc)
  117            *  @see gov. va.med.ima ging.stora ge.cache.f ilesystem. InstanceBy teChannelF actory#get InstanceWr itableByte Channel(ja va.io.File )
  118            * /
  119           pu blic Insta nceWritabl eByteChann el getInst anceWritab leByteChan nel(File i nstanceFil e, Instanc eByteChann elListener  timeoutLi stener) 
  120           th rows Persi stenceIOEx ception, C acheExcept ion
  121           {
  122                    try
  123                    {
  124                             Checks um checksu m = null;
  125                             try
  126                             {
  127                                      checksum  = Checksu mFactory.g etFactory( ).get(getC hecksumCla ssname());
  128                             } 
  129                             catch( Exception  x)
  130                             {
  131                                      log.erro r("Unable  to create  checksum i nstance of  class '"  + getCheck sumClassna me() + "'. ");
  132                                      checksum  = null;
  133                             }
  134                             
  135                             Instan ceWritable ByteChanne lImpl writ able = new  InstanceW ritableByt eChannelIm pl( this,  instanceFi le, checks um );
  136  
  137                             if(tim eoutListen er != null )
  138                                      putWrita bleChannel (writable,  timeoutLi stener);
  139                             
  140                             return  writable;
  141                    } 
  142                    catc h (IOExcep tion ioX)
  143                    {
  144                             throw  new Persis tenceIOExc eption(ioX );
  145                    }
  146           }
  147           
  148           pr otected In stanceRead ableByteCh annel getO penReadabl eByteChann el(File in stanceFile )
  149           {
  150                    if(i nstanceFil e == null)
  151                             return  null;
  152                    
  153                    sync hronized(g etOpenRead Channels() )
  154                    {
  155                             for(In stanceRead ableByteCh annel chan nel: getOp enReadChan nels().key Set() )
  156                             {
  157                                      Instance ReadableBy teChannelI mpl fileCh annel = (I nstanceRea dableByteC hannelImpl )channel; 
  158                                      File cha nnelFile =  fileChann el.getFile ();
  159                                      
  160                                      if(insta nceFile.eq uals(chann elFile))
  161                                               return cha nnel;
  162                             }
  163                    }
  164                    
  165                    retu rn null;
  166           }
  167           
  168           pr otected In stanceWrit ableByteCh annel getO penWritabl eByteChann el(File in stanceFile )
  169           {
  170                    if(i nstanceFil e == null)
  171                             return  null;
  172                    
  173                    sync hronized(g etOpenWrit eChannels( ))
  174                    {
  175                             for(In stanceWrit ableByteCh annel chan nel: getOp enWriteCha nnels().ke ySet() )
  176                             {
  177                                      Instance WritableBy teChannelI mpl fileCh annel = (I nstanceWri tableByteC hannelImpl )channel; 
  178                                      File cha nnelFile =  fileChann el.getFile ();
  179                                      
  180                                      if(insta nceFile.eq uals(chann elFile))
  181                                               return cha nnel;
  182                             }
  183                    }
  184                    
  185                    retu rn null;
  186           }
  187           
  188   }