source: FOIAVistA/tag/r/VISTALINK-XOBV/XOBVSYSI.m@ 1625

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

initial load of FOIAVistA 6/30/08 version

File size: 6.7 KB
Line 
1XOBVSYSI ;; ld,mjk/alb - VistaLink Interface Implementation ; [7/20/06 10:51am]
2 ;;1.5;VistALink;**1**;Sep 09, 2005;Build 3
3 ;;Foundations Toolbox Release v1.5 [Build: 1.5.1.001]
4 ;
5CALLBACK(CB) ; -- init callbacks implementation
6 SET CB("STARTELEMENT")="ELEST^XOBVSYSI"
7 QUIT
8 ;
9 ; ------------------------------------------------------------------------
10 ; RPC Server: Request Message XML SAX Parser Callbacks
11 ; ------------------------------------------------------------------------
12ELEST(ELE,ATR) ; -- element start event handler
13 IF ELE="VistaLink" DO QUIT
14 . SET XOBDATA("MODE")=$GET(ATR("mode"),"single call")
15 ;
16 IF ELE="Request" DO QUIT
17 . SET XOBDATA("XOB SYSTEM","TYPE")=$GET(ATR("type"),"unknown")
18 . SET XOBDATA("XOB SYSTEM","ENV")=$$LOW^XLFSTR($GET(ATR("environment"),"j2se"))
19 ;
20 QUIT
21 ;
22READER(XOBUF,XOBDATA) ; -- proprietary format reader implementation
23 QUIT
24 ;
25REQHDLR(XOBDATA) ; -- request handler implementation
26 NEW TYPE
27 SET TYPE=$GET(XOBDATA("XOB SYSTEM","TYPE"),"unknown")
28 ;
29 ; -- initialize socket partition request
30 IF TYPE="initializeSocket" DO INIT(.TYPE) GOTO REQHDLRQ
31 ;
32 ; -- set stop flag to close socket request
33 IF TYPE="closeSocket" DO CLOSE(.TYPE) GOTO REQHDLRQ
34 ;
35 ; -- cleanup partition request
36 IF TYPE="cleanupPartition" DO CLEANUP(.TYPE) GOTO REQHDLRQ
37 ;
38 ; -- heartbeat request
39 IF TYPE="heartbeat" DO HB(.TYPE) GOTO REQHDLRQ
40 ;
41 ; -- system info request
42 IF TYPE="systemInfo" DO SYSINFO(.TYPE) GOTO REQHDLRQ
43 ;
44 ; -- failue if processing get here
45 DO RESPONSE(.TYPE,"failure")
46 ;
47REQHDLRQ ;
48 QUIT
49 ;
50ENV ; -- set env variable
51 SET XOBSYS("ENV")=$GET(XOBDATA("XOB SYSTEM","ENV"))
52 QUIT
53 ;
54PSTANUM ; -- set primary station number
55 SET XOBSYS("PRIMARY STATION#")=+$$STA^XUAF4($$KSP^XUPARAM("INST"))
56 QUIT
57 ;
58INIT(TYPE) ; -- handle initialize request
59 KILL XOBSYS
60 DO ENV
61 DO PSTANUM
62 ;
63 IF "^j2se^j2ee^.net^"[(U_XOBSYS("ENV")_U) DO
64 . DO RESPONSE(.TYPE,"success",$$RATE()_$$JOB()_$$RASTO())
65 ELSE DO
66 . DO RESPONSE(.TYPE,"failure")
67 QUIT
68 ;
69CLOSE(TYPE) ; -- handle close socket request
70 SET XOBSTOP=1
71 DO RESPONSE(.TYPE,"success")
72 QUIT
73 ;
74CLEANUP(TYPE) ; -- handle cleanup partition request
75 ; -- unlock any pending locks
76 LOCK
77 ;
78 ; -- clean ^TMP, ^UTILITY, ^XUTL
79 DO XUTL^XUSCLEAN
80 ;
81 ; -- restore DUZ to connector user
82 KILL DUZ
83 MERGE DUZ=XOBSYS("DUZ")
84 ;
85 ; -- clean symbol table
86 DO KILL^XOBVLL
87 ;
88 DO RESPONSE(.TYPE,"success")
89 QUIT
90 ;
91DUZSV(DUZ) ; -- save initial DUZ info for session
92 IF $GET(XOBSYS("ENV"))="j2ee" DO
93 . KILL XOBSYS("DUZ")
94 . MERGE XOBSYS("DUZ")=DUZ
95 QUIT
96 ;
97HB(TYPE) ; -- handle heartbeat request
98 DO ENV
99 DO RESPONSE(.TYPE,"success",$$RATE())
100 QUIT
101 ;
102RATE() ; -- set up rate attribute for response
103 NEW XOBRATE
104 ; -- get J2EE timeout value for app serv environment
105 IF $GET(XOBSYS("ENV"))="j2ee" DO
106 . SET XOBRATE=$$GETASTO^XOBVLIB()
107 ELSE DO
108 . SET XOBRATE=$$GETRATE^XOBVLIB()
109 QUIT " rate="""_XOBRATE_""""
110 ;
111JOB() ; -- set up $JOB attribute for response
112 QUIT " mJob="""_$JOB_""""
113 ;
114RASTO() ; -- set up ReAuthenticated Session TimeOut
115 QUIT " reAuthSessionTimeout="""_$$GETRASTO^XOBVLIB()_""""
116 ;
117RESPONSE(TYPE,STATUS,ATTRS) ; -- build xml response
118 ; -- initialize
119 DO PRE^XOBVSKT
120 DO WRITE^XOBVSKT($$VLHDR^XOBVLIB(4))
121 DO WRITE^XOBVSKT("<Response type="""_$GET(TYPE)_""" status="""_$GET(STATUS)_""""_$GET(ATTRS,"")_" />")
122 DO WRITE^XOBVSKT($$ENVFTR^XOBVLIB())
123 ; -- send eot and flush buffer
124 DO POST^XOBVSKT
125 QUIT
126 ;
127SYSINFO(TYPE) ; -- build system info response
128 NEW XOBINFO,XOBELE,XOBDEFLT,XOBINTRO,XOBI
129 ;
130 ; -- set up default value
131 SET XOBDEFLT="unknown"
132 ;
133 ; -- get system info array
134 DO GETSINFO(.XOBINFO)
135 ;
136 ; -- build <SystemInfo> element
137 SET XOBELE="<SystemInfo"
138 SET XOBELE=XOBELE_" vistalinkVersion="""_$GET(XOBINFO("version"),XOBDEFLT)_""""
139 SET XOBELE=XOBELE_" vistalinkBuild="""_$GET(XOBINFO("build"),XOBDEFLT)_""""
140 SET XOBELE=XOBELE_" appServerTimeout="""_$GET(XOBINFO("appServerTimeout"),XOBDEFLT)_""""
141 SET XOBELE=XOBELE_" reAuthSessionTimeout="""_$GET(XOBINFO("reAuthSessionTimeout"),XOBDEFLT)_""""
142 SET XOBELE=XOBELE_" uci="""_$GET(XOBINFO("uci"),XOBDEFLT)_""""
143 SET XOBELE=XOBELE_" vol="""_$GET(XOBINFO("vol"),XOBDEFLT)_""""
144 SET XOBELE=XOBELE_" boxVolume="""_$GET(XOBINFO("boxVolume"),XOBDEFLT)_""""
145 SET XOBELE=XOBELE_" mVersion="""_$GET(XOBINFO("mVersion"),XOBDEFLT)_""""
146 SET XOBELE=XOBELE_" operatingSystem="""_$GET(XOBINFO("operatingSystem"),XOBDEFLT)_""""
147 SET XOBELE=XOBELE_" domainName="""_$GET(XOBINFO("domainName"),XOBDEFLT)_""""
148 SET XOBELE=XOBELE_" vistaProduction="""_$GET(XOBINFO("vistaProduction"),XOBDEFLT)_""""
149 SET XOBELE=XOBELE_" defaultInstitution="""_$GET(XOBINFO("defaultInstitution"),XOBDEFLT)_""""
150 SET XOBELE=XOBELE_" cpName="""_$GET(XOBINFO("cpName"),XOBDEFLT)_""""
151 SET XOBELE=XOBELE_" />"
152 ;
153 SET XOBINTRO=$GET(XOBINFO("introductoryText"))
154 ;
155 ; -- build and send complate message
156 DO PRE^XOBVSKT
157 DO WRITE^XOBVSKT($$VLHDR^XOBVLIB(4))
158 DO WRITE^XOBVSKT("<Response type="""_$GET(TYPE)_""" status=""success"" >")
159 DO WRITE^XOBVSKT(XOBELE)
160 FOR XOBI=1:1 QUIT:'$DATA(XOBINFO("introductoryText",XOBI)) DO
161 . DO WRITE^XOBVSKT(XOBINFO("introductoryText",XOBI))
162 DO WRITE^XOBVSKT("</Response>")
163 DO WRITE^XOBVSKT($$ENVFTR^XOBVLIB())
164 DO POST^XOBVSKT
165 ;
166 QUIT
167 ;
168GETSINFO(XOBINFO) ; -- gather system info into array
169 NEW X,Y
170 ;
171 ; -- get version
172 SET XOBINFO("version")=$PIECE($TEXT(XOBVSYSI+1),";",3)
173 ;
174 ; -- get build number
175 SET XOBINFO("build")=$PIECE($PIECE($TEXT(XOBVSYSI+2),"Build: ",2),"]")
176 ;
177 ; -- get application server connection timeout
178 SET XOBINFO("appServerTimeout")=$$GETASTO^XOBVLIB()
179 ;
180 ; -- get reauthentication session timeout
181 SET XOBINFO("reAuthSessionTimeout")=$$GETRASTO^XOBVLIB()
182 ;
183 ; -- get basic M environment information
184 SET Y=""
185 DO GETENV^%ZOSV
186 ;
187 ; -- get uci
188 SET XOBINFO("uci")=$PIECE(Y,U,1)
189 ;
190 ; -- get vol
191 SET XOBINFO("vol")=$PIECE(Y,U,2)
192 ;
193 ; -- get box volume
194 SET XOBINFO("boxVolume")=$PIECE(Y,U,4)
195 ;
196 ; -- get M version (full name)
197 SET XOBINFO("mVersion")=$$SYMENC^MXMLUTL($$VERSION^%ZOSV(1))
198 ;
199 ; -- get operating system
200 SET XOBINFO("operatingSystem")=$$SYMENC^MXMLUTL($$SYSOS^XOBVLIB(XOBOS))
201 ;
202 ; -- get domain name
203 SET XOBINFO("domainName")=$$SYMENC^MXMLUTL($$KSP^XUPARAM("WHERE"))
204 ;
205 ; -- production or test
206 SET XOBINFO("vistaProduction")=$S($$PROD^XUPROD(0):"true",1:"false")
207 ;
208 ; -- default institution
209 SET XOBINFO("defaultInstitution")=$$SYMENC^MXMLUTL($$STA^XUAF4($$KSP^XUPARAM("INST"))_"/"_$$NAME^XUAF4($$KSP^XUPARAM("INST")))
210 ;
211 ; -- get intro text
212 D GETINTRO^XOBSCAV2("XOBINFO(""introductoryText"")",1)
213 ;
214 ; -- get c/p username
215 SET XOBINFO("cpName")=$$NAME^XUSER(DUZ)
216 ;
217 QUIT
218 ;
219RPC(XOBY) ;
220 NEW XOBX,XOBLINE,XOBARR
221 D GETSINFO(.XOBARR)
222 SET XOBLINE=0
223 S XOBX="" F S XOBX=$O(XOBARR(XOBX)) Q:XOBX']"" D
224 . SET XOBLINE=XOBLINE+1
225 . SET XOBY(XOBLINE)=XOBX_"~"_XOBARR(XOBX)
226 QUIT
227 ;
Note: See TracBrowser for help on using the repository browser.