| View previous topic :: View next topic |
| Author |
Message |
munkejens General User

Joined: 12 Sep 2003 Posts: 19
|
Posted: Tue Dec 14, 2004 7:23 am Post subject: Choosing API and language |
|
|
I believe I tried to search and read all information I could before posting, but still it seems at bit confusing.
Well, here goes my question:
I have diffucilties choosing what language and APIto use for an integration of OOo to at system that is using .Net/COM+ clientside components to interact to a Windows IIS Web-Application. Yes, you guessed it: the client OS is and can only be Windows.
I would like to use only UNO and Java to make add-ons to Writer that can interact to these client components, but I sense that UNO-COM bridge is a better choice?
Does this makes sense? If it does, what would you recommend?
Thanks is advance |
|
| Back to top |
|
 |
Cybb20 Super User


Joined: 02 Mar 2004 Posts: 1569 Location: Frankfurt, Germany
|
Posted: Tue Dec 14, 2004 9:39 am Post subject: |
|
|
To make Add-Ons to OOo there are three languages that you can choose from:
C++, Java, Python
What you do is called "registering new components", that means you add something to OOo that is emerged into its component model (UNO) and doesn't need any file to be run actually (the code is integrated into some main dlls and the service is added to the OOo internal registry).
Now it doesn't really matter how you access these add-ons, ie it doesn't matter which bridge you use, because these implemented components have become part of OOo.
In your case as you already said it would be going over the COM-UNO bridge.
So if you basically want to add functionality to OOo you don't have to fiddle around with a certain bridge (which would actually involve real hacking of OOo's source code), you can just use C++, Java or Python to write your implementation.
There is a complete chapter about writing components in the Developer's Guide on http://api.openoffice.org .
Also be sure to download the SDK, without its tools you're unable to do what you want.
Christian _________________ - Knowledge is Power - |
|
| Back to top |
|
 |
DannyB Moderator


Joined: 02 Apr 2003 Posts: 3991 Location: Lawrence, Kansas, USA
|
Posted: Tue Dec 14, 2004 10:13 am Post subject: |
|
|
It is possible to program OOo using COM, such as Microsoft Visual Basic, but this is NOT how to create AddOns.
AddOns can only be created using Java, Python or C++, at present.
Are you trying to have an external program drive OOo, or are you trying to create an AddOn component which is installed into the office and becomes part of the office?
BTW, AddOn's would work on any platform or operating system. Therefore, you cannot write AddOns using COM. _________________ Want to make OOo Drawings like the colored flower design to the left? |
|
| Back to top |
|
 |
munkejens General User

Joined: 12 Sep 2003 Posts: 19
|
Posted: Tue Dec 14, 2004 10:57 am Post subject: |
|
|
Thank you for your answer.
So you are saying that any language and API/brigde would give the same possibilities even though the rest of the system which OOo is supposed to be integrated into is build of COM+/.NET components? |
|
| Back to top |
|
 |
munkejens General User

Joined: 12 Sep 2003 Posts: 19
|
Posted: Tue Dec 14, 2004 10:59 am Post subject: |
|
|
| Ups, DannyB have answered while my reply was still in the making and therefore I haven't taking it into my reply. I will read and reply when this message is submitted. |
|
| Back to top |
|
 |
munkejens General User

Joined: 12 Sep 2003 Posts: 19
|
Posted: Tue Dec 14, 2004 11:17 am Post subject: |
|
|
| DannyB wrote: |
Are you trying to have an external program drive OOo, or are you trying to create an AddOn component which is installed into the office and becomes part of the office?
|
Internet Explorer and OOo should be able exchange data through some COM+ components. This means the you have buttons in both IE (the website) and OOo invoking funktions and exchaging data and files. The IE components have already been made and the integration to Windows. I want to make the component to OOo.
I now understand that I have to make two components: one Java AddOn and one COM component. One to each "direction" of data-flow.
Thanks |
|
| Back to top |
|
 |
Cybb20 Super User


Joined: 02 Mar 2004 Posts: 1569 Location: Frankfurt, Germany
|
Posted: Tue Dec 14, 2004 2:18 pm Post subject: |
|
|
| Quote: |
I now understand that I have to make two components: one Java AddOn and one COM component. One to each "direction" of data-flow.
|
As far as I understand you, you don't even need to those two things, you just need to write the AddOn part.
The nice thing about writing a Java component (and as an example I take the MinimalComponent example of the SDK) is that once it is installed into OOo it is already wrapped up into OOo's UNO structure and that means COM interface information (that you usually have to write yourself) are taken care of on the fly.
So if you have the MinimalComponent that has the getImplementationName() method, which returns a String you can already exchange data back and forth with COM.
I tested if the string really gets back to where it is called from (in your case it would be some script that calls from IE to get input from OOo) in Python and this is the result:
| Code: |
oo = DispatchEx("com.sun.star.ServiceManager")
>>> comp = oo.createInstance("org.OpenOffice.MinimalComponent")
>>> print comp
<COMObject <unknown>>
>>> name = comp.getImplementationName()
>>> name
u'MinimalComponent$MinimalComponentImplementation' |
[/code]
You see that it is actually a Unicode string (last line begins with a u) and that shows you that OOo has fully taken care of wrapping things into a COM interface when I deployed the component and returns a Unicode string, Unicode because OOo handles characters in unicode usually.
So the same easy way for returning data would be for passing data (you just specify it in the UNO component for OOo and you use it via a script that involves IE into the whole thing).
I hope that you understood my post, if you're familiar with coding COM servers in C or C++ you know that is an awful lot of work for you to do. The amount of extra work of making a method in OpenOffice compatible for the COM-UNO bridge is 0, because it is fully taken care of OpenOffice itself (once the component is registered).
Hope this helps.
Christian _________________ - Knowledge is Power - |
|
| Back to top |
|
 |
