Package com.sun.star.bridge

Examples of com.sun.star.bridge.XBridge


    // do not create a new bridge, if one already exists
        if (hasName) {
            IBridge iBridges[] = UnoRuntime.getBridges();
            for(int i = 0; i < iBridges.length; ++ i) {
                XBridge xBridge = (XBridge)UnoRuntime.queryInterface(XBridge.class, iBridges[i]);

                if(xBridge != null) {
                    if(xBridge.getName().equals(sName))
                        throw new BridgeExistsException(sName + " already exists");
                }
            }
        }

    XBridge xBridge = null;

    try {
      IBridge iBridge = UnoRuntime.getBridgeByName("java", context, "remote", context, hasName ? new Object[]{sProtocol, aConnection, anInstanceProvider, sName} : new Object[]{sProtocol, aConnection, anInstanceProvider});

      xBridge = (XBridge)UnoRuntime.queryInterface(XBridge.class, iBridge);
View Full Code Here


   * @return   the bridge
   * @param    sName                the name of the bridge
   * @see                           com.sun.star.bridge.XBridgeFactory
   */
    public XBridge getBridge(String sName) throws com.sun.star.uno.RuntimeException {
    XBridge xBridge = null;

    IBridge iBridges[] = UnoRuntime.getBridges();
    for(int i = 0; i < iBridges.length; ++ i) {
      xBridge = (XBridge)UnoRuntime.queryInterface(XBridge.class, iBridges[i]);

      if(xBridge != null) {
        if(xBridge.getName().equals(sName))
          break;
         
        else
          xBridge = null;
      }
View Full Code Here

    public synchronized XBridge[] getExistingBridges() throws com.sun.star.uno.RuntimeException {
    Vector vector = new Vector();

    IBridge iBridges[] = UnoRuntime.getBridges();
    for(int i = 0; i < iBridges.length; ++ i) {
      XBridge xBridge = (XBridge)UnoRuntime.queryInterface(XBridge.class, iBridges[i]);

      if(xBridge != null)
        vector.addElement(xBridge);
    }

    XBridge xBridges[]= new XBridge[vector.size()];
    for(int i = 0; i < vector.size(); ++ i)
      xBridges[i] = (XBridge)vector.elementAt(i);

    return xBridges;
  }
View Full Code Here

        xBridgeFactory = (XBridgeFactory)UnoRuntime.queryInterface(XBridgeFactory.class,
                                      _xMultiServiceFactory.createInstance("com.sun.star.bridge.BridgeFactory"));
      } catch (com.sun.star.uno.Exception e) {
        throw new com.sun.star.uno.RuntimeException(e.getMessage());
      }
      XBridge xBridge = xBridgeFactory.getBridge(conDcp + ";" + protDcp);
     
      if(xBridge == null) {
        Object connector= null;
        try {
          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());
        }
      }
      rootObject = xBridge.getInstance(rootOid);
      return rootObject;
    }
View Full Code Here

            XBridgeFactory xBridgeFactory = (XBridgeFactory) UnoRuntime.queryInterface(
                XBridgeFactory.class , x );

            // create a nameless bridge with no instance provider
            // using the middle part of the uno-url
            XBridge bridge = xBridgeFactory.createBridge( "" , a[1] , connection , null );

            // query for the XComponent interface and add this as event listener
            XComponent xComponent = (XComponent) UnoRuntime.queryInterface(
                XComponent.class, bridge );
            xComponent.addEventListener( this );

            // get the remote instance
            x = bridge.getInstance( a[2] );

            // Did the remote server export this object ?
            if( null == x )
            {
                throw new com.sun.star.uno.Exception(
View Full Code Here

    while( true )
    {
      XConnection xConnection = xAcceptor.accept(conDcp);
      System.out.println( xConnection.getDescription() );
      XBridgeFactory xBridgeFactory = (XBridgeFactory)UnoRuntime.queryInterface(XBridgeFactory.class, serviceManager.createInstance("com.sun.star.bridge.BridgeFactory"));
      XBridge xBridge = xBridgeFactory.createBridge(conDcp + ";" + protDcp, protDcp, xConnection, new InstanceProvider(serviceManager, rootOid));
    }
  }
View Full Code Here

          if( broadcaster != null )
            broadcaster.addStreamListener(
              new ConnectionListener( holder ) );
             
          // create the bridge
          XBridge xBridge = xBridgeFactory.createBridge(conDcp + ";" + protDcp + "#" + (connect_count ++), protDcp, xConnection, new InstanceProvider(rootOid, object));
        }
        catch(com.sun.star.uno.Exception exception) {
          System.err.println( "UnoApp acceptor:  exeception occurred - " + exception);
          if(xConnection != null)
            xConnection.close();
View Full Code Here

  static public boolean test_standard_methods(boolean virtual, boolean forceSynchronous, Vector notpassed) throws Exception {
    boolean passed = true;

    Requester requester = new Requester(virtual, forceSynchronous);
    XBridge xBridge = (XBridge)Proxy.create(requester, "oidoid", new Type(com.sun.star.bridge.XBridge.class), virtual, forceSynchronous);
    Class proxyClass = xBridge.getClass();
   
    passed = test_exceptions(requester, xBridge,
                 proxyClass.getMethod("queryInterface", new Class[]{Type.class}), new Object[]{new Type("com.sun.star.connection.XConnector")},
                 new Class[] {null,
                        MappingException.class,
View Full Code Here

    PipedConnection leftSide = new PipedConnection(new Object[]{rightSide});

    BridgeFactory bridgeFactory = new BridgeFactory(); // create the needed bridgeFactory

    // create a bridge
    XBridge xBridge = bridgeFactory.createBridge("testbridge", "urp", (XConnection)leftSide, null);

    // test that we get the same bridge
    boolean passed = UnoRuntime.areSame(xBridge, bridgeFactory.getBridge("testbridge"));

    // test that we can not create another bridge with same name
    try {
      XBridge dummy = bridgeFactory.createBridge("testbridge", "urp", (XConnection)leftSide, null);

      passed = false;
    }
    catch(BridgeExistsException bridgeExistsException) {
    }


    // test getExistingBridges
    XBridge xBridges[] = bridgeFactory.getExistingBridges();
    passed = UnoRuntime.areSame(xBridge, xBridges[0]) && passed;

    // dispose the bridge
    XComponent xComponent = (XComponent)UnoRuntime.queryInterface(XComponent.class, xBridge);
    xComponent.dispose();


    // test that the bridge has been removed
    passed = (bridgeFactory.getBridge("testbridge") == null) && passed;



    rightSide = new PipedConnection(new Object[0]);
    leftSide = new PipedConnection(new Object[]{rightSide});


    // test that we really get a new bridge
    XBridge xBridge_new = bridgeFactory.createBridge("testbridge", "urp", (XConnection)leftSide, null);
    passed = !UnoRuntime.areSame(xBridge, xBridge_new) && passed;

    for(int i = 0; i <10000; ++ i) {
      Object x[] = new Object[100];
    }
View Full Code Here

           
            XBridgeFactory xBridgeFactory = (XBridgeFactory)UnoRuntime.queryInterface(
                XBridgeFactory.class,
                smgr.createInstanceWithContext("com.sun.star.bridge.BridgeFactory",ctx));
           
            XBridge xBridge = xBridgeFactory.createBridge(
                "", protDcp, xConnection, new InstanceProvider(ctx));
        }
           
  }
View Full Code Here

TOP

Related Classes of com.sun.star.bridge.XBridge

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.