Produced by Araxis Merge on 6/5/2018 10:24:07 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 | patch_205_build_9.zip\Java\CacheImpl\main\src\java\gov\va\med\imaging\storage\cache\impl\filesystem\configuration | FileSystemCacheConfigurator.java | Wed May 30 14:35:29 2018 UTC |
2 | patch_205_build_9.zip\Java\CacheImpl\main\src\java\gov\va\med\imaging\storage\cache\impl\filesystem\configuration | FileSystemCacheConfigurator.java | Fri Jun 1 18:03:51 2018 UTC |
Description | Between Files 1 and 2 |
|
---|---|---|
Text Blocks | Lines | |
Unchanged | 3 | 512 |
Changed | 2 | 12 |
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.i maging.sto rage.cache .impl.file system.con figuration ; | |
2 | ||
3 | import jav a.beans.XM LDecoder; | |
4 | import jav a.beans.XM LEncoder; | |
5 | import jav a.io.File; | |
6 | import jav a.io.FileI nputStream ; | |
7 | import jav a.io.FileN otFoundExc eption; | |
8 | import jav a.io.FileO utputStrea m; | |
9 | import jav a.io.IOExc eption; | |
10 | ||
11 | import org .apache.lo gging.log4 j.LogManag er; | |
12 | import org .apache.lo gging.log4 j.Logger; | |
13 | ||
14 | import gov .va.med.im aging.stor age.cache. impl.files ystem.meme nto.FileSy stemCacheM emento; | |
15 | ||
16 | //import g ov.va.med. imaging.st orage.cach e.impl.fil esystem.me mento.File SystemCach eMenento; | |
17 | ||
18 | ||
19 | /** | |
20 | * | |
21 | * @author PII | |
22 | * | |
23 | */ | |
24 | public cla ss FileSys temCacheCo nfigurator | |
25 | { | |
26 | pr ivate Logg er logger = LogManag er.getLogg er(FileSys temCacheCo nfigurator .class); | |
27 | ||
28 | pr ivate stat ic final S tring CACH E_MEMENTO_ CONFIG = " ImagingExc hangeCache -cache.xml "; | |
29 | pr ivate stat ic final S tring defa ultSqlHost = "localh ost"; | |
30 | pr ivate stat ic final S tring defa ultSqlPort = " PORT "; | |
31 | pr ivate stat ic final S tring defa ultUserPas sword = " VsID "; | |
32 | pr ivate stat ic final S tring defa ultUserLog in = " V s ID ; | |
33 | pr ivate stat ic final S tring defa ultNetwork Password = " V s ID "; | |
34 | pr ivate stat ic final S tring defa ultNetwork Login = " V s ID "; | |
35 | ||
36 | pu blic FileS ystemCache Configurat or() | |
37 | { | |
38 | supe r(); | |
39 | } | |
40 | ||
41 | pr ivate stat ic FileSys temCacheCo nfigurator configura tion = nul l; | |
42 | pu blic synch ronized st atic FileS ystemCache Memento ge tFileSyste mCacheMeme nto() | |
43 | { | |
44 | File SystemCach eMemento m emento = n ull; | |
45 | if(c onfigurati on == null ) | |
46 | { | |
47 | config uration = new FileSy stemCacheC onfigurato r(); | |
48 | mement o = config uration.lo adConfigur ation(); | |
49 | } | |
50 | retu rn memento ; | |
51 | } | |
52 | ||
53 | pu blic FileS ystemCache Memento lo adConfigur ation() | |
54 | { | |
55 | File SystemCach eMemento c onfig = lo adConfigur ationFromF ile(); | |
56 | retu rn config; | |
57 | } | |
58 | ||
59 | ||
60 | pr ivate File SystemCach eMemento l oadConfigu rationFrom File() | |
61 | { | |
62 | XMLD ecoder dec oder = nul l; | |
63 | try | |
64 | { | |
65 | File f ile = new File(getCo nfiguratio nFileName( )); | |
66 | if(fil e.exists() ) | |
67 | { | |
68 | decoder = new XMLD ecoder(new FileInput Stream(fil e.getAbsol utePath()) ); | |
69 | FileSyst emCacheMem ento confi guration = (FileSyst emCacheMem ento)decod er.readObj ect(); | |
70 | logger.i nfo("Loade d configur ation file [" + file .getAbsolu tePath() + "]"); | |
71 | return c onfigurati on; | |
72 | } | |
73 | else | |
74 | { | |
75 | logger.i nfo("File [" + file. getAbsolut ePath() + "] does no t exist"); | |
76 | return n ull; | |
77 | } | |
78 | } | |
79 | catc h(FileNotF oundExcept ion fnfX) | |
80 | { | |
81 | logger .error("Er ror readin g configur ation, " + fnfX.getM essage(), fnfX); | |
82 | return null; | |
83 | } | |
84 | fina lly | |
85 | { | |
86 | if(dec oder != nu ll) | |
87 | decoder. close(); | |
88 | } | |
89 | } | |
90 | ||
91 | pu blic synch ronized vo id storeCo nfiguratio n(FileSyst emCacheMem ento fileS ystemCache Memento) | |
92 | { | |
93 | XMLE ncoder enc oder = nul l; | |
94 | try | |
95 | { | |
96 | String filename = getConfi gurationFi leName(); | |
97 | encode r = new XM LEncoder(n ew FileOut putStream( filename)) ; | |
98 | encode r.writeObj ect(fileSy stemCacheM emento); | |
99 | logger .info("Sto red config uration fi le [" + fi lename + " ]"); | |
100 | } | |
101 | catc h(IOExcept ion ioX) | |
102 | { | |
103 | logger .error("Er ror storin g configur ation, " + ioX.getMe ssage(), i oX); | |
104 | } | |
105 | fina lly | |
106 | { | |
107 | if(enc oder != nu ll) | |
108 | encoder. close(); | |
109 | } | |
110 | } | |
111 | ||
112 | /* * | |
113 | * Get the c onfigurati on directo ry. | |
114 | * Usually, derived cl asses do n ot need to access th e director y | |
115 | * and just rely on th e storeCon figuration )( and loa dConfigura tion() | |
116 | * methods. This meth od is prov ided for e xceptional cases. | |
117 | * / | |
118 | pr ivate File getConfig urationDir ectory() | |
119 | { | |
120 | Stri ng configu rationDire ctoryName = System.g etenv("vix config"); | |
121 | if(c onfigurati onDirector yName == n ull) | |
122 | config urationDir ectoryName = System. getPropert y("user.ho me"); | |
123 | if(c onfigurati onDirector yName == n ull) | |
124 | config urationDir ectoryName = "/"; | |
125 | ||
126 | File configura tionDirect ory = new File(confi gurationDi rectoryNam e); | |
127 | if(! configura tionDirect ory.exists ()) | |
128 | config urationDir ectory.mkd irs(); // make the direct ories if t hey don't exist | |
129 | ||
130 | retu rn configu rationDire ctory; | |
131 | } | |
132 | ||
133 | pr ivate Stri ng getConf igurationF ileName() | |
134 | { | |
135 | File configura tionDirect ory = getC onfigurati onDirector y(); | |
136 | retu rn configu rationDire ctory.getA bsolutePat h() + "/ca che-config /" + CACHE _MEMENTO_C ONFIG; | |
137 | } | |
138 | ||
139 | pu blic stati c void mai n(String [ ] args) | |
140 | { | |
141 | Logg er logger = LogManag er.getLogg er(FileSys temCacheCo nfigurator .class); | |
142 | ||
143 | File SystemCach eMemento f ileSystemC acheMement o = getFil eSystemCac heMemento( ); | |
144 | if ( fileSystem CacheMemen to == null ) | |
145 | { | |
146 | logger .error(CAC HE_MEMENTO _CONFIG + " couldn't be decode "); | |
147 | return ; | |
148 | } | |
149 | ||
150 | if(( args != nu ll) && (ar gs.length > 0)) | |
151 | { | |
152 | String host = de faultSqlHo st; | |
153 | String port = de faultSqlPo rt; | |
154 | String login = d efaultUser Login; | |
155 | String pwd = def aultUserPa ssword; | |
156 | String netLogin = defaultN etworkLogi n; | |
157 | String netPwd = defaultNet workPasswo rd; | |
158 | ||
159 | for(in t i = 0; i < args.le ngth; i++) | |
160 | { | |
161 | logger.d ebug(args[ i] + " " + args[i+1] ); | |
162 | ||
163 | if("-hos t".equals( args[i])) | |
164 | { | |
165 | host = arg s[++i]; | |
166 | } | |
167 | else if( "-port".eq uals(args[ i])) | |
168 | { | |
169 | port = arg s[++i]; | |
170 | } | |
171 | else if( "-login".e quals(args [i])) | |
172 | { | |
173 | login = ar gs[++i]; | |
174 | } | |
175 | else if( "-pwd".equ als(args[i ])) | |
176 | { | |
177 | pwd = args [++i]; | |
178 | } | |
179 | else if( "-netLogin ".equals(a rgs[i])) | |
180 | { | |
181 | netLogin = args[++i] ; | |
182 | } | |
183 | else if( "-netPwd". equals(arg s[i])) | |
184 | { | |
185 | netPwd = a rgs[++i]; | |
186 | } | |
187 | } | |
188 | fileSy stemCacheM emento.set SqlHost(ho st); | |
189 | fileSy stemCacheM emento.set SqlPort(po rt); | |
190 | fileSy stemCacheM emento.set SqlUserLog in(login); | |
191 | fileSy stemCacheM emento.set SqlUserPas sword(pwd) ; | |
192 | fileSy stemCacheM emento.set NetworkSto rageUserLo gin(netLog in); | |
193 | fileSy stemCacheM emento.set NetworkSto rageUserPa ssword(net Pwd); | |
194 | } | |
195 | stor eFileSyste mCacheMeme nto(fileSy stemCacheM emento); | |
196 | } | |
197 | ||
198 | pr ivate stat ic void st oreFileSys temCacheMe mento(File SystemCach eMemento f ileSystemC acheMement o) { | |
199 | conf iguration. storeConfi guration(f ileSystemC acheMement o); | |
200 | } | |
201 | ||
202 | pr ivate Stri ng sqlUser Password = defaultUs erPassword ; | |
203 | pu blic void setSqlUser Password(S tring pwd) { | |
204 | sqlU serPasswor d = pwd; | |
205 | } | |
206 | pu blic Strin g getSqlUs erPassword () | |
207 | { | |
208 | retu rn sqlUser Password; | |
209 | } | |
210 | ||
211 | pr ivate Stri ng sqlUser Login = de faultUserL ogin; | |
212 | pu blic void setSqlUser Login(Stri ng login) | |
213 | { | |
214 | sqlU serLogin = login; | |
215 | } | |
216 | pu blic Strin g getSqlUs erLogin() | |
217 | { | |
218 | retu rn sqlUser Login; | |
219 | } | |
220 | ||
221 | pr ivate Stri ng sqlPort = default SqlPort; | |
222 | pu blic void setSqlPort (String po rt) | |
223 | { | |
224 | sqlP ort = port ; | |
225 | } | |
226 | pu blic Strin g getSqlPo rt() | |
227 | { | |
228 | retu rn sqlPort ; | |
229 | } | |
230 | ||
231 | pr ivate Stri ng sqlHost = default SqlHost; | |
232 | pu blic void setSqlHost (String ho st) | |
233 | { | |
234 | sqlH ost = host ; | |
235 | } | |
236 | pu blic Strin g getSqlHo st() | |
237 | { | |
238 | retu rn sqlHost ; | |
239 | } | |
240 | ||
241 | ||
242 | pr ivate Stri ng cluster NetworkPas sword = de faultNetwo rkPassword ; | |
243 | pu blic void setCluster NetworkPas sword(Stri ng pwd) { | |
244 | clus terNetwork Password = pwd; | |
245 | } | |
246 | pu blic Strin g getClust erNetworkP assword() | |
247 | { | |
248 | retu rn cluster NetworkPas sword; | |
249 | } | |
250 | ||
251 | pr ivate Stri ng cluster NetworkLog in = defau ltNetworkL ogin; | |
252 | pu blic void setCluster NetworkLog in(String login) | |
253 | { | |
254 | clus terNetwork Login = lo gin; | |
255 | } | |
256 | pu blic Strin g getClust erNetworkL ogin() | |
257 | { | |
258 | retu rn cluster NetworkLog in; | |
259 | } | |
260 | ||
261 | } | |
262 |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.