Has anyone had any success with DOORS DXL invoking a call to get information from another server?
// On Windows platforms only, passes the string command to the operating // system for execution, and continues the current DXL program. void system(string command)
//------------------------------------------------------------------------------
// *** Interprocess communications (See DOORS help) ****************************
//------------------------------------------------------------------------------
// Resolves the IP address ipAddress to its host name.
string ipcHostname(string ipAddress)
// The first form establishes a server connection to the UNIX socket socket.
// The second form establishes a server connection to the port number port
// on all platforms. In the case that supplied port number is 0, an ephemeral
// port number is allocated by the operating system. To fetch this ephemeral
// port number, use getPort() on the resulting IPC.
IPC server(string socket) // UNIX only
IPC server(int port)
// Fetches the port associated with the specified IPC.
// Useful when the IPC is allocated an ephemeral port by the
// operating system (see IPC server(int)).
int getPort(IPC channel)
// The first form establishes a client connection to the UNIX socket socket.
// The second form establishes a client connection to the IP address ip at
// host on all platforms.
IPC client(string socket)
IPC client(int ip, string host)
// Waits for a client connection at the server end of the connection.
bool accept(IPC)
// Sends the string message down IPC channel chan.
bool send(IPC chan, string message)
// Waits for a message to arrive in channel chan and assigns it to string or
// buffer variable response.
// The optional third argument defines a time-out, tmt seconds,
// for a message to arrive in channel chan. If tmt is zero,
// these functions wait forever. They only work if the caller is
// connected to the channel as a client or a server.
bool recv(IPC chan, {string|Buffer} &response [,int tmt])
// Disconnects channel chan.
void disconnect(IPC chan)
// Deletes channel chan (can be a server or a client).
void delete(IPC chan)
SystemAdmin - Wed Sep 28 12:44:31 EDT 2011 |
Re: How to Communicate with an External Process from DOORS We ended up using a file based protocol with flag files for synchronization (i.e. whenever the client / server is finished with reading a message it will delete the flag file of the communication partner and after writing a message it will create its own flag file). This works pretty well and has the advantage that it is very easy to implement on both sides and it does not rely on any third party component. We also experimented with the XML COM libraries of microsoft, which will allow you to create XML Documents and send them over the network which also worked well and supports non-blocking, but has the drawback of handling the XML data in DXL using COM so it is not clear how massive communication will affect memory consumption and performance. Additionally you have to rely on the third party COM Library which might not be available in future versions of windows. From other languages a good way to go is either start a DXL IPC server and read its console or run a DOORS batch job and read its console to get data from DOORS. Maybe that helps, Regards, Mathias Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS |
Re: How to Communicate with an External Process from DOORS Mathias Mamsch - Thu Sep 29 03:05:14 EDT 2011 Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS I thought about the file/flag methods but thought there had to be a package that did the job "out of the box". The use-case here is doing a test run with a test procedure in a DOORS module. The procedure is in DOORS and certain columns are for live data input. Many user responses are simple numbers or a few characters. In some cases I'd like to get a file from another server (Linux in this case). Once I have the file it would be parsed and key information would be ripped out of it. The semi-automatic procedure that exists now is to logon to the remote server and run a shell script that writes output to a console window. The user would then copy the output in the clipboard buffer and paste it into a DOORS scratch object cell. Once copied, a DXL script is run to extract the data of interest from the scratch object cell and deposit it in other objects with nicer, cataloged organization. In my application, blocking communication (with timeout) is what I'm looking for. If it fails we can revert to the semi-automatic method described above. If blocking with timeout is not available, I suppose I could poll for results and throw in the towel if no results appear in N seconds. Another technique I've used in the past (not in DOORS) is using a database and triggers as a command processor. The methodology is when a row in a certain table is inserted, a trigger runs a program which reads the newly inserted record and does some deed and deposits the result in another table. Summarizing the desire:
I admit I have not seen any documentation or postings on DOORS creating and using database connections, but if it is possible it opens a world of possibilities. |
Re: How to Communicate with an External Process from DOORS SystemAdmin - Thu Sep 29 09:58:32 EDT 2011
I admit I have not seen any documentation or postings on DOORS creating and using database connections, but if it is possible it opens a world of possibilities. If this is not what you are looking for and you want to implement a custom service, e.g. in java which will do all the stuff for you, you can just use the MSXML COM object for communication: https://www.ibm.com/developerworks/forums/thread.jspa?messageID=14632812� Watch out: The IPC functions and OleAutoObj functions do only take strings, that means you might end up filling your string table badly for longer communications. Additionally the "send" function of the IPC has no timeout. So when you get in a situation where the receiver wont take your message, then your DXL will hang and the user will have to restart DOORS. Regards, Mathias Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS |
Re: How to Communicate with an External Process from DOORS Mathias Mamsch - Fri Sep 30 10:15:08 EDT 2011 Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
Thanks Mathias. OleAutoObj objDAOobjDAO = oleCreateAutoObject "DAO.DBEngine.36"; On some websites I saw recommendations not to use DAO for new development. Although it works, I'm wondering if I could use something else -- especially if I don't plan to use a Microsoft data source.
Obsolete Data Access Technologies
DB-Library:This is a SQL Server-specific programming model that includes C APIs. There have been no feature enhancements to the DB-Library since SQL Server 6.5. Its final release was with SQL Server 2000, and it will not be ported to the 64-bit Windows operating system.
Embedded SQL (E-SQL):This is a SQL Server-specific programming model that enables Transact-SQL statements to be embedded in Visual C code. No feature enhancements have been made to the E-SQL since SQL Server 6.5. Its final release was with SQL Server 2000, and it will not be ported to the 64-bit Windows operating system.
Data Access Objects (DAO):DAO provides access to JET (Access) databases. This API can be used from Microsoft Visual Basic, Microsoft Visual C++, and scripting languages. It was included with Microsoft Office 2000 and Office XP. DAO 3.6 is the final version of this technology. It will not be available on the 64-bit Windows operating system.
Remote Data Objects (RDO):
RDO was designed specifically to access remote ODBC relational data sources, and made it easier to use ODBC without complex application code. It was included with Microsoft Visual Basic versions 4, 5, and 6. RDO version 2.0 was the final version of this technology.
// Given this works for Excel OleAutoObj objDAO = oleCreateAutoObject "DAO.DBEngine.36";
// Is this all I need to do to substitute for SQLite? OleAutoObj objADODB = oleCreateAutoObject "OleSQLite.SQLiteSource.1";
'define connection used through out in the form
Private mConn As ADODB.Connection
'//Synposis:
'//1. Create an ADO connection
'//2. Enable Read Data button if the table exists
Private Sub Form_Load()
On Error GoTo Trap
Set mConn = New ADODB.Connection
mConn.Open "Provider=OleSQLite.SQLiteSource.1; " _
& "Data Source=C:\public\customer.dat"
If HasCustTable Then
Me.Read.Enabled = True
End If
Exit Sub
Trap:
MsgBox Err.Description
End Sub
'//Synposis:
'//1. Create a table named cust if it does not exist. If the table exits,
'//delete all records from the table.
'//2. Insert some records into cust table
'//3. Update the records using parameters which makes it easy for
'//binary data manipulation
Private Sub Create_Click()
On Error GoTo Trap
Dim cmd As New ADODB.Command
cmd.ActiveConnection = mConn
If HasCustTable Then 'delete all data from the table if table exists
cmd.CommandText = "DELETE FROM cust;"
Else 'create cust table if it does not exists
cmd.CommandText = "CREATE TABLE cust(ID " _
& "INTEGER PRIMARY KEY, Name VARCHAR(60), "
& "Address VARCHAR(120), Picture BLOB);"
End If
cmd.Execute
cmd.CommandText = ""
'insert data
Dim I As Integer
For I = 100 To 110
cmd.CommandText = cmd.CommandText _
& "INSERT INTO cust (ID, Name) VALUES (" _
& I & ", 'Sean " & I & "');"
Next I
cmd.Execute
'update records with Parameters
Dim BA(999) As Byte
For I = 0 To 999
BA(I) = (I + 1) Mod 256
Next I
Dim params(2) As Parameter
Set params(0) = New ADODB.Parameter
params(0).Type = adInteger 'integer
params(0).Value = 100
Set params(1) = New ADODB.Parameter
params(1).Type = adBSTR 'string
params(1).Value = "1010 Main St, Salem, OR"
Set params(2) = New ADODB.Parameter
params(2).Type = adBinary
params(2).Value = BA
params(2).Size = 1000
cmd.CommandText = "UPDATE cust SET Address=?, Picture=? WHERE ID=?;"
'add parameters according to commend text
cmd.Parameters.Append params(1)
cmd.Parameters.Append params(2)
cmd.Parameters.Append params(0)
cmd.Execute
'using transaction
params(0).Value = 101
mConn.BeginTrans
cmd.Execute
mConn.RollbackTrans 'You will see the address is NOT updated
params(0).Value = 102
mConn.BeginTrans
cmd.Execute
mConn.CommitTrans 'Address is updated when read back
Set cmd = Nothing
MsgBox "Done"
Exit Sub
Trap:
MsgBox Err.Description
End Sub
'//Synposis:
'//Create a recordset to get all data from cust table and present the
'//data in a data grid.
'//To view the binary data read back from the database, you may open
'//open a watch window in the debug mode
Private Sub Read_Click()
Dim BA() As Byte
On Error GoTo Trap
Me.MSHFlexGrid1.Clear
Dim Rs As New ADODB.Recordset
Rs.Open "SELECT * FROM cust;", mConn
If Not Rs.EOF Then
BA = Rs("Picture").Value 'add to watch window to view byte array
End If
Set Me.MSHFlexGrid1.Recordset = Rs
Exit Sub
Trap:
MsgBox Err.Description
End Sub
'//Synposis:
'//Clear all data from the data grid
Private Sub Clear_Click()
Me.MSHFlexGrid1.Clear
End Sub
'//Synposis:
'//Check if the cust table exists. Return true if it does. Return false
'//otherwise.
Private Function HasCustTable() As Boolean
Dim Rs As ADODB.Recordset
Set Rs = mConn.OpenSchema(adSchemaTables)
While Not Rs.EOF
If Rs("table_name").Value = "cust" Then
HasCustTable = True
GoTo funExit
End If
Rs.MoveNext
Wend
funExit:
Rs.Close
Set Rs = Nothing
End Function
|
How to Communicate with SQLite database from DOORS? SystemAdmin - Fri Sep 30 12:30:55 EDT 2011
Thanks Mathias. OleAutoObj objDAOobjDAO = oleCreateAutoObject "DAO.DBEngine.36"; On some websites I saw recommendations not to use DAO for new development. Although it works, I'm wondering if I could use something else -- especially if I don't plan to use a Microsoft data source.
Obsolete Data Access Technologies
DB-Library:This is a SQL Server-specific programming model that includes C APIs. There have been no feature enhancements to the DB-Library since SQL Server 6.5. Its final release was with SQL Server 2000, and it will not be ported to the 64-bit Windows operating system.
Embedded SQL (E-SQL):This is a SQL Server-specific programming model that enables Transact-SQL statements to be embedded in Visual C code. No feature enhancements have been made to the E-SQL since SQL Server 6.5. Its final release was with SQL Server 2000, and it will not be ported to the 64-bit Windows operating system.
Data Access Objects (DAO):DAO provides access to JET (Access) databases. This API can be used from Microsoft Visual Basic, Microsoft Visual C++, and scripting languages. It was included with Microsoft Office 2000 and Office XP. DAO 3.6 is the final version of this technology. It will not be available on the 64-bit Windows operating system.
Remote Data Objects (RDO):
RDO was designed specifically to access remote ODBC relational data sources, and made it easier to use ODBC without complex application code. It was included with Microsoft Visual Basic versions 4, 5, and 6. RDO version 2.0 was the final version of this technology.
// Given this works for Excel OleAutoObj objDAO = oleCreateAutoObject "DAO.DBEngine.36";
// Is this all I need to do to substitute for SQLite? OleAutoObj objADODB = oleCreateAutoObject "OleSQLite.SQLiteSource.1";
'define connection used through out in the form
Private mConn As ADODB.Connection
'//Synposis:
'//1. Create an ADO connection
'//2. Enable Read Data button if the table exists
Private Sub Form_Load()
On Error GoTo Trap
Set mConn = New ADODB.Connection
mConn.Open "Provider=OleSQLite.SQLiteSource.1; " _
& "Data Source=C:\public\customer.dat"
If HasCustTable Then
Me.Read.Enabled = True
End If
Exit Sub
Trap:
MsgBox Err.Description
End Sub
'//Synposis:
'//1. Create a table named cust if it does not exist. If the table exits,
'//delete all records from the table.
'//2. Insert some records into cust table
'//3. Update the records using parameters which makes it easy for
'//binary data manipulation
Private Sub Create_Click()
On Error GoTo Trap
Dim cmd As New ADODB.Command
cmd.ActiveConnection = mConn
If HasCustTable Then 'delete all data from the table if table exists
cmd.CommandText = "DELETE FROM cust;"
Else 'create cust table if it does not exists
cmd.CommandText = "CREATE TABLE cust(ID " _
& "INTEGER PRIMARY KEY, Name VARCHAR(60), "
& "Address VARCHAR(120), Picture BLOB);"
End If
cmd.Execute
cmd.CommandText = ""
'insert data
Dim I As Integer
For I = 100 To 110
cmd.CommandText = cmd.CommandText _
& "INSERT INTO cust (ID, Name) VALUES (" _
& I & ", 'Sean " & I & "');"
Next I
cmd.Execute
'update records with Parameters
Dim BA(999) As Byte
For I = 0 To 999
BA(I) = (I + 1) Mod 256
Next I
Dim params(2) As Parameter
Set params(0) = New ADODB.Parameter
params(0).Type = adInteger 'integer
params(0).Value = 100
Set params(1) = New ADODB.Parameter
params(1).Type = adBSTR 'string
params(1).Value = "1010 Main St, Salem, OR"
Set params(2) = New ADODB.Parameter
params(2).Type = adBinary
params(2).Value = BA
params(2).Size = 1000
cmd.CommandText = "UPDATE cust SET Address=?, Picture=? WHERE ID=?;"
'add parameters according to commend text
cmd.Parameters.Append params(1)
cmd.Parameters.Append params(2)
cmd.Parameters.Append params(0)
cmd.Execute
'using transaction
params(0).Value = 101
mConn.BeginTrans
cmd.Execute
mConn.RollbackTrans 'You will see the address is NOT updated
params(0).Value = 102
mConn.BeginTrans
cmd.Execute
mConn.CommitTrans 'Address is updated when read back
Set cmd = Nothing
MsgBox "Done"
Exit Sub
Trap:
MsgBox Err.Description
End Sub
'//Synposis:
'//Create a recordset to get all data from cust table and present the
'//data in a data grid.
'//To view the binary data read back from the database, you may open
'//open a watch window in the debug mode
Private Sub Read_Click()
Dim BA() As Byte
On Error GoTo Trap
Me.MSHFlexGrid1.Clear
Dim Rs As New ADODB.Recordset
Rs.Open "SELECT * FROM cust;", mConn
If Not Rs.EOF Then
BA = Rs("Picture").Value 'add to watch window to view byte array
End If
Set Me.MSHFlexGrid1.Recordset = Rs
Exit Sub
Trap:
MsgBox Err.Description
End Sub
'//Synposis:
'//Clear all data from the data grid
Private Sub Clear_Click()
Me.MSHFlexGrid1.Clear
End Sub
'//Synposis:
'//Check if the cust table exists. Return true if it does. Return false
'//otherwise.
Private Function HasCustTable() As Boolean
Dim Rs As ADODB.Recordset
Set Rs = mConn.OpenSchema(adSchemaTables)
While Not Rs.EOF
If Rs("table_name").Value = "cust" Then
HasCustTable = True
GoTo funExit
End If
Rs.MoveNext
Wend
funExit:
Rs.Close
Set Rs = Nothing
End Function
Oddly enough, I have the same question as above. I have a SQLite database and i would like to query and modify this from a DXL within DOORS. Did anyone happen to find a solution for this? If so please shed some light.
|
Re: How to Communicate with SQLite database from DOORS? xdweissx - Tue Dec 03 15:45:13 EST 2013 Oddly enough, I have the same question as above. I have a SQLite database and i would like to query and modify this from a DXL within DOORS. Did anyone happen to find a solution for this? If so please shed some light.
I am doing that at the moment as an example for my "Parallels" library, which you can find here: https://github.com/domoran/DXLParallels My goal is to check the performance gain of DXL parallelization by a typical application, so I decided to make an SQLite Exporter, that will dump module contents to an SQLite database. Hopefully parallalization, i.e. extracting data from modules in different batch processes, brings a reasonable speedup on multicore machines. I will checkin some example code this evening - The SQLite interface is pretty much implemented, I have a working example that will put and read some data to/from a database. You can see if it suits your needs. Feel free to contribute to the project by the way ;-) Regards, Mathias |
Re: How to Communicate with SQLite database from DOORS? Mathias Mamsch - Wed Dec 04 05:20:23 EST 2013 I am doing that at the moment as an example for my "Parallels" library, which you can find here: https://github.com/domoran/DXLParallels My goal is to check the performance gain of DXL parallelization by a typical application, so I decided to make an SQLite Exporter, that will dump module contents to an SQLite database. Hopefully parallalization, i.e. extracting data from modules in different batch processes, brings a reasonable speedup on multicore machines. I will checkin some example code this evening - The SQLite interface is pretty much implemented, I have a working example that will put and read some data to/from a database. You can see if it suits your needs. Feel free to contribute to the project by the way ;-) Regards, Mathias Okay, I uploaded the code to gitgub. At the moment I am experimenting on how to store/query link and object hierarchies in the fastest way. In the example I built a trigger to update the closure table for the hierarchy using a trigger, but that might slow down inserts a lot, so I think about creating the closure table on demand or even use a recursive query on the original data. Anyway, what do you want to do with sqlite and doors? It seems to me you might want to export data there to run statistics / queries so the parallels library might come in the right direction for you. Would be glad if you gave some feedback. Regards, Mathias |
Re: How to Communicate with SQLite database from DOORS? Mathias Mamsch - Wed Dec 04 17:35:28 EST 2013 Okay, I uploaded the code to gitgub. At the moment I am experimenting on how to store/query link and object hierarchies in the fastest way. In the example I built a trigger to update the closure table for the hierarchy using a trigger, but that might slow down inserts a lot, so I think about creating the closure table on demand or even use a recursive query on the original data. Anyway, what do you want to do with sqlite and doors? It seems to me you might want to export data there to run statistics / queries so the parallels library might come in the right direction for you. Would be glad if you gave some feedback. Regards, Mathias Thank You in advance Mathias. I havent gotten a chance to look at your project but I will over the next few days. It sounds very relevant to my application. My concept is as follows: I need to read in parameters (strings) from a SQLite database to DOORS (not sure how this is done), use some logic to manipulate them (also not sure how this is done.) and then enter the processed strings (essentially concatenated SQLite database entries) into a DOORS module. I then need to read the generated Object ID from DOORS and flow back to the SQLite database. I should mention that I am new to dxl scripting. I would like to automate this somehow so that when a user adds a row to the SQLite table, a command can be run in DOORS which will update the DOORS module based on the modification to the SQLite database. *** Alternatively, I have considered performing an export to csv from SQLite, and then importing the tables directly into intermediate DOORS modules. These intermediate modules must then be queried and passed into some function (dxl) which will use the data from these modules to generate object text for the main or "readable" module. This is a much less elegant alternative. The logic to generate the final object text is the same in either approach, but the second approach retrieves its data from DOORS (intermediate modules) where as the option above is assuming some connectivity to a SQLite database (read, write). Regards, Daniel
|
Re: How to Communicate with SQLite database from DOORS? Mathias Mamsch - Wed Dec 04 17:35:28 EST 2013 Okay, I uploaded the code to gitgub. At the moment I am experimenting on how to store/query link and object hierarchies in the fastest way. In the example I built a trigger to update the closure table for the hierarchy using a trigger, but that might slow down inserts a lot, so I think about creating the closure table on demand or even use a recursive query on the original data. Anyway, what do you want to do with sqlite and doors? It seems to me you might want to export data there to run statistics / queries so the parallels library might come in the right direction for you. Would be glad if you gave some feedback. Regards, Mathias I have downloaded all of your files and ran the sqlite.dxl code which compiled properly. I did however receive a "SQLite invocation failed" message. I was hoping you could provide some clarification/guidance on this? Thanks again, Daniel |
Re: How to Communicate with SQLite database from DOORS? xdweissx - Thu Dec 05 21:15:36 EST 2013 I have downloaded all of your files and ran the sqlite.dxl code which compiled properly. I did however receive a "SQLite invocation failed" message. I was hoping you could provide some clarification/guidance on this? Thanks again, Daniel Hi Daniel, the code tries to locate the SQLite executable automatically from the configured include path. Packaged with the parallels library is a runDOORS.bat file, which is configured to start DOORS with the include path set to the Parallels install directory. I can think of a couple of reasons, why this fails: a) The sqlite.exe is not determined correctly (please verify by commenting in the print statement that will print the command that is run. It should contain the absolute path of the sqlite.exe executable) Maybe there is a quotation problem with spaces on the path, etc. b) The example is configured to create an SQL database on c:\\temp\\mydb.sql .... If that path does not exist, of course the invocation will fail. If that does not resolve the problems, please take the command, that is printed by the example and run it manually on the DOS prompt, but without the pipe operator "> output file". I did not yet redirect stderr output of the command to the result, so at the moment any SQLite error messages are swallowed by the library. I will take care of this issue on the next push. Please contact me by e-mail for further discussions: mmamsch (at) google (remove this space) mail.com Regards, Mathias |