source: FOIAVistA/trunk/r/FOUNDATIONS-XOBU/XOBUM1.m@ 761

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

initial load of FOIAVistA 6/30/08 version

File size: 4.6 KB
Line 
1XOBUM1 ;; ld,mjk/alb - Foundations Manager ; 07/27/2002 13:00
2 ;;1.5;Foundations;;Sep 09, 2005
3 ;;Foundations Toolbox Release v1.5 [Build: 1.5.0.026]
4 ;
5START(XOBPORT) ;-- Entry point to start a single VistALink Listener
6 ;
7 ; This procedure will start the VistALink Listener on a specific port. The port number is optional
8 ; and will be validated if passed to this procedure. If the port is not passed, the user will be
9 ; prompted for a port number.
10 ;
11 ; Input:
12 ; XOBPORT - Port number for the Listener (optional)
13 ;
14 ; Output:
15 ; None
16 ;
17 NEW XOBTASK,Y,XOBOK
18 ;
19 ;-- Reset I/O variables
20 SET U="^" DO HOME^%ZIS
21 ;
22 DO
23 . ;
24 . ;-- Check operating system
25 . IF '$$CHKOS() SET XOBOK=0 QUIT
26 . ;
27 . ;-- Validate/prompt for port
28 . IF '$$VALID($GET(XOBPORT)) SET XOBPORT=$$GETPORT("start")
29 . IF 'XOBPORT SET XOBOK=0 QUIT
30 . ;
31 . ;-- Wait msg to user
32 . DO WAIT^DICD WRITE !
33 . ;
34 . ;-- Check if Listener is running on port
35 . IF '$$LOCK^XOBVTCP(XOBPORT) DO QUIT
36 . . DO EN^DDIOL("VistALink Listener on port "_XOBPORT_" appears to be running already.")
37 . . SET XOBOK=0
38 . ;
39 . ;-- Lock was successful; unlock and queue the listener to startup
40 . DO UNLOCK^XOBVTCP(XOBPORT)
41 . DO UPDATE^XOBVTCP(XOBPORT,1)
42 . SET XOBOK=$$START^XOBVTCP(XOBPORT)
43 . IF 'XOBOK DO
44 . . DO UPDATE^XOBVTCP(XOBPORT,5)
45 . . DO EN^DDIOL("Unable to start VistALink Listener on port "_XOBPORT_".")
46 ;
47 QUIT XOBOK
48 ;
49 ;
50CHKOS() ;-- Check operating system
51 ;
52 ; This function will determine which operating system is being used.
53 ;
54 ; Input:
55 ; None
56 ;
57 ; Output:
58 ; Function value - returns 1 on success, 0 on failure
59 ;
60 NEW OPERSYS,RESULT
61 ;
62 SET RESULT=0
63 ;
64 ;-- Get operating system
65 SET OPERSYS=$$GETOS^XOBVTCP()
66 ;
67 DO
68 . IF OPERSYS="OpenM-NT" DO QUIT
69 .. DO EN^DDIOL("Starting VistALink Listener...")
70 .. SET RESULT=1
71 . ;
72 . IF OPERSYS["DSM" DO EN^DDIOL("Use the TCPIP utility in VMS to enable the VistALink Listener.") QUIT
73 . ;
74 . ;-- All other operating systems
75 . DO EN^DDIOL("Starting the VistALink Listener is not yet supported for "_OPERSYS_".") QUIT
76 . ;
77 QUIT RESULT
78 ;
79 ;
80VALID(XOBPORT) ;-- Validate port
81 ;
82 ; This function will validate a port number passed in.
83 ;
84 ; Input:
85 ; XOBPORT - Port number for the Listener (Optional)
86 ;
87 ; Output:
88 ; Function value - returns 1 if valid, 0 otherwise
89 ;
90 NEW RESULT
91 ;
92 SET XOBPORT=+$GET(XOBPORT)
93 SET RESULT=0
94 ;
95 ;-- Check if port is not defined or invalid
96 DO ; Drops out of block on failure
97 . QUIT:XOBPORT=0
98 . QUIT:(XOBPORT?.AP)
99 . QUIT:XOBPORT<5000!(XOBPORT>65535)
100 . SET RESULT=1
101 QUIT RESULT
102 ;
103 ;
104GETPORT(XOBST) ;-- Prompt user for port number
105 ;
106 ; This function will prompt the user for a valid port number.
107 ;
108 ; Input:
109 ; XOBST - start = start Listener
110 ; stop = stop Listener
111 ;
112 ; Output:
113 ; Function value - returns port # or zero
114 ;
115 NEW DIR,DIRUT,PORT
116 SET XOBST=$GET(XOBST)
117 ;
118 SET DIR(0)="NA^5000:65535"
119 SET DIR("A")="Enter Port: "
120 SET DIR("B")=8000 ; Default port is 8000
121 SET DIR("?")="Choose a numeric port to "_XOBST_" the VistALink Listener on in the range of 5000-65535."
122 DO ^DIR KILL DIR
123 IF $DATA(DIRUT) DO
124 . DO EN^DDIOL("Port not specified. VistALink Listener not "_$SELECT(XOBST="start":"started",1:"stopped")_".")
125 . SET PORT=0
126 ELSE SET PORT=+$GET(Y)
127 ;
128 QUIT PORT
129 ;
130 ;
131BOX() ; -- start this BOX-VOl default configuration
132 NEW XOBOX
133 IF $$CHKOS^XOBUM1() DO
134 . SET XOBOK=1
135 . DO WAIT^DICD WRITE !
136 . DO STARTCFG^XOBVTCP($$GETCFG^XOBVTCP())
137 ELSE DO
138 . SET XOBOK=0
139 QUIT XOBOK
140 ;
141 ;
142STOP(LOGDA) ; -- stop a listener
143 NEW Y,X,LOG0,XOBBOX,XOBPORT,XONCFG,XOBSTAT,XOBOK
144 SET XOBOK=0
145 ;
146 SET LOG0=$GET(^XOB(18.04,LOGDA,0))
147 SET XOBBOX=$PIECE(LOG0,U)
148 SET XOBPORT=$PIECE(LOG0,U,2)
149 SET XOBSTAT=$PIECE(LOG0,U,3)
150 SET XOBCFG=$PIECE(LOG0,U,6)
151 ;
152 ; -- must be valid entyr with a running status
153 IF XOBPORT,XOBSTAT=2 DO
154 . DO UPDLOG^XOBVTCP(LOGDA,XOBPORT,3,XOBCFG)
155 . SET XOBOK=1
156 ELSE DO
157 . SET XOBOK=0_U_"Listener is not running!"
158 ;
159 QUIT XOBOK
160 ;
161PARMS() ; -- maintain site parameters
162 NEW DIC,X,Y,DR,DA,DIE,XOBOK
163 SET XOBOK=0
164 ;
165 IF $GET(^XOB(18.01,1,0))["" DO
166 . SET DA=1,DR="[XOBU SITE PARAMETERS]",DIE="^XOB(18.01," DO ^DIE
167 . SET XOBOK=1
168 ELSE DO
169 . SET XOBOK=0_U_"Error: Site parameter file not initialized."
170 ;
171 QUIT XOBOK
172 ;
173CFG() ; -- listener configuration edit
174 NEW DIC,X,Y,DR,DA,DIE,XOBDONE,XOBOK
175 SET XOBOK=0
176 ;
177 SET XOBDONE=0
178 ;
179 FOR DO QUIT:XOBDONE
180 . WRITE !
181 . SET DIC="^XOB(18.03,",DIC(0)="AEMLQ" DO ^DIC
182 . IF Y<1 SET XOBDONE=1 QUIT
183 . SET DA=+Y,DR="[XOBV LISTENER CONFIG EDIT]",DIE="^XOB(18.03," DO ^DIE
184 SET XOBOK=1
185 ;
186 QUIT XOBOK
187 ;
188CP() ; -- add a connector proxy
189 NEW XOBOK
190 SET XOBOK=0
191 DO CONT^XUSAP
192 SET XOBOK=1
193 QUIT XOBOK
194 ;
Note: See TracBrowser for help on using the repository browser.