Re: [api-dev] How to deploy Python macros as Addon

2007-12-07 Thread Alexandro Colorado
On Fri, 07 Dec 2007 18:37:35 -0600, Noelson Duarte  
<[EMAIL PROTECTED]> wrote:



Hello,

I've a py script with only two functions (no class) . From PyUNO docs I
know that is possible to deploy scripting framework py files as UNO
packages. All right.

I want to know if is it possible to deploy it as an Addon and, if yes,  
what

is the URL used within addons.xcu to call func1 ?

Sorry my english and thanks.
--
Noelson


You can generate your own Addon.xcu (is an XML), you will define the menu,  
options and other parameters. In the end you will need to send the execute  
to the function a good explanation of the addon is on the wiki.


then just zip it and rename to an oxd so you can install as a package  
manager.

http://wiki.services.openoffice.org/wiki/UNO_component_packaging#Addons.xcu

http://wiki.services.openoffice.org/wiki/Extension_Deployement



--
Alexandro Colorado
Help the Tabasco Relief efforts:
http://rootcoffee.blogspot.com/2007/11/race-to-save-mexico-flood-victims.html

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[api-dev] How to deploy Python macros as Addon

2007-12-07 Thread Noelson Duarte
Hello,

I've a py script with only two functions (no class) . From PyUNO docs I
know that is possible to deploy scripting framework py files as UNO
packages. All right.

I want to know if is it possible to deploy it as an Addon and, if yes, what
is the URL used within addons.xcu to call func1 ?

Sorry my english and thanks.
--
Noelson

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: [api-dev] Re: Would like to connect to OOo in its own terms

2007-12-07 Thread John Sisson
The current discussion seems to focus on the situation where a singleton
process hooks up to OpenOffice. As soon as there are multiple clients
for OO the situation is controlled by the operations of the
MacroManager. As of my last reports from [EMAIL PROTECTED], the MacroManager in 
OO
is not threadsafe and remotely invoking a macro on document A while
another process is running a macro on its document B has indeterminate
results. 

Our application makes heavy use of both Uno-Xinterfaces and custom
OO-Macros to process text into documents. We have both user clients and
robotic services that perform these operations and the solutions
presented so far won't allow for multiple processes with our behaviors
to run concurrently on a box.

Given this, it seems to be best for the client processes to be the
chickens and to lay instances of OO as eggs. In this model, each
workstation has a number of configurations of OO and client processes
are assigned to those by some shared client config. Now a client process
first tries to connect to a running instance of OO of its specified OO
configuration using the bootstrap initialComponentContext to ask for a
XBridge or a remoteContext. If not found, the process will start up that
instance using (for OO 2.x) the ENV startup parameters. One side effect
of this is that disconnect/shutdown issues seem to go away; another is
that a 'default user' config can be created to allow casual users to
work on OO documents on the desktop without being affected by custom
aspects of the service configurations. It's a bit more code work to hook
up this way; and it's a lot harder to install properly.

- John Sisson

-Original Message-
From: news [mailto:[EMAIL PROTECTED] On Behalf Of Ramon F Herrera
Sent: Friday, December 07, 2007 8:23 AM
To: dev@api.openoffice.org
Subject: [api-dev] Re: Would like to connect to OOo in its own terms

Stephan Bergmann wrote:
> Ramon F Herrera wrote:
>> (1) xContext = Bootstrap.bootstrap();  // starts OO process (plus
Windows icon) if not already running
> 
> After step (1), you already have a connection to OOo.


That was precisely my discovery. I concluded that Bootstrap.bootstrap() 
is the only connection method needed to fulfill my requirement ("Would 
like to connect to 'soffice' in its own terms"). I noticed that the 
bootstrap() step created the little icon (wonderful visual aid, it helps

a lot in development, btw) when soffice was not running, or, if it was 
running alreay, it just connects to it.

But, it turns out that Bootstrap.bootstrap() is less than a perfect 
solution, as it has a big problem. Read on...

My problem of achieving a clean disconnect persisted, so I went through 
as many tutorials and snippets as I could find. My conclusion was (and 
still is) this: "it has been determined that Bootstrap.bootstrap() is 
bad for the termination of your program". In Eclipse, at least I can 
click on the red square (stop) button, but in NetBeans the process 
simply keeps on running and the only way to terminate it is from the 
server side, right clicking the Quickstarter and exiting it. Notice that

those are *interactive* ways to terminate the bridge, and what I am 
really looking for is a *programmatic* way to terminate the bridge.

So far, the only programmatic solution involves:

(a) Bootstrap.createInitialComponentContext(null);
(b) connection = xConnector.connect(con);
(c) Keeping the value of 'bridge' around, so I can .dispose() it.

I am looking for a clean disconnect, which doesn't use (a) or (b).

-Ramon

ps: many thanks to everybody, I finally! found a knowledgeable source of

OO expertise, I mean *The* source.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[api-dev] Re: Would like to connect to OOo in its own terms

2007-12-07 Thread Ramon F Herrera

Stephan Bergmann wrote:

Ramon F Herrera wrote:

(5) connection = xConnector.connect(con);  <-- finally!, there is IPC here


That creates a connection from OOo to OOo.  Probably not what you want.



If that is the case, how come every single client example (except the 
ultrasimplistic, those that don't care about disconnecting) found in the 
SDK and elsewhere uses the


   connection = xConnector.connect(con);  // pipe or socket

statement? See, for instance, "Connection Aware *Client*"? (1)

My contention is that in order to make a connection-aware program, the 
first requirement is to make a socket/pipe IPC or else you will not be 
able to kill the session/bridge programmatically.


This issue should be clarified, documented and included in the examples.

Why? Because we are sending thousands of potential developers into a 
blind alley. There should be all kind of red flags:


  "Notice: there is no known(2) way to terminate a connection initiated 
by Bootstrap.bootstrap()"


-Ramon

(1) \examples\Developer's 
Guide\PorfUNO\InterprocessConn\ConnectionAwareClient.java


(2) programmatic.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[api-dev] Re: Would like to connect to OOo in its own terms

2007-12-07 Thread Ramon F Herrera

Stephan Bergmann wrote:

Ramon F Herrera wrote:

So the question becomes: is there any way to disconnect programmatically
from a session started by Bootstrap.bootstrap()?


There is some Close and VetoableClose or whatever stuff, maybe somebody 
from the framework who knows the details can kick in.


That is the Holy Grail that I have been looking for.

Are we sure that the VetoableClose is the solution we need to achieve a 
clean disconnect? I did find that vetoable "solution" (change an 
attribute to "true") on the net and implemented it. Not only does it get 
rid of the bridge -plus the icon- it additionally kills the soffice 
process altogether, regardless of how many other sessions it has.


Needless to say that is not a clean disconnect.

-Ramon

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[api-dev] Re: Would like to connect to OOo in its own terms

2007-12-07 Thread Ramon F Herrera

Stephan Bergmann wrote:

Ramon F Herrera wrote:

(1) xContext = Bootstrap.bootstrap();  // starts OO process (plus Windows icon) 
if not already running


After step (1), you already have a connection to OOo.



That was precisely my discovery. I concluded that Bootstrap.bootstrap() 
is the only connection method needed to fulfill my requirement ("Would 
like to connect to 'soffice' in its own terms"). I noticed that the 
bootstrap() step created the little icon (wonderful visual aid, it helps 
a lot in development, btw) when soffice was not running, or, if it was 
running alreay, it just connects to it.


But, it turns out that Bootstrap.bootstrap() is less than a perfect 
solution, as it has a big problem. Read on...


My problem of achieving a clean disconnect persisted, so I went through 
as many tutorials and snippets as I could find. My conclusion was (and 
still is) this: "it has been determined that Bootstrap.bootstrap() is 
bad for the termination of your program". In Eclipse, at least I can 
click on the red square (stop) button, but in NetBeans the process 
simply keeps on running and the only way to terminate it is from the 
server side, right clicking the Quickstarter and exiting it. Notice that 
those are *interactive* ways to terminate the bridge, and what I am 
really looking for is a *programmatic* way to terminate the bridge.


So far, the only programmatic solution involves:

(a) Bootstrap.createInitialComponentContext(null);
(b) connection = xConnector.connect(con);
(c) Keeping the value of 'bridge' around, so I can .dispose() it.

I am looking for a clean disconnect, which doesn't use (a) or (b).

-Ramon

ps: many thanks to everybody, I finally! found a knowledgeable source of 
OO expertise, I mean *The* source.



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [api-dev] Frustrations with Eclipse Plugin for Java Component Dev.

2007-12-07 Thread Cedric Bosdonnat
Hi Hasan,

Bramwell, Hasan M. a écrit :
>>> That may have been true with the previous version I was using, 
>>> but it is not the case with this version.  At any rate not in 
>>> my Windows XP machine with OOo 2.3.0
>> The latest dev versions haven't been tested on windows yet. 
>> I'll test it and fix the problems if needed.
> 
> It's not a big deal once you understand what's going on.  For newcomers, like 
> me it's a black mark against your plugin (and you only get so many of those 
> before they give up). 

I've updated the dev version here:
http://cedric.bosdonnat.free.fr/ooeclipseintegration_site.zip

Fixed:
  + the RegistrationHandler.classes file isn't empty anymore
  + some streams wheren't closed and could block the project destruction.

Tell me if there is something else.

-- 
Cédric Bosdonnat
OOo Eclipse Integration developer
http://cedric.bosdonnat.free.fr

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [api-dev] Would like to connect to OOo in its own terms

2007-12-07 Thread Mathias Bauer
Ramon F Herrera wrote:

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

No, that is not necessary. Only if you are not satisfied with the
standard connection that you get with the Simple Bootstrap process or if
you want to connect to an OOo instance that is not running on the same
machine as your application.

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

If *your* program wants to use a specific communication channel then of
course you will need to know which one you want to use. But OOo does not
enforce that. If you are fine with whatever connection OOo uses, you can
ignore which it is exactly.

> 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

It not only starts OOo, it already connects to it and gives you an
object that can be used to create and access others. See the attached
source code that loads a document via UNO (I tried to link to the source
code on api.openoffice.org but for whatever reasons it's not there).

> (2) XMultiComponentFactory xMCF = xContext.getServiceManager();
> (3) createInstanceWithContext("com.sun.star.bridge.BridgeFactory");
> (4) 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".
> 
> 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?

I don't understand why you want to know that. The Component Context you
have bootstrapped is your entry to the UNO world and gives you
everything you need. What else do you want to achieve by establishing
another connection?

I don't know what answers you will get here - in case they don't satisfy
you you could perhaps try to get more information on [EMAIL PROTECTED]

Ciao,
Mathias

-- 
Mathias Bauer (mba) - Project Lead OpenOffice.org Writer
OpenOffice.org Engineering at Sun: http://blogs.sun.com/GullFOSS
Please don't reply to "[EMAIL PROTECTED]".
I use it for the OOo lists and only rarely read other mails sent to it.
/*
 *
 *  $RCSfile: DocumentLoader.java,v $
 *
 *  $Revision: 1.5 $
 *
 *  last change: $Author: rt $ $Date: 2005/01/31 17:08:37 $
 *
 *  The Contents of this file are made available subject to the terms of
 *  the BSD license.
 *  
 *  Copyright (c) 2003 by Sun Microsystems, Inc.
 *  All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions
 *  are met:
 *  1. Redistributions of source code must retain the above copyright
 * notice, this list of conditions and the following disclaimer.
 *  2. Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution.
 *  3. Neither the name of Sun Microsystems, Inc. nor the names of its
 * contributors may be used to endorse or promote products derived
 * from this software without specific prior written permission.
 *
 *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
 *  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
 *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
 *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
 *  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
 *  OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 *  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
 *  TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
 *  USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 * 
 */

import com.sun.star.uno.UnoRuntime;


/** This class opens a new or an existing office document.
 */
public class DocumentLoader {
public static void main(String args[]) {
if ( args.length < 1 ) {
System.out.println(
"usage: java -jar DocumentLoader.jar \"\"" 

Re: [api-dev] Re: Would like to connect to OOo in its own terms

2007-12-07 Thread Stephan Bergmann

Ramon F Herrera wrote:

Perhaps my concern (see Subject line) could be addressed in
a simpler way. I was mostly satisfied with the simplest and
most common (at least in tutorial stuff) way of starting OOo:

   Bootstrap.bootstrap();

But, after a lot of experimentation I have concluded that
you cannot possibly disconnect from OOo when it is started in
the above bootstrap() fashion. If there were a way to disconnect,
I would be satisfied, until a more general UDDI is added.


Yes, life cycle control of soffice is a known problem (there probably 
are even issues for it in the issue database).  After 
Bootstrap.bootstrap() has connected to soffice, soffice can later find 
out when that connection has been closed (because your application has 
terminated) and could in principle then terminate itself (i.e., 
terminate itself once no more clients are there).  Just not 
implemented... ;)


-Stephan


So the question becomes: is there any way to disconnect programmatically
from a session started by Bootstrap.bootstrap()?


There is some Close and VetoableClose or whatever stuff, maybe somebody 
from the framework who knows the details can kick in.


-Stephan

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [api-dev] Would like to connect to OOo in its own terms

2007-12-07 Thread Stephan Bergmann

Ramon F Herrera wrote:


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


After step (1), you already have a connection to OOo.  The xContext 
object you get is a UNO proxy for an OOo-side UNO object, bridged across 
a UNO bridge which runs on top some connection (e.g., named pipe or 
TCP).  Any services you obtain from that xContext are services running 
in OOo.



(2) XMultiComponentFactory xMCF = xContext.getServiceManager();
(3) createInstanceWithContext("com.sun.star.bridge.BridgeFactory");
(4) xConnector = UnoRuntime.queryInterface(XConnector.class, x);
(5) connection = xConnector.connect(con);  <-- finally!, there is TCP/IP 
communication here


That creates a connection from OOo to OOo.  Probably not what you want.

-Stephan

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]