Produced by Araxis Merge on 7/3/2018 11:43:24 AM 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 | Tue Jul 3 16:43:24 2018 UTC | ||
| 2 | eHealth_v8.2.0_build_8.2.0.1.zip\NHIN_adapter\AdapterBundle\target\archive-tmp\fileSetFormatter.228405665.tmp\VistALinkSetup\VistALinkSetup.jar\gov\va\med\nhin\adapter\vistalinksetup | VistALinkSetup.java | Fri Jun 29 20:36:28 2018 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 0 | 0 |
| Changed | 0 | 0 |
| Inserted | 1 | 142 |
| 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 | * To chan ge this te mplate, ch oose Tools | Templat es | |||||
| 3 | * and ope n the temp late in th e editor. | |||||
| 4 | */ | |||||
| 5 | package go v.va.med.n hin.adapte r.vistalin ksetup; | |||||
| 6 | ||||||
| 7 | import jav a.io.*; | |||||
| 8 | import jav a.util.*; | |||||
| 9 | import jav a.util.reg ex.*; | |||||
| 10 | ||||||
| 11 | import jav ax.xml.par sers.*; | |||||
| 12 | import jav ax.xml.xpa th.*; | |||||
| 13 | ||||||
| 14 | import org .w3c.dom.* ; | |||||
| 15 | ||||||
| 16 | /** | |||||
| 17 | * | |||||
| 18 | * @author PII | |||||
| 19 | */ | |||||
| 20 | public cla ss VistALi nkSetup | |||||
| 21 | { | |||||
| 22 | /** | |||||
| 23 | * @pa ram args t he command line argu ments | |||||
| 24 | */ | |||||
| 25 | static public vo id main(St ring[] arg s) | |||||
| 26 | { | |||||
| 27 | tr y { | |||||
| 28 | Properti es propert ies = new Properties (); | |||||
| 29 | properti es.load(ne w FileRead er("config /VistALink Setup.prop erties")); | |||||
| 30 | ||||||
| 31 | String v istALinkCo nnectorCon figFileNam e = proper ties.getPr operty("vi stALinkCon nectorConf igFileName "); | |||||
| 32 | String r aTemplateD ir = prope rties.getP roperty("r aTemplateD ir"); | |||||
| 33 | String r aStageDir = properti es.getProp erty("raSt ageDir"); | |||||
| 34 | ||||||
| 35 | String[] connector JNDINames = getConne ctorJNDINa mes(vistAL inkConnect orConfigFi leName); | |||||
| 36 | ||||||
| 37 | for (Str ing connec torJNDINam e : connec torJNDINam es) { | |||||
| 38 | Stri ng connect orName = m akeConnect orName(con nectorJNDI Name); | |||||
| 39 | copy TemplateTo Stage(raTe mplateDir, raStageDi r, connect orName); | |||||
| 40 | fixC onfigurati on(raStage Dir, conne ctorName, connectorJ NDIName); | |||||
| 41 | } | |||||
| 42 | } | |||||
| 43 | ca tch (Throw able t) { | |||||
| 44 | System.o ut.println ("Unrecove rable Erro r!"); | |||||
| 45 | t.printS tackTrace( ); | |||||
| 46 | } | |||||
| 47 | } | |||||
| 48 | ||||||
| 49 | static private S tring[] ge tConnector JNDINames( String con nectorConf igFileName ) | |||||
| 50 | throws E xception | |||||
| 51 | { | |||||
| 52 | Li st<String> ret = new ArrayList <String>() ; | |||||
| 53 | ||||||
| 54 | Do cumentBuil derFactory dbf = Doc umentBuild erFactory. newInstanc e(); | |||||
| 55 | Do cumentBuil der db = d bf.newDocu mentBuilde r(); | |||||
| 56 | Do cument doc = db.pars e(connecto rConfigFil eName); | |||||
| 57 | ||||||
| 58 | XP athFactory xpathFact ory = XPat hFactory.n ewInstance (); | |||||
| 59 | XP ath xpath = xpathFac tory.newXP ath(); | |||||
| 60 | No deList nod eList = (N odeList)xp ath.evalua te("connec tors/conne ctor/@jndi Name", doc , XPathCon stants.NOD ESET); | |||||
| 61 | ||||||
| 62 | fo r (int i = 0; i < no deList.get Length(); ++i) { | |||||
| 63 | Node nod e = nodeLi st.item(i) ; | |||||
| 64 | ret.add( node.getNo deValue()) ; | |||||
| 65 | } | |||||
| 66 | ||||||
| 67 | re turn ret.t oArray(new String[]{ }); | |||||
| 68 | } | |||||
| 69 | ||||||
| 70 | static private S tring make ConnectorN ame(String connector JNDIName) | |||||
| 71 | { | |||||
| 72 | re turn conne ctorJNDINa me.replace ("/", ""); | |||||
| 73 | } | |||||
| 74 | ||||||
| 75 | static private v oid copyTe mplateToSt age(String templateD ir, String stageDir, String co nnectorNam e) | |||||
| 76 | throws E xception | |||||
| 77 | { | |||||
| 78 | Fi le source = new File (templateD ir); | |||||
| 79 | Fi le dest = new File(s tageDir + File.separ ator + con nectorName ); | |||||
| 80 | Fi le stage = new File( stageDir); | |||||
| 81 | ||||||
| 82 | if (!stage.e xists()) { | |||||
| 83 | stage.mk dir(); | |||||
| 84 | } | |||||
| 85 | ||||||
| 86 | co pyDirector y(source, dest); | |||||
| 87 | } | |||||
| 88 | ||||||
| 89 | static private v oid copyDi rectory(Fi le sourceL ocation, F ile target Location) | |||||
| 90 | throws I OException | |||||
| 91 | { | |||||
| 92 | ||||||
| 93 | if (sourceLo cation.isD irectory() ) { | |||||
| 94 | if (!tar getLocatio n.exists() ) { | |||||
| 95 | targ etLocation .mkdir(); | |||||
| 96 | } | |||||
| 97 | ||||||
| 98 | String[] children = sourceLo cation.lis t(); | |||||
| 99 | for (int i = 0; i < children .length; i ++) { | |||||
| 100 | copy Directory( new File(s ourceLocat ion, child ren[i]), | |||||
| 101 | new File(t argetLocat ion, child ren[i])); | |||||
| 102 | } | |||||
| 103 | } | |||||
| 104 | el se { | |||||
| 105 | InputStr eam in = n ew FileInp utStream(s ourceLocat ion); | |||||
| 106 | OutputSt ream out = new FileO utputStrea m(targetLo cation); | |||||
| 107 | ||||||
| 108 | // Copy the bits f rom instre am to outs tream | |||||
| 109 | byte[] b uf = new b yte[1024]; | |||||
| 110 | int len; | |||||
| 111 | while (( len = in.r ead(buf)) > 0) { | |||||
| 112 | out. write(buf, 0, len); | |||||
| 113 | } | |||||
| 114 | in.close (); | |||||
| 115 | out.clos e(); | |||||
| 116 | } | |||||
| 117 | } | |||||
| 118 | ||||||
| 119 | static private v oid fixCon figuration (String st ageDir, St ring conne ctorName, String jnd iName) | |||||
| 120 | throws E xception | |||||
| 121 | { | |||||
| 122 | Fi le configD ir = new F ile(stageD ir + File. separator + connecto rName + Fi le.separat or + "META -INF"); | |||||
| 123 | Fi le configF ile = new File(confi gDir, "web logic-ra.x ml"); | |||||
| 124 | Fi le tempFil e = File.c reateTempF ile("out", ".xml", c onfigDir); | |||||
| 125 | ||||||
| 126 | Bu fferedRead er in = ne w Buffered Reader(new FileReade r(configFi le)); | |||||
| 127 | Bu fferedWrit er out = n ew Buffere dWriter(ne w FileWrit er(tempFil e)); | |||||
| 128 | ||||||
| 129 | wh ile (in.re ady()) { | |||||
| 130 | String l ine = in.r eadLine(); | |||||
| 131 | String r eplacement = line.re placeAll(" \\$\\{vlj\ \.jndi\\.n ame\\}", j ndiName); | |||||
| 132 | out.writ e(replacem ent); | |||||
| 133 | out.writ e("\n"); | |||||
| 134 | } | |||||
| 135 | ||||||
| 136 | in .close(); | |||||
| 137 | ou t.close(); | |||||
| 138 | ||||||
| 139 | co nfigFile.d elete(); | |||||
| 140 | te mpFile.ren ameTo(conf igFile); | |||||
| 141 | } | |||||
| 142 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.