Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: XOBUM1

XOBUM1.m

Go to the documentation of this file.
  1. XOBUM1 ;; ld,mjk/alb - Foundations Manager ; 07/27/2002 13:00
  1. ;;1.6;Foundations;;May 08, 2009;Build 15
  1. ;Per VHA directive 2004-038, this routine should not be modified.
  1. ;
  1. START(XOBPORT) ;-- Entry point to start a single VistALink Listener
  1. ;
  1. ; This procedure will start the VistALink Listener on a specific port. The port number is optional
  1. ; and will be validated if passed to this procedure. If the port is not passed, the user will be
  1. ; prompted for a port number.
  1. ;
  1. ; Input:
  1. ; XOBPORT - Port number for the Listener (optional)
  1. ;
  1. ; Output:
  1. ; None
  1. ;
  1. NEW XOBTASK,Y,XOBOK
  1. ;
  1. ;-- Reset I/O variables
  1. SET U="^" DO HOME^%ZIS
  1. ;
  1. DO
  1. . ;
  1. . ;-- Check operating system
  1. . IF '$$CHKOS() SET XOBOK=0 QUIT
  1. . ;
  1. . ;-- Validate/prompt for port
  1. . IF '$$VALID($GET(XOBPORT)) SET XOBPORT=$$GETPORT("start")
  1. . IF 'XOBPORT SET XOBOK=0 QUIT
  1. . ;
  1. . ;-- Wait msg to user
  1. . DO WAIT^DICD WRITE !
  1. . ;
  1. . ;-- Check if Listener is running on port
  1. . IF '$$LOCK^XOBVTCP(XOBPORT) DO QUIT
  1. . . DO EN^DDIOL("VistALink Listener on port "_XOBPORT_" appears to be running already.")
  1. . . SET XOBOK=0
  1. . ;
  1. . ;-- Lock was successful; unlock and queue the listener to startup
  1. . DO UNLOCK^XOBVTCP(XOBPORT)
  1. . DO UPDATE^XOBVTCP(XOBPORT,1)
  1. . SET XOBOK=$$START^XOBVTCP(XOBPORT)
  1. . IF 'XOBOK DO
  1. . . DO UPDATE^XOBVTCP(XOBPORT,5)
  1. . . DO EN^DDIOL("Unable to start VistALink Listener on port "_XOBPORT_".")
  1. ;
  1. QUIT XOBOK
  1. ;
  1. ;
  1. CHKOS() ;-- Check operating system
  1. ;
  1. ; This function will determine which operating system is being used.
  1. ;
  1. ; Input:
  1. ; None
  1. ;
  1. ; Output:
  1. ; Function value - returns 1 on success, 0 on failure
  1. ;
  1. NEW OPERSYS,RESULT
  1. ;
  1. SET RESULT=0
  1. ;
  1. ;-- Get operating system
  1. SET OPERSYS=$$GETOS^XOBVTCP()
  1. ;
  1. DO
  1. . IF OPERSYS="OpenM-NT" DO QUIT
  1. .. DO EN^DDIOL("Starting VistALink Listener...")
  1. .. SET RESULT=1
  1. . ;
  1. . IF OPERSYS["DSM" DO EN^DDIOL("Use the TCPIP utility in VMS to enable the VistALink Listener.") QUIT
  1. . ;
  1. . ;-- All other operating systems
  1. . DO EN^DDIOL("Starting the VistALink Listener is not yet supported for "_OPERSYS_".") QUIT
  1. . ;
  1. QUIT RESULT
  1. ;
  1. ;
  1. VALID(XOBPORT) ;-- Validate port
  1. ;
  1. ; This function will validate a port number passed in.
  1. ;
  1. ; Input:
  1. ; XOBPORT - Port number for the Listener (Optional)
  1. ;
  1. ; Output:
  1. ; Function value - returns 1 if valid, 0 otherwise
  1. ;
  1. NEW RESULT
  1. ;
  1. SET XOBPORT=+$GET(XOBPORT)
  1. SET RESULT=0
  1. ;
  1. ;-- Check if port is not defined or invalid
  1. DO ; Drops out of block on failure
  1. . QUIT:XOBPORT=0
  1. . QUIT:(XOBPORT?.AP)
  1. . QUIT:XOBPORT<5000!(XOBPORT>65535)
  1. . SET RESULT=1
  1. QUIT RESULT
  1. ;
  1. ;
  1. GETPORT(XOBST) ;-- Prompt user for port number
  1. ;
  1. ; This function will prompt the user for a valid port number.
  1. ;
  1. ; Input:
  1. ; XOBST - start = start Listener
  1. ; stop = stop Listener
  1. ;
  1. ; Output:
  1. ; Function value - returns port # or zero
  1. ;
  1. NEW DIR,DIRUT,PORT
  1. SET XOBST=$GET(XOBST)
  1. ;
  1. SET DIR(0)="NA^5000:65535"
  1. SET DIR("A")="Enter Port: "
  1. SET DIR("B")=8000 ; Default port is 8000
  1. SET DIR("?")="Choose a numeric port to "_XOBST_" the VistALink Listener on in the range of 5000-65535."
  1. DO ^DIR KILL DIR
  1. IF $DATA(DIRUT) DO
  1. . DO EN^DDIOL("Port not specified. VistALink Listener not "_$SELECT(XOBST="start":"started",1:"stopped")_".")
  1. . SET PORT=0
  1. ELSE SET PORT=+$GET(Y)
  1. ;
  1. QUIT PORT
  1. ;
  1. ;
  1. BOX() ; -- start this BOX-VOl default configuration
  1. NEW XOBOX
  1. IF $$CHKOS^XOBUM1() DO
  1. . SET XOBOK=1
  1. . DO WAIT^DICD WRITE !
  1. . DO STARTCFG^XOBVTCP($$GETCFG^XOBVTCP())
  1. ELSE DO
  1. . SET XOBOK=0
  1. QUIT XOBOK
  1. ;
  1. ;
  1. STOP(LOGDA) ; -- stop a listener
  1. NEW Y,X,LOG0,XOBBOX,XOBPORT,XONCFG,XOBSTAT,XOBOK,XOBCFG
  1. SET XOBOK=0
  1. ;
  1. SET LOG0=$GET(^XOB(18.04,LOGDA,0))
  1. SET XOBBOX=$PIECE(LOG0,U)
  1. SET XOBPORT=$PIECE(LOG0,U,2)
  1. SET XOBSTAT=$PIECE(LOG0,U,3)
  1. SET XOBCFG=$PIECE(LOG0,U,6)
  1. ;
  1. ; -- must be valid entry with a running status
  1. IF XOBPORT,XOBSTAT=2 DO
  1. . DO UPDLOG^XOBVTCP(LOGDA,XOBPORT,3,XOBCFG)
  1. . SET XOBOK=1
  1. ELSE DO
  1. . SET XOBOK=0_U_"Listener is not running!"
  1. ;
  1. QUIT XOBOK
  1. ;
  1. PARMS() ; -- maintain site parameters
  1. NEW DIC,X,Y,DR,DA,DIE,XOBOK
  1. SET XOBOK=0
  1. ;
  1. IF $GET(^XOB(18.01,1,0))["" DO
  1. . SET DA=1,DR="[XOBU SITE PARAMETERS]",DIE="^XOB(18.01," DO ^DIE
  1. . SET XOBOK=1
  1. ELSE DO
  1. . SET XOBOK=0_U_"Error: Site parameter file not initialized."
  1. ;
  1. QUIT XOBOK
  1. ;
  1. CFG() ; -- listener configuration edit
  1. NEW DIC,X,Y,DR,DA,DIE,XOBDONE,XOBOK
  1. SET XOBOK=0
  1. ;
  1. SET XOBDONE=0
  1. ;
  1. FOR DO QUIT:XOBDONE
  1. . WRITE !
  1. . SET DIC="^XOB(18.03,",DIC(0)="AEMLQ" DO ^DIC
  1. . IF Y<1 SET XOBDONE=1 QUIT
  1. . SET DA=+Y,DR="[XOBV LISTENER CONFIG EDIT]",DIE="^XOB(18.03," DO ^DIE
  1. SET XOBOK=1
  1. ;
  1. QUIT XOBOK
  1. ;
  1. CP() ; -- add a connector proxy
  1. NEW XOBOK
  1. SET XOBOK=0
  1. DO CONT^XUSAP
  1. SET XOBOK=1
  1. QUIT XOBOK
  1. ;