Produced by Araxis Merge on 12/5/2017 12:06:37 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\CoreRouter\main\src\java\gov\va\med\imaging\exchange\configuration | AppConfiguration.java | Mon Dec 4 21:34:54 2017 UTC |
| 2 | IV-eHMP_CIF.zip\IMAG_Source\VISA\Java\CoreRouter\main\src\java\gov\va\med\imaging\exchange\configuration | AppConfiguration.java | Mon Dec 4 21:58:36 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 3 | 1234 |
| 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: Dec 10, 2006 | |
| 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.exc hange.conf iguration; | |
| 27 | ||
| 28 | import gov .va.med.im aging.core .interface s.IAppConf iguration; | |
| 29 | import gov .va.med.im aging.core .interface s.exceptio ns.Applica tionConfig urationExc eption; | |
| 30 | ||
| 31 | import jav a.beans.Be anInfo; | |
| 32 | import jav a.beans.En coder; | |
| 33 | import jav a.beans.Ex pression; | |
| 34 | import jav a.beans.In trospectio nException ; | |
| 35 | import jav a.beans.In trospector ; | |
| 36 | import jav a.beans.Pe rsistenceD elegate; | |
| 37 | import jav a.beans.Pr opertyDesc riptor; | |
| 38 | import jav a.beans.XM LDecoder; | |
| 39 | import jav a.beans.XM LEncoder; | |
| 40 | import jav a.io.Buffe redInputSt ream; | |
| 41 | import jav a.io.Buffe redOutputS tream; | |
| 42 | import jav a.io.File; | |
| 43 | import jav a.io.FileI nputStream ; | |
| 44 | import jav a.io.FileN otFoundExc eption; | |
| 45 | import jav a.io.FileO utputStrea m; | |
| 46 | import jav a.net.URI; | |
| 47 | //import j ava.net.UR ISyntaxExc eption; | |
| 48 | //import j ava.util.M issingReso urceExcept ion; | |
| 49 | //import j ava.util.R esourceBun dle; | |
| 50 | import jav a.util.con current.lo cks.Lock; | |
| 51 | import jav a.util.con current.lo cks.Reentr antReadWri teLock; | |
| 52 | import org .apache.lo gging.log4 j.LogManag er; | |
| 53 | import org .apache.lo gging.log4 j.Logger; | |
| 54 | ||
| 55 | /** | |
| 56 | * @author
|
|
| 57 | * This cl ass holds the config uration fo r the ViX web app. I t uses the XmlEncode r/XmlDecod er classes to manage persistan ce. | |
| 58 | */ | |
| 59 | public cla ss AppConf iguration implements IAppConfi guration | |
| 60 | { | |
| 61 | public static bo olean load AppConfigu rationfrom File = tru e; // for use by uni t tests - not produc tion code | |
| 62 | privat e static f inal Strin g APP_CONF IG_FILENAM E = "ViXCo nfig.xml"; | |
| 63 | ||
| 64 | pr otected fi nal Logger logger = LogManager .getLogger (this.getC lass()); | |
| 65 | // prot ected stat ic org.apa che.common s.logging. Log log = null; | |
| 66 | privat e final Re entrantRea dWriteLock rwl = new Reentrant ReadWriteL ock(); | |
| 67 | protec ted final Lock readL ock = rwl. readLock() ; | |
| 68 | protec ted final Lock write Lock = rwl .writeLock (); | |
| 69 | ||
| 70 | // tra nsient mem bers - nev er persist ed - initi alized on demand in the respec tive gette rs | |
| 71 | // do not access directly | |
| 72 | pr ivate Stri ng appConf igurationF ilespec = null; | |
| 73 | pr ivate Stri ng vixConf igurationD irectory = null; | |
| 74 | ||
| 75 | pr otected St ring vixSo ftwareVers ion = null ; | |
| 76 | ||
| 77 | // members e xposed as public pro perties th at may be persisted | |
| 78 | pr otected UR I smtpServ erUri = nu ll; | |
| 79 | pr otected bo olean cach ingEnabled = false; | |
| 80 | pr otected bo olean down SamplingEn abled = fa lse; | |
| 81 | pr otected bo olean noLo sslessComp ression = false; | |
| 82 | pr otected bo olean deco mpressionE nabled = f alse; | |
| 83 | pr otected St ring local SiteNumber = null; | |
| 84 | protec ted boolea n sensitiv ePatientBl ocked = fa lse; | |
| 85 | ||
| 86 | protec ted String vistaImag ingVersion Required = "3.0P83"; // null; | |
| 87 | ||
| 88 | /* * | |
| 89 | * Default c onstructor | |
| 90 | * / | |
| 91 | pu blic AppCo nfiguratio n() { | |
| 92 | logg er.info("A ppConfigur ation() - " + this.h ashCode()) ; | |
| 93 | } | |
| 94 | ||
| 95 | /* * | |
| 96 | * Initializ ation call ed by Spri ng to load the confi guration i nformation from the database. | |
| 97 | * Note that this meth od is not a part of the IAppCo nfiguratio n interfac e | |
| 98 | * / | |
| 99 | pu blic void init() th rows Appli cationConf igurationE xception{ | |
| 100 | logg er.info("A ppConfigur ation:Init () - " + t his.hashCo de()); | |
| 101 | // T ransient p roperties - always a ccess thro ugh getter to ensure proper in itializati on | |
| 102 | // N ote: this is where t he Applica tionConfig urationExc eption cou ld be thro wn (in the ory) | |
| 103 | // I n practice , this err or will be caught in developme nt because Spring in itializati on | |
| 104 | // w ill fail. | |
| 105 | this .markPrope rtyAsTrans ient("vixC onfigurati onDirector y"); //det ermined at run time | |
| 106 | this .markPrope rtyAsTrans ient("appC onfigurati onFilespec "); //dete rmined at run time | |
| 107 | ||
| 108 | //in itialize a ppConfigur ationFiles pec and ap pConfigura tionDirect ory proper ties. | |
| 109 | ||
| 110 | if ( AppConfigu ration.loa dAppConfig urationfro mFile == t rue) | |
| 111 | { | |
| 112 | // att empt to lo ad the app configura tion from file | |
| 113 | this.l oadAppConf igurationF romFile(); | |
| 114 | } | |
| 115 | } | |
| 116 | ||
| 117 | // ---------- ---------- ---------- ----- | |
| 118 | // IAppConfi guration p roperties | |
| 119 | // ---------- ---------- ---------- ----- | |
| 120 | ||
| 121 | /* (non-Java doc) | |
| 122 | * @see gov. va.med.ima ging.excha nge.interf aces.IAppC onfigurati on#isCachi ngEnabled( ) | |
| 123 | * / | |
| 124 | pu blic boole an isCachi ngEnabled( ) { | |
| 125 | this .readLock. lock(); | |
| 126 | try {return th is.caching Enabled;} | |
| 127 | fina lly {this. readLock.u nlock();} | |
| 128 | } | |
| 129 | ||
| 130 | /* (non-Java doc) | |
| 131 | * @see gov. va.med.ima ging.excha nge.interf aces.IAppC onfigurati on#setCach ingEnabled (boolean) | |
| 132 | * / | |
| 133 | pu blic void setCaching Enabled(bo olean enab led) { | |
| 134 | this .writeLock .lock(); | |
| 135 | try {this.cach ingEnabled = enabled ;} | |
| 136 | fina lly {this. writeLock. unlock();} | |
| 137 | } | |
| 138 | ||
| 139 | /* (non-Java doc) | |
| 140 | * @see gov. va.med.ima ging.excha nge.interf aces.IAppC onfigurati on#isSensi tivePatien tBlocked() | |
| 141 | * / | |
| 142 | pu blic boole an isSensi tivePatien tBlocked() { | |
| 143 | this .readLock. lock(); | |
| 144 | try {return th is.sensiti vePatientB locked;} | |
| 145 | fina lly {this. readLock.u nlock();} | |
| 146 | } | |
| 147 | ||
| 148 | /* (non-Java doc) | |
| 149 | * @see gov. va.med.ima ging.excha nge.interf aces.IAppC onfigurati on#setSens itivePatie ntBlocked( boolean) | |
| 150 | * / | |
| 151 | pu blic void setSensiti vePatientB locked(boo lean enabl ed) { | |
| 152 | this .writeLock .lock(); | |
| 153 | try {this.sens itivePatie ntBlocked = enabled; } | |
| 154 | fina lly {this. writeLock. unlock();} | |
| 155 | } | |
| 156 | ||
| 157 | /* (non-Java doc) | |
| 158 | * @see gov. va.med.ima ging.excha nge.interf aces.IAppC onfigurati on#isDownS amplingEna bled() | |
| 159 | * / | |
| 160 | pu blic boole an isDownS amplingEna bled() { | |
| 161 | this .readLock. lock(); | |
| 162 | try {return th is.downSam plingEnabl ed;} | |
| 163 | fina lly {this. readLock.u nlock();} | |
| 164 | } | |
| 165 | ||
| 166 | /* (non-Java doc) | |
| 167 | * @see gov. va.med.ima ging.excha nge.interf aces.IAppC onfigurati on#setDown SamplingEn abled(bool ean) | |
| 168 | * / | |
| 169 | pu blic void setDownSam plingEnabl ed(boolean enabled) { | |
| 170 | this .writeLock .lock(); | |
| 171 | try {this.down SamplingEn abled = en abled;} | |
| 172 | fina lly {this. writeLock. unlock();} | |
| 173 | } | |
| 174 | /* (non-Java doc) | |
| 175 | * @see gov. va.med.ima ging.excha nge.interf aces.IAppC onfigurati on#isNoLos slessCompr ession() | |
| 176 | * / | |
| 177 | pu blic boole an isNoLos slessCompr ession() { | |
| 178 | this .readLock. lock(); | |
| 179 | try {return th is.noLossl essCompres sion;} | |
| 180 | fina lly {this. readLock.u nlock();} | |
| 181 | } | |
| 182 | ||
| 183 | /* (non-Java doc) | |
| 184 | * @see gov. va.med.ima ging.excha nge.interf aces.IAppC onfigurati on#setNoLo sslessComp ression(bo olean) | |
| 185 | * / | |
| 186 | pu blic void setNoLossl essCompres sion(boole an enabled ) { | |
| 187 | this .writeLock .lock(); | |
| 188 | try {this.noLo sslessComp ression = enabled;} | |
| 189 | fina lly {this. writeLock. unlock();} | |
| 190 | } | |
| 191 | ||
| 192 | /* (non-Java doc) | |
| 193 | * @see gov. va.med.ima ging.excha nge.interf aces.IAppC onfigurati on#isNoLos slessCompr ession() | |
| 194 | * / | |
| 195 | pu blic boole an isDecom pressionEn abled() { | |
| 196 | this .readLock. lock(); | |
| 197 | try {return th is.decompr essionEnab led;} | |
| 198 | fina lly {this. readLock.u nlock();} | |
| 199 | } | |
| 200 | ||
| 201 | /* (non-Java doc) | |
| 202 | * @see gov. va.med.ima ging.excha nge.interf aces.IAppC onfigurati on#setNoLo sslessComp ression(bo olean) | |
| 203 | * / | |
| 204 | pu blic void setDecompr essionEnab led(boolea n enabled) { | |
| 205 | this .writeLock .lock(); | |
| 206 | try {this.deco mpressionE nabled = e nabled;} | |
| 207 | fina lly {this. writeLock. unlock();} | |
| 208 | } | |
| 209 | ||
| 210 | /* (non-Java doc) | |
| 211 | * @see gov. va.med.ima ging.excha nge.interf aces.IAppC onfigurati on#getSmtp ServerUri( ) | |
| 212 | * / | |
| 213 | pu blic URI g etSmtpServ erUri() { | |
| 214 | this .readLock. lock(); | |
| 215 | try {return th is.smtpSer verUri;} | |
| 216 | fina lly {this. readLock.u nlock();} | |
| 217 | } | |
| 218 | ||
| 219 | /* (non-Java doc) | |
| 220 | * @see gov. va.med.ima ging.excha nge.interf aces.IAppC onfigurati on#setSmtp ServerUri( java.net.U RI) | |
| 221 | * / | |
| 222 | pu blic void setSmtpSer verUri(URI uri) { | |
| 223 | this .writeLock .lock(); | |
| 224 | try {this.smtp ServerUri = uri;} | |
| 225 | fina lly {this. writeLock. unlock();} | |
| 226 | } | |
| 227 | ||
| 228 | /* (non-Java doc) | |
| 229 | * @see gov. va.med.ima ging.excha nge.interf aces.IAppC onfigurati on#getVixS oftwareVer sion() | |
| 230 | * / | |
| 231 | pu blic Strin g getVixSo ftwareVers ion() { | |
| 232 | this .readLock. lock(); | |
| 233 | try {return th is.vixSoft wareVersio n;} | |
| 234 | fina lly {this. readLock.u nlock();} | |
| 235 | } | |
| 236 | ||
| 237 | pu blic void setVixSoft wareVersio n(String v ixSoftware Version) { | |
| 238 | this .writeLock .lock(); | |
| 239 | try {this.vixS oftwareVer sion = vix SoftwareVe rsion;} | |
| 240 | fina lly {this. writeLock. unlock();} | |
| 241 | } | |
| 242 | ||
| 243 | /* (non-Java doc) | |
| 244 | * @see gov. va.med.ima ging.excha nge.interf aces.IAppC onfigurati on#getLoca lSiteNumbe r() | |
| 245 | * / | |
| 246 | pu blic Strin g getLocal SiteNumber () { | |
| 247 | this .readLock. lock(); | |
| 248 | try {return th is.localSi teNumber;} | |
| 249 | fina lly {this. readLock.u nlock();} | |
| 250 | } | |
| 251 | ||
| 252 | /* (non-Java doc) | |
| 253 | * @see gov. va.med.ima ging.excha nge.interf aces.IAppC onfigurati on#setLoca lSiteNumbe r(java.lan g.String) | |
| 254 | * / | |
| 255 | pu blic void setLocalSi teNumber(S tring site Number) { | |
| 256 | this .writeLock .lock(); | |
| 257 | try {this.loca lSiteNumbe r = siteNu mber;} | |
| 258 | fina lly {this. writeLock. unlock();} | |
| 259 | } | |
| 260 | ||
| 261 | // ---------- ---------- ---------- ----- | |
| 262 | // IAppConfi guration m ethods | |
| 263 | // ---------- ---------- ---------- ----- | |
| 264 | ||
| 265 | /* (non-Java doc) | |
| 266 | * @see gov. va.med.ima ging.excha nge.interf aces.IAppC onfigurati on#loadApp Configurat ionFromFil e() | |
| 267 | * / | |
| 268 | pu blic boole an loadApp Configurat ionFromFil e() { | |
| 269 | bool ean succes s = false; | |
| 270 | try | |
| 271 | { | |
| 272 | succes s = this.l oadAppConf igurationF romFile(th is.getAppC onfigurati onFilespec ()); // us es read lo ck | |
| 273 | } | |
| 274 | catc h (Applica tionConfig urationExc eption ex) {} | |
| 275 | retu rn success ; | |
| 276 | } | |
| 277 | ||
| 278 | /* (non-Java doc) | |
| 279 | * @see gov. va.med.ima ging.excha nge.interf aces.IAppC onfigurati on#saveApp Configurat ionToFile( ) | |
| 280 | * / | |
| 281 | pu blic boole an saveApp Configurat ionToFile( ) { | |
| 282 | bool ean succes s = false; | |
| 283 | XMLE ncoder xml Encoder = null; | |
| 284 | ||
| 285 | this .readLock. lock(); | |
| 286 | try | |
| 287 | { | |
| 288 | xmlEnc oder = new XMLEncode r(new Buff eredOutput Stream(new FileOutpu tStream(th is.getAppC onfigurati onFilespec ()))); | |
| 289 | // add a Persist enceDelega te for the URI class | |
| 290 | xmlEnc oder.setPe rsistenceD elegate(UR I.class, | |
| 291 | new Persis tenceDeleg ate() { | |
| 292 | @O verride | |
| 293 | pr otected Ex pression i nstantiate (Object ol dInstance, Encoder o ut) { | |
| 294 | retu rn new Exp ression(ol dInstance, oldInstanc e.getClass (),"new", new Object []{ oldIns tance.toSt ring() }); | |
| 295 | } | |
| 296 | }); | |
| 297 | xmlEnc oder.write Object(thi s); | |
| 298 | logger .info("App Configurat ion: confi guration s aved to: " + this.ge tAppConfig urationFil espec()); | |
| 299 | succes s = true; | |
| 300 | } | |
| 301 | catc h (Applica tionConfig urationExc eption ex) | |
| 302 | { | |
| 303 | logger .error(ex. getMessage ()); | |
| 304 | } | |
| 305 | catc h (FileNot FoundExcep tion ex) | |
| 306 | { | |
| 307 | logger .error("Ap pConfigura tion.saveA ppConfigur ationToFil e: " + ex. getMessage ()); | |
| 308 | } | |
| 309 | fina lly | |
| 310 | { | |
| 311 | this.r eadLock.un lock(); | |
| 312 | if (xm lEncoder ! = null) | |
| 313 | { | |
| 314 | xmlEncod er.close() ; | |
| 315 | } | |
| 316 | } | |
| 317 | ||
| 318 | retu rn success ; | |
| 319 | } | |
| 320 | ||
| 321 | /* * | |
| 322 | * @return t he vixConf igurationD irectory | |
| 323 | * / | |
| 324 | pu blic Strin g getVixCo nfiguratio nDirectory () throws Applicatio nConfigura tionExcept ion | |
| 325 | { | |
| 326 | Stri ng configD ir = null; | |
| 327 | this .readLock. lock(); | |
| 328 | try {configDir = this.vi xConfigura tionDirect ory;} | |
| 329 | fina lly {this. readLock.u nlock();} | |
| 330 | ||
| 331 | if ( configDir == null) | |
| 332 | { | |
| 333 | config Dir = Syst em.getenv( "vixconfig "); | |
| 334 | if (co nfigDir == null) | |
| 335 | { | |
| 336 | throw ne w Applicat ionConfigu rationExce ption("The vixconfig has not b een set.") ; | |
| 337 | // configDi r = this.g etBootstra pAppConfig urationDir ectory(); | |
| 338 | } | |
| 339 | ||
| 340 | this.s etVixConfi gurationDi rectory(co nfigDir); | |
| 341 | } | |
| 342 | retu rn configD ir; | |
| 343 | } | |
| 344 | ||
| 345 | // ---------- ---------- ---------- ---------- ---------- ---------- -------- | |
| 346 | // public me thods that are not p art of the IAppConfi guration i nterface | |
| 347 | // ---------- ---------- ---------- ---------- ---------- ---------- -------- | |
| 348 | ||
| 349 | /* * | |
| 350 | * @param fi leSpec - t he file th at contain s the appl ication co nfiguratio n | |
| 351 | * @return t rue if the configura tion was s ucessfully loaded fr om the fil e specifie d by appCo nfiguratio nFilespec | |
| 352 | * / | |
| 353 | pu blic boole an loadApp Configurat ionFromFil e(String f ileSpec) { | |
| 354 | bool ean succes s = false; | |
| 355 | XMLD ecoder xml Decoder = null; | |
| 356 | AppC onfigurati on appConf iguration = null; | |
| 357 | ||
| 358 | if ( fileSpec ! = null) | |
| 359 | { | |
| 360 | File c onfigFile = new File (fileSpec) ; | |
| 361 | if (co nfigFile.e xists()) | |
| 362 | { | |
| 363 | try | |
| 364 | { | |
| 365 | xmlDecoder = new XML Decoder(ne w Buffered InputStrea m(new File InputStrea m(fileSpec ))); // th rows FileN otFoundExc eption | |
| 366 | appConfigu ration = ( AppConfigu ration) xm lDecoder.r eadObject( ); | |
| 367 | if (appCon figuration != null) | |
| 368 | { | |
| 369 | th is.assignS tate(appCo nfiguratio n); // thi s method o btains a w rite lock | |
| 370 | lo gger.info( "AppConfig uration: l oaded Vix configurat ion from: " + fileSp ec); | |
| 371 | su ccess = tr ue; | |
| 372 | } | |
| 373 | } | |
| 374 | catch (F ileNotFoun dException ex) | |
| 375 | { | |
| 376 | logger.err or(ex.getM essage()); | |
| 377 | } | |
| 378 | catch (A rrayIndexO utOfBounds Exception ex) | |
| 379 | { | |
| 380 | logger.err or("AppCon figuration .loadAppCo nfiguratio nFromFile: ArrayInde xOutOfBoun dsExceptio n : " + ex .getMessag e()); | |
| 381 | } | |
| 382 | finally | |
| 383 | { | |
| 384 | if (xmlDec oder != nu ll) | |
| 385 | { | |
| 386 | xm lDecoder.c lose(); | |
| 387 | } | |
| 388 | } | |
| 389 | } | |
| 390 | } | |
| 391 | // p erform the bootStrap initializ ation of a ny propert y that has not alrea dy been in itialized. | |
| 392 | // this .loadBootS trapProper ties(); | |
| 393 | retu rn success ; | |
| 394 | } | |
| 395 | ||
| 396 | ||
| 397 | /* * | |
| 398 | * @param vi xConfigura tionDirect ory the vi xConfigura tionDirect ory to set | |
| 399 | * / | |
| 400 | pu blic void setVixConf igurationD irectory(S tring vixC onfigurati onDirector y) { | |
| 401 | this .writeLock .lock(); | |
| 402 | try {this.vixC onfigurati onDirector y = vixCon figuration Directory; } | |
| 403 | fina lly {this. writeLock. unlock();} | |
| 404 | } | |
| 405 | /* * | |
| 406 | * @param se t the full y qualifie d file tha t contains the persi sted state of this o bject - fo r use by u nit tests | |
| 407 | * / | |
| 408 | pu blic void setAppConf igurationF ilespec(St ring fileS pec) { | |
| 409 | this .writeLock .lock(); | |
| 410 | try {this.appC onfigurati onFilespec = fileSpe c;} | |
| 411 | fina lly {this. writeLock. unlock();} | |
| 412 | } | |
| 413 | ||
| 414 | /* * | |
| 415 | * @return t he fully q ualified f ile that c ontains th e persiste d state of this obje ct | |
| 416 | * / | |
| 417 | pu blic Strin g getAppCo nfiguratio nFilespec( ) throws A pplication Configurat ionExcepti on | |
| 418 | { | |
| 419 | Stri ng fileSpe c = null; | |
| 420 | this .readLock. lock(); | |
| 421 | try {fileSpec = this.app Configurat ionFilespe c;} | |
| 422 | fina lly {this. readLock.u nlock();} | |
| 423 | ||
| 424 | if ( fileSpec = = null) | |
| 425 | { | |
| 426 | fileSp ec = this. getVixConf igurationD irectory() ; | |
| 427 | // add the trail ing file s eparator c haracter i f necessar y | |
| 428 | if (!f ileSpec.en dsWith("\\ ") || !fil eSpec.ends With("/")) | |
| 429 | { | |
| 430 | fileSpec += "/"; | |
| 431 | } | |
| 432 | fileSp ec += APP_ CONFIG_FIL ENAME; | |
| 433 | ||
| 434 | this.s etAppConfi gurationFi lespec(fil eSpec); | |
| 435 | } | |
| 436 | ||
| 437 | retu rn fileSpe c; | |
| 438 | } | |
| 439 | ||
| 440 | /* * | |
| 441 | * @param vi xSoftwareV ersion - t he version of the Vi X software - for use by unit t ests | |
| 442 | * / | |
| 443 | // pu blic void setVixSoft wareVersio n(String v ixSoftware Version) | |
| 444 | // { | |
| 445 | // this .writeLock .lock(); | |
| 446 | // try {this.vixS oftwareVer sion = vix SoftwareVe rsion;} | |
| 447 | // fina lly {this. writeLock. unlock();} | |
| 448 | // } | |
| 449 | ||
| 450 | /* * | |
| 451 | * @param ap pConfig - the AppCon figuration object th at contain s the stat e to use | |
| 452 | * This publ ic method takes the state of t he passed appConfigu ration par am and ove rlays it o nto the cu rrent inst ance | |
| 453 | * / | |
| 454 | pu blic void assignStat e(AppConfi guration a ppConfigur ation) | |
| 455 | { | |
| 456 | if ( appConfigu ration != null) | |
| 457 | { | |
| 458 | this.w riteLock.l ock(); | |
| 459 | appCon figuration .readLock. lock(); | |
| 460 | try | |
| 461 | { | |
| 462 | // TODO: consider doing via inspection | |
| 463 | // Transie nt propert ies do not participa te | |
| 464 | // this.app Configurat ionFilespe c = appCon figuration .appConfig urationFil espec; | |
| 465 | // this.vix Configurat ionDirecto ry = appCo nfiguratio n.vixConfi gurationDi rectory; | |
| 466 | // this.vix Enabled = appConfigu ration.vix Enabled; | |
| 467 | // this.vix Configured = appConf iguration. vixConfigu red; | |
| 468 | this.cac hingEnable d = appCon figuration .cachingEn abled; | |
| 469 | this.dow nSamplingE nabled = a ppConfigur ation.down SamplingEn abled; | |
| 470 | this.noL osslessCom pression = appConfig uration.no LosslessCo mpression; | |
| 471 | this.dec ompression Enabled = appConfigu ration.dec ompression Enabled; | |
| 472 | this.loc alSiteNumb er = appCo nfiguratio n.localSit eNumber; | |
| 473 | this.smt pServerUri = appConf iguration. smtpServer Uri; | |
| 474 | this.vix SoftwareVe rsion = ap pConfigura tion.vixSo ftwareVers ion; | |
| 475 | this.sen sitivePati entBlocked = appConf iguration. sensitiveP atientBloc ked; | |
| 476 | } | |
| 477 | finall y | |
| 478 | { | |
| 479 | this.wri teLock.unl ock(); | |
| 480 | appConfi guration.r eadLock.un lock(); | |
| 481 | } | |
| 482 | } | |
| 483 | } | |
| 484 | ||
| 485 | // ---------- ---------- ---------- ----- | |
| 486 | // private m ethods | |
| 487 | // ---------- ---------- ---------- ----- | |
| 488 | ||
| 489 | /* * | |
| 490 | * Mark a be an propert y as trans ient so th at the Xml Encoder wi ll not inc lude it as part of t he | |
| 491 | * persisted state. | |
| 492 | * @param pr opertyName - the pro perty to m ark as tra nsient | |
| 493 | * @throws A pplication Configurat ionExcepti on | |
| 494 | * @see gov. va.med.ima ging.excha nge.config uration.Ap pConfigura tion#saveA ppConfigur ationToFil e() | |
| 495 | * @see gov. va.med.ima ging.excha nge.config uration.Ap pConfigura tion#loadA ppConfigur ationFromF ile() | |
| 496 | * / | |
| 497 | pr ivate void markPrope rtyAsTrans ient(Strin g property Name) thro ws Applica tionConfig urationExc eption | |
| 498 | { | |
| 499 | Bean Info info = null; | |
| 500 | bool ean proper tySet = fa lse; | |
| 501 | ||
| 502 | try { | |
| 503 | info = Introspec tor.getBea nInfo(this .getClass( )); | |
| 504 | Proper tyDescript or[] prope rtyDescrip tors = inf o.getPrope rtyDescrip tors(); | |
| 505 | for (i nt i = 0; i < proper tyDescript ors.length ; ++i) | |
| 506 | { | |
| 507 | Property Descriptor pd = prop ertyDescri ptors[i]; | |
| 508 | if (pd.g etName().e quals(prop ertyName)) | |
| 509 | { | |
| 510 | pd.setValu e("transie nt", Boole an.TRUE); | |
| 511 | propertySe t = true; | |
| 512 | break; | |
| 513 | } | |
| 514 | } | |
| 515 | if (!p ropertySet ) | |
| 516 | { | |
| 517 | throw ne w Applicat ionConfigu rationExce ption("mar kPropertyA sTransient : property not found : " + pro pertyName) ; | |
| 518 | } | |
| 519 | } | |
| 520 | catc h (Introsp ectionExce ption ex) { | |
| 521 | throw new Applic ationConfi gurationEx ception(ex .getMessag e()); | |
| 522 | } | |
| 523 | } | |
| 524 | ||
| 525 | /* | |
| 526 | * The follo wing metho d was gene rated by E clipse. If you regen erate this method, n ote that: | |
| 527 | * transient property appConfigu rationFile spec does not partic ipate. | |
| 528 | * transient property vixConfigu rationDire ctory does not parti cipate | |
| 529 | * all final members d o not part icipate | |
| 530 | * (non-Java doc) | |
| 531 | * @see java .lang.Obje ct#hashCod e() | |
| 532 | * / | |
| 533 | @O verride | |
| 534 | pu blic int h ashCode() { | |
| 535 | fina l int PRIM E = 31; | |
| 536 | int result = 1 ; | |
| 537 | this .readLock. lock(); | |
| 538 | try | |
| 539 | { | |
| 540 | result = PRIME * result + (cachingEn abled ? 12 31 : 1237) ; | |
| 541 | result = PRIME * result + (downSampl ingEnabled ? 1231 : 1237); | |
| 542 | result = PRIME * result + ((localSit eNumber == null) ? 0 : localSi teNumber.h ashCode()) ; | |
| 543 | result = PRIME * result + (noLossles sCompressi on ? 1231 : 1237); | |
| 544 | result = PRIME * result + (decompres sionEnable d ? 1231 : 1237); | |
| 545 | result = PRIME * result + (sensitive PatientBlo cked ? 123 1 : 1237); | |
| 546 | result = PRIME * result + ((smtpServ erUri == n ull) ? 0 : smtpServe rUri.hashC ode()); | |
| 547 | result = PRIME * result + ((vixSoftw areVersion == null) ? 0 : vixS oftwareVer sion.hashC ode()); | |
| 548 | } | |
| 549 | fina lly {this. readLock.u nlock();} | |
| 550 | retu rn result; | |
| 551 | } | |
| 552 | ||
| 553 | /* | |
| 554 | * The follo wing metho d was gene rated by E clipse. If you regen erate this method, n ote that: | |
| 555 | * transient property appConfigu rationFile spec does not partic ipate. | |
| 556 | * transient property vixConfigu rationDire ctory does not parti cipate | |
| 557 | * all final members d o not part icipate | |
| 558 | * (non-Java doc) | |
| 559 | * @see java .lang.Obje ct#equals( java.lang. Object) | |
| 560 | * / | |
| 561 | @O verride | |
| 562 | pu blic boole an equals( Object obj ) { | |
| 563 | this .readLock. lock(); | |
| 564 | try | |
| 565 | { | |
| 566 | if (th is == obj) | |
| 567 | return t rue; | |
| 568 | if (ob j == null) | |
| 569 | return f alse; | |
| 570 | if (ge tClass() ! = obj.getC lass()) | |
| 571 | return f alse; | |
| 572 | final AppConfigu ration oth er = (AppC onfigurati on) obj; | |
| 573 | if (ca chingEnabl ed != othe r.cachingE nabled) | |
| 574 | return f alse; | |
| 575 | if (do wnSampling Enabled != other.dow nSamplingE nabled) | |
| 576 | return f alse; | |
| 577 | if (lo calSiteNum ber == nul l) { | |
| 578 | if (othe r.localSit eNumber != null) | |
| 579 | return fal se; | |
| 580 | } else if (!loca lSiteNumbe r.equals(o ther.local SiteNumber )) | |
| 581 | return f alse; | |
| 582 | if (no LosslessCo mpression != other.n oLosslessC ompression ) | |
| 583 | return f alse; | |
| 584 | if (de compressio nEnabled ! = other.de compressio nEnabled) | |
| 585 | return f alse; | |
| 586 | if (se nsitivePat ientBlocke d != other .sensitive PatientBlo cked) | |
| 587 | return f alse; | |
| 588 | if (sm tpServerUr i == null) { | |
| 589 | if (othe r.smtpServ erUri != n ull) | |
| 590 | return fal se; | |
| 591 | } else if (!smtp ServerUri. equals(oth er.smtpSer verUri)) | |
| 592 | return f alse; | |
| 593 | if (vi xSoftwareV ersion == null) { | |
| 594 | if (othe r.vixSoftw areVersion != null) | |
| 595 | return fal se; | |
| 596 | } else if (!vixS oftwareVer sion.equal s(other.vi xSoftwareV ersion)) | |
| 597 | return f alse; | |
| 598 | return true; | |
| 599 | } | |
| 600 | fina lly {this. readLock.u nlock();} | |
| 601 | } | |
| 602 | ||
| 603 | @O verride | |
| 604 | pu blic Strin g getVistA ImagingVer sionRequir ed() | |
| 605 | throws Applicati onConfigur ationExcep tion { | |
| 606 | this .readLock. lock(); | |
| 607 | try {return th is.vistaIm agingVersi onRequired ;} | |
| 608 | fina lly {this. readLock.u nlock();} | |
| 609 | } | |
| 610 | ||
| 611 | @O verride | |
| 612 | pu blic void setVistAIm agingVersi onRequired (String ve rsion) { | |
| 613 | this .writeLock .lock(); | |
| 614 | try {this.vist aImagingVe rsionRequi red = vers ion;} | |
| 615 | fina lly {this. writeLock. unlock();} | |
| 616 | } | |
| 617 | ||
| 618 | } | |
| 619 |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.