Produced by Araxis Merge on 12/5/2017 12:06:51 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.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | IV-eHMP_CIF.zip\IMAG_Source\VISA\Java\VixServerHealth\main\src\java\gov\va\med\imaging\health | VisaConfiguration.java | Mon Dec 4 21:34:32 2017 UTC |
| 2 | IV-eHMP_CIF.zip\IMAG_Source\VISA\Java\VixServerHealth\main\src\java\gov\va\med\imaging\health | VisaConfiguration.java | Mon Dec 4 22:07:30 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 3 | 510 |
| Changed | 2 | 4 |
| Inserted | 0 | 0 |
| Removed | 0 | 0 |
| 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 |
No regular expressions were active.
| 1 | /** | |
| 2 | * | |
| 3 | Package: MAG - Vis tA Imaging | |
| 4 | WARNING: Per VHA D irective 2 004-038, t his routin e should n ot be modi fied. | |
| 5 | Date Cre ated: Jun 6, 2012 | |
| 6 | Site Nam e: Washin gton OI Fi eld Office , Silver S pring, MD | |
| 7 | Developer:
|
|
| 8 | Descript ion: | |
| 9 | ||
| 10 | ;; +-------- ---------- ---------- ---------- ---------- ---------- ---------- + | |
| 11 | ;; Property of the US Government . | |
| 12 | ;; No permis sion to co py or redi stribute t his softwa re is give n. | |
| 13 | ;; Use of un released v ersions of this soft ware requi res the us er | |
| 14 | ;; to execu te a writt en test ag reement wi th the Vis tA Imaging | |
| 15 | ;; Developm ent Office of the De partment o f Veterans Affairs, | |
| 16 | ;; telephon e (301) 73 4-0100. | |
| 17 | ;; | |
| 18 | ;; The Food and Drug A dministrat ion classi fies this software a s | |
| 19 | ;; a Class I I medical device. A s such, it may not b e changed | |
| 20 | ;; in any wa y. Modifi cations to this soft ware may r esult in a n | |
| 21 | ;; adulterat ed medical device un der 21CFR8 20, the us e of which | |
| 22 | ;; is consid ered to be a violati on of US F ederal Sta tutes. | |
| 23 | ;; +-------- ---------- ---------- ---------- ---------- ---------- ---------- + | |
| 24 | ||
| 25 | */ | |
| 26 | package go v.va.med.i maging.hea lth; | |
| 27 | ||
| 28 | import gov .va.med.im aging.Null OutputStre am; | |
| 29 | import gov .va.med.im aging.chan nels.ByteS treamPump; | |
| 30 | import gov .va.med.im aging.chan nels.Check sumValue; | |
| 31 | import gov .va.med.im aging.chan nels.Abstr actBytePum p.TRANSFER _TYPE; | |
| 32 | ||
| 33 | import jav a.io.File; | |
| 34 | import jav a.io.FileI nputStream ; | |
| 35 | import jav a.util.Arr ayList; | |
| 36 | import jav a.util.Dat e; | |
| 37 | import jav a.util.Has htable; | |
| 38 | import jav a.util.Lis t; | |
| 39 | import jav a.util.zip .Adler32; | |
| 40 | import jav a.util.zip .CheckedIn putStream; | |
| 41 | ||
| 42 | import jav ax.managem ent.Attrib uteNotFoun dException ; | |
| 43 | import jav ax.managem ent.Instan ceNotFound Exception; | |
| 44 | import jav ax.managem ent.MBeanE xception; | |
| 45 | import jav ax.managem ent.MBeanS erver; | |
| 46 | import jav ax.managem ent.Malfor medObjectN ameExcepti on; | |
| 47 | import jav ax.managem ent.Object Name; | |
| 48 | import jav ax.managem ent.Reflec tionExcept ion; | |
| 49 | import jav ax.managem ent.openmb ean.Compos iteData; | |
| 50 | import jav ax.managem ent.openmb ean.Tabula rData; | |
| 51 | ||
| 52 | import org .apache.lo gging.log4 j.LogManag er; | |
| 53 | import org .apache.lo gging.log4 j.Logger; | |
| 54 | ||
| 55 | /** | |
| 56 | * @author
|
|
| 57 | * | |
| 58 | */ | |
| 59 | public cla ss VisaCon figuration | |
| 60 | { | |
| 61 | pr ivate fina l List<Vis aConfigura tionProper ty> visaCo nfiguratio nPropertie s = | |
| 62 | new ArrayList< VisaConfig urationPro perty>(); | |
| 63 | pr ivate fina l static L ogger logg er = LogMa nager.getL ogger(Visa Configurat ion.class) ; | |
| 64 | ||
| 65 | pr ivate Visa Configurat ion() | |
| 66 | { | |
| 67 | supe r(); | |
| 68 | } | |
| 69 | ||
| 70 | pu blic stati c VisaConf iguration getVisaCon figuration (VisaConfi gurationTy pe visaCon figuration Type, bool ean calcul ateChecksu ms) | |
| 71 | { | |
| 72 | Visa Configurat ion visaCo nfiguratio n = new Vi saConfigur ation(); | |
| 73 | visa Configurat ion.determ ineConfigu ration(vis aConfigura tionType, | |
| 74 | calculat eChecksums ); | |
| 75 | retu rn visaCon figuration ; | |
| 76 | } | |
| 77 | ||
| 78 | pu blic List< VisaConfig urationPro perty> get VisaConfig urationPro perties() | |
| 79 | { | |
| 80 | retu rn visaCon figuration Properties ; | |
| 81 | } | |
| 82 | ||
| 83 | pu blic Strin g toXml() | |
| 84 | { | |
| 85 | Stri ngBuilder sb = new S tringBuild er(); | |
| 86 | sb.a ppend("<?x ml version =\"1.0\" e ncoding=\" UTF-8\"?>" ); | |
| 87 | sb.a ppend("<Vi saConfigur ation>"); | |
| 88 | ||
| 89 | for( VisaConfig urationPro perty vp : visaConfi gurationPr operties) | |
| 90 | { | |
| 91 | sb.app end("<Prop erty name= \"" + vp.g etName() + "\" modif ied=\"" + vp.getModi fiedFormat ted() + "\ " size=\"" + vp.getS ize() + "\ " checksum =\"" + (vp .getChecks um() == nu ll ? "" : vp.getChec ksum()) + "\" />"); | |
| 92 | } | |
| 93 | ||
| 94 | sb.a ppend("</V isaConfigu ration>"); | |
| 95 | retu rn sb.toSt ring(); | |
| 96 | } | |
| 97 | ||
| 98 | pr ivate void determine Configurat ion(VisaCo nfiguratio nType visa Configurat ionType, b oolean cal culateChec ksums) | |
| 99 | { | |
| 100 | File libDir = null; | |
| 101 | swit ch(visaCon figuration Type) | |
| 102 | { | |
| 103 | case j reLibExt: | |
| 104 | libDir = getJreLib ExtDirecto ry(); | |
| 105 | break; | |
| 106 | defaul t: | |
| 107 | libDir = getLibDir ectory(); | |
| 108 | break; | |
| 109 | } | |
| 110 | if(l ibDir != n ull) | |
| 111 | { | |
| 112 | if(lib Dir.exists () && libD ir.isDirec tory() && libDir.can Read()) | |
| 113 | { | |
| 114 | File [] fileList = libDir.li stFiles(); | |
| 115 | for(File file : fi leList) | |
| 116 | { | |
| 117 | String che cksum = nu ll; | |
| 118 | if(calcula teChecksum s) | |
| 119 | ch ecksum = c alculateCh ecksum(fil e); | |
| 120 | visaConfig urationPro perties.ad d( | |
| 121 | new VisaConfig urationPro perty(file .getName() , new Date (file.last Modified() ), | |
| 122 | file.len gth(), che cksum)); | |
| 123 | } | |
| 124 | ||
| 125 | } | |
| 126 | else | |
| 127 | { | |
| 128 | logger.e rror("Erro r reading lib direct ory '" + l ibDir.getA bsolutePat h() + "'." ); | |
| 129 | } | |
| 130 | } | |
| 131 | } | |
| 132 | ||
| 133 | pr ivate Stri ng calcula teChecksum (File file ) | |
| 134 | { | |
| 135 | Chec kedInputSt ream check edStream = null; | |
| 136 | Null OutputStre am nullOut Stream = n ull; | |
| 137 | try | |
| 138 | { | |
| 139 | checke dStream = | |
| 140 | new Chec kedInputSt ream(new F ileInputSt ream(file) , new Adle r32()); | |
| 141 | nullOu tStream = new NullOu tputStream (); | |
| 142 | ByteSt reamPump p ump = Byte StreamPump .getByteSt reamPump(T RANSFER_TY PE.Network ToByteArra y); | |
| 143 | pump.x fer(checke dStream, n ullOutStre am); | |
| 144 | Checks umValue ch ecksumValu e = new Ch ecksumValu e(checkedS tream.getC hecksum()) ; | |
| 145 | return checksumV alue.toStr ing(); | |
| 146 | } | |
| 147 | catc h(Exceptio n ex) | |
| 148 | { | |
| 149 | logger .warn("Err or calcula ting check sum for fi le '" + fi le.getAbso lutePath() + "', " + ex.getMes sage()); | |
| 150 | return null; | |
| 151 | } | |
| 152 | fina lly | |
| 153 | { | |
| 154 | if(che ckedStream != null) | |
| 155 | { | |
| 156 | try {che ckedStream .close();} catch(Exc eption ex) {} | |
| 157 | } | |
| 158 | if(nul lOutStream != null) | |
| 159 | { | |
| 160 | try {nul lOutStream .close();} catch(Exc eption ex) {} | |
| 161 | } | |
| 162 | } | |
| 163 | } | |
| 164 | ||
| 165 | pr ivate stat ic File jr eLibExtDir ectory = n ull; | |
| 166 | pr ivate sync hronized s tatic File getJreLib ExtDirecto ry() | |
| 167 | { | |
| 168 | if(j reLibExtDi rectory == null) | |
| 169 | { | |
| 170 | String javaHome = getJavaH ome(); | |
| 171 | jreLib ExtDirecto ry = new F ile(javaHo me + File. separatorC har + "lib " + File.s eparatorCh ar + "ext" ); | |
| 172 | } | |
| 173 | retu rn jreLibE xtDirector y; | |
| 174 | } | |
| 175 | ||
| 176 | ||
| 177 | ||
| 178 | pu blic stati c String g etJavaHome () | |
| 179 | { | |
| 180 | MBea nServer se rver = jav a.lang.man agement.Ma nagementFa ctory.getP latformMBe anServer() ; | |
| 181 | Hash table<Stri ng, String > objectNa meKeys = n ew Hashtab le<String, String>() ; | |
| 182 | obje ctNameKeys .put("type ", "Runtim e"); | |
| 183 | try | |
| 184 | { | |
| 185 | Object Name objec tName = ne w ObjectNa me("java.l ang", obje ctNameKeys ); | |
| 186 | Object value = s erver.getA ttribute(o bjectName, "SystemPr operties") ; | |
| 187 | //Tabu larDataSup port tds = (TabularD ataSupport )value; | |
| 188 | Tabula rData tds = (Tabular Data)value ; | |
| 189 | ||
| 190 | for(Ob ject v : t ds.values( )) | |
| 191 | { | |
| 192 | Composit eData cd = (Composit eData)v; | |
| 193 | ||
| 194 | Object k ey = cd.ge t("key"); | |
| 195 | Object v al = cd.ge t("value") ; | |
| 196 | if("java .home".equ als(key)) | |
| 197 | return val .toString( ); | |
| 198 | /* | |
| 199 | ||
| 200 | if(cd.co ntainsKey( "java.home ")) | |
| 201 | { | |
| 202 | System.out .println(" Found java home: " + cd.get("j ava.home") ); | |
| 203 | } | |
| 204 | else | |
| 205 | { | |
| 206 | System.out .println(c d.getClass ().getName () + ": " + cd.toS tring()); | |
| 207 | for(Object rv : cd.v alues()) | |
| 208 | { | |
| 209 | Sy stem.out.p rintln("\t " + rv.toS tring()); | |
| 210 | } | |
| 211 | }*/ | |
| 212 | } | |
| 213 | ||
| 214 | return null; | |
| 215 | } | |
| 216 | catc h (Malform edObjectNa meExceptio n e) | |
| 217 | { | |
| 218 | e.prin tStackTrac e(); | |
| 219 | } ca tch (NullP ointerExce ption e) | |
| 220 | { | |
| 221 | e.prin tStackTrac e(); | |
| 222 | } ca tch (Attri buteNotFou ndExceptio n e) | |
| 223 | { | |
| 224 | e.prin tStackTrac e(); | |
| 225 | } ca tch (Insta nceNotFoun dException e) | |
| 226 | { | |
| 227 | e.prin tStackTrac e(); | |
| 228 | } ca tch (MBean Exception e) | |
| 229 | { | |
| 230 | e.prin tStackTrac e(); | |
| 231 | } ca tch (Refle ctionExcep tion e) | |
| 232 | { | |
| 233 | e.prin tStackTrac e(); | |
| 234 | } | |
| 235 | retu rn null; | |
| 236 | ||
| 237 | } | |
| 238 | ||
| 239 | pr ivate fina l static S tring cata lina_home_ env = "cat alina_home "; | |
| 240 | pr ivate stat ic File li bDirectory = null; | |
| 241 | pr ivate sync hronized s tatic File getLibDir ectory() | |
| 242 | { | |
| 243 | if(l ibDirector y == null) | |
| 244 | { | |
| 245 | String tomcatDir = System. getenv(cat alina_home _env); | |
| 246 | if(tom catDir == null) | |
| 247 | { | |
| 248 | logger.w arn("Did n ot find '" + catalin a_home_env + "' envi ronment va riable."); | |
| 249 | return n ull; | |
| 250 | } | |
| 251 | libDir ectory = n ew File(to mcatDir + File.separ atorChar + "lib"); | |
| 252 | logger .debug("Fo und lib di rectory '" + libDire ctory.getA bsolutePat h() + "'." ); | |
| 253 | } | |
| 254 | retu rn libDire ctory; | |
| 255 | } | |
| 256 | ||
| 257 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.