For as long as I’ve been doing DXL development, I’ve desired ways to interface DOORS with languages besides DXL.  This desire was rooted in my prior experience with writing automation scripts for Rational ClearQuest.  Though quirky, I had found CQ very easy to automate using COM.  Rational DOORS, on the other hand (owing most likely to its Telelogic origins) provides very little in the way of COM automation or any other interface besides DXL for automation.  It is my opinion that this design decision is a legacy form of lock-in for the DXL language (and associated consulting charges).  The COM automation for DOORS is limited to launching DOORS, sending it DXL code, hoping that the code succeeds, and then possibly receiving some string output.  (Note that the opposite is true when DOORS is the client; automating other COM components is reliable, if tedious).

In addition to this simple COM server capability, DOORS also provides a similar socket server.  It still requires automating DOORS using a fair amount of DXL code. If we accept that we are going to have to muck around with DXL code, possibly dedicating it towards providing an API that is driven by code written in another language over the socket, we can still manage to get a lot of work done.  The usage of such a system seemed obscure to me at first (the documentation didn’t help a ton), but it was actually pretty easy to create a simple socket server in DXL and a socket client in Python.  This is is where Python really shines.

Here is the DXL socket server code.  This code can be executed in the DXL interactive editor.  It will lock up the client GUI while the code loops waiting for connections.  Connecting clients can then send arbitrary DXL code or the keywords “quit_” (to disconnect) or “shutdown_” (to shutdown the DXL socket server).

Here is the Python socket client code.  First, to shutdown the DXL socket server, run the client script like “python IPC_Client.py —shutdown”.  This will unblock the DOORS GUI.  Otherwise, run the script without any arguments and the three print_* functions will send DXL code to the socket server and then print the returned results.

Advertisements