Package com.sun.star.lang

Examples of com.sun.star.lang.XMultiComponentFactory


      // create default local component context
      XComponentContext xLocalContext =
          com.sun.star.comp.helper.Bootstrap.createInitialComponentContext(null);
     
      // initial serviceManager
      XMultiComponentFactory xLocalServiceManager = xLocalContext.getServiceManager();
       
      // 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 );
View Full Code Here


    protected TestServiceFactory getTestServiceFactory() throws Exception {
        return new TestServiceFactory() {
                public Object get() throws Exception {
                    XComponentContext context
                        = Bootstrap.createInitialComponentContext(null);
                    XMultiComponentFactory serviceManager
                        = context.getServiceManager();
                    ((XSet) UnoRuntime.queryInterface(
                        XSet.class, serviceManager)).insert(new TestService());
                    return serviceManager.createInstanceWithContext(
                        "testtools.servicetests.TestService2", context);
                }

                public void dispose() throws Exception {}
            };
View Full Code Here

    public static final class Server {
        public static void main(String[] arguments) throws Exception {
            XComponentContext context
                = Bootstrap.createInitialComponentContext(null);
            XMultiComponentFactory serviceManager
                = context.getServiceManager();
            ((XSet) UnoRuntime.queryInterface(XSet.class, serviceManager)).
                insert(new TestService());
            final Object instance = serviceManager.createInstanceWithContext(
                "testtools.servicetests.TestService2", context);
            XBridgeFactory bridgeFactory
                = (XBridgeFactory) UnoRuntime.queryInterface(
                    XBridgeFactory.class,
                    serviceManager.createInstanceWithContext(
                        "com.sun.star.bridge.BridgeFactory", context));
            XConnection connection = Acceptor.create(context).accept(
                CONNECTION_DESCRIPTION);
            bridgeFactory.createBridge(
                "", PROTOCOL_DESCRIPTION, connection,
View Full Code Here

            table = new Hashtable();
            table.put( "bla2", new ComponentContextEntry( new Integer( 2 ) ) );
            table.put( "bla3", new Integer( 3 ) );
            XComponentContext xContext = new ComponentContext( table, xInitialContext );
           
            XMultiComponentFactory xSMgr = xContext.getServiceManager();
            Object o = xSMgr.createInstanceWithContext( "com.sun.star.loader.Java", xContext );
            if (o == null)
                System.err.println( "### failed raising service: 1!" );
            o = xSMgr.createInstanceWithContext( "com.sun.star.bridge.BridgeFactory", xContext );
            if (o == null)
                System.err.println( "### failed raising service: 2!" );
            o = xSMgr.createInstanceWithContext( "com.sun.star.bridge.UnoUrlResolver", xContext );
            if (o == null)
                System.err.println( "### failed raising service: 3!" );
            o = xSMgr.createInstanceWithContext( "com.sun.star.connection.Connector", xContext );
            if (o == null)
                System.err.println( "### failed raising service: 4!" );
            o = xSMgr.createInstanceWithContext( "com.sun.star.connection.Acceptor", xContext );
            if (o == null)
                System.err.println( "### failed raising service: 5!" );
            o = xSMgr.createInstanceWithContext( "com.sun.star.lang.ServiceManager", xContext );
            if (o == null)
                System.err.println( "### failed raising service: 6!" );
           
            if (xContext.getValueByName( "bla1" ) == null ||
                xContext.getValueByName( "bla2" ) == null ||
View Full Code Here

    // XTestDialogHandler
    public String createDialog( String DialogURL, XModel xModel, XFrame xFrame ) {
      m_xFrame = xFrame;
   
      try {
        XMultiComponentFactory xMCF = m_xCmpCtx.getServiceManager();
        Object obj;

        // If valid we must pass the XModel when creating a DialogProvider object
        if( xModel != null ) {
          Object[] args = new Object[1];
          args[0] = xModel;
                                  
          obj = xMCF.createInstanceWithArgumentsAndContext(
            "com.sun.star.awt.DialogProvider2", args, m_xCmpCtx );
        }
        else {
          obj = xMCF.createInstanceWithContext(
            "com.sun.star.awt.DialogProvider2", m_xCmpCtx );
        }

        XDialogProvider2 xDialogProvider = (XDialogProvider2)
          UnoRuntime.queryInterface( XDialogProvider2.class, obj );
View Full Code Here

    }
public  ParsedScriptUri parseScriptUri( String scriptURI ) throws com.sun.star.lang.IllegalArgumentException
{

        XMultiComponentFactory xMcFac = null;
        XUriReferenceFactory xFac = null;

        try
        {
            xMcFac = m_xCtx.getServiceManager();
            xFac = ( XUriReferenceFactory )
                UnoRuntime.queryInterface( XUriReferenceFactory.class,
                    xMcFac.createInstanceWithContext(
                        "com.sun.star.uri.UriReferenceFactory", m_xCtx ) );
        }
        catch( com.sun.star.uno.Exception e )
        {
            LogUtils.DEBUG("Problems parsing  URL:" + e.toString() );
View Full Code Here

    public static void main(String[] args) {
        try {
            XComponentContext xcomponentcontext = Bootstrap.createInitialComponentContext( null );

            // 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= (XMultiComponentFactory) UnoRuntime.queryInterface(
                XMultiComponentFactory.class, initialObject );

            // retrieve the component context (it's not yet exported from the office)
            // Query for the XPropertySet interface.
            XPropertySet xProperySet = ( XPropertySet ) UnoRuntime.queryInterface(
                XPropertySet.class, xOfficeFactory);

            // Get the default context from the office server.
            Object oDefaultContext = xProperySet.getPropertyValue( "DefaultContext" );

            // Query for the interface XComponentContext.
            XComponentContext xOfficeComponentContext = ( XComponentContext ) UnoRuntime.queryInterface(
                XComponentContext.class, oDefaultContext );

            // now create the desktop service
            // NOTE: use the office component context here !
            Object oDesktop = xOfficeFactory.createInstanceWithContext("com.sun.star.frame.Desktop",
                                                                       xOfficeComponentContext );
        } catch(com.sun.star.connection.NoConnectException e) {
            System.out.println(e.getMessage());
            e.printStackTrace();
        } catch(com.sun.star.connection.ConnectionSetupException ce) {
View Full Code Here

    XSingleComponentFactory smgr_fac = (XSingleComponentFactory)UnoRuntime.queryInterface(
            XSingleComponentFactory.class, xImpLoader.activate(
                "com.sun.star.comp.servicemanager.ServiceManager", null, null, null ) );
       
    // Create an instance of the ServiceManager
    XMultiComponentFactory xSMgr = (XMultiComponentFactory)UnoRuntime.queryInterface(
            XMultiComponentFactory.class, smgr_fac.createInstanceWithContext( null ) );
       
    // post init loader
    XInitialization xInit = (XInitialization)UnoRuntime.queryInterface(
            XInitialization.class, xImpLoader );
View Full Code Here

            Process p = Runtime.getRuntime().exec( cmdArray );
            pipe( p.getInputStream(), System.out, "CO> " );
            pipe( p.getErrorStream(), System.err, "CE> " );
           
            // initial service manager
            XMultiComponentFactory xLocalServiceManager =
                xLocalContext.getServiceManager();
            if ( xLocalServiceManager == null )
                throw new BootstrapException( "no initial service manager!" );
           
            // create a URL resolver
View Full Code Here

        dcp = dcp.substring(index + 1).trim();
       
        rootOid = dcp.trim().trim();

        XComponentContext ctx = com.sun.star.comp.helper.Bootstrap.createInitialComponentContext( null );
        XMultiComponentFactory smgr = ctx.getServiceManager();
        XMultiServiceFactory oldsmgr = (XMultiServiceFactory)
            UnoRuntime.queryInterface( XMultiServiceFactory.class, smgr );

        // prepare servicemanager
        XSet set = (XSet) UnoRuntime.queryInterface(XSet.class, smgr);
        Object o = com.sun.star.comp.bridge.TestComponent.__getServiceFactory(
            "com.sun.star.comp.bridge.TestComponent$_TestObject", oldsmgr,null );
        set.insert(o);
       
    XAcceptor xAcceptor = Acceptor.create(ctx);

    System.err.println("waiting for connect...");

        while( true )
        {
            XConnection xConnection = xAcceptor.accept(conDcp);
           
            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.lang.XMultiComponentFactory

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.