Package com.sun.star.connection

Examples of com.sun.star.connection.XConnector


      XComponentContext xRemoteContext = Bootstrap.createInitialComponentContext(null);
      logger.debug("InitialComponentContext xRemoteContext created: " + xRemoteContext);

      Object x = xRemoteContext.getServiceManager().createInstanceWithContext(
        "com.sun.star.connection.Connector", xRemoteContext);
      XConnector xConnector = (XConnector) UnoRuntime.queryInterface(XConnector.class, x);
      logger.debug("XConnector retrieved: " + xConnector);
      XConnection connection = xConnector.connect("socket,host=" + host + ",port=" + port);
      logger.debug("XConnection retrieved: " + connection);
      x = xRemoteContext.getServiceManager().createInstanceWithContext("com.sun.star.bridge.BridgeFactory",
        xRemoteContext);
      XBridgeFactory xBridgeFactory = (XBridgeFactory) UnoRuntime.queryInterface(XBridgeFactory.class, x);
      logger.debug("XBridgeFactory retrieved: " + xBridgeFactory);
View Full Code Here


        {
            // instantiate connector service
            Object x = _ctx.getServiceManager().createInstanceWithContext(
                "com.sun.star.connection.Connector", _ctx );
           
            XConnector xConnector = (XConnector )
                UnoRuntime.queryInterface(XConnector.class, x);

            String a[] = parseUnoUrl( _url );
            if( null == a )
            {
                throw new com.sun.star.uno.Exception( "Couldn't parse uno-url "+ _url );
            }

            // connect using the connection string part of the uno-url only.
            XConnection connection = xConnector.connect( a[0] );
       
            x = _ctx.getServiceManager().createInstanceWithContext(
                "com.sun.star.bridge.BridgeFactory", _ctx );

            XBridgeFactory xBridgeFactory = (XBridgeFactory) UnoRuntime.queryInterface(
View Full Code Here

       // instantiate connector service
       Object x = xComponentContext.getServiceManager().createInstanceWithContext(
                "com.sun.star.connection.Connector", xComponentContext );
           
       XConnector xConnector = (XConnector )
                UnoRuntime.queryInterface(XConnector.class, x);

       String a[] = parseUnoUrl( sConnectionString );
       if( null == a )
       {
            throw new com.sun.star.uno.Exception( "Couldn't parse uno-url "+ sConnectionString );
       }

       // connect using the connection string part of the uno-url only.
       m_Connection = xConnector.connect( a[0] );
       
       x = xComponentContext.getServiceManager().createInstanceWithContext(
                "com.sun.star.bridge.BridgeFactory", xComponentContext );

       XBridgeFactory xBridgeFactory = (XBridgeFactory) UnoRuntime.queryInterface(
View Full Code Here

    XComponentContext xLocalContext = Bootstrap
        .createInitialComponentContext(null);
    Object connector = xLocalContext.getServiceManager()
        .createInstanceWithContext("com.sun.star.connection.Connector",
            xLocalContext);
    XConnector xConnector = (XConnector) UnoRuntime.queryInterface(
        XConnector.class, connector);

    String url[] = parseUnoUrl(unoUrl);
    if (null == url) {
      throw new com.sun.star.uno.Exception("Couldn't parse UNO URL "
          + unoUrl);
    }

    XConnection connection = xConnector.connect(url[0]);
    Object bridgeFactory = xLocalContext.getServiceManager()
        .createInstanceWithContext("com.sun.star.bridge.BridgeFactory",
            xLocalContext);
    XBridgeFactory xBridgeFactory = (XBridgeFactory) UnoRuntime
        .queryInterface(XBridgeFactory.class, bridgeFactory);
View Full Code Here

   */
  public boolean openConnection() throws Exception {
    String unoUrl = "uno:socket,host=" + host + ",port=" + port +";urp;StarOffice.ServiceManager";
    XComponentContext xLocalContext = Bootstrap.createInitialComponentContext(null);
    Object connector = xLocalContext.getServiceManager().createInstanceWithContext("com.sun.star.connection.Connector", xLocalContext);
    XConnector xConnector = (XConnector) UnoRuntime.queryInterface(XConnector.class, connector);
   
    String url[] = parseUnoUrl(unoUrl);
    if (null == url) {
      throw new com.sun.star.uno.Exception("Couldn't parse UNO URL "+ unoUrl);
    }
   
    XConnection connection = xConnector.connect(url[0]);
    Object bridgeFactory = xLocalContext.getServiceManager().createInstanceWithContext("com.sun.star.bridge.BridgeFactory", xLocalContext);
    XBridgeFactory xBridgeFactory = (XBridgeFactory) UnoRuntime.queryInterface(XBridgeFactory.class, bridgeFactory);
    xBridge = xBridgeFactory.createBridge("", url[1], connection ,null);
    bridgeFactory = xBridge.getInstance(url[2]);
    xMultiComponentFactory = (XMultiComponentFactory)UnoRuntime.queryInterface(XMultiComponentFactory.class, bridgeFactory);
View Full Code Here

        if (this.closed) {
            try {
                XComponentContext localContext = bsc.connect("127.0.0.1", port);
                String connectionString = "socket,host=127.0.0.1,port=" + port;
                XMultiComponentFactory localServiceManager = localContext.getServiceManager();
                XConnector connector = as(XConnector.class,
                        localServiceManager.createInstanceWithContext("com.sun.star.connection.Connector", localContext));
                XConnection connection = connector.connect(connectionString);
                XBridgeFactory bridgeFactory = as(XBridgeFactory.class,
                        localServiceManager.createInstanceWithContext("com.sun.star.bridge.BridgeFactory", localContext));
                String bridgeName = "yarg_" + bridgeIndex.incrementAndGet();
                XBridge bridge = bridgeFactory.createBridge(bridgeName, "urp", connection, null);
                XMultiComponentFactory serviceManager = as(XMultiComponentFactory.class, bridge.getInstance("StarOffice.ServiceManager"));
View Full Code Here

                    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++);
View Full Code Here

        // instantiate connector service
        Object x = xComponentContext.getServiceManager().createInstanceWithContext(
                "com.sun.star.connection.Connector", xComponentContext);

        XConnector xConnector = (XConnector) UnoRuntime.queryInterface(XConnector.class, x);

        String a[] = parseUnoUrl(sConnectionString);
        if (null == a) {
            throw new com.sun.star.uno.Exception("Couldn't parse uno-url " + sConnectionString);
        }

        // connect using the connection string part of the uno-url only.
        m_Connection = xConnector.connect(a[0]);

        x = xComponentContext.getServiceManager().createInstanceWithContext(
                "com.sun.star.bridge.BridgeFactory", xComponentContext);

        XBridgeFactory xBridgeFactory = (XBridgeFactory) UnoRuntime.queryInterface(
View Full Code Here

          connector = _xMultiServiceFactory.createInstance("com.sun.star.connection.Connector");
        } 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);
        try {
          xBridge = xBridgeFactory.createBridge(conDcp + ";" + protDcp, protDcp, xConnection, null);
        } catch (com.sun.star.bridge.BridgeExistsException e) {
          throw new com.sun.star.uno.RuntimeException(e.getMessage());
        }
View Full Code Here

        {
            // instantiate connector service
            Object x = _ctx.getServiceManager().createInstanceWithContext(
                "com.sun.star.connection.Connector", _ctx );
           
            XConnector xConnector = (XConnector )
                UnoRuntime.queryInterface(XConnector.class, x);

            String a[] = parseUnoUrl( _url );
            if( null == a )
            {
                throw new com.sun.star.uno.Exception( "Couldn't parse uno-url "+ _url );
            }

            // connect using the connection string part of the uno-url only.
            XConnection connection = xConnector.connect( a[0] );
       
            x = _ctx.getServiceManager().createInstanceWithContext(
                "com.sun.star.bridge.BridgeFactory", _ctx );

            XBridgeFactory xBridgeFactory = (XBridgeFactory) UnoRuntime.queryInterface(
View Full Code Here

TOP

Related Classes of com.sun.star.connection.XConnector

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.