Topic
  • 24 replies
  • Latest Post - ‏2014-11-18T09:45:13Z by Costas..Aravidis
Darwin_duan
Darwin_duan
1 Post

Pinned topic java access doors

‏2011-08-25T05:42:54Z |
helppppppp~
hello all,
i wanna get datas(such as Text) from doors with java language. any approach i have to make it?

i appreciate if can give some specific code.
thx
Updated on 2012-08-01T16:12:37Z at 2012-08-01T16:12:37Z by Mathias Mamsch
  • Mathias Mamsch
    Mathias Mamsch
    2147 Posts

    Re: java access doors

    ‏2011-08-25T07:11:29Z  
    You need to have a DXL script that will dump your data to a file (probably in XML or something), then read it from java. You start the DXL script from java over COM or over Batch Mode, then you read back the results. What exactly do you want to read? Regards, Mathias


    Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
  • llandale
    llandale
    3035 Posts

    Re: java access doors

    ‏2011-08-25T15:34:07Z  
    To clarify, you cannot run Java to query the database service directly; you must have your java send a DOOR DXL script to the DOORS client (on your PC), and perhaps also starting that DOORS client.
  • MichaelGeorg
    MichaelGeorg
    53 Posts

    Re: java access doors

    ‏2011-08-31T09:20:28Z  
    Also I've never checked it practice I think there is a commercial tool with which you can fully access DOORS data via Java.
    See: http://www.model-engineers.com/en/our-products/tudoor.html
  • SystemAdmin
    SystemAdmin
    3180 Posts

    Re: java access doors

    ‏2011-08-31T10:57:44Z  
    Also I've never checked it practice I think there is a commercial tool with which you can fully access DOORS data via Java.
    See: http://www.model-engineers.com/en/our-products/tudoor.html
    You could also fire DOORS from java in batch mode then capture DOORS's output via the standard out and standard error streams in DOORS "cout" and "cerr" respectively
  • kbmurphy
    kbmurphy
    160 Posts

    Re: java access doors

    ‏2011-08-31T13:10:47Z  
    You could also fire DOORS from java in batch mode then capture DOORS's output via the standard out and standard error streams in DOORS "cout" and "cerr" respectively
    MDWorkbench lets you access DOORS via Java. I went through it and was very impressed.

    http://sodius.com/mdw.php

    I am not a Java Developer, but it was obvious that if I were, the DOORS model is exposed very nicely through here, and I may choose to only access DOORS via Java. Try the demo!
  • llandale
    llandale
    3035 Posts

    Re: java access doors

    ‏2011-08-31T14:16:17Z  
    • kbmurphy
    • ‏2011-08-31T13:10:47Z
    MDWorkbench lets you access DOORS via Java. I went through it and was very impressed.

    http://sodius.com/mdw.php

    I am not a Java Developer, but it was obvious that if I were, the DOORS model is exposed very nicely through here, and I may choose to only access DOORS via Java. Try the demo!
    Is this to the DOORS client or to the DOORS service directly?
  • Mathias Mamsch
    Mathias Mamsch
    2147 Posts

    Re: java access doors

    ‏2011-08-31T15:47:28Z  
    • llandale
    • ‏2011-08-31T14:16:17Z
    Is this to the DOORS client or to the DOORS service directly?
    DOORS Service directly = nogo ... MD Workbench also works by creating dynamic DXL code, marshalling information over the COM interface in a very efficient, optimized way. Their DOORS connector (for reading data) is for free by the way, as far as I know (but I could be wrong). Regards, Mathias

    Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
  • llandale
    llandale
    3035 Posts

    Re: java access doors

    ‏2011-08-31T20:21:57Z  
    DOORS Service directly = nogo ... MD Workbench also works by creating dynamic DXL code, marshalling information over the COM interface in a very efficient, optimized way. Their DOORS connector (for reading data) is for free by the way, as far as I know (but I could be wrong). Regards, Mathias

    Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
    Did you say they use the DOORS Client to communicate efficiently with the service using COM rather than the normal DXL perms?
  • Mathias Mamsch
    Mathias Mamsch
    2147 Posts

    Re: java access doors

    ‏2011-08-31T20:34:54Z  
    • llandale
    • ‏2011-08-31T20:21:57Z
    Did you say they use the DOORS Client to communicate efficiently with the service using COM rather than the normal DXL perms?
    No, I said they send dynamically generated DXL code through the COM interface to the DOORS client and the DXL efficiently transfers data back to java. And by efficient I mean as efficient as you can get, marshalling all data through the COM interface. Regards, Mathias


    Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
  • SystemAdmin
    SystemAdmin
    3180 Posts

    Re: java access doors

    ‏2011-09-02T07:39:45Z  
    No, I said they send dynamically generated DXL code through the COM interface to the DOORS client and the DXL efficiently transfers data back to java. And by efficient I mean as efficient as you can get, marshalling all data through the COM interface. Regards, Mathias


    Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
    Hi,

    I am using the "jacob" component to interface java/jython to DOORS with COM.
    You have to write a "wrapper" library, to define a set of Java API to access DOORS, and then implement each API function as a DXL script to send to DOORS.

    url http://danadler.com/jacob/

    For example:

    get the top level items in DB

    dxl script:

    bool db_get_items()
    {
    Buffer b = create()
    Item i
    for i in folder "/" do
    {
    string u = uniqueID i
    string t = type i
    b += u
    b += ";"
    b += t
    b += "\n"
    }
    oleSetResult tempStringOf(b)
    delete b

    return true
    }

    jython/java wrapper:

    from com.jacob.com import *
    from com.jacob.activeX import *

    class DOORSDB:
    #
    FOLDER = "Folder"
    PROJECT = "Project"
    LINK = "Link"
    FORMAL = "Formal"
    #
    def __init__(self,app):
    self.app = app
    #
    def send(self,oper):
    try:
    s = '#include <e:/tests/lib/doorslib.dxl>\n'
    s = s + oper
    self.app.app.invoke("RunStr", s)
    res = self.app.app.getPropertyAsString("Result")
    return res
    except Exception,err:
    print "** execution error: " + str(err)
    return ""
    #
    def buildItemList(self,list):
    items = []
    if list == "" or list == None: return items
    for i in list.split("\n"):
    if i == "": continue
    v = i.split(";")
    u = v[0]
    t = v[1]
    if t == DOORSDB.FOLDER: items.append(DOORSFolder(self.app,u))
    elif t == DOORSDB.PROJECT: items.append(DOORSProject(self.app,u))
    elif t == DOORSDB.LINK: items.append(DOORSLinkModule(self.app,u))
    elif t == DOORSDB.FORMAL: items.append(DOORSFormalModule(self.app,u))
    else: continue
    return items
    #
    def getItems(self):
    s = 'db_get_items()\n'
    res = self.send(s)
    return self.buildItemList(res)
    ##

    I have used this mecanism to write a mockup of a DOORS interface in java/swing
    (attached file)

    You need to have java and dxl skills for that, but when the java API is writen you can reuse it ...

    luc
  • Mathias Mamsch
    Mathias Mamsch
    2147 Posts

    Re: java access doors

    ‏2011-09-05T12:55:03Z  
    Hi,

    I am using the "jacob" component to interface java/jython to DOORS with COM.
    You have to write a "wrapper" library, to define a set of Java API to access DOORS, and then implement each API function as a DXL script to send to DOORS.

    url http://danadler.com/jacob/

    For example:

    get the top level items in DB

    dxl script:

    bool db_get_items()
    {
    Buffer b = create()
    Item i
    for i in folder "/" do
    {
    string u = uniqueID i
    string t = type i
    b += u
    b += ";"
    b += t
    b += "\n"
    }
    oleSetResult tempStringOf(b)
    delete b

    return true
    }

    jython/java wrapper:

    from com.jacob.com import *
    from com.jacob.activeX import *

    class DOORSDB:
    #
    FOLDER = "Folder"
    PROJECT = "Project"
    LINK = "Link"
    FORMAL = "Formal"
    #
    def __init__(self,app):
    self.app = app
    #
    def send(self,oper):
    try:
    s = '#include <e:/tests/lib/doorslib.dxl>\n'
    s = s + oper
    self.app.app.invoke("RunStr", s)
    res = self.app.app.getPropertyAsString("Result")
    return res
    except Exception,err:
    print "** execution error: " + str(err)
    return ""
    #
    def buildItemList(self,list):
    items = []
    if list == "" or list == None: return items
    for i in list.split("\n"):
    if i == "": continue
    v = i.split(";")
    u = v[0]
    t = v[1]
    if t == DOORSDB.FOLDER: items.append(DOORSFolder(self.app,u))
    elif t == DOORSDB.PROJECT: items.append(DOORSProject(self.app,u))
    elif t == DOORSDB.LINK: items.append(DOORSLinkModule(self.app,u))
    elif t == DOORSDB.FORMAL: items.append(DOORSFormalModule(self.app,u))
    else: continue
    return items
    #
    def getItems(self):
    s = 'db_get_items()\n'
    res = self.send(s)
    return self.buildItemList(res)
    ##

    I have used this mecanism to write a mockup of a DOORS interface in java/swing
    (attached file)

    You need to have java and dxl skills for that, but when the java API is writen you can reuse it ...

    luc
    Uuuh ... A python DOORS interface ;-) My fingers are itching ... Any plans to make your code open source and improve it together? Regards, Mathias


    Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
  • SystemAdmin
    SystemAdmin
    3180 Posts

    Re: java access doors

    ‏2011-09-07T07:38:07Z  
    Uuuh ... A python DOORS interface ;-) My fingers are itching ... Any plans to make your code open source and improve it together? Regards, Mathias


    Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
    No plan for such a thing ... But no problem to give information to anybody interrested to do it ....
    Python is interresting because it's a complete OO language with all useful features for developper. I's interpreted, so you can adopt a development style very efficient similar to DXL, and Jython (the java implementation of Python) because you can reuse any Java code into your script without having to write wrappers.
    luc
  • Mathias Mamsch
    Mathias Mamsch
    2147 Posts

    Re: java access doors

    ‏2011-09-07T08:15:18Z  
    No plan for such a thing ... But no problem to give information to anybody interrested to do it ....
    Python is interresting because it's a complete OO language with all useful features for developper. I's interpreted, so you can adopt a development style very efficient similar to DXL, and Jython (the java implementation of Python) because you can reuse any Java code into your script without having to write wrappers.
    luc
    Yeah I know about jython, I am myself a python fanatic and also experimented with jython regarding Eclipse (plattform for DOORS 10?). I have quite some DXL experience and would find it an interesting challenge to design and implement an optimal interface for a) language wrappers in general and b) a proof of concept python/jython wrapper. I looks like you already did quite some work on that subject, so if you are willing to share the code and see if we can improve it together, send me a PM.

    Regards, Mathias
    Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
  • SystemAdmin
    SystemAdmin
    3180 Posts

    Re: java access doors

    ‏2012-02-15T16:27:50Z  
    Yeah I know about jython, I am myself a python fanatic and also experimented with jython regarding Eclipse (plattform for DOORS 10?). I have quite some DXL experience and would find it an interesting challenge to design and implement an optimal interface for a) language wrappers in general and b) a proof of concept python/jython wrapper. I looks like you already did quite some work on that subject, so if you are willing to share the code and see if we can improve it together, send me a PM.

    Regards, Mathias
    Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

    Hi Mathias/Luke,
    Wondered how you two got on with this. I find I have reason to try and get the active instance of doors from a rhapsody java application, this looked like a good candidate to solve my problem.

    Just had a stab at using Jacob and its very nice, but I am having trouble figuring out whether there is an active instance of DOORS running or not. The following works fine: -

    ActiveXComponent runningDOORS = new ActiveXComponent("DOORS.Application");
    runningDoors.invoke("RunStr","print(\"Is it Working\")");
    


    but what looks like the correct command: -

     

    ActiveXComponent.connectTOActiveInstance("DOORS.Application");
    


    crashes java completely

    if there is no running instance I want to fire it up using some specific parameters as we have many different data services: -

     

     

    Process doorsProc Runtime.getRuntime().exec(doors.exe -d port@server);
    



    Any words of wisdom?
    Thanks for any help.

    Richard



     

    Updated on 2014-01-03T00:53:44Z at 2014-01-03T00:53:44Z by iron-man
  • SystemAdmin
    SystemAdmin
    3180 Posts

    Re: java access doors

    ‏2012-02-16T09:47:33Z  

    Hi Mathias/Luke,
    Wondered how you two got on with this. I find I have reason to try and get the active instance of doors from a rhapsody java application, this looked like a good candidate to solve my problem.

    Just had a stab at using Jacob and its very nice, but I am having trouble figuring out whether there is an active instance of DOORS running or not. The following works fine: -

    <pre class="javascript dw" data-editor-lang="js" data-pbcklang="javascript" dir="ltr">ActiveXComponent runningDOORS = new ActiveXComponent("DOORS.Application"); runningDoors.invoke("RunStr","print(\"Is it Working\")"); </pre>


    but what looks like the correct command: -

     

    <pre class="javascript dw" data-editor-lang="js" data-pbcklang="javascript" dir="ltr">ActiveXComponent.connectTOActiveInstance("DOORS.Application"); </pre>


    crashes java completely

    if there is no running instance I want to fire it up using some specific parameters as we have many different data services: -

     

     

    <pre class="javascript dw" data-editor-lang="js" data-pbcklang="javascript" dir="ltr">Process doorsProc Runtime.getRuntime().exec(doors.exe -d port@server); </pre>



    Any words of wisdom?
    Thanks for any help.

    Richard



     

    The following seems a bit more stable than my first attempt, doesn't always detect when DOORS is open, but does most of the time, not sure why the standard answer to I cn't connect DOORS to Java isn't use JACOB?

    import com.jacob.activeX.ActiveXComponent;
            import com.jacob.com.*;
                    
                    String dxlFile = "" + appDir + "\\dxl\\transferTraceInfoToDOORS.dxl";
            try{
                //Try and get the active instance of doors first
                ComThread.InitMTA();
                //ActiveXComponent runningDoors = new ActiveXComponent("DOORS.Application");
     
                ActiveXComponent runningDoors = ActiveXComponent.connectToActiveInstance("DOORS.Application");
                if( runningDoors ==null) {
                        JOptionPane.showMessageDialog(null,"This application needs an active running instance of DOORS to work, please fire DOORS up and try again");
                        System.exit(0);
                }
                else {
                    runningDoors.invoke("RunStr", "print(\"Testing\");oleSetResult(\"Finished\")");
                    //runningDoors.invoke("RunFile", dxlFile);
                    System.out.println(runningDoors.getPropertyAsString("Result"));
                }
            }
            catch (Exception e) {
                e.printStackTrace();
            }
            finally {
                ComThread.Release();
            }
    
    Updated on 2014-01-03T00:54:27Z at 2014-01-03T00:54:27Z by iron-man
  • Pankaj@Moog
    Pankaj@Moog
    2 Posts

    Re: java access doors

    ‏2012-07-20T05:01:20Z  
    Uuuh ... A python DOORS interface ;-) My fingers are itching ... Any plans to make your code open source and improve it together? Regards, Mathias


    Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
    Hi Mathias Mamsch

    I need to create GUI for end user. I am very much new to DXL scripts but I know Python.
    Can you please tell me how I can link DXL scripts to Python scripts.

    Thanks :)
  • Mathias Mamsch
    Mathias Mamsch
    2147 Posts

    Re: java access doors

    ‏2012-08-01T16:12:37Z  
    Hi Mathias Mamsch

    I need to create GUI for end user. I am very much new to DXL scripts but I know Python.
    Can you please tell me how I can link DXL scripts to Python scripts.

    Thanks :)
    Creating a GUI in DXL is actually very simple... Creating a python wrapper for executing DXL commands is pretty complex. So in my opinion you will be MUCH better of by looking at GUI programming in DXL. Regards, Mathias

    Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
  • zsombor90
    zsombor90
    1 Post

    Re: java access doors

    ‏2013-11-12T14:24:26Z  

    The following seems a bit more stable than my first attempt, doesn't always detect when DOORS is open, but does most of the time, not sure why the standard answer to I cn't connect DOORS to Java isn't use JACOB?

    <pre class="javascript dw" data-editor-lang="js" data-pbcklang="javascript" dir="ltr">import com.jacob.activeX.ActiveXComponent; import com.jacob.com.*; String dxlFile = "" + appDir + "\\dxl\\transferTraceInfoToDOORS.dxl"; try{ //Try and get the active instance of doors first ComThread.InitMTA(); //ActiveXComponent runningDoors = new ActiveXComponent("DOORS.Application"); ActiveXComponent runningDoors = ActiveXComponent.connectToActiveInstance("DOORS.Application"); if( runningDoors ==null) { JOptionPane.showMessageDialog(null,"This application needs an active running instance of DOORS to work, please fire DOORS up and try again"); System.exit(0); } else { runningDoors.invoke("RunStr", "print(\"Testing\");oleSetResult(\"Finished\")"); //runningDoors.invoke("RunFile", dxlFile); System.out.println(runningDoors.getPropertyAsString("Result")); } } catch (Exception e) { e.printStackTrace(); } finally { ComThread.Release(); } </pre>

    Hi!

    I want to script doors from Eclipse/Java, and I tried out your sample code. It worked fine, but if I wanted to run again I got this message: "This application needs an active running instance of DOORS to work, please fire DOORS up and try again");
    and I don't no why. I found this documentation: http://pub.open-conflict.de/gui/java%20WIP/Sensors/lib/api/com/jacob/activeX/ActiveXComponent.html#invoke%28java.lang.String%29
    but I want a specific doc for com doors interface, because it's too average. 

    Is there any sample code or official documentation?

    I would be really appreciate,

    thanks,
    Zsombor Egyed


                     

     

  • Richard_Good
    Richard_Good
    61 Posts

    Re: java access doors

    ‏2013-11-18T18:46:11Z  
    • zsombor90
    • ‏2013-11-12T14:24:26Z

    Hi!

    I want to script doors from Eclipse/Java, and I tried out your sample code. It worked fine, but if I wanted to run again I got this message: "This application needs an active running instance of DOORS to work, please fire DOORS up and try again");
    and I don't no why. I found this documentation: http://pub.open-conflict.de/gui/java%20WIP/Sensors/lib/api/com/jacob/activeX/ActiveXComponent.html#invoke%28java.lang.String%29
    but I want a specific doc for com doors interface, because it's too average. 

    Is there any sample code or official documentation?

    I would be really appreciate,

    thanks,
    Zsombor Egyed


                     

     

    Through a little trial and error I found that the most reliable configuration was: - 

    1) to not setup the COM thread i.e.Don't use the .InitMTA() method

    2) Set the ActiveXComponent to null when initializing it

    3) Simply use runningDoors = ActiveXComponent.connectActiveInstance("DOORS.Application") to check for a running instance using local variables, then check for null to indicate there are no DOORS clients running, don't bother to clean up any references, just let things go out of scope, bit bonkers, but I found I had less issues that way

    Note you can only use the COM methods runStr, runFile from Jacob, you need something like: -

    runningDoors.invoke("RunFile", dxlFile)

    Where RunFile is the method name passed as a string and dxlFile is the file I want to run in DOORS

    Richard

    Updated on 2013-11-18T18:49:38Z at 2013-11-18T18:49:38Z by Richard_Good
  • Marina_Raf
    Marina_Raf
    3 Posts

    Re: java access doors

    ‏2014-11-14T20:21:38Z  

    Hello,

    I have a curiosity. It is possible to check with java if DOORS is running when DOORS is accessed via Citrix? And another point , from where I could download the safe jacob.jar, or more exactly what version, because I downloaded one, but 

    runningDoors = ActiveXComponent.connectActiveInstance("DOORS.Application") does not work, because connect method is not recognized. I am struggling for almost one year with this issue, would be great if someone found a solution for this problem.

  • Mathias Mamsch
    Mathias Mamsch
    2147 Posts

    Re: java access doors

    ‏2014-11-16T21:51:04Z  

    Hello,

    I have a curiosity. It is possible to check with java if DOORS is running when DOORS is accessed via Citrix? And another point , from where I could download the safe jacob.jar, or more exactly what version, because I downloaded one, but 

    runningDoors = ActiveXComponent.connectActiveInstance("DOORS.Application") does not work, because connect method is not recognized. I am struggling for almost one year with this issue, would be great if someone found a solution for this problem.

    I think what you are trying to do, is by design not possible ... Citrix is a "Remote Application" framework, i.e. you are starting the application on another computer (remote PC) and only displaying it on your computer (client PC). That means all the DOORS interfaces (COM, batch) cannot be used the same way as before.

    If you want to interact with a running DOORS citrix session, then this must be done from the remote machine, i.e. for example by starting a DXL script from the DOORS menu. Of course using DXL you can also start your Java application - in this case you can use the normal COM api for interacting with the DOORS client. Normally Citrix will pop up child processes of DOORS (your java application) on the client PC as well, so it should be possible to deploy your java application inside the citrix environment and have it interact with DOORS from there.

    The other possibility is, that you install a DOORS client outside the citrix environment and use that one for interacting with your DOORS server.

    Regards, Mathias

  • Wolfgang Uhr
    Wolfgang Uhr
    304 Posts

    Re: java access doors

    ‏2014-11-17T07:29:58Z  

    I think what you are trying to do, is by design not possible ... Citrix is a "Remote Application" framework, i.e. you are starting the application on another computer (remote PC) and only displaying it on your computer (client PC). That means all the DOORS interfaces (COM, batch) cannot be used the same way as before.

    If you want to interact with a running DOORS citrix session, then this must be done from the remote machine, i.e. for example by starting a DXL script from the DOORS menu. Of course using DXL you can also start your Java application - in this case you can use the normal COM api for interacting with the DOORS client. Normally Citrix will pop up child processes of DOORS (your java application) on the client PC as well, so it should be possible to deploy your java application inside the citrix environment and have it interact with DOORS from there.

    The other possibility is, that you install a DOORS client outside the citrix environment and use that one for interacting with your DOORS server.

    Regards, Mathias

    Hello

    > I think what you are trying to do, is by design not possible ... Citrix is a "Remote Application" framework, i.e. you are starting the application on another computer (remote PC) and only displaying it on your computer (client PC). That means all the DOORS interfaces (COM, batch) cannot be used the same way as before.

    In this case you shall create the object on the server.

    Standard ist:

    Object objDoors = createObject("DOORS.Application")

    But you can use the same commad for a remote object 

    Object objDoors = createObject("DOORS.Application", "theServer");

    Best regards

    Wolfgang

  • Marina_Raf
    Marina_Raf
    3 Posts

    Re: java access doors

    ‏2014-11-17T13:14:51Z  

    Ok, if I will proceed like this:

    Object objDoors = createObject("DOORS.Application", "theServer");

     

    Then Object should be the same ActiveXComponent? and the method is simply createObject()?

    thank you!

  • Costas..Aravidis
    Costas..Aravidis
    21 Posts

    Re: java access doors

    ‏2014-11-18T09:45:13Z  

    Ok, if I will proceed like this:

    Object objDoors = createObject("DOORS.Application", "theServer");

     

    Then Object should be the same ActiveXComponent? and the method is simply createObject()?

    thank you!

    This is also not possible as the server has a lot of sessions. Citrix is delivering an application through terminal server or remote services as it called.

    If doors is delivered through citrix then you need to start from doors something that will execute your application. This requires DXL, and you can do a lot of things with DXL much easier.

    Don't forget that citrix a lot of times delivers applications in an isolate environment for security.