Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / December 2007

Tip: Looking for answers? Try searching our database.

Another question about OpenOffice (and component based programming in     general)

Thread view: 
Ramon F Herrera - 05 Dec 2007 01:08 GMT
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\OpenOffice.org 2.3\program\soffice" -
accept=socket,host=0,port=8100;urp;

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("com.sun.star.bridge.BridgeFactory");
(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
Ramon F Herrera - 05 Dec 2007 02:08 GMT
I figured out the answer to this part:

> 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?

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

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

OSL_PIPE_S-1-3-21-3013719433-76483947-1417158311-1005_SingleOfficeIPC_9debf783ac2f938dc2d509a53b7ebe9

(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):

OSL_PIPE_S-1-3-21-3013719433-76483947-1417158311-1005_whatever

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

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

-Ramon


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.