com.jurismarches.vradi.services.ooo
Class BootstrapConnector

java.lang.Object
  extended by com.jurismarches.vradi.services.ooo.BootstrapConnector
Direct Known Subclasses:
BootstrapSocketConnector

public class BootstrapConnector
extends Object

A bootstrap connector which establishes a connection to an OOo server. Most of the source code in this class has been taken from the Java class "Bootstrap.java" (Revision: 1.15) from the UDK projekt (Uno Software Develop- ment Kit) from OpenOffice.org (http://udk.openoffice.org/). The source code is available for example through a browser based online version control access at http://udk.openoffice.org/source/browse/udk/. The Java class "Bootstrap.java" is there available at http://udk.openoffice.org/source/browse/udk/javaunohelper/com/sun/star/comp/helper/Bootstrap.java?view=markup The idea to develop this BootstrapConnector comes from the blog "Getting started with the OpenOffice.org API part III : starting OpenOffice.org with jars not in the OOo install dir by Wouter van Reeven" (http://technology.amis.nl/blog/?p=1284) and from various posts in the "(Unofficial) OpenOffice.org Forum" at http://www.oooforum.org/ and the "OpenOffice.org Community Forum" at http://user.services.openoffice.org/ complaining about "no ooo executable found!".


Constructor Summary
BootstrapConnector(OOoServer oooServer)
          Constructs a bootstrap connector which connects to the specified OOo server.
BootstrapConnector(String oooExecFolder)
          Constructs a bootstrap connector which uses the folder of the OOo installation containing the soffice executable.
 
Method Summary
static com.sun.star.uno.XComponentContext bootstrap(String oooExecFolder, String oooAcceptOption, String oooConnectionString)
          Bootstraps a connection to an OOo server in the specified soffice executable folder of the OOo installation using the specified accept option and connection string and returns a component context for using the connection to the OOo server.
 com.sun.star.uno.XComponentContext connect(String oooAcceptOption, String oooConnectionString)
          Connects to an OOo server using the specified accept option and connection string and returns a component context for using the connection to the OOo server.
 void disconnect()
          Disconnects from an OOo server using the connection string from the previous connect.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BootstrapConnector

public BootstrapConnector(String oooExecFolder)
Constructs a bootstrap connector which uses the folder of the OOo installation containing the soffice executable.

Parameters:
oooExecFolder - The folder of the OOo installation containing the soffice executable

BootstrapConnector

public BootstrapConnector(OOoServer oooServer)
Constructs a bootstrap connector which connects to the specified OOo server.

Parameters:
oooServer - The OOo server
Method Detail

connect

public com.sun.star.uno.XComponentContext connect(String oooAcceptOption,
                                                  String oooConnectionString)
                                           throws com.sun.star.comp.helper.BootstrapException
Connects to an OOo server using the specified accept option and connection string and returns a component context for using the connection to the OOo server. The accept option and the connection string should match to get a connection. OOo provides to different types of connections: 1) The socket connection 2) The named pipe connection To create a socket connection a host and port must be provided. For example using the host "localhost" and the port "8100" the accept option and connection string looks like this: - accept option : -accept=socket,host=localhost,port=8100;urp; - connection string: uno:socket,host=localhost,port=8100;urp;StarOffice.ComponentContext To create a named pipe a pipe name must be provided. For example using the pipe name "oooPipe" the accept option and connection string looks like this: - accept option : -accept=pipe,name=oooPipe;urp; - connection string: uno:pipe,name=oooPipe;urp;StarOffice.ComponentContext

Parameters:
oooAcceptOption - The accept option
oooConnectionString - The connection string
Returns:
The component context
Throws:
com.sun.star.comp.helper.BootstrapException

disconnect

public void disconnect()
Disconnects from an OOo server using the connection string from the previous connect. If there has been no previous connect, the disconnects does nothing. If there has been a previous connect, disconnect tries to terminate the OOo server and kills the OOo server process the connect started.


bootstrap

public static final com.sun.star.uno.XComponentContext bootstrap(String oooExecFolder,
                                                                 String oooAcceptOption,
                                                                 String oooConnectionString)
                                                          throws com.sun.star.comp.helper.BootstrapException
Bootstraps a connection to an OOo server in the specified soffice executable folder of the OOo installation using the specified accept option and connection string and returns a component context for using the connection to the OOo server. The accept option and the connection string should match in connection type and pipe name or host and port to get a connection.

Parameters:
oooExecFolder - The folder of the OOo installation containing the soffice executable
oooAcceptOption - The accept option
oooConnectionString - The connection string
Returns:
The component context
Throws:
com.sun.star.comp.helper.BootstrapException


Copyright © 2009-2010 JurisMarches. All Rights Reserved.