munkejens General User

Joined: 12 Sep 2003 Posts: 19
|
Posted: Wed Dec 15, 2004 5:39 am Post subject: |
|
|
Thank you for your replies.
I believe I understood your post. It was good, thanks. It is relieving to hear I only need one AddOn.
I thought about quitting the COM+ components and communication with IE altogether and make OOo connect directly to the webservers business-logic through the web services the webserver supplies.
This would make the whole solution more generic and open-source friendly. At least the client would be able to use a Linux platform.
How is OOo able to process HTTP request? Do I need some sort of client Java Servlet that OOo can communicate with to do this? Some hints would be very much appriciated.
PS: I am reading the DevelopersGuide and trying to understand the possibilities of OOo UNO, but it all sounds at bit confusing at the time. |
|
| Back to top |
|
 |
Cybb20 Super User


Joined: 02 Mar 2004 Posts: 1569 Location: Frankfurt, Germany
|
Posted: Wed Dec 15, 2004 6:48 am Post subject: |
|
|
Yes I believe that you have to deal with servlets then. I think there is a servlet example in the examples of the SDK.
Christian _________________ - Knowledge is Power - |
|
| Back to top |
|
 |
DannyB Moderator


Joined: 02 Apr 2003 Posts: 3991 Location: Lawrence, Kansas, USA
|
Posted: Wed Dec 15, 2004 9:05 am Post subject: |
|
|
| munkejens wrote: | I thought about quitting the COM+ components and communication with IE altogether and make OOo connect directly to the webservers business-logic through the web services the webserver supplies.
This would make the whole solution more generic and open-source friendly. At least the client would be able to use a Linux platform.
|
Okay, now I have a better idea of what you are asking. I was completely confused, and unclear earlier.
Here is what I now think that I am hearing.
You want to have OOo, with an AddOn component, and have that component connect to a web server, and consume web services from that server.
The web server can be implemented using any technology. Microsoft or not, it doesn't matter.
Here are two possible solutions.
1. Build an AddOn component in Java. The component could use any Java technologies to access the web service functions that live on the server. There is no writing of any new servlets. (Your web server might already use servlets, or other technologies, but that, as I said previously, is irrelevant.)
The advantage of this approach is that it would work on any platform that can run OOo. Windows. Linux. Mac OS X. probably other platforms as well. Solaris. Maybe OS/2? Maybe other platforms.
Approach 2.
Write a COM server. Use all the Microsoft technologies that you are familiar with. Install and register that com server on the client machine along with OOo. Whenever you install OOo onto a workstation, also install and register your com server.
Write macros, or even AddOns for OOo. These macros or AddOns can use the com.sun.star.bridge.OleObjectFactory to access your COM server. These macros or AddOns would be as minimal as possible. They would just serve as the "glue" between OOo and your COM server.
Macros would be preferable due to (1) simplicity, (2) portability to any OS. It is probably not necessary to write an AddOn. Macros are probably all that would be necessary to glue user interface actions (i.e. toolbars, menu commands, some dialog boxes, etc.) to your COM component which contacts your web server.
Access external COM/OLE server from OOo Basic
http://www.oooforum.org/forum/viewtopic.php?t=5918
http://www.oooforum.org/forum/viewtopic.php?t=6381 _________________ Want to make OOo Drawings like the colored flower design to the left? |
|
| Back to top |
|
 |
munkejens General User

Joined: 12 Sep 2003 Posts: 19
|
Posted: Wed Dec 15, 2004 12:09 pm Post subject: |
|
|
Thank you both for your very competent answers.
I'm sorry I wasn't clear at first, but I myself had a hard time figuring out the correct approach.
And as we know: unenlightened people tend to ask questions in an unenlightened manner
I'm not at all familliar with Microsofts technologies and therefore any approaches excluding Microsoft technologies is preferable.
Approach 1 sound like what I was looking for, as Cybb20 also indicated.
Making the client completely independent of the server and server platform is very preferable. Client OS independence even more.
I was thinking about using Apache Axis as an SOAP/XML Web Service client, but I understand that that might be overkill since OOo_SDK already gives such possibility.
I will start reading up on those until someone tells me Axis is more flexible and as easy to use.
Approach 2 from DannyB sounds very good and easy. I will take that one into consideration if/when I fail to do the more elegant approach 1.
I'm actually quite a fond user of Linux and Open Source, have just been assigned to do this integration of a productivity suite to a Windows Server milieu as a student project.
Thanks again, guys.
PS: Input is always welcome if you are bored. |
|
| Back to top |
|
 |
Cybb20 Super User


Joined: 02 Mar 2004 Posts: 1569 Location: Frankfurt, Germany
|
Posted: Wed Dec 15, 2004 1:09 pm Post subject: |
|
|
I would be cautious of saying approach 2 would be easy.
Of course it's relative, but it all depends and from my standpoint point 1 would be much easier to do.
Christian _________________ - Knowledge is Power - |
|
| Back to top |
|
 |
DannyB Moderator


Joined: 02 Apr 2003 Posts: 3991 Location: Lawrence, Kansas, USA
|
Posted: Thu Dec 16, 2004 7:43 am Post subject: |
|
|
| munkejens wrote: | | I'm not at all familliar with Microsofts technologies and therefore any approaches excluding Microsoft technologies is preferable. |
I was assuming just the opposite because you mention that it must run on Windows, and only Windows. I was assuming that part of your code was deeply tied to Microsoft technology. So my answer was about how to leverage this. _________________ Want to make OOo Drawings like the colored flower design to the left? |
|
| Back to top |
|
 |
|