source: WorldVistAEHR/trunk/r/VISTALINK-XOBV/XOBVRPCI.m@ 1365

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

initial load of WorldVistAEHR

File size: 5.3 KB
Line 
1XOBVRPCI ;; ld,mjk/alb - VistaLink Interface Implementation for RPCs; 07/27/2002 13:00
2 ;;1.5;VistALink;;Sep 09, 2005
3 ;;Foundations Toolbox Release v1.5 [Build: 1.5.0.026]
4 ;
5CALLBACK(CB) ; -- init callbacks implementation
6 SET CB("STARTELEMENT")="ELEST^XOBVRPCI"
7 SET CB("ENDELEMENT")="ELEND^XOBVRPCI"
8 SET CB("CHARACTERS")="CHR^XOBVRPCI"
9 QUIT
10 ;
11READER(XOBUF,XOBDATA) ; -- propriatary format reader implementation
12 DO START^XOBVRPCX(.XOBUF,.XOBDATA)
13 QUIT
14 ;
15REQHDLR(XOBDATA) ; -- request handler implementation
16 DO EN^XOBVRPC(.XOBDATA)
17 QUIT
18 ;
19 ; ------------------------------------------------------------------------
20 ; RPC Server: Request Message XML SAX Parser Callbacks
21 ; ------------------------------------------------------------------------
22ELEST(ELE,ATR) ; -- element start event handler
23 IF ELE="VistaLink" DO QUIT
24 . KILL XOBPARAM,XOBCTXT,XOBPN,XOBPTYPE
25 . ; -- if called from VL v1.0 client then set up J2SE defaults
26 . IF $GET(XOBDATA("VL VERSION"))="1.0" DO V1^XOBVRPCX
27 ;
28 IF ELE="RpcHandler" SET XOBDATA("XOB RPC","RPC HANDLER VERSION")=$GET(ATR("version")) QUIT
29 ;
30 IF ELE="Request" DO QUIT
31 . SET XOBDATA("XOB RPC","RPC NAME")=$$ESC^XOBVRMX($GET(ATR("rpcName"),"##Unkown RPC##"))
32 . NEW X
33 . SET X=$$SETTO^XOBVLIB($GET(ATR("rpcClientTimeOut"),9000))
34 . SET X=$$SETVER^XOBVRPCX($GET(ATR("rpcVersion"),0))
35 ;
36 IF ELE="RpcContext" SET XOBCTXT="" QUIT
37 ;
38 ; -------------------- Param Node Start Event Processing ---------------------------
39 ;
40 IF ELE="Param" DO QUIT
41 . SET XOBPARAM=""
42 . SET XOBPN="XOBP"_ATR("position")
43 . SET XOBDATA("XOB RPC","PARAMS",ATR("position"))=XOBPN
44 . SET XOBPTYPE=ATR("type")
45 . SET:XOBPTYPE="array" @XOBPN=""
46 ;
47 IF ELE="Index" DO QUIT
48 . KILL XOBPARAM
49 . IF $DATA(ATR("name"))&$DATA(ATR("value")) DO
50 . . SET @XOBPN@($$ESC^XOBVRMX(ATR("name")))=$$ESC^XOBVRMX(ATR("value"))
51 ;
52 IF ELE="Name" DO QUIT
53 . SET XOBPARNM=""
54 ;
55 IF ELE="Value" DO QUIT
56 . SET XOBPARVL=""
57 ;
58 ; -------------------- Security Node Start Event Processing ---------------------------
59 ;
60 IF ELE="Security" DO QUIT
61 . SET XOBDATA("XOB RPC","SECURITY","TYPE")=$GET(ATR("type"))
62 . SET XOBDATA("XOB RPC","SECURITY","DIV")=$GET(ATR("division"))
63 . SET XOBDATA("XOB RPC","SECURITY","STATE")=$GET(ATR("state"),"notauthenticated")
64 . KILL XOBSECFL
65 . ;
66 . ; -- use to make sure child nodes are from Security
67 . ; parent when processing child node names
68 . SET XOBSECFL=1
69 ;
70 IF ELE="AccessVerify",$GET(XOBSECFL),$EXTRACT($GET(XOBDATA("XOB RPC","SECURITY","TYPE")),1,2)="av" DO QUIT
71 . SET XOBAVCOD=""
72 ;
73 IF ELE="KernelCcowToken",$GET(XOBSECFL),$GET(XOBDATA("XOB RPC","SECURITY","TYPE"))="ccow" DO QUIT
74 . SET XOBCCOWT=""
75 ;
76 IF ELE="Duz",$GET(XOBSECFL),$GET(XOBDATA("XOB RPC","SECURITY","TYPE"))="duz" DO QUIT
77 . SET XOBDATA("XOB RPC","SECURITY","TYPE","VALUE")=$GET(ATR("value"))
78 ;
79 IF ELE="Vpid",$GET(XOBSECFL),$GET(XOBDATA("XOB RPC","SECURITY","TYPE"))="vpid" DO QUIT
80 . SET XOBDATA("XOB RPC","SECURITY","TYPE","VALUE")=$GET(ATR("value"))
81 ;
82 IF ELE="ApplicationProxyName",$GET(XOBSECFL),$GET(XOBDATA("XOB RPC","SECURITY","TYPE"))="appproxy" DO QUIT
83 . SET XOBDATA("XOB RPC","SECURITY","TYPE","VALUE")=$GET(ATR("value"))
84 ;
85 ; ---------------------------------------------------------------------------
86 ;
87 QUIT
88 ;
89ELEND(ELE) ; -- element end event handler
90 IF ELE="VistaLink" DO QUIT
91 . SET XOBDATA("MODE")=$GET(ATR("mode"),"singleton")
92 . KILL XOBPOS,XOBPARAM,XOBCTXT,XOBPN,XOBPTYPE
93 ;
94 IF ELE="RpcContext" DO QUIT
95 . SET XOBDATA("XOB RPC","RPC CONTEXT")=$GET(XOBCTXT)
96 ;
97 IF ELE="Param" DO KILL XOBPARAM QUIT
98 . IF XOBPTYPE="string" SET @XOBPN=$$ESC^XOBVRMX(XOBPARAM) QUIT
99 . IF XOBPTYPE="ref" SET @XOBPN=$GET(@$$ESC^XOBVRMX(XOBPARAM)) QUIT
100 ;
101 IF ELE="Params" DO QUIT
102 . NEW POS,PARAMS
103 . SET PARAMS="",POS=0
104 . FOR SET POS=$ORDER(XOBDATA("XOB RPC","PARAMS",POS)) QUIT:'POS SET PARAMS=PARAMS_",."_XOBDATA("XOB RPC","PARAMS",POS)
105 . SET XOBDATA("XOB RPC","PARAMS")=PARAMS
106 ;
107 IF ELE="Index" DO QUIT
108 . IF $DATA(XOBPARNM)&$DATA(XOBPARVL) DO
109 . . KILL XOBPARAM
110 . . IF $EXTRACT(XOBPARNM,1)=$CHAR(13) DO
111 . . . SET @("@XOBPN@("_$$ESC^XOBVRMX($EXTRACT(XOBPARNM,2,$LENGTH(XOBPARNM)))_")=$$ESC^XOBVRMX(XOBPARVL)")
112 . . ELSE DO
113 . . . SET @XOBPN@($$ESC^XOBVRMX(XOBPARNM))=$$ESC^XOBVRMX(XOBPARVL)
114 . . KILL XOBPARNM,XOBPARVL
115 ;
116 IF ELE="Name" DO QUIT
117 . SET XOBPARNM("DONE")=1
118 ;
119 IF ELE="Value" DO QUIT
120 . SET XOBPARVL("DONE")=1
121 ;
122 IF ELE="AccessVerify",$GET(XOBSECFL),$EXTRACT($GET(XOBDATA("XOB RPC","SECURITY","TYPE")),1,2)="av" DO QUIT
123 . SET XOBDATA("XOB RPC","SECURITY","TYPE","AVCODE")=XOBAVCOD KILL XOBAVCOD
124 IF ELE="KernelCcowToken",$GET(XOBSECFL),$GET(XOBDATA("XOB RPC","SECURITY","TYPE"))="ccow" DO QUIT
125 . SET XOBDATA("XOB RPC","SECURITY","TYPE","CCOW")=XOBCCOWT KILL XOBCCOWT
126 IF ELE="Security" KILL XOBSECFL QUIT
127 ;
128 QUIT
129 ;
130CHR(TEXT) ; -- character value event handler <tag>TEXT</tag)
131 ; -- need to concatenate because MXML parses on ENTITY characters (<>& etc.) and
132 ; callback gets hit multiple times even though the tag text value is just one piece of data.
133 ; (Yes, this seems kludgie!)
134 IF $DATA(XOBPARAM) SET XOBPARAM=XOBPARAM_TEXT
135 IF $DATA(XOBPARNM),'+$GET(XOBPARNM("DONE")) SET XOBPARNM=XOBPARNM_TEXT QUIT
136 IF $DATA(XOBPARVL),'+$GET(XOBPARVL("DONE")) SET XOBPARVL=XOBPARVL_TEXT QUIT
137 IF $DATA(XOBCTXT) SET XOBCTXT=XOBCTXT_TEXT QUIT
138 IF $DATA(XOBAVCOD) SET XOBAVCOD=XOBAVCOD_TEXT QUIT
139 IF $DATA(XOBCCOWT) SET XOBCCOWT=XOBCCOWT_TEXT QUIT
140 QUIT
141 ;
Note: See TracBrowser for help on using the repository browser.