net.sf.joott.uno
Class UnoConnection
java.lang.Object
net.sf.joott.uno.UnoConnection
- All Implemented Interfaces:
- com.sun.star.lang.XEventListener, com.sun.star.uno.XInterface
- public class UnoConnection
- extends Object
- implements com.sun.star.lang.XEventListener
Establishes and maintains a UNO Interprocess Connection with OpenOffice.org.
Only connections to the local machine are supported (otherwise it would be
difficult to work with local files).
By default tries to autoreconnect if the existing connection goes down.
This class is a regular bean so it can be managed by a dependency injection container (such as Spring).
| Fields inherited from interface com.sun.star.lang.XEventListener |
UNOTYPEINFO |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface com.sun.star.lang.XEventListener |
|
UnoConnection
public UnoConnection()
UnoConnection
public UnoConnection(int port)
setPort
public void setPort(int port)
setAutoReconnecting
public void setAutoReconnecting(boolean autoReconnecting)
- Should we try to reestablish the connection if it goes down?
- Parameters:
autoReconnecting -
getAutoReconnecting
public boolean getAutoReconnecting()
connect
public void connect()
throws ConnectException
- Throws:
ConnectException
close
public void close()
getService
protected Object getService(String service)
throws ConnectException
- Obtains a UNO service.
- Parameters:
service - the UNO service name (e.g. "com.sun.star.frame.Desktop")
- Returns:
-
- Throws:
ConnectException - if the underlying connection went down
getDesktop
public com.sun.star.frame.XComponentLoader getDesktop()
throws ConnectException
- Obtains the com.sun.star.frame.Desktop service.
- Returns:
-
- Throws:
ConnectException
disposing
public void disposing(com.sun.star.lang.EventObject event)
- Specified by:
disposing in interface com.sun.star.lang.XEventListener