From 57a14ea0bed679c4b120c0371ab5316faf7c883f Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Thu, 25 Apr 2013 13:58:29 +0200 Subject: Clean up Java ServiceManager bootstrapping ...and remove the unused feature of initializing it with an obsolete XSimpleRegistry. Change-Id: I333dae51f67c16da3e6822ba81e4b8ca125188a5 --- .../com/sun/star/comp/helper/Bootstrap.java | 25 +++++----------------- 1 file changed, 5 insertions(+), 20 deletions(-) (limited to 'javaunohelper/com/sun/star/comp') diff --git a/javaunohelper/com/sun/star/comp/helper/Bootstrap.java b/javaunohelper/com/sun/star/comp/helper/Bootstrap.java index 2087aeca5689..989e283853b0 100644 --- a/javaunohelper/com/sun/star/comp/helper/Bootstrap.java +++ b/javaunohelper/com/sun/star/comp/helper/Bootstrap.java @@ -23,11 +23,11 @@ package com.sun.star.comp.helper; import com.sun.star.bridge.UnoUrlResolver; import com.sun.star.bridge.XUnoUrlResolver; import com.sun.star.comp.loader.JavaLoader; +import com.sun.star.comp.servicemanager.ServiceManager; import com.sun.star.container.XSet; import com.sun.star.lang.XInitialization; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.lang.XMultiComponentFactory; -import com.sun.star.lang.XSingleComponentFactory; import com.sun.star.lib.util.NativeLibraryLoader; import com.sun.star.loader.XImplementationLoader; import com.sun.star.uno.UnoRuntime; @@ -98,19 +98,10 @@ public class Bootstrap { static public XComponentContext createInitialComponentContext( Hashtable context_entries ) throws Exception { + ServiceManager xSMgr = new ServiceManager(); + XImplementationLoader xImpLoader = UnoRuntime.queryInterface( XImplementationLoader.class, new JavaLoader() ); - - // Get the factory of the ServiceManager - XSingleComponentFactory smgr_fac = UnoRuntime.queryInterface( - XSingleComponentFactory.class, xImpLoader.activate( - "com.sun.star.comp.servicemanager.ServiceManager", null, null, null ) ); - - // Create an instance of the ServiceManager - XMultiComponentFactory xSMgr = UnoRuntime.queryInterface( - XMultiComponentFactory.class, smgr_fac.createInstanceWithContext( null ) ); - - // post init loader XInitialization xInit = UnoRuntime.queryInterface( XInitialization.class, xImpLoader ); Object[] args = new Object [] { xSMgr }; @@ -126,16 +117,10 @@ public class Bootstrap { // ... xxx todo: add standard entries XComponentContext xContext = new ComponentContext( context_entries, null ); - // post init smgr - xInit = UnoRuntime.queryInterface( - XInitialization.class, xSMgr ); - args = new Object [] { null, xContext }; // no registry, default context - xInit.initialize( args ); + xSMgr.setDefaultContext(xContext); XSet xSet = UnoRuntime.queryInterface( XSet.class, xSMgr ); - // insert the service manager - xSet.insert( smgr_fac ); - // and basic jurt factories + // insert basic jurt factories insertBasicFactories( xSet, xImpLoader ); return xContext; -- cgit