Produced by Araxis Merge on 12/5/2017 12:06:36 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\CacheWeb\src\gov\va\med\cache\rest | DumpCacheServlet.java | Mon Dec 4 21:34:08 2017 UTC |
| 2 | IV-eHMP_CIF.zip\IMAG_Source\VISA\Java\CacheWeb\src\gov\va\med\cache\rest | DumpCacheServlet.java | Mon Dec 4 21:58:05 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 460 |
| Changed | 1 | 2 |
| 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 | package go v.va.med.c ache.rest; | |
| 2 | ||
| 3 | import gov .va.med.ca che.gui.se rver.Imagi ngCacheMan agementSer viceImpl; | |
| 4 | import gov .va.med.ca che.gui.sh ared.CACHE _POPULATIO N_DEPTH; | |
| 5 | import gov .va.med.ca che.gui.sh ared.Cache ItemPath; | |
| 6 | import gov .va.med.ca che.gui.sh ared.Cache VO; | |
| 7 | import gov .va.med.ca che.gui.sh ared.Group VO; | |
| 8 | import gov .va.med.ca che.gui.sh ared.Insta nceVO; | |
| 9 | import gov .va.med.ca che.gui.sh ared.Regio nVO; | |
| 10 | ||
| 11 | import jav a.io.IOExc eption; | |
| 12 | import jav a.io.Print Writer; | |
| 13 | import jav a.net.URL; | |
| 14 | import jav a.util.Ite rator; | |
| 15 | import jav a.util.Lis t; | |
| 16 | ||
| 17 | import jav ax.servlet .ServletEx ception; | |
| 18 | import jav ax.servlet .http.Http ServletReq uest; | |
| 19 | import jav ax.servlet .http.Http ServletRes ponse; | |
| 20 | ||
| 21 | /** | |
| 22 | * | |
| 23 | * @author
|
|
| 24 | * | |
| 25 | */ | |
| 26 | public cla ss DumpCac heServlet | |
| 27 | extends Ht tpMethodHa ckServlet | |
| 28 | { | |
| 29 | pr ivate stat ic final l ong serial VersionUID = 1L; | |
| 30 | pr ivate Imag ingCacheMa nagementSe rviceImpl imagingCac he = null; | |
| 31 | // private fi nal Logger logger = LogManager .getLogger (this.getC lass()); | |
| 32 | ||
| 33 | /* * | |
| 34 | * Construct or of the object. | |
| 35 | * / | |
| 36 | pu blic DumpC acheServle t() | |
| 37 | { | |
| 38 | supe r(); | |
| 39 | } | |
| 40 | ||
| 41 | /* * | |
| 42 | * Initializ ation of t he servlet . <br> | |
| 43 | * | |
| 44 | * @throws S ervletExce ption if a n error oc curs | |
| 45 | * / | |
| 46 | pu blic void init() | |
| 47 | th rows Servl etExceptio n | |
| 48 | { | |
| 49 | imag ingCache = new Imagi ngCacheMan agementSer viceImpl() ; | |
| 50 | } | |
| 51 | ||
| 52 | /* * | |
| 53 | * The doGet method of the servl et. <br> | |
| 54 | * | |
| 55 | * @param re quest the request se nd by the client to the server | |
| 56 | * @param re sponse the response send by th e server t o the clie nt | |
| 57 | * @throws S ervletExce ption if a n error oc curred | |
| 58 | * @throws I OException if an err or occurre d | |
| 59 | * / | |
| 60 | pu blic void doGet(Http ServletReq uest reque st, HttpSe rvletRespo nse respon se) | |
| 61 | th rows Servl etExceptio n, IOExcep tion | |
| 62 | { | |
| 63 | //Ca cheItemPat h startPat h = CacheI temPath.bu ildCacheIt emPath(req uest); | |
| 64 | Stri ng myPath = request. getServlet Path(); | |
| 65 | ||
| 66 | CACH E_POPULATI ON_DEPTH d epth = CAC HE_POPULAT ION_DEPTH. INSTANCE; | |
| 67 | Stri ng request edMaxDepth = request .getParame ter("level "); | |
| 68 | if(r equestedMa xDepth != null) | |
| 69 | depth = CACHE_PO PULATION_D EPTH.value Of(request edMaxDepth ); | |
| 70 | ||
| 71 | resp onse.addHe ader("Cach e-Control" , "no-cach e"); | |
| 72 | resp onse.addHe ader("Prag ma", "no-c ache"); | |
| 73 | ||
| 74 | Prin tWriter ou t = respon se.getWrit er(); | |
| 75 | ||
| 76 | Cach eWriter ca cheWriter = new Cach eItemHtmlW riter(out, myPath); | |
| 77 | resp onse.setCo ntentType( cacheWrite r.getMedia Type()); | |
| 78 | ||
| 79 | cach eWriter.wr iteStartTa g(); | |
| 80 | dump Caches(cac heWriter, depth); | |
| 81 | cach eWriter.wr iteEndTag( ); | |
| 82 | ||
| 83 | out. flush(); | |
| 84 | out. close(); | |
| 85 | } | |
| 86 | ||
| 87 | /* * | |
| 88 | * | |
| 89 | * / | |
| 90 | @O verride | |
| 91 | pr otected vo id doDelet e(HttpServ letRequest request, HttpServle tResponse response) | |
| 92 | th rows Servl etExceptio n, IOExcep tion | |
| 93 | { | |
| 94 | Cach eItemPath itemPath = Identifie rUtility.c reate(requ est); | |
| 95 | ||
| 96 | Prin tWriter ou t = respon se.getWrit er(); | |
| 97 | ||
| 98 | if(i temPath.ge tCacheName () == null ) | |
| 99 | throw new Servle tException ("The cach e name mus t be inclu ded to del ete an ite m"); | |
| 100 | if(i temPath.ge tRegionNam e() == nul l) | |
| 101 | throw new Servle tException ("The regi on name mu st be incl uded to de lete an it em"); | |
| 102 | if(i temPath.ge tGroupName s() == nul l || itemP ath.getGro upNames(). length < 1 ) | |
| 103 | throw new Servle tException ("The grou p name(s) must be in cluded to delete an item"); | |
| 104 | ||
| 105 | Cach eItemPath deletedPat h = null; | |
| 106 | if(i temPath.ge tInstanceN ame() != n ull) | |
| 107 | delete dPath = de leteInstan ce(itemPat h.getCache Name(), it emPath.get RegionName (), itemPa th.getGrou pNames(), itemPath.g etInstance Name()); | |
| 108 | else | |
| 109 | delete dPath = de leteGroup( itemPath.g etCacheNam e(), itemP ath.getReg ionName(), itemPath. getGroupNa mes()); | |
| 110 | ||
| 111 | if(d eletedPath != null) | |
| 112 | out.pr intln("Del eted " + d eletedPath .toString( )); | |
| 113 | ||
| 114 | resp onse.setSt atus(303); // r esponse ca n be found at the gi ven URI | |
| 115 | URL redirectUr l = new UR L(request. getScheme( ), request .getServer Name(), re quest.getS erverPort( ), request .getContex tPath() + request.ge tServletPa th()); | |
| 116 | resp onse.setHe ader("Loca tion", red irectUrl.t oExternalF orm()); // redirect back to ou rselves | |
| 117 | } | |
| 118 | ||
| 119 | /* * | |
| 120 | * | |
| 121 | * @param ou t | |
| 122 | * @param ma xDepth | |
| 123 | * / | |
| 124 | pr ivate void dumpCache s(CacheWri ter writer , CACHE_PO PULATION_D EPTH maxDe pth) | |
| 125 | { | |
| 126 | List <CacheVO> caches = i magingCach e.getCache List(CACHE _POPULATIO N_DEPTH.IN STANCE, CA CHE_POPULA TION_DEPTH .CACHE); | |
| 127 | ||
| 128 | for( Iterator<C acheVO> it r = caches .iterator( ); itr.has Next(); ) | |
| 129 | { | |
| 130 | CacheV O cache = itr.next() ; | |
| 131 | dumpCa che(writer , cache, m axDepth); | |
| 132 | } | |
| 133 | } | |
| 134 | ||
| 135 | /* * | |
| 136 | * | |
| 137 | * @param wr iter | |
| 138 | * @param ca che | |
| 139 | * @param ma xDepth | |
| 140 | * / | |
| 141 | pr ivate void dumpCache (CacheWrit er writer, CacheVO c ache, CACH E_POPULATI ON_DEPTH m axDepth) | |
| 142 | { | |
| 143 | writ er.writeSt artTag(cac he); | |
| 144 | ||
| 145 | if(C ACHE_POPUL ATION_DEPT H.REGION.c ompareTo(m axDepth) < = 0) | |
| 146 | for(Re gionVO reg ion : cach e.getRegio ns()) | |
| 147 | dumpRegi on(writer, cache, re gion, maxD epth); | |
| 148 | writ er.writeEn dTag(cache ); | |
| 149 | } | |
| 150 | ||
| 151 | /* * | |
| 152 | * | |
| 153 | * @param wr iter | |
| 154 | * @param ca che | |
| 155 | * @param re gion | |
| 156 | * @param ma xDepth | |
| 157 | * / | |
| 158 | pr ivate void dumpRegio n(CacheWri ter writer , CacheVO cache, Reg ionVO regi on, CACHE_ POPULATION _DEPTH max Depth) | |
| 159 | { | |
| 160 | writ er.writeSt artTag(cac he, region ); | |
| 161 | if(C ACHE_POPUL ATION_DEPT H.GROUP0.c ompareTo(m axDepth) < = 0) | |
| 162 | for(Gr oupVO grou p : region .getChildr en()) | |
| 163 | dumpGrou p(writer, cache, reg ion, new G roupVO[]{g roup}, max Depth, CAC HE_POPULAT ION_DEPTH. GROUP0); | |
| 164 | writ er.writeEn dTag(cache , region); | |
| 165 | } | |
| 166 | ||
| 167 | /* * | |
| 168 | * | |
| 169 | * @param wr iter | |
| 170 | * @param ca che | |
| 171 | * @param re gion | |
| 172 | * @param gr oups | |
| 173 | * @param ma xDepth | |
| 174 | * @param cu rrentDepth | |
| 175 | * / | |
| 176 | pr ivate void dumpGroup (CacheWrit er writer, CacheVO c ache, Regi onVO regio n, GroupVO [] groups, CACHE_POP ULATION_DE PTH maxDep th, CACHE_ POPULATION _DEPTH cur rentDepth) | |
| 177 | { | |
| 178 | writ er.writeSt artTag(cac he, region , groups); | |
| 179 | ||
| 180 | Grou pVO subjec tGroup = g roups[grou ps.length - 1]; | |
| 181 | ||
| 182 | if(C ACHE_POPUL ATION_DEPT H.INSTANCE .compareTo (maxDepth) <= 0) | |
| 183 | for(In stanceVO i nstance : subjectGro up.getInst ances()) | |
| 184 | { | |
| 185 | writer.w riteStartT ag(cache, region, gr oups, inst ance); | |
| 186 | writer.w riteEndTag (cache, re gion, grou ps, instan ce); | |
| 187 | } | |
| 188 | ||
| 189 | if(c urrentDept h.compareT o(maxDepth ) <= 0) | |
| 190 | for(Gr oupVO chil dGroup : s ubjectGrou p.getGroup s()) | |
| 191 | { | |
| 192 | GroupVO[ ] ancestry Groups = a ppend(grou ps, childG roup); | |
| 193 | dumpGrou p(writer, cache, reg ion, ances tryGroups, maxDepth, CACHE_POP ULATION_DE PTH.GROUP0 ); | |
| 194 | } | |
| 195 | writ er.writeEn dTag(cache , region, groups); | |
| 196 | } | |
| 197 | ||
| 198 | pr ivate Grou pVO[] appe nd(GroupVO [] groups, GroupVO g roup) | |
| 199 | { | |
| 200 | // b uild an ar ray that i ncludes ch ildGroup a s the last group | |
| 201 | // t hen make a call to d umpGroup() , which ca lls this m ethod agai n, | |
| 202 | // m aking thes e recursiv e calls | |
| 203 | Grou pVO[] chil dGroupAnce stry = new GroupVO[g roups.leng th + 1]; | |
| 204 | Syst em.arrayco py(groups, 0, childG roupAncest ry, 0, gro ups.length ); | |
| 205 | chil dGroupAnce stry[child GroupAnces try.length -1] = grou p; | |
| 206 | ||
| 207 | retu rn childGr oupAncestr y; | |
| 208 | } | |
| 209 | ||
| 210 | pr ivate Cach eItemPath deleteGrou p(String c acheName, String reg ionName, S tring[] gr oupsName) | |
| 211 | { | |
| 212 | Cach eItemPath groupPath = new Cach eItemPath( cacheName, regionNam e, groupsN ame); | |
| 213 | ||
| 214 | retu rn imaging Cache.dele teGroup(gr oupPath); | |
| 215 | } | |
| 216 | ||
| 217 | pr ivate Cach eItemPath deleteInst ance(Strin g cacheNam e, String regionName , String[] groupsNam e, String instanceNa me) | |
| 218 | { | |
| 219 | Cach eItemPath instancePa th = new C acheItemPa th(cacheNa me, region Name, grou psName, in stanceName ); | |
| 220 | ||
| 221 | retu rn imaging Cache.dele teInstance (instanceP ath); | |
| 222 | } | |
| 223 | ||
| 224 | /* * | |
| 225 | * Destructi on of the servlet. < br> | |
| 226 | * / | |
| 227 | pu blic void destroy() | |
| 228 | { | |
| 229 | supe r.destroy( ); | |
| 230 | } | |
| 231 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.