source: FOIAVistA/trunk/r/VISTALINK-XOBV/XOBVPOST.m@ 1203

Last change on this file since 1203 was 628, checked in by George Lilly, 15 years ago

initial load of FOIAVistA 6/30/08 version

File size: 8.1 KB
Line 
1XOBVPOST ;; ld,mjk/alb - VistaLink Post-Init ; 07/27/2002 13:00
2 ;;1.5;VistALink;;Sep 09, 2005
3 ;;Foundations Toolbox Release v1.5 [Build: 1.5.0.026]
4 ;
5 QUIT
6 ;
7EN ; -- add post-init code here
8 NEW XOBCFG,XOBOS
9 SET XOBOS=$$GETOS^XOBVTCP()
10 SET XOBCFG=0
11 ;
12 ; -- add config if Cache NT
13 IF XOBOS="OpenM-NT" SET XOBCFG=$$CFG()
14 ;
15 ; -- add params entry
16 DO PARMS(XOBCFG)
17 ;
18 ; -- add STARTUP task if OpenM-NT and on Windows
19 IF XOBOS="OpenM-NT",$$SYSOS^XOBVLIB(XOBOS)="NT" DO SCHEDOPT
20 ;
21 ; -- add XOBVTESTER,APPLICATION PROXY user if not present
22 DO ADDPROXY("XOBVTESTER,APPLICATION PROXY")
23 ;
24 QUIT
25 ;
26 ;
27CFG() ; -- add default config if not pressent
28 NEW DIC,X,Y,XOBDA,XOBNEW
29 ;
30 ; -- DEFAULT configuration --
31 SET DIC="^XOB(18.03,"
32 SET DIC(0)="LX"
33 SET X="DEFAULT"
34 DO ^DIC
35 ; -- quit if lookup failed
36 IF Y=-1 GOTO CFGQ
37 ;
38 SET XOBDA=+Y
39 SET XOBNEW=$PIECE(Y,U,3)
40 ;
41 ; -- add default port to multiple
42 IF XOBNEW,'$$PORTS(XOBDA) GOTO CFGQ
43 ;
44CFGQ ;
45 QUIT +$GET(XOBDA)
46 ;
47 ;
48PORTS(XOBDA) ; -- add 8000 port
49 NEW XOBOK,XOBNEW,DIC,DIE,DR,X,DA,Y
50 ;
51 ; -- set oth of multiple is needed
52 IF $DATA(^XOB(18.03,1,"PORTS",0))=0 SET ^XOB(18.03,1,"PORTS",0)="^18.031^^"
53 ;
54 SET DA(1)=XOBDA
55 SET DIC="^XOB(18.03,"_XOBDA_",""PORTS"","
56 SET DIC(0)="LX"
57 SET X=8000
58 DO ^DIC
59 ;
60 ; -- quit if lookup failed
61 IF Y=-1 SET XOBOK=0 GOTO PORTSQ
62 SET XOBNEW=$PIECE(Y,U,3)
63 ;
64 ; -- if multiple entry is new, set port to NOT startup when config is started
65 ; (site should change to startup explicitly)
66 IF XOBNEW DO
67 . SET DA(1)=XOBDA
68 . SET DA=+Y
69 . SET DR=".02////0"
70 . SET DIE="^XOB(18.03,"_XOBDA_",""PORTS"","
71 . DO ^DIE
72 ;
73 SET XOBOK=1
74PORTSQ ;
75 QUIT XOBOK
76 ;
77 ;
78PARMS(XOBCFG) ; -- add parameter entry
79 NEW DIC,X,Y,DIE,DA,DR,XOBBOX,XOBDA,XOBMULI,XOBNEW
80 ;
81 ; -- box-pair name, no ien
82 SET XOBBOX=$PIECE($$GETENV^XOBVTCP(),U,4)
83 ;
84 ; -- Top-Level Parameters --
85 SET DIC="^XOB(18.01,",DIC(0)="LXZ",X=$$DOMAIN() DO ^DIC
86 ;
87 ; -- quit if lookup failed or if already exists
88 IF Y=-1 GOTO PARMSQ
89 ;
90 SET XOBDA=+Y
91 SET XOBNEW=0
92 IF $PIECE(Y(0),U,2)="",$PIECE(Y(0),U,3)="" SET XOBNEW=1
93 ;
94 ; -- set basic parameters (HEARTBEAT RATE and LATENCY DELTA)
95 IF XOBNEW DO
96 . SET DA=XOBDA
97 . SET DR=".02////180;.03////180"
98 . SET DIE="^XOB(18.01,"
99 . DO ^DIE
100 ;
101 ; -- Listeners Multiple --
102 ;
103 ; -- quit if no config passed in (ie. not Cache NT)
104 IF '$GET(XOBCFG) GOTO PARMSQ
105 ;
106 ; -- set oth of multiple is needed
107 IF $DATA(^XOB(18.01,1,"CONFIG",0))=0 SET ^XOB(18.01,1,"CONFIG",0)="^18.012P^^"
108 ;
109 SET DA(1)=XOBDA
110 SET DIC="^XOB(18.01,"_XOBDA_",""CONFIG"","
111 SET DIC(0)="LX"
112 SET X=XOBBOX
113 DO ^DIC
114 ;
115 ; -- quit if lookup failed or if already exists
116 IF Y=-1 GOTO PARMSQ
117 ;
118 SET XOBMULI=+Y
119 SET XOBNEW=$PIECE(Y,U,3)
120 ;
121 ; -- set listener config default
122 IF XOBNEW DO
123 . SET DA(1)=XOBDA
124 . SET DA=XOBMULI
125 . SET DR=".02////"_XOBCFG
126 . SET DIE="^XOB(18.01,"_XOBDA_",""CONFIG"","
127 . DO ^DIE
128 ;
129PARMSQ ;
130 QUIT
131 ;
132 ;
133DOMAIN() ; -- get account's domain entry
134 ;
135 QUIT $$KSP^XUPARAM("WHERE")
136 ;
137 ;
138SCHEDOPT ;-- Schedule XOBV LISTENER STARTUP option in TaskMan
139 ;
140 ; This procedure will schedule the XOBV LISTENER STARTUP option
141 ; in the OPTION SCHEDULING file (#19.2).
142 ;
143 NEW XOBMSG,XOBOIEN,XOBSIEN
144 ;
145 ;-- XOBOIEN = IEN (OPTION file), XOBSIEN = IEN (OPTION SCHEDULING file)
146 SET (XOBOIEN,XOBSIEN)=0
147 ;
148 DO BMES^XPDUTL(">>> Scheduling the XOBV LISTENER STARTUP option...")
149 ;
150 ;-- Check that option was added to OPTION file #19 during installation
151 SET XOBOIEN=$$FIND1^DIC(19,"","BX","XOBV LISTENER STARTUP","","","")
152 ;
153 ;-- Error XOBMSG and quit if option was not added
154 IF 'XOBOIEN DO QUIT
155 . SET XOBMSG(1)=""
156 . SET XOBMSG(2)=">>> Error: Option XOBV LISTENER STARTUP was not created in the OPTION (#19)"
157 . SET XOBMSG(3)=" file during the KIDS installation. Please reinstall."
158 . DO BMES^XPDUTL(.XOBMSG)
159 ;
160 ;-- Check if option was already scheduled
161 SET XOBSIEN=$$CHKOPT(XOBOIEN)
162 ;
163 ;-- Display option and quit if option was previously added
164 IF XOBSIEN DO QUIT
165 . DO BMES^XPDUTL(">>> The XOBV LISTENER STARTUP option has previously been scheduled:")
166 . DO DSPLYOP(XOBSIEN)
167 ;
168 ;-- Schedule the option
169 SET XOBSIEN=$$FILEOPT(XOBSIEN,XOBOIEN,,,,"S")
170 IF XOBSIEN DO
171 . DO BMES^XPDUTL(">>> The XOBV LISTENER STARTUP option has been scheduled as follows:")
172 . DO DSPLYOP(XOBSIEN)
173 ELSE DO
174 . SET XOBMSG(1)=">>> Error: There was an error scheduling the XOBV LISTENER STARTUP option."
175 . SET XOBMSG(2)=" Please schedule this option using 'Schedule/Unschedule Options'"
176 . SET XOBMSG(3)=" in the Taskman Management menu."
177 . DO BMES^XPDUTL(.XOBMSG)
178 QUIT
179 ;
180 ;
181CHKOPT(IEN) ;-- Check if option is already scheduled
182 ;
183 ; Input:
184 ; IEN - IEN of option in OPTION file (#19)
185 ;
186 ; Output:
187 ; XOBSIEN - IEN of option in OPTION SCHEDULING file (#19.2) or zero if it does not exist
188 ;
189 NEW X,X1,X2,XOBARY,XOBI,XOBIEN2
190 SET (X1,X2,XOBI,XOBIEN2)=0
191 DO FIND^DIC(19.2,"","@;.01I;9I","","XOBV LISTENER STARTUP","*","B","","","XOBARY")
192 SET X=+$PIECE($GET(XOBARY("DILIST",0)),"^")
193 FOR SET XOBI=$ORDER(XOBARY("DILIST","ID",X,XOBI)) QUIT:'XOBI DO
194 . IF XOBI=.01,$GET(XOBARY("DILIST","ID",X,XOBI))=IEN SET X1=1
195 . IF XOBI=9,$GET(XOBARY("DILIST","ID",X,XOBI))["S" SET X2=1
196 . IF X1,X2 SET XOBIEN2=+$GET(XOBARY("DILIST",2,X))
197 QUIT XOBIEN2
198 ;
199 ;
200DSPLYOP(IEN) ;-- Display fields from OPTION SCHEDULING file (#19.2)
201 ;
202 ; Input:
203 ; IEN - IEN of record in file #19.2
204 ;
205 ; Output:
206 ; Display of fields in record
207 ;
208 QUIT:'$GET(IEN)
209 NEW DA,DIC,DIQ
210 SET DIC="^DIC(19.2,",DA=IEN,DIQ(0)="CAR"
211 DO MES^XPDUTL("")
212 DO EN^DIQ
213 DO BMES^XPDUTL("")
214 QUIT
215 ;
216 ;
217FILEOPT(XOBIEN,XOBOPT,XOBQUE,XOBDEV,XOBRSCH,XOBSPARM) ;-- Schedule the option
218 ;
219 ;-- File a new record in file #19.2 or edit existing
220 ;
221 ; Input:
222 ; XOBIEN - IEN from record in file #19.2 if it exists
223 ; XOBOPT - IEN of option (file #19); (required)
224 ; XOBQUE - Queued to run at what time; (optional)
225 ; XOBDEV - Device for queued job output; (optional)
226 ; XOBRSCH - Rescheduling frequency; (optional)
227 ; XOBSPARM - Special queueing; (optional)
228 ;
229 ; Output:
230 ; Function Value - Returns IEN of record on success, 0 on failure
231 ;
232 NEW XOBFDA,XOBFDAI,XOBERR,XOBIENS
233 ;
234 SET XOBIEN=+$GET(XOBIEN)
235 ;
236 ;-- If record doesn't already exist, create new
237 IF XOBIEN SET XOBIENS=XOBIEN_","
238 ELSE SET XOBIENS="+1,"
239 ;
240 ;-- Set up array with field values
241 SET XOBFDA(19.2,XOBIENS,.01)=$GET(XOBOPT)
242 SET XOBFDA(19.2,XOBIENS,2)=$GET(XOBQUE)
243 SET XOBFDA(19.2,XOBIENS,3)=$GET(XOBDEV)
244 SET XOBFDA(19.2,XOBIENS,6)=$GET(XOBRSCH)
245 SET XOBFDA(19.2,XOBIENS,9)=$GET(XOBSPARM)
246 ;
247 IF XOBIEN DO
248 . DO FILE^DIE("","XOBFDA","XOBERR")
249 . IF $DATA(XOBERR) SET XOBIEN=0
250 ELSE DO
251 . DO UPDATE^DIE("","XOBFDA","XOBFDAI","XOBERR")
252 . IF '$DATA(XOBERR) SET XOBIEN=$GET(XOBFDAI(1))
253 ;
254 QUIT $SELECT($GET(XOBIEN)>0:XOBIEN,1:0)
255 ;
256ADDPROXY(XOBANAME) ; add application proxy if not present
257 ; depends on XU*8*361
258 NEW XOBID,XOBMSG,XOBSUBER,XOBSUBTX,XOBLINE
259 ;
260 ; if already present don't add
261 QUIT:(+$$APFIND^XUSAP(XOBANAME))>0
262 ;
263 SET XOBID=$$CREATE^XUSAP(XOBANAME,"","XOBV VISTALINK TESTER")
264 IF (+XOBID)>0 DO
265 . SET XOBMSG(1)=" Added new Kernel Application Proxy User '"_XOBANAME_"'."
266 . SET XOBMSG(2)=" ::This application proxy user account is used in the VistALink sample web"
267 . SET XOBMSG(3)=" ::application, to demonstrate usage of the VistaLinkAppProxyConnectionSpec"
268 . SET XOBMSG(4)=" ::connection spec."
269 . DO BMES^XPDUTL(.XOBMSG)
270 IF (+XOBID)=0 DO
271 . ; already checked if user present, should never get 0 back
272 . SET XOBMSG(1)=">>> Error: Could not add VistALink Application Proxy User '"_XOBANAME_"' -- Already exists."
273 . DO BMES^XPDUTL(.XOBMSG)
274 IF (+XOBID)<0 DO
275 . SET XOBMSG(1)=">>> Error: Could not add VistALink Application Proxy User '"_XOBANAME_"'."
276 . SET XOBMSG(2)=" DIERR nodes: <start of error(s)>"
277 . SET XOBLINE=3,XOBSUBER=0 FOR SET XOBSUBER=$O(^TMP("DIERR",$J,XOBSUBER)) QUIT:(+XOBSUBER)'>0 DO
278 . . SET XOBMSG(XOBLINE)=" "_^TMP("DIERR",$J,XOBSUBER),XOBLINE=XOBLINE+1
279 . . SET XOBSUBTX=0 FOR SET XOBSUBTX=$O(^TMP("DIERR",$J,XOBSUBER,"TEXT",XOBSUBTX)) QUIT:(+XOBSUBTX)'>0 DO
280 . . . SET XOBMSG(XOBLINE)=" "_^TMP("DIERR",$J,XOBSUBER,"TEXT",XOBSUBTX),XOBLINE=XOBLINE+1
281 . SET XOBMSG(XOBLINE+1)=" <end of error(s)>"
282 . DO BMES^XPDUTL(.XOBMSG)
283 . K ^TMP("DIERR",$J)
284 ;
285 QUIT
Note: See TracBrowser for help on using the repository browser.