rootOid = dcp.trim().trim();
}
Object rootObject = null;
XBridgeFactory xBridgeFactory= null;
XMultiComponentFactory xLocalServiceManager = xLocalContext.getServiceManager();
try {
xBridgeFactory = (XBridgeFactory)UnoRuntime.queryInterface(
XBridgeFactory.class,
xLocalServiceManager.createInstanceWithContext(
"com.sun.star.bridge.BridgeFactory", xLocalContext));
} catch (com.sun.star.uno.Exception e) {
throw new com.sun.star.uno.RuntimeException(e.getMessage());
}
synchronized(this) {
if(mBridge == null) {
Object connector= null;
try {
connector = xLocalServiceManager.createInstanceWithContext(
"com.sun.star.connection.Connector", xLocalContext);
} catch (com.sun.star.uno.Exception e) {
throw new com.sun.star.uno.RuntimeException(e.getMessage());
}
XConnector connector_xConnector = (XConnector)UnoRuntime.queryInterface(XConnector.class, connector);
// connect to the server
XConnection xConnection = connector_xConnector.connect(conDcp);
// create the bridge name. This should not be necessary if we pass an
//empty string as bridge name into createBridge. Then we should always get
//a new bridge. This does not work because of (i51323). Therefore we
//create unique bridge names for the current process.
String sBridgeName = "OOoBean_private_bridge_" + String.valueOf(m_nBridgeCounter++);
try {
mBridge = xBridgeFactory.createBridge(sBridgeName, protDcp, xConnection, null);
} catch (com.sun.star.bridge.BridgeExistsException e) {
throw new com.sun.star.uno.RuntimeException(e.getMessage());
}
}
rootObject = mBridge.getInstance(rootOid);