Class BootstrapConnector
- Direct Known Subclasses:
BootstrapSocketConnector
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 office executable found!".
-
Field Summary
Modifier and TypeFieldDescriptionprotected static final int
-
Constructor Summary
ConstructorDescriptionBootstrapConnector
(OOServer oooServer, Supplier<Integer> connectionTimeoutSupplier) Constructs a bootstrap connector which connects to the specified OOo server. -
Method Summary
Modifier and TypeMethodDescriptioncom.sun.star.uno.XComponentContext
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
Disconnects from an OOo server using the connection string from the previous connect.protected com.sun.star.uno.XComponentContext
Create default local component context.protected com.sun.star.uno.XComponentContext
getRemoteContext
(com.sun.star.bridge.XUnoUrlResolver xUrlResolver) Try to connect to office.
-
Field Details
-
CONNECTION_RETRY_INTERVAL
protected static final int CONNECTION_RETRY_INTERVAL- See Also:
-
connectionTimeoutSupplier
-
-
Constructor Details
-
BootstrapConnector
Constructs a bootstrap connector which connects to the specified OOo server.- Parameters:
oooServer
- The OOo server
-
-
Method Details
-
connect
public com.sun.star.uno.XComponentContext connect(String oooConnectionString) throws 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:
oooConnectionString
- The connection string- Returns:
- The component context
- Throws:
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.
-
getLocalContext
Create default local component context.- Returns:
- The default local component context
- Throws:
Exception
-
getRemoteContext
protected com.sun.star.uno.XComponentContext getRemoteContext(com.sun.star.bridge.XUnoUrlResolver xUrlResolver) throws BootstrapException, com.sun.star.connection.ConnectionSetupException, com.sun.star.lang.IllegalArgumentException, com.sun.star.connection.NoConnectException Try to connect to office.- Returns:
- The remote component context
- Throws:
BootstrapException
com.sun.star.connection.ConnectionSetupException
com.sun.star.lang.IllegalArgumentException
com.sun.star.connection.NoConnectException
-