diff options
author | Daniel Boelzle <dbo@openoffice.org> | 2002-10-21 14:30:36 +0000 |
---|---|---|
committer | Daniel Boelzle <dbo@openoffice.org> | 2002-10-21 14:30:36 +0000 |
commit | a9cc51b0eedcefabac4d4727da4ae303b86aa969 (patch) | |
tree | 678ff8add2dbbbde56d5e0a41f26eabc6e8a6703 /javaunohelper/com/sun/star/comp | |
parent | 6ff0747fd7a7bc203d074019c183e2dfaf3bb36e (diff) |
#104367# added Bootstrap.defaultBootstrap_InitialComponentContext() and native code for bootstrapping out of cppuhelper
Diffstat (limited to 'javaunohelper/com/sun/star/comp')
-rw-r--r-- | javaunohelper/com/sun/star/comp/helper/Bootstrap.java | 57 |
1 files changed, 55 insertions, 2 deletions
diff --git a/javaunohelper/com/sun/star/comp/helper/Bootstrap.java b/javaunohelper/com/sun/star/comp/helper/Bootstrap.java index e2beebea14fd..47f4c96f565f 100644 --- a/javaunohelper/com/sun/star/comp/helper/Bootstrap.java +++ b/javaunohelper/com/sun/star/comp/helper/Bootstrap.java @@ -2,9 +2,9 @@ * * $RCSfile: Bootstrap.java,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: jl $ $Date: 2002-01-22 10:49:27 $ + * last change: $Author: dbo $ $Date: 2002-10-21 15:30:32 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -78,6 +78,7 @@ import com.sun.star.loader.XImplementationLoader; import com.sun.star.uno.UnoRuntime; import java.util.Hashtable; +import java.util.Enumeration; /** Bootstrap offers functionality to obtain a context or simply a service manager. @@ -190,4 +191,56 @@ public class Bootstrap { return (XMultiServiceFactory)UnoRuntime.queryInterface( XMultiServiceFactory.class, createInitialComponentContext( null ).getServiceManager() ); } + + + /** Bootstraps the initial component context from a native UNO installation. + + @see cppuhelper/defaultBootstrap_InitialComponentContext() + */ + static public final XComponentContext defaultBootstrap_InitialComponentContext() + throws Exception + { + return defaultBootstrap_InitialComponentContext( null, null ); + } + /** Bootstraps the initial component context from a native UNO installation. + + @param ini_file + ini_file (may be null: uno.rc besides cppuhelper lib) + @param bootstrap_parameters + bootstrap parameters (maybe null) + + @see cppuhelper/defaultBootstrap_InitialComponentContext() + */ + static public final XComponentContext defaultBootstrap_InitialComponentContext( + String ini_file, Hashtable bootstrap_parameters ) + throws Exception + { + // jni convenience: easier to iterate over array than calling Hashtable + String pairs [] = null; + if (null != bootstrap_parameters) + { + pairs = new String [ 2 * bootstrap_parameters.size() ]; + Enumeration enum = bootstrap_parameters.keys(); + int n = 0; + while (enum.hasMoreElements()) + { + String name = (String)enum.nextElement(); + pairs[ n++ ] = name; + pairs[ n++ ] = (String)bootstrap_parameters.get( name ); + } + } + + if (! m_loaded_juh) + { + System.loadLibrary( "juh" ); + m_loaded_juh = true; + } + return (XComponentContext)UnoRuntime.queryInterface( + XComponentContext.class, cppuhelper_bootstrap( ini_file, pairs ) ); + } + + static private boolean m_loaded_juh = false; + static private native final Object cppuhelper_bootstrap( + String ini_file, String bootstrap_parameters [] ) + throws Exception; } |