Another question about OpenOffice (and component based programming ingeneral)

Discussion in 'Java' started by Ramon F Herrera, Dec 5, 2007.

  1. I understand that in UNO (and COM, and CORBA...) the programmer can
    "inspect" or "interrogate" the components in order to find ways to
    communicate ("send messages") to them.

    The OpenOffice process can be run in either (a) named-pipe mode, or
    (b) listening to some particular socket mode. According to all the
    code I have seen, the programmer has to know those details in advance.
    IOW, if my program is going to connect the OO server via socket 8100
    (some sort of convention), it has to be started like this:

    "C:\Program Files\ 2.3\program\soffice" -

    The server has to be started to accommodate my code, and think it
    should be the other way around. I would like my client program to be
    as general and flexible as possible. If I understand component-based
    programming, I don't have to know a lot of stuff in advance, because
    the components themselves will provide the details. I just don't know
    what the correct "questions" are.

    These are the first 5 lines of a typical OO client program (not drawn
    to scale!):

    (1) xContext = Bootstrap.bootstrap(); // starts OO process (plus
    Windows icon) if not already running
    (2) XMultiComponentFactory xMCF = xContext.getServiceManager();
    (3) createInstanceWithContext("");
    (4) xConnector = (XConnector)
    UnoRuntime.queryInterface(XConnector.class, x);
    (5) connection = xConnector.connect(con); <-- finally!, there is TCP/
    IP communication here

    where 'con' can be something like: "socket,host=localhost,port=8100"
    or "pipe,name=whatever".

    Notice that it is not only after step (4) that finally a regular TCP/
    IP connection is established. How do they talk in steps (2-4)? Beats
    me, I am sure is not telegraph or smoke signals, the point is that
    there is some sort of communication going on. In fact, does anyone
    know how they solve this chicken-and-egg issue?

    But let's go to the...

    Main Question:

    Can I insert some statement between steps (4) and (5) in which I ask
    the OO server: what kind of IPC mode are you using: named pipe or
    socket? If pipe: what is the name of the pipe? If socket, what socket
    number are you using?

    Ramon F Herrera, Dec 5, 2007
    1. Advertisements

  2. I figured out the answer to this part:

    I got a "System Info for Windows" program and spied on the pipes being

    It turns out that there is a pipe with a well-known name which is used
    preliminary communication. It has some magic, agreed upon name like:


    (I swapped a few digits so you guys can't hack my OpenOffice :)

    Then, depending on the type of IPC used, either another pipe is
    started (with my chosen name appended):


    or a socket on the chosen port is created and listened to

    The Main Question, however, is still a big unknown...

    Ramon F Herrera, Dec 5, 2007
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.