Produced by Araxis Merge on 7/6/2017 8:23:02 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.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | OSCIF_CTT_v4_build 1.zip\ISAAC-rest\src\main\java\gov\vha\isaac\rest\session | PrismeServiceUtils.java | Wed May 31 03:58:36 2017 UTC |
| 2 | OSCIF_CTT_v4_build 1.zip\ISAAC-rest\src\main\java\gov\vha\isaac\rest\session | PrismeServiceUtils.java | Mon Jul 3 21:59:18 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 330 |
| Changed | 1 | 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 | * Copyrig ht Notice | |
| 3 | * | |
| 4 | * This is a work of the U.S. Government and is no t subject to copyrig ht | |
| 5 | * protect ion in the United St ates. Fore ign copyri ghts may a pply. | |
| 6 | * | |
| 7 | * License d under th e Apache L icense, Ve rsion 2.0 (the "Lice nse"); | |
| 8 | * you may not use t his file e xcept in c ompliance with the L icense. | |
| 9 | * You may obtain a copy of th e License at | |
| 10 | * | |
| 11 | * http:// www.apache .org/licen ses/LICENS E-2.0 | |
| 12 | * | |
| 13 | * Unless required b y applicab le law or agreed to in writing , software | |
| 14 | * distrib uted under the Licen se is dist ributed on an "AS IS " BASIS, | |
| 15 | * WITHOUT WARRANTIE S OR CONDI TIONS OF A NY KIND, e ither expr ess or imp lied. | |
| 16 | * See the License f or the spe cific lang uage gover ning permi ssions and | |
| 17 | * limitat ions under the Licen se. | |
| 18 | */ | |
| 19 | ||
| 20 | package go v.vha.isaa c.rest.ses sion; | |
| 21 | ||
| 22 | import jav a.io.Input Stream; | |
| 23 | import jav a.net.URL; | |
| 24 | import jav a.util.Has hMap; | |
| 25 | import jav a.util.Map ; | |
| 26 | import jav a.util.Pro perties; | |
| 27 | ||
| 28 | import jav ax.ws.rs.c lient.Enti ty; | |
| 29 | import jav ax.ws.rs.c lient.WebT arget; | |
| 30 | import jav ax.ws.rs.c ore.Respon se; | |
| 31 | ||
| 32 | import org .apache.lo gging.log4 j.LogManag er; | |
| 33 | import org .apache.lo gging.log4 j.Logger; | |
| 34 | ||
| 35 | import gov .vha.isaac .ochre.api .LookupSer vice; | |
| 36 | ||
| 37 | /** | |
| 38 | * | |
| 39 | * {@link PrismeServ iceUtils} | |
| 40 | * | |
| 41 | * @author <a href=" mailto:joe l.kniaz.li st@gmail.c om">Joel K niaz</a> | |
| 42 | * | |
| 43 | */ | |
| 44 | public cla ss PrismeS erviceUtil s { | |
| 45 | pr ivate stat ic Logger log = LogM anager.get Logger(Pri smeService Utils.clas s); | |
| 46 | ||
| 47 | pr ivate stat ic Propert ies prisme Properties _ = null; | |
| 48 | ||
| 49 | pr ivate Pris meServiceU tils() {} | |
| 50 | ||
| 51 | /* * | |
| 52 | * Return a Properties object wh ich contai ns the PRI SME proper ties. | |
| 53 | * Empty if prisme.pro perties no t found. N ever retur ns null. | |
| 54 | * | |
| 55 | */ | |
| 56 | pu blic stati c Properti es getPris meProperti es() | |
| 57 | { | |
| 58 | // #if prisme.pro perties is present p risme must be up! | |
| 59 | // #edi ts here re quire a re start to y our Komet instance | |
| 60 | // #Edi t prisme_r oot to use prisme fo r roles. | |
| 61 | // #pri sme_root=h ttp://loca lhost:8080 /rails_pri sme | |
| 62 | // #pri sme_all_ro les_url=ht tps://loca lhost:443/ roles/get_ all_roles. json | |
| 63 | // #pri sme_roles_ user_url=h ttps://loc alhost:443 /roles/get _user_role s.json | |
| 64 | // #pri sme_roles_ ssoi_url=h ttps://loc alhost:443 /roles/get _ssoi_role s.json | |
| 65 | // #pri sme_roles_ by_token_u rl=https:/ /localhost :443/roles /get_roles _by_token. json | |
| 66 | // #pri sme_config _url=https ://localho st:443/uti lities/pri sme_config .json | |
| 67 | // #Edi t this to true to de fault to t he prisme instead of the test roles test harness. | |
| 68 | // #war _group_id= gov.vha.is aac.gui.ra ils | |
| 69 | // #war _artifact_ id=rails_k omet | |
| 70 | // #war _version=1 .11 | |
| 71 | // #war _repo=rele ases | |
| 72 | // #war _classifie r=a | |
| 73 | // #war _package=w ar | |
| 74 | // #isaac_roo t=https:// DNS : PORT | |
| 75 | // #prisme_no tify_url=h ttp://loca lhost: PORT /log_event ?security_ token=%5B% 22u%5Cf%5C x92%5CxBC% 5Cx17%7D%5 CxD1%5CxE4 %5CxFB%5Cx E5%5Cx99%5 CxA3%5C%22 %5CxE8%5C% 5CK%22%2C+ %22%3E%5Cx 16%5CxDE%5 CxA8v%5Cx1 4%5CxFF%5C xD2%5CxC6% 5CxDD%5CxA D%5Cx9F%5C x1D%5CxD1c F%22%5D | |
| 76 | ||
| 77 | if ( prismeProp erties_ == null) { | |
| 78 | InputS tream stre am = null; | |
| 79 | try { | |
| 80 | Properti es props = new Prope rties(); | |
| 81 | final UR L properti esFile = P rismeServi ceUtils.cl ass.getRes ource("/pr isme.prope rties"); | |
| 82 | ||
| 83 | stream = PrismeSer viceUtils. class.getR esourceAsS tream("/pr isme.prope rties"); | |
| 84 | ||
| 85 | if (stre am == null ) | |
| 86 | { | |
| 87 | log.debug( "No prisme .propertie s file was found on the classp ath"); | |
| 88 | } | |
| 89 | else | |
| 90 | { | |
| 91 | log.info(" Reading PR ISME confi guration f rom prisme .propertie s file " + propertie sFile); | |
| 92 | props.load (stream); | |
| 93 | } | |
| 94 | ||
| 95 | prismePr operties_ = props; | |
| 96 | } | |
| 97 | catch (Exception e) | |
| 98 | { | |
| 99 | String m sg = "Unex pected err or trying to read pr operties f rom the pr isme.prope rties file "; | |
| 100 | log.erro r(msg, e); | |
| 101 | throw ne w RuntimeE xception(m sg, e); | |
| 102 | } | |
| 103 | finall y { | |
| 104 | if (stre am != null ) { | |
| 105 | try { | |
| 106 | st ream.close (); | |
| 107 | } catch (E xception e ) { | |
| 108 | // ignore | |
| 109 | } | |
| 110 | } | |
| 111 | } | |
| 112 | } | |
| 113 | ||
| 114 | retu rn prismeP roperties_ ; | |
| 115 | } | |
| 116 | ||
| 117 | pu blic stati c String g etTargetFr omUrl(URL url) { | |
| 118 | Stri ngBuilder target = n ew StringB uilder(); | |
| 119 | targ et.append( url.getPro tocol()); | |
| 120 | targ et.append( "://"); | |
| 121 | targ et.append( url.getHos t()); | |
| 122 | if ( url.getPor t() > 0) { | |
| 123 | target .append(": " + url.ge tPort()); | |
| 124 | } | |
| 125 | ||
| 126 | retu rn target. toString() ; | |
| 127 | } | |
| 128 | ||
| 129 | st atic Strin g postJson ToPrisme(W ebTarget t argetWithP ath, Strin g json) { | |
| 130 | retu rn postJso nToPrisme( targetWith Path, json , (Map<Str ing, Strin g>)null); | |
| 131 | } | |
| 132 | st atic Strin g postJson ToPrisme(W ebTarget t argetWithP ath, Strin g json, Ma p<String, String> pa rams) { | |
| 133 | if ( params != null) { | |
| 134 | for (M ap.Entry<S tring, Str ing> entry : params. entrySet() ) { | |
| 135 | targetWi thPath = t argetWithP ath.queryP aram(entry .getKey(), entry.get Value()); | |
| 136 | } | |
| 137 | } | |
| 138 | Resp onse respo nse = targ etWithPath .request() .post(Enti ty.json(js on)); | |
| 139 | ||
| 140 | Stri ng respons eJson = re sponse.rea dEntity(St ring.class ); | |
| 141 | ||
| 142 | retu rn respons eJson; | |
| 143 | } | |
| 144 | ||
| 145 | st atic Strin g getResul tJsonFromP risme(WebT arget targ etWithPath , Map<Stri ng, String > params) { | |
| 146 | for (Map.Entry <String, S tring> ent ry : param s.entrySet ()) { | |
| 147 | target WithPath = targetWit hPath.quer yParam(ent ry.getKey( ), entry.g etValue()) ; | |
| 148 | } | |
| 149 | Resp onse respo nse = targ etWithPath .request() .get(); | |
| 150 | ||
| 151 | Stri ng respons eJson = re sponse.rea dEntity(St ring.class ); | |
| 152 | ||
| 153 | retu rn respons eJson; | |
| 154 | } | |
| 155 | ||
| 156 | st atic Strin g getResul tJsonFromP risme(Stri ng targetS tr, String pathStr, Map<String , String> params) { | |
| 157 | Clie ntService clientServ ice = Look upService. getService (ClientSer vice.class ); | |
| 158 | WebT arget targ et = clien tService.g etClient() .target(ta rgetStr); | |
| 159 | targ et = targe t.path(pat hStr); | |
| 160 | ||
| 161 | retu rn getResu ltJsonFrom Prisme(tar get, param s); | |
| 162 | } | |
| 163 | ||
| 164 | st atic Strin g getResul tJsonFromP risme(Stri ng targetS tr, String pathStr) { | |
| 165 | retu rn getResu ltJsonFrom Prisme(tar getStr, pa thStr, new HashMap<> ()); | |
| 166 | } | |
| 167 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.