Java Extension Bootstrap

Java, C++, C#, Delphi... - Using the UNO bridges
Post Reply
Zambomba
Posts: 2
Joined: Mon Dec 07, 2015 5:14 pm

Java Extension Bootstrap

Post by Zambomba »

Hello forum!
I have been working on a extension that allows me to get a connection to OOo and load documents (at least for now). I have the compiled java classes and the extension and I create a UNO Service createUnoService("java.blabla.bla") and access the methods. One of these methods, is an init that makes a Bootstrap.bootstrap() and gets component loaders... When executing the code in Eclipse it automatically gets an OOo instance and loads documents, but when I do the same I have no other option than to start the OOo in listening mode. I thought that by using bootstrap I could avoid starting in listening mode, I already have an instance running to connect to, but it does not. I only have found something like this for python.
Image
Where the Python is in the OOo process, is it also like that for java? Source: http://www.openoffice.org/udk/python/python-bridge.html
So, question is, can I run a macro that uses a service from a java extension to bootstrap to an existing OOo instance?
OpenOffice 4.1 on Windows 7
User avatar
Villeroy
Volunteer
Posts: 31269
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Java Extension Bootstrap

Post by Villeroy »

1) A macro is a simple script that can be triggered by the office suite. All scripts are callable via Tools>Macros>Run or language specific via Tools>Macros>Organize>Language...
2) When you connect to an office suite running in listening mode, two separate programs (yours and the office suite) communicate with each other.
3) Extensions are much more than code. Have you ever installed any office extension from http://extensions.openoffice.org/ ?
An extension becomes part of the office suite with some integrated GUI elements and help files in most cases. Some extensions are just a bundle of graphics, document templates or colour palettes with no code at all. Some extensions integrate spreadsheet functions ("Calc add-ins"). Some extensions install macro code.

Working with a socket connection (2) helps you to develop some working code. But for a Java extension you need to write XML configuration files, type descriptions and lots of things I don't understand.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Zambomba
Posts: 2
Joined: Mon Dec 07, 2015 5:14 pm

Re: Java Extension Bootstrap

Post by Zambomba »

Yes, I have installed extensions, and building the extension is not the problem as I already have the source code and XML configuration files, I just insert my classes inside the source and can run my methods, like I said that is working. The problem is that in my source code I do a Bootstrap.bootstrap() that works perfectly when running pure java code, but when running the same code through a macro that uses the extension this does not work, I have to either open myself a listening instance or use a interprocess connection with the urp. I dont understand why the bootstrap does not work in that case because it even has a running instance that he could use.
OpenOffice 4.1 on Windows 7
Post Reply