Examples of XUnoUrlResolver


Examples of com.sun.star.bridge.XUnoUrlResolver

       
        // create a connector, so that it can contact the office
//        XUnoUrlResolver urlResolver = UnoUrlResolver.create(xcomponentcontext);
        Object xUrlResolver = xLocalServiceManager.createInstanceWithContext(
                    "com.sun.star.bridge.UnoUrlResolver", xcomponentcontext);
        XUnoUrlResolver urlResolver = (XUnoUrlResolver) UnoRuntime.queryInterface(
                    XUnoUrlResolver.class, xUrlResolver);
       
        Object rInitialObject = urlResolver.resolve(connectStr);
       
        XMultiServiceFactory xMSF = null;
       
        if (rInitialObject != null) {
            if (debug) {
View Full Code Here

Examples of com.sun.star.bridge.XUnoUrlResolver

        if (UtilValidate.isEmpty(port)) port = UtilProperties.getPropertyValue("openoffice-uno", "oo.port", "8100");

        XMultiComponentFactory xmulticomponentfactory = null;
        XComponentContext xcomponentcontext = null;
        Object objectUrlResolver = null;
        XUnoUrlResolver xurlresolver = null;
        Object objectInitial = null;
        // Converting the document to the favoured type
        try {
            /* Bootstraps a component context with the jurt base components
            registered. Component context to be granted to a component for running.
            Arbitrary values can be retrieved from the context. */
            xcomponentcontext = com.sun.star.comp.helper.Bootstrap.createInitialComponentContext(null);

            /* Gets the service manager instance to be used (or null). This method has
            been added for convenience, because the service manager is a often used
            object. */
            xmulticomponentfactory = xcomponentcontext.getServiceManager();

            /* Creates an instance of the component UnoUrlResolver which
            supports the services specified by the factory. */
            objectUrlResolver = xmulticomponentfactory.createInstanceWithContext("com.sun.star.bridge.UnoUrlResolver", xcomponentcontext);

            // Create a new url resolver
            xurlresolver = (XUnoUrlResolver) UnoRuntime.queryInterface(XUnoUrlResolver.class, objectUrlResolver);

            // Resolves an object that is specified as follow:
            // uno:<connection description>;<protocol description>;<initial object name>
            String url = "uno:socket,host=" + host + ",port=" + port + ";urp;StarOffice.ServiceManager";
            objectInitial = xurlresolver.resolve(url);

            // Create a service manager from the initial object
            xmulticomponentfactory = (XMultiComponentFactory) UnoRuntime.queryInterface(XMultiComponentFactory.class, objectInitial);
        } catch (Exception e) {
            // TODO: None of this works. Need a programmable start solution.
View Full Code Here

Examples of com.sun.star.bridge.XUnoUrlResolver

    {
        XComponentContext xcomponentcontext = null;
        XMultiComponentFactory xMultiComponentFactory = getMultiComponentFactory();
        // create a connector, so that it can contact the office
        Object xUrlResolver = xMultiComponentFactory.createInstanceWithContext("com.sun.star.bridge.UnoUrlResolver", xcomponentcontext);
        XUnoUrlResolver urlResolver = (XUnoUrlResolver) UnoRuntime.queryInterface(XUnoUrlResolver.class, xUrlResolver);
        Object rInitialObject = urlResolver.resolve(connectStr);
        XNamingService rName = (XNamingService) UnoRuntime.queryInterface(XNamingService.class, rInitialObject);
        XMultiServiceFactory xMSF = null;
        if (rName != null)
        {
            System.err.println("got the remote naming service !");
View Full Code Here

Examples of com.sun.star.bridge.XUnoUrlResolver

        // create a connector, so that it can contact the office
//        XUnoUrlResolver urlResolver = UnoUrlResolver.create(xcomponentcontext);
        final Object xUrlResolver = xLocalServiceManager.createInstanceWithContext(
                "com.sun.star.bridge.UnoUrlResolver", xcomponentcontext);
        final XUnoUrlResolver urlResolver = (XUnoUrlResolver) UnoRuntime.queryInterface(
                XUnoUrlResolver.class, xUrlResolver);

        final Object rInitialObject = urlResolver.resolve(connectStr);

        XMultiServiceFactory xMSF = null;

        if (rInitialObject != null)
        {
View Full Code Here

Examples of com.sun.star.bridge.XUnoUrlResolver

            // initial serviceManager
            XMultiComponentFactory xLocalServiceManager = xcomponentcontext.getServiceManager();

            // create a connector, so that it can contact the office
            XUnoUrlResolver urlResolver
                = UnoUrlResolver.create( xcomponentcontext );

            Object initialObject = urlResolver.resolve(
                "uno:socket,host=localhost,port=8100;urp;StarOffice.ServiceManager" );

            XMultiComponentFactory  xOfficeFactory= UnoRuntime.queryInterface(
                XMultiComponentFactory.class, initialObject );
View Full Code Here

Examples of com.sun.star.bridge.XUnoUrlResolver

                xLocalContext.getServiceManager();
            if ( xLocalServiceManager == null )
                throw new BootstrapException( "no initial service manager!" );
           
            // create a URL resolver
            XUnoUrlResolver xUrlResolver =
                UnoUrlResolver.create( xLocalContext );
           
            // connection string
            String sConnect = "uno:pipe,name=" + sPipeName +
                ";urp;StarOffice.ComponentContext";
           
            // wait until office is started
            for (int i = 0;; ++i) {
                try {
                    // try to connect to office
                    Object context = xUrlResolver.resolve( sConnect );
                    xContext = UnoRuntime.queryInterface(
                        XComponentContext.class, context);
                    if ( xContext == null )
                        throw new BootstrapException( "no component context!" );
                    break;
View Full Code Here

Examples of com.sun.star.bridge.XUnoUrlResolver

      // create a urlresolver
      Object urlResolver  = xLocalServiceManager.createInstanceWithContext(
          "com.sun.star.bridge.UnoUrlResolver", xLocalContext );

      // query for the XUnoUrlResolver interface
      XUnoUrlResolver xUrlResolver =
          (XUnoUrlResolver) UnoRuntime.queryInterface( XUnoUrlResolver.class, urlResolver );

      // try to connect to soffice
      Object aInitialObject = null;
      try
      {
        aInitialObject = xUrlResolver.resolve( mURL );
      }
      catch( com.sun.star.connection.NoConnectException e )
      {
        // launch soffice
        OfficeService aSOffice = new OfficeService();
        aSOffice.startupService();
   
        // wait until soffice is started
        long nMaxMillis = System.currentTimeMillis() + 1000*aSOffice.getStartupTime();
        while ( aInitialObject == null )
        {
          try
          {
            // try to connect to soffice
            Thread.currentThread().sleep( 500 );
            aInitialObject = xUrlResolver.resolve( mURL );
          }
          catch( com.sun.star.connection.NoConnectException aEx )
          {
            // soffice did not start in time
            if ( System.currentTimeMillis() > nMaxMillis )
View Full Code Here

Examples of com.sun.star.bridge.XUnoUrlResolver

    com.sun.star.comp.servicemanager.ServiceManager smgr = new com.sun.star.comp.servicemanager.ServiceManager();
    smgr.addFactories(neededServices);

    Object  resolver  = smgr.createInstance("com.sun.star.bridge.UnoUrlResolver" );
    XUnoUrlResolver resolver_xUnoUrlResolver = UnoRuntime.queryInterface(XUnoUrlResolver.class, resolver);

      Object rInitialObject = resolver_xUnoUrlResolver.resolve(argv[0]);

    if(rInitialObject != null) {
      System.err.println("got the remote object");
      doSomething(rInitialObject);
    }
View Full Code Here

Examples of com.sun.star.bridge.XUnoUrlResolver

                xLocalContext.getServiceManager();
            if ( xLocalServiceManager == null )
                throw new BootstrapException( "no initial service manager!" );
           
            // create a URL resolver
            XUnoUrlResolver xUrlResolver =
                UnoUrlResolver.create( xLocalContext );
           
            // connection string
            String sConnect = "uno:pipe,name=" + sPipeName +
                ";urp;StarOffice.ComponentContext";
           
            // wait until office is started
            for ( ; ; ) {   
                try {
                    // try to connect to office
                    Object context = xUrlResolver.resolve( sConnect );
                    xContext = (XComponentContext) UnoRuntime.queryInterface(
                        XComponentContext.class, context);
                    if ( xContext == null )
                        throw new BootstrapException( "no component context!" );
                    break;
View Full Code Here

Examples of com.sun.star.bridge.XUnoUrlResolver

        if (UtilValidate.isEmpty(port)) port = UtilProperties.getPropertyValue("openoffice-uno", "oo.port", "8100");

        XMultiComponentFactory xmulticomponentfactory = null;
        XComponentContext xcomponentcontext = null;
        Object objectUrlResolver = null;
        XUnoUrlResolver xurlresolver = null;
        Object objectInitial = null;
        // Converting the document to the favoured type
        try {
            /* Bootstraps a component context with the jurt base components
            registered. Component context to be granted to a component for running.
            Arbitrary values can be retrieved from the context. */
            xcomponentcontext = com.sun.star.comp.helper.Bootstrap.createInitialComponentContext(null);

            /* Gets the service manager instance to be used (or null). This method has
            been added for convenience, because the service manager is a often used
            object. */
            xmulticomponentfactory = xcomponentcontext.getServiceManager();

            /* Creates an instance of the component UnoUrlResolver which
            supports the services specified by the factory. */
            objectUrlResolver = xmulticomponentfactory.createInstanceWithContext("com.sun.star.bridge.UnoUrlResolver", xcomponentcontext);

            // Create a new url resolver
            xurlresolver = (XUnoUrlResolver) UnoRuntime.queryInterface(XUnoUrlResolver.class, objectUrlResolver);

            // Resolves an object that is specified as follow:
            // uno:<connection description>;<protocol description>;<initial object name>
            String url = "uno:socket,host=" + host + ",port=" + port + ";urp;StarOffice.ServiceManager";
            objectInitial = xurlresolver.resolve(url);

            // Create a service manager from the initial object
            xmulticomponentfactory = (XMultiComponentFactory) UnoRuntime.queryInterface(XMultiComponentFactory.class, objectInitial);
        } catch (Exception e) {
            // TODO: None of this works. Need a programmable start solution.
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.