OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

How to grant that OOo is running? (Java)

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
Trinkler
Guest





PostPosted: Fri Feb 27, 2004 6:00 am    Post subject: How to grant that OOo is running? (Java) Reply with quote

Hello again,

I integrated some handles with OOo - Documents in my JavaApplication...

The first time i granted that OOo is up by launching it
on startup in -invisible mode during launch of my application.

But now I face the problem, that some users close the complete
Office after viewing one document.
The Javaapp is processing on and tries to connect to the Office
the next time a document was requested ... BUT there is no listening office anymore Crying or Very sad

I tried to initalize a loop requesting access to a remoteServiceManager before i want real access, but I despaired
catching the thousandth ConnectionException and others.
I only want to check if OOo is running and listening in an easy way.

Maybe anyone has a nice solution or want to give me a kick to get me on the right way ? Smile
Back to top
dickkniep
Guest





PostPosted: Sat Feb 28, 2004 5:00 am    Post subject: Script that checks if OpenOffice is running on Linux Reply with quote

Hi there, here is a little script (in Python) that checks if OpenOffice is running, and if not start it with the appropriate parameters.

def CheckAppRun( chknam ):

k = os.popen('ps -e','r',1000)

h = k.read(1000)

l = ''

while h:

h = k.read(1000)

l += h

k.close()



try:

l.index(chknam)

Gevonden = True

except: Gevonden=False



return Gevonden



def StartOO(wppgmdir):

if os.name in ('dos','nt','xp'):

pass

elif os.name == 'posix':

if not CheckAppRun('soffice.bin'):

print wppgmdir

os.spawnv(os.P_NOWAIT, wppgmdir, [wppgmdir,'-accept=socket,host=localhost,port=2002;urp;'])

time.sleep(13)


The sleep is to make sure that OO has initialized and is ready to accept connections.

Hope this helps....


Cheers,
Dick
Back to top
Trinkler
Guest





PostPosted: Mon Mar 01, 2004 4:52 am    Post subject: Reply with quote

Many Thanks for your script Smile

But, finally I didn't use it, cause I had an idea while reading your post...

Now I'm trying to create a socket connection at the officeport and return a "status"-int.
If a BindException occurs - status "launched" is returned (the Exception catched).
Otherwise (the connection has been created) status "not launched" is returned ... after closing the socket I execute OOo.
Now I'm looping round until i get the status "launched" returned by the function.

Trinkler
Back to top
doctorlove
General User
General User


Joined: 08 Feb 2005
Posts: 25

PostPosted: Fri Feb 25, 2005 5:30 am    Post subject: Script that checks if OpenOffice is running on Linux Reply with quote

you can try "telnet <oohost> 8100"
if oo is listening, telnet will be accepted.
_________________
born to be alive
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group