Additional parameters for the Java VM can be provided. For every parameter
@@ -114,7 +114,7 @@
regcomp -env:UNO_JAVA_JFW_PARAMETER_1=-Xdebug
-env:UNO_JAVA_JFW_PARAMETER_2=-Xrunjdwp:transport=dt_socket,server=y,address=8100
-env:UNO_JAVA_JFW_JREHOME=file:///d:/j2re1.4.2
- -env:"UNO_JAVA_JFW_CLASSPATH=d:\\solver\\bin\\classes.jar;d:\\solver\\bin\\ridl.jar"
+ -env:"UNO_JAVA_JFW_CLASSPATH=d:\\solver\\bin\\classes.jar;d:\\solver\\bin\\libreoffice.jar"
-register...
Here is a complete list of the bootstrap parameter for the direct mode:
diff --git a/instsetoo_native/CustomTarget_setup.mk b/instsetoo_native/CustomTarget_setup.mk
index 0f0f6158abc8..4d845441c6a6 100644
--- a/instsetoo_native/CustomTarget_setup.mk
+++ b/instsetoo_native/CustomTarget_setup.mk
@@ -69,7 +69,7 @@ $(call gb_CustomTarget_get_workdir,instsetoo_native/setup)/$(call gb_Helper_get_
&& echo 'URE_MORE_JAVA_CLASSPATH_URLS=$(if $(SYSTEM_HSQLDB),$(HSQLDB_JAR))' \
&& echo 'URE_OVERRIDE_JAVA_JFW_SHARED_DATA=$${BRAND_BASE_DIR}/$(LIBO_SHARE_FOLDER)/config/javasettings_$${_OS}_$${_ARCH}.xml' \
&& echo 'URE_OVERRIDE_JAVA_JFW_USER_DATA=$${$${BRAND_BASE_DIR}/$(LIBO_ETC_FOLDER)/$(call gb_Helper_get_rcfile,bootstrap):UserInstallation}/user/config/javasettings_$${_OS}_$${_ARCH}.xml' \
- && echo 'URE_MORE_JAVA_TYPES=$${BRAND_BASE_DIR}/$(LIBO_SHARE_JAVA_FOLDER)/ridl.jar $${BRAND_BASE_DIR}/$(LIBO_SHARE_JAVA_FOLDER)/ScriptFramework.jar $${$${$$ORIGIN/$(call gb_Helper_get_rcfile,louno):PKG_UserUnoFile}:UNO_JAVA_CLASSPATH} $${$${$$ORIGIN/$(call gb_Helper_get_rcfile,louno):PKG_SharedUnoFile}:UNO_JAVA_CLASSPATH} $${$${$$ORIGIN/$(call gb_Helper_get_rcfile,louno):PKG_BundledUnoFile}:UNO_JAVA_CLASSPATH}' \
+ && echo 'URE_MORE_JAVA_TYPES=$${BRAND_BASE_DIR}/$(LIBO_SHARE_JAVA_FOLDER)/libreoffice.jar $${BRAND_BASE_DIR}/$(LIBO_SHARE_JAVA_FOLDER)/ScriptFramework.jar $${$${$$ORIGIN/$(call gb_Helper_get_rcfile,louno):PKG_UserUnoFile}:UNO_JAVA_CLASSPATH} $${$${$$ORIGIN/$(call gb_Helper_get_rcfile,louno):PKG_SharedUnoFile}:UNO_JAVA_CLASSPATH} $${$${$$ORIGIN/$(call gb_Helper_get_rcfile,louno):PKG_BundledUnoFile}:UNO_JAVA_CLASSPATH}' \
&& echo 'URE_MORE_SERVICES=$${$${$$ORIGIN/$(call gb_Helper_get_rcfile,louno):PKG_UserUnoFile}:UNO_SERVICES} $${$${$$ORIGIN/$(call gb_Helper_get_rcfile,louno):PKG_SharedUnoFile}:UNO_SERVICES} $${$${$$ORIGIN/$(call gb_Helper_get_rcfile,louno):PKG_BundledUnoFile}:UNO_SERVICES} <$$ORIGIN/services>*' \
&& echo 'URE_MORE_TYPES=<$$ORIGIN/types>* $${$${$$ORIGIN/$(call gb_Helper_get_rcfile,louno):PKG_UserUnoFile}:UNO_TYPES} $${$${$$ORIGIN/$(call gb_Helper_get_rcfile,louno):PKG_SharedUnoFile}:UNO_TYPES} $${$${$$ORIGIN/$(call gb_Helper_get_rcfile,louno):PKG_BundledUnoFile}:UNO_TYPES}' \
) > $@
diff --git a/javaunohelper/Jar_juh.mk b/javaunohelper/Jar_juh.mk
index 7f90852eb6df..cf469200cd49 100644
--- a/javaunohelper/Jar_juh.mk
+++ b/javaunohelper/Jar_juh.mk
@@ -9,40 +9,10 @@
$(eval $(call gb_Jar_Jar,juh))
-$(eval $(call gb_Jar_use_jars,juh,\
- ridl \
-))
-
-$(eval $(call gb_Jar_set_packageroot,juh,com))
-
$(eval $(call gb_Jar_add_manifest_classpath,juh, \
- ridl.jar \
- $(if $(filter MACOSX,$(OS)),../../Frameworks/,../) \
+ libreoffice.jar \
))
$(eval $(call gb_Jar_set_manifest,juh,$(SRCDIR)/javaunohelper/util/manifest))
-$(eval $(call gb_Jar_add_sourcefiles,juh,\
- javaunohelper/com/sun/star/comp/helper/Bootstrap \
- javaunohelper/com/sun/star/comp/helper/BootstrapException \
- javaunohelper/com/sun/star/comp/helper/ComponentContext \
- javaunohelper/com/sun/star/comp/helper/ComponentContextEntry \
- javaunohelper/com/sun/star/comp/helper/SharedLibraryLoader \
- javaunohelper/com/sun/star/lib/uno/adapter/ByteArrayToXInputStreamAdapter \
- javaunohelper/com/sun/star/lib/uno/adapter/InputStreamToXInputStreamAdapter \
- javaunohelper/com/sun/star/lib/uno/adapter/OutputStreamToXOutputStreamAdapter \
- javaunohelper/com/sun/star/lib/uno/adapter/XInputStreamToInputStreamAdapter \
- javaunohelper/com/sun/star/lib/uno/adapter/XOutputStreamToByteArrayAdapter \
- javaunohelper/com/sun/star/lib/uno/adapter/XOutputStreamToOutputStreamAdapter \
- javaunohelper/com/sun/star/lib/uno/helper/ComponentBase \
- javaunohelper/com/sun/star/lib/uno/helper/Factory \
- javaunohelper/com/sun/star/lib/uno/helper/InterfaceContainer \
- javaunohelper/com/sun/star/lib/uno/helper/MultiTypeInterfaceContainer \
- javaunohelper/com/sun/star/lib/uno/helper/PropertySet \
- javaunohelper/com/sun/star/lib/uno/helper/PropertySetMixin \
- javaunohelper/com/sun/star/lib/uno/helper/UnoUrl \
- javaunohelper/com/sun/star/lib/uno/helper/WeakAdapter \
- javaunohelper/com/sun/star/lib/uno/helper/WeakBase \
-))
-
# vim:set noet sw=4 ts=4:
diff --git a/javaunohelper/JunitTest_juh.mk b/javaunohelper/JunitTest_juh.mk
index d819cb237fc7..e5ccfa1c4716 100644
--- a/javaunohelper/JunitTest_juh.mk
+++ b/javaunohelper/JunitTest_juh.mk
@@ -16,22 +16,12 @@ $(eval $(call gb_JunitTest_set_defs,juh,\
$(eval $(call gb_JunitTest_use_jars,juh,\
OOoRunner \
- ridl \
+ libreoffice \
))
-$(eval $(call gb_JunitTest_use_jar_classset,juh,ridljar))
+$(eval $(call gb_JunitTest_use_jar_classset,juh,libreoffice))
$(eval $(call gb_JunitTest_add_sourcefiles,juh,\
- javaunohelper/com/sun/star/comp/helper/Bootstrap \
- javaunohelper/com/sun/star/comp/helper/BootstrapException \
- javaunohelper/com/sun/star/comp/helper/ComponentContext \
- javaunohelper/com/sun/star/comp/helper/ComponentContextEntry \
- javaunohelper/com/sun/star/lib/uno/helper/ComponentBase \
- javaunohelper/com/sun/star/lib/uno/helper/InterfaceContainer \
- javaunohelper/com/sun/star/lib/uno/helper/MultiTypeInterfaceContainer \
- javaunohelper/com/sun/star/lib/uno/helper/PropertySet \
- javaunohelper/com/sun/star/lib/uno/helper/WeakAdapter \
- javaunohelper/com/sun/star/lib/uno/helper/WeakBase \
javaunohelper/test/com/sun/star/comp/helper/ComponentContext_Test \
javaunohelper/test/com/sun/star/lib/uno/helper/AWeakBase \
javaunohelper/test/com/sun/star/lib/uno/helper/ComponentBase_Test \
diff --git a/javaunohelper/com/sun/star/comp/helper/Bootstrap.java b/javaunohelper/com/sun/star/comp/helper/Bootstrap.java
deleted file mode 100644
index edf21d7d2adf..000000000000
--- a/javaunohelper/com/sun/star/comp/helper/Bootstrap.java
+++ /dev/null
@@ -1,429 +0,0 @@
-// -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
-
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-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.lib.util.NativeLibraryLoader;
-import com.sun.star.loader.XImplementationLoader;
-import com.sun.star.uno.UnoRuntime;
-import com.sun.star.uno.XComponentContext;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.PrintStream;
-import java.io.UnsupportedEncodingException;
-import java.util.HashMap;
-import java.util.Hashtable;
-import java.util.Map;
-import java.util.Random;
-
-/** Bootstrap offers functionality to obtain a context or simply
- a service manager.
- The service manager can create a few basic services, whose implementations are:
-
-
com.sun.star.comp.loader.JavaLoader
-
com.sun.star.comp.urlresolver.UrlResolver
-
com.sun.star.comp.bridgefactory.BridgeFactory
-
com.sun.star.comp.connections.Connector
-
com.sun.star.comp.connections.Acceptor
-
com.sun.star.comp.servicemanager.ServiceManager
-
-
- Other services can be inserted into the service manager by
- using its XSet interface:
-
- XSet xSet = UnoRuntime.queryInterface( XSet.class, aMultiComponentFactory );
- // insert the service manager
- xSet.insert( aSingleComponentFactory );
-
-*/
-public class Bootstrap {
-
- private static void insertBasicFactories(
- XSet xSet, XImplementationLoader xImpLoader )
- throws Exception
- {
- // insert the factory of the loader
- xSet.insert( xImpLoader.activate(
- "com.sun.star.comp.loader.JavaLoader", null, null, null ) );
-
- // insert the factory of the URLResolver
- xSet.insert( xImpLoader.activate(
- "com.sun.star.comp.urlresolver.UrlResolver", null, null, null ) );
-
- // insert the bridgefactory
- xSet.insert( xImpLoader.activate(
- "com.sun.star.comp.bridgefactory.BridgeFactory", null, null, null ) );
-
- // insert the connector
- xSet.insert( xImpLoader.activate(
- "com.sun.star.comp.connections.Connector", null, null, null ) );
-
- // insert the acceptor
- xSet.insert( xImpLoader.activate(
- "com.sun.star.comp.connections.Acceptor", null, null, null ) );
- }
-
- /**
- * Returns an array of default commandline options to start bootstrapped
- * instance of soffice with. You may use it in connection with bootstrap
- * method for example like this:
- *
- * List list = Arrays.asList( Bootstrap.getDefaultOptions() );
- * list.remove("--nologo");
- * list.remove("--nodefault");
- * list.add("--invisible");
- *
- * Bootstrap.bootstrap( list.toArray( new String[list.size()] );
- *
- *
- * @return an array of default commandline options
- * @see #bootstrap( String[] )
- * @since LibreOffice 5.1
- */
- public static final String[] getDefaultOptions()
- {
- return new String[]
- {
- "--nologo",
- "--nodefault",
- "--norestore",
- "--nolockcheck"
- };
- }
-
- /**
- backwards compatibility stub.
- @param context_entries the hash table contains mappings of entry names (type string) to
- context entries (type class ComponentContextEntry).
- @throws Exception if things go awry.
- @return a new context.
- */
- public static XComponentContext createInitialComponentContext( Hashtable context_entries )
- throws Exception
- {
- return createInitialComponentContext((Map) context_entries);
- }
- /** Bootstraps an initial component context with service manager and basic
- jurt components inserted.
- @param context_entries the hash table contains mappings of entry names (type string) to
- context entries (type class ComponentContextEntry).
- @throws Exception if things go awry.
- @return a new context.
- */
- public static XComponentContext createInitialComponentContext( Map context_entries )
- throws Exception
- {
- ServiceManager xSMgr = new ServiceManager();
-
- XImplementationLoader xImpLoader = UnoRuntime.queryInterface(
- XImplementationLoader.class, new JavaLoader() );
- XInitialization xInit = UnoRuntime.queryInterface(
- XInitialization.class, xImpLoader );
- Object[] args = new Object [] { xSMgr };
- xInit.initialize( args );
-
- // initial component context
- if (context_entries == null)
- context_entries = new HashMap( 1 );
- // add smgr
- context_entries.put(
- "/singletons/com.sun.star.lang.theServiceManager",
- new ComponentContextEntry( null, xSMgr ) );
- // ... xxx todo: add standard entries
- XComponentContext xContext = new ComponentContext( context_entries, null );
-
- xSMgr.setDefaultContext(xContext);
-
- XSet xSet = UnoRuntime.queryInterface( XSet.class, xSMgr );
- // insert basic jurt factories
- insertBasicFactories( xSet, xImpLoader );
-
- return xContext;
- }
-
- /**
- * Bootstraps a servicemanager with the jurt base components registered.
- *
- * See also UNOIDL com.sun.star.lang.ServiceManager.
- *
- * @throws Exception if things go awry.
- * @return a freshly bootstrapped service manager
- */
- public static XMultiServiceFactory createSimpleServiceManager() throws Exception
- {
- return UnoRuntime.queryInterface(
- XMultiServiceFactory.class, createInitialComponentContext( (Map) null ).getServiceManager() );
- }
-
-
- /** Bootstraps the initial component context from a native UNO installation.
-
- @throws Exception if things go awry.
- @return a freshly bootstrapped component context.
-
- See also
- cppuhelper/defaultBootstrap_InitialComponentContext().
- */
- public static final XComponentContext defaultBootstrap_InitialComponentContext()
- throws Exception
- {
- return defaultBootstrap_InitialComponentContext( (String) null, (Map) null );
- }
- /**
- * Backwards compatibility stub.
- *
- * @param ini_file
- * ini_file (may be null: uno.rc besides cppuhelper lib)
- * @param bootstrap_parameters
- * bootstrap parameters (maybe null)
- *
- * @throws Exception if things go awry.
- * @return a freshly bootstrapped component context.
- */
- public static final XComponentContext defaultBootstrap_InitialComponentContext(
- String ini_file, Hashtable bootstrap_parameters )
- throws Exception
- {
- return defaultBootstrap_InitialComponentContext(ini_file, (Map) bootstrap_parameters);
-
- }
- /** Bootstraps the initial component context from a native UNO installation.
-
- See also
- cppuhelper/defaultBootstrap_InitialComponentContext().
-
- @param ini_file
- ini_file (may be null: uno.rc besides cppuhelper lib)
- @param bootstrap_parameters
- bootstrap parameters (maybe null)
-
- @throws Exception if things go awry.
- @return a freshly bootstrapped component context.
- */
- public static final XComponentContext defaultBootstrap_InitialComponentContext(
- String ini_file, Map 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() ];
- int n = 0;
- for (Map.Entry bootstrap_parameter : bootstrap_parameters.entrySet()) {
- pairs[ n++ ] = bootstrap_parameter.getKey();
- pairs[ n++ ] = bootstrap_parameter.getValue();
- }
- }
-
- if (! m_loaded_juh)
- {
- if ("The Android Project".equals(System.getProperty("java.vendor")))
- {
- // Find out if we are configured with DISABLE_DYNLOADING or
- // not. Try to load the lo-bootstrap shared library which
- // won't exist in the DISABLE_DYNLOADING case. (And which will
- // be already loaded otherwise, so nothing unexpected happens
- // that case.) Yeah, this would be simpler if I just could be
- // bothered to keep a separate branch for DISABLE_DYNLOADING
- // on Android, merging in master periodically, until I know
- // for sure whether it is what I want, or not.
-
- boolean disable_dynloading = false;
- try {
- System.loadLibrary( "lo-bootstrap" );
- } catch ( UnsatisfiedLinkError e ) {
- disable_dynloading = true;
- }
-
- if (!disable_dynloading)
- {
- NativeLibraryLoader.loadLibrary( Bootstrap.class.getClassLoader(), "juh" );
- }
- }
- else
- {
- NativeLibraryLoader.loadLibrary( Bootstrap.class.getClassLoader(), "juh" );
- }
- m_loaded_juh = true;
- }
- return UnoRuntime.queryInterface(
- XComponentContext.class,
- cppuhelper_bootstrap(
- ini_file, pairs, Bootstrap.class.getClassLoader() ) );
- }
-
- private static boolean m_loaded_juh = false;
- private static native Object cppuhelper_bootstrap(
- String ini_file, String bootstrap_parameters [], ClassLoader loader )
- throws Exception;
-
- /**
- * Bootstraps the component context from a UNO installation.
- *
- * @throws BootstrapException if things go awry.
- *
- * @return a bootstrapped component context.
- *
- * @since UDK 3.1.0
- */
- public static final XComponentContext bootstrap()
- throws BootstrapException {
-
- String[] defaultArgArray = getDefaultOptions();
- return bootstrap( defaultArgArray );
- }
-
- /**
- * Bootstraps the component context from a UNO installation.
- *
- * @param argArray
- * an array of strings - commandline options to start instance of
- * soffice with
- * @see #getDefaultOptions()
- *
- * @throws BootstrapException if things go awry.
- *
- * @return a bootstrapped component context.
- *
- * @since LibreOffice 5.1
- */
- public static final XComponentContext bootstrap( String[] argArray )
- throws BootstrapException {
-
- XComponentContext xContext = null;
-
- try {
- // create default local component context
- XComponentContext xLocalContext =
- createInitialComponentContext( (Map) null );
- if ( xLocalContext == null )
- throw new BootstrapException( "no local component context!" );
-
- // find office executable relative to this class's class loader
- String sOffice =
- System.getProperty( "os.name" ).startsWith( "Windows" ) ?
- "soffice.exe" : "soffice";
- File fOffice = NativeLibraryLoader.getResource(
- Bootstrap.class.getClassLoader(), sOffice );
- if ( fOffice == null )
- throw new BootstrapException( "no office executable found!" );
-
- // create random pipe name
- String sPipeName = "uno" +
- Long.toString(randomPipeName.nextLong() & 0x7fffffffffffffffL);
-
- // create call with arguments
- String[] cmdArray = new String[ argArray.length + 2 ];
- cmdArray[0] = fOffice.getPath();
- cmdArray[1] = ( "--accept=pipe,name=" + sPipeName + ";urp;" );
-
- System.arraycopy( argArray, 0, cmdArray, 2, argArray.length );
-
- // start office process
- 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
- 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;
- } catch ( com.sun.star.connection.NoConnectException ex ) {
- // Wait 500 ms, then try to connect again, but do not wait
- // longer than 5 min (= 600 * 500 ms) total:
- if (i == 600) {
- throw new BootstrapException(ex);
- }
- Thread.sleep( 500 );
- }
- }
- } catch ( BootstrapException e ) {
- throw e;
- } catch ( java.lang.RuntimeException e ) {
- throw e;
- } catch ( java.lang.Exception e ) {
- throw new BootstrapException( e );
- }
-
- return xContext;
- }
-
- private static final Random randomPipeName = new Random();
-
- private static void pipe(
- final InputStream in, final PrintStream out, final String prefix ) {
-
- new Thread( "Pipe: " + prefix) {
- @Override
- public void run() {
- try {
- BufferedReader r = new BufferedReader(
- new InputStreamReader(in, "UTF-8") );
-
- for ( ; ; ) {
- String s = r.readLine();
- if ( s == null ) {
- break;
- }
- out.println( prefix + s );
- }
- } catch ( UnsupportedEncodingException e ) {
- e.printStackTrace( System.err );
- } catch ( java.io.IOException e ) {
- e.printStackTrace( System.err );
- }
- }
- }.start();
- }
-}
-
-// vim:set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/javaunohelper/com/sun/star/comp/helper/BootstrapException.java b/javaunohelper/com/sun/star/comp/helper/BootstrapException.java
deleted file mode 100644
index 11911bbc07e0..000000000000
--- a/javaunohelper/com/sun/star/comp/helper/BootstrapException.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-package com.sun.star.comp.helper;
-
-/**
- * BootstrapException is a checked exception that wraps an exception
- * thrown by the original target.
- *
- * @since UDK 3.1.0
- */
-public class BootstrapException extends java.lang.Exception {
-
- /**
- * This field holds the target exception.
- */
- private Exception m_target = null;
-
- /**
- * Constructs a BootstrapException with null as
- * the target exception.
- */
- public BootstrapException() {
- super();
- }
-
- /**
- * Constructs a BootstrapException with the specified
- * detail message.
- *
- * @param message the detail message
- */
- public BootstrapException( String message ) {
- super( message );
- }
-
- /**
- * Constructs a BootstrapException with the specified
- * detail message and a target exception.
- *
- * @param message the detail message
- * @param target the target exception
- */
- public BootstrapException( String message, Exception target ) {
- super( message );
- m_target = target;
- }
-
- /**
- * Constructs a BootstrapException with a target exception.
- *
- * @param target the target exception
- */
- public BootstrapException( Exception target ) {
- super();
- m_target = target;
- }
-
- /**
- * Get the thrown target exception.
- *
- * @return the target exception
- */
- public Exception getTargetException() {
- return m_target;
- }
-}
diff --git a/javaunohelper/com/sun/star/comp/helper/ComponentContext.java b/javaunohelper/com/sun/star/comp/helper/ComponentContext.java
deleted file mode 100644
index 34649d563395..000000000000
--- a/javaunohelper/com/sun/star/comp/helper/ComponentContext.java
+++ /dev/null
@@ -1,308 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-package com.sun.star.comp.helper;
-
-import com.sun.star.uno.UnoRuntime;
-import com.sun.star.uno.Any;
-
-import com.sun.star.uno.DeploymentException;
-import com.sun.star.uno.XComponentContext;
-import com.sun.star.lang.XMultiComponentFactory;
-import com.sun.star.lang.XSingleComponentFactory;
-import com.sun.star.lang.XComponent;
-import com.sun.star.lang.XEventListener;
-import com.sun.star.lang.EventObject;
-
-import java.util.ArrayList;
-import java.util.Hashtable;
-import java.util.Map;
-
-
-
-class Disposer implements XEventListener
-{
- private final XComponent m_xComp;
-
-
- Disposer( XComponent xComp )
- {
- m_xComp = xComp;
- }
-
- public void disposing( EventObject Source )
- {
- m_xComp.dispose();
- }
-}
-
-/** Component context implementation.
-*/
-public class ComponentContext implements XComponentContext, XComponent
-{
- private static final boolean DEBUG = false;
- private static final String SMGR_NAME = "/singletons/com.sun.star.lang.theServiceManager";
- private static final String TDMGR_NAME = "/singletons/com.sun.star.reflection.theTypeDescriptionManager";
-
- private Map m_table;
- private XComponentContext m_xDelegate;
-
- private XMultiComponentFactory m_xSMgr;
- private boolean m_bDisposeSMgr;
-
- private ArrayList m_eventListener;
-
- public ComponentContext( Hashtable table, XComponentContext xDelegate )
- {
- this((Map) table, xDelegate);
- }
-
- /** Ctor to create a component context passing a hashtable for values and a delegator
- reference. Entries of the passed hashtable are either direct values or
- ComponentContextEntry objects.
-
- @param table
- entries
- @param xDelegate
- if values are not found, request is delegated to this object
- */
- public ComponentContext( Map table, XComponentContext xDelegate )
- {
- m_eventListener = new ArrayList();
- m_table = table;
- m_xDelegate = xDelegate;
- m_xSMgr = null;
- m_bDisposeSMgr = false;
-
- Object o = table.get( SMGR_NAME );
- if (o != null)
- {
- if (o instanceof ComponentContextEntry)
- {
- o = ((ComponentContextEntry)o).m_value;
- }
- m_xSMgr = UnoRuntime.queryInterface(
- XMultiComponentFactory.class, o );
- }
- if (m_xSMgr != null)
- {
- m_bDisposeSMgr = true;
- }
- else if (m_xDelegate != null)
- {
- m_xSMgr = m_xDelegate.getServiceManager();
- }
-
- // listen for delegate
- XComponent xComp = UnoRuntime.queryInterface(
- XComponent.class, m_xDelegate );
- if (xComp != null)
- {
- xComp.addEventListener( new Disposer( this ) );
- }
- }
-
- // XComponentContext impl
-
- public Object getValueByName( String rName )
- {
- Object o = m_table.get( rName );
- if (o == null)
- {
- if (m_xDelegate != null)
- {
- return m_xDelegate.getValueByName( rName );
- }
- else
- {
- return Any.VOID;
- }
- }
-
- if (!(o instanceof ComponentContextEntry))
- {
- // direct value in map
- return o;
- }
-
- ComponentContextEntry entry = (ComponentContextEntry)o;
- if (entry.m_lateInit == null)
- {
- return entry.m_value;
- }
-
- Object xInstance = null;
- try
- {
- String serviceName = (String)entry.m_lateInit;
- if (serviceName != null)
- {
- if (m_xSMgr != null)
- {
- xInstance = m_xSMgr.createInstanceWithContext( serviceName, this );
- }
- else
- {
- if (DEBUG)
- System.err.println( "### no service manager instance for late init of singleton instance \"" + rName + "\"!" );
- }
- }
- else
- {
- XSingleComponentFactory xCompFac = UnoRuntime.queryInterface( XSingleComponentFactory.class, entry.m_lateInit );
- if (xCompFac != null)
- {
- xInstance = xCompFac.createInstanceWithContext( this );
- }
- else
- {
- if (DEBUG)
- System.err.println( "### neither service name nor service factory given for late init of singleton instance \"" + rName + "\"!" );
- }
- }
- }
- catch (com.sun.star.uno.Exception exc)
- {
- if (DEBUG)
- System.err.println( "### exception occurred on late init of singleton instance \"" + rName + "\": " + exc.getMessage() );
- }
-
- if (xInstance != null)
- {
- synchronized (entry)
- {
- if (entry.m_lateInit != null)
- {
- entry.m_value = xInstance;
- entry.m_lateInit = null;
- }
- else // inited in the meantime
- {
- // dispose fresh service instance
- XComponent xComp = UnoRuntime.queryInterface(
- XComponent.class, xInstance );
- if (xComp != null)
- {
- xComp.dispose();
- }
- }
- }
- }
- else
- {
- if (DEBUG)
- System.err.println( "### failed late init of singleton instance \"" + rName + "\"!" );
- }
- return entry.m_value;
- }
-
- public XMultiComponentFactory getServiceManager()
- {
- if (m_xSMgr == null)
- {
- throw new DeploymentException(
- "null component context service manager" );
- }
- return m_xSMgr;
- }
-
- // XComponent impl
-
- public void dispose()
- {
- if (DEBUG)
- System.err.print( "> disposing context " + this );
-
- // fire events
- EventObject evt = new EventObject( this );
- for (XEventListener listener : m_eventListener)
- {
- listener.disposing( evt );
- }
- m_eventListener.clear();
-
- XComponent tdmgr = null;
- // dispose values, then service manager, then typedescription manager
- for (Map.Entry entry : m_table.entrySet())
- {
- String name = entry.getKey();
- if (! name.equals( SMGR_NAME ))
- {
- Object o = entry.getValue();
- if (o instanceof ComponentContextEntry)
- {
- o = ((ComponentContextEntry)o).m_value;
- }
-
- XComponent xComp = UnoRuntime.queryInterface( XComponent.class, o );
- if (xComp != null)
- {
- if (name.equals( TDMGR_NAME ))
- {
- tdmgr = xComp;
- }
- else
- {
- xComp.dispose();
- }
- }
- }
- }
- m_table.clear();
-
- // smgr
- if (m_bDisposeSMgr)
- {
- XComponent xComp = UnoRuntime.queryInterface(
- XComponent.class, m_xSMgr );
- if (xComp != null)
- {
- xComp.dispose();
- }
- }
- m_xSMgr = null;
-
- // tdmgr
- if (tdmgr != null)
- {
- tdmgr.dispose();
- }
-
- if (DEBUG)
- System.err.println( "... finished" );
- }
-
- public void addEventListener( XEventListener xListener )
- {
- if (xListener == null)
- throw new com.sun.star.uno.RuntimeException( "Listener must not be null" );
- if (m_eventListener.contains( xListener ))
- throw new com.sun.star.uno.RuntimeException( "Listener already registered." );
-
- m_eventListener.add( xListener );
- }
-
- public void removeEventListener( XEventListener xListener )
- {
- if (xListener == null)
- throw new com.sun.star.uno.RuntimeException( "Listener must not be null" );
- if (! m_eventListener.contains( xListener ))
- throw new com.sun.star.uno.RuntimeException( "Listener is not registered." );
-
- m_eventListener.remove( xListener );
- }
-}
diff --git a/javaunohelper/com/sun/star/comp/helper/ComponentContextEntry.java b/javaunohelper/com/sun/star/comp/helper/ComponentContextEntry.java
deleted file mode 100644
index aa402d29c6d1..000000000000
--- a/javaunohelper/com/sun/star/comp/helper/ComponentContextEntry.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-package com.sun.star.comp.helper;
-
-/** Component context entry for constructing ComponentContext objects.
-
- A ComponentContextEntry is separated into a late-init and direct-value
- purpose.
- The first one is commonly used for singleton objects of the component
- context, that are raised on first-time retrieval of the key.
- You have to pass a com.sun.star.lang.XSingleComponentFactory
- or string (=> service name) object for this.
-
-*/
-public class ComponentContextEntry
-{
- /** if late init of service instance, set service name (String) or
- component factory (XSingleComponentFactory), null otherwise
- */
- public Object m_lateInit;
- /** set entry value
- */
- public Object m_value;
-
- /** Creating a late-init singleton entry component context entry.
- The second parameter will be ignored and overwritten during
- instantiation of the singleton instance.
-
- @param lateInit
- object factory or service string
- @param value
- pass null (dummy separating from second constructor signature)
- */
- public ComponentContextEntry( Object lateInit, Object value )
- {
- this.m_lateInit = lateInit;
- this.m_value = value;
- }
- /** Creating a direct value component context entry.
-
- @param value
- pass null
- */
- public ComponentContextEntry( Object value )
- {
- this.m_lateInit = null;
- this.m_value = value;
- }
-}
diff --git a/javaunohelper/com/sun/star/comp/helper/SharedLibraryLoader.java b/javaunohelper/com/sun/star/comp/helper/SharedLibraryLoader.java
deleted file mode 100644
index 035644efa0b8..000000000000
--- a/javaunohelper/com/sun/star/comp/helper/SharedLibraryLoader.java
+++ /dev/null
@@ -1,175 +0,0 @@
-// -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-package com.sun.star.comp.helper;
-
-import com.sun.star.uno.UnoRuntime;
-import com.sun.star.lang.XMultiServiceFactory;
-import com.sun.star.lang.XSingleServiceFactory;
-import com.sun.star.registry.XRegistryKey;
-
-/**
- * @deprecated use class Bootstrap bootstrapping a native UNO installation
- * and use the shared library loader service.
- *
- * The SharedLibraryLoader class provides the functionality of the com.sun.star.loader.SharedLibrary
- * service.
- *
- * See also UNOIDL com.sun.star.lang.ServiceManager.
- *
- * @see com.sun.star.loader.SharedLibrary
- */
-@Deprecated
-public class SharedLibraryLoader {
- /**
- * The default library which contains the SharedLibraryLoader component
- */
- public static final String DEFAULT_LIBRARY = "shlibloader.uno";
-
- /**
- * The default implementation name
- */
- public static final String DEFAULT_IMPLEMENTATION = "com.sun.star.comp.stoc.DLLComponentLoader";
-
- static {
- if ("The Android Project".equals(System.getProperty("java.vendor"))) {
- // See corresponding code in
- // javaunohelper/com/sun/star/comp/helper/Bootstrap.java for more
- // comments.
-
- boolean disable_dynloading = false;
- try {
- System.loadLibrary("lo-bootstrap");
- } catch (UnsatisfiedLinkError e) {
- disable_dynloading = true;
- }
-
- if (!disable_dynloading)
- System.loadLibrary("juh");
- } else
- System.loadLibrary("juh");
- }
-
- private static native boolean component_writeInfo(
- String libName, XMultiServiceFactory smgr, XRegistryKey regKey,
- ClassLoader loader );
-
- private static native Object component_getFactory(
- String libName, String implName, XMultiServiceFactory smgr,
- XRegistryKey regKey, ClassLoader loader );
-
- /**
- * Supplies the ServiceFactory of the default SharedLibraryLoader.
- * The defaults are "shlibloader.uno"
- * for the library and "com.sun.star.comp.stoc.DLLComponentLoader"
- * for the component name.
- *
- * See also UNOIDL com.sun.star.lang.ServiceManager and
- * com.sun.star.registry.RegistryKey.
- *
- * @return the factory for the "com.sun.star.comp.stoc.DLLComponentLoader" component.
- * @param smgr the ServiceManager
- * @param regKey the root registry key
- * @see com.sun.star.loader.SharedLibrary
- */
- public static XSingleServiceFactory getServiceFactory(
- XMultiServiceFactory smgr,
- XRegistryKey regKey )
- {
- return UnoRuntime.queryInterface(
- XSingleServiceFactory.class,
- component_getFactory(
- DEFAULT_LIBRARY, DEFAULT_IMPLEMENTATION, smgr, regKey,
- SharedLibraryLoader.class.getClassLoader() ) );
- }
-
- /**
- * Loads and returns a specific factory for a given library and implementation name.
- *
- * See also UNOIDL com.sun.star.lang.ServiceManager and
- * com.sun.star.registry.RegistryKey.
- *
- * @return the factory of the component
- * @param libName the name of the shared library
- * @param impName the implementation name of the component
- * @param smgr the ServiceManager
- * @param regKey the root registry key
- * @see com.sun.star.loader.SharedLibrary
- */
- public static XSingleServiceFactory getServiceFactory(
- String libName,
- String impName,
- XMultiServiceFactory smgr,
- XRegistryKey regKey )
- {
- return UnoRuntime.queryInterface(
- XSingleServiceFactory.class,
- component_getFactory(
- libName, impName, smgr, regKey,
- SharedLibraryLoader.class.getClassLoader() ) );
- }
-
- /**
- * Registers the SharedLibraryLoader under a RegistryKey.
- *
- * See also UNOIDL com.sun.star.lang.ServiceManager and
- * com.sun.star.registry.RegistryKey.
- *
- * @return true if the registration was successful - otherwise false
- * @param smgr the ServiceManager
- * @param regKey the root key under that the component should be registered
- * @see com.sun.star.loader.SharedLibrary
- */
- public static boolean writeRegistryServiceInfo(
- com.sun.star.lang.XMultiServiceFactory smgr,
- com.sun.star.registry.XRegistryKey regKey )
- {
- return component_writeInfo(
- DEFAULT_LIBRARY, smgr, regKey,
- SharedLibraryLoader.class.getClassLoader() );
- }
-
- /**
- * Registers the SharedLibraryLoader under a RegistryKey.
- *
- * See also UNOIDL com.sun.star.lang.ServiceManager and
- * com.sun.star.registry.RegistryKey.
- *
- * @return true if the registration was successful - otherwise false
- * @param libName name of the shared library
- * @param smgr the ServiceManager
- * @param regKey the root key under that the component should be registered
- * @throws com.sun.star.registry.InvalidRegistryException
- * if the registry is not valid.
- *
- * @see com.sun.star.loader.SharedLibrary
- */
- public static boolean writeRegistryServiceInfo(
- String libName,
- com.sun.star.lang.XMultiServiceFactory smgr,
- com.sun.star.registry.XRegistryKey regKey )
-
- throws com.sun.star.registry.InvalidRegistryException,
- com.sun.star.uno.RuntimeException
- {
- return component_writeInfo(
- libName, smgr, regKey, SharedLibraryLoader.class.getClassLoader() );
- }
-}
-
-// vim:set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/javaunohelper/com/sun/star/lib/uno/adapter/ByteArrayToXInputStreamAdapter.java b/javaunohelper/com/sun/star/lib/uno/adapter/ByteArrayToXInputStreamAdapter.java
deleted file mode 100644
index 2d3e9a8480b7..000000000000
--- a/javaunohelper/com/sun/star/lib/uno/adapter/ByteArrayToXInputStreamAdapter.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-package com.sun.star.lib.uno.adapter;
-
-import com.sun.star.io.XInputStream;
-import com.sun.star.io.XSeekable;
-import com.sun.star.lib.uno.helper.ComponentBase;
-
-public final class ByteArrayToXInputStreamAdapter
- extends ComponentBase
- implements XInputStream, XSeekable
-{
-
- byte[] m_bytes;
- int m_length;
- int m_pos;
-
- boolean m_open;
-
- /** Creates a new instance of ByteArrayXInputStram */
- public ByteArrayToXInputStreamAdapter(byte[] bytes) {
- init(bytes);
- }
-
- public void init(byte[] bytes) {
- m_bytes = bytes;
- m_length = bytes.length;
- m_pos = 0;
- m_open = true;
- }
-
- private void _check() throws com.sun.star.io.NotConnectedException, com.sun.star.io.IOException {
- if (m_bytes == null) {
- throw new com.sun.star.io.NotConnectedException("no bytes");
- }
- if(!m_open) {
- throw new com.sun.star.io.IOException("input closed");
- }
- }
-
- public int available() throws com.sun.star.io.NotConnectedException, com.sun.star.io.IOException {
- _check();
- long a = m_length - m_pos;
- if (a != (int)a)
- throw new com.sun.star.io.IOException("integer overflow");
- else {
- return (int)a;
- }
- }
-
- public void closeInput() throws com.sun.star.io.NotConnectedException, com.sun.star.io.IOException {
- _check();
- m_open = false;
- }
-
- public int readBytes(byte[][] values, int param) throws com.sun.star.io.NotConnectedException, com.sun.star.io.BufferSizeExceededException, com.sun.star.io.IOException {
- _check();
- try {
- int remain = (m_length - m_pos);
- if (param > remain) param = remain;
- /* ARGH!!! */
- if (values[0] == null){
- values[0] = new byte[param];
- }
- System.arraycopy(m_bytes, m_pos, values[0], 0, param);
- m_pos += param;
- return param;
- } catch (ArrayIndexOutOfBoundsException ex) {
- throw new com.sun.star.io.BufferSizeExceededException(ex, "buffer overflow");
- } catch (Exception ex) {
- throw new com.sun.star.io.IOException(ex, "error accessing buffer");
- }
- }
-
- public int readSomeBytes(byte[][] values, int param) throws com.sun.star.io.NotConnectedException, com.sun.star.io.BufferSizeExceededException, com.sun.star.io.IOException {
- return readBytes(values, param);
- }
-
- public void skipBytes(int param) throws com.sun.star.io.NotConnectedException, com.sun.star.io.BufferSizeExceededException, com.sun.star.io.IOException {
- _check();
- if (param > (m_length - m_pos))
- throw new com.sun.star.io.BufferSizeExceededException("buffer overflow");
- m_pos += param;
- }
-
- public long getLength() throws com.sun.star.io.IOException {
- if (m_bytes != null) return m_length;
- else throw new com.sun.star.io.IOException("no bytes");
- }
-
- public long getPosition() throws com.sun.star.io.IOException {
- if (m_bytes != null) return m_pos;
- else throw new com.sun.star.io.IOException("no bytes");
- }
-
- public void seek(long param) throws com.sun.star.lang.IllegalArgumentException, com.sun.star.io.IOException {
- if (m_bytes != null){
- if (param < 0 || param > m_length) throw new com.sun.star.lang.IllegalArgumentException("invalid seek position");
- else m_pos = (int)param;
- }else throw new com.sun.star.io.IOException("no bytes");
- }
-}
diff --git a/javaunohelper/com/sun/star/lib/uno/adapter/InputStreamToXInputStreamAdapter.java b/javaunohelper/com/sun/star/lib/uno/adapter/InputStreamToXInputStreamAdapter.java
deleted file mode 100644
index 3d60e5a1181a..000000000000
--- a/javaunohelper/com/sun/star/lib/uno/adapter/InputStreamToXInputStreamAdapter.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-package com.sun.star.lib.uno.adapter;
-
-import java.io.IOException;
-
-import com.sun.star.io.XInputStream;
-
-import java.io.InputStream;
-
-/** The InputStreamToInputXStreamAdapter wraps the
- Java InputStream object into a
- UNO XInputStream object.
- This allows users to access an InputStream
- as if it were an XInputStream.
- */
-public final class InputStreamToXInputStreamAdapter implements XInputStream {
-
- /**
- * Internal store to the InputStream
- */
- private final InputStream iIn;
-
- /**
- * Constructor.
- *
- * @param in The XInputStream to be
- * accessed as an InputStream.
- */
- public InputStreamToXInputStreamAdapter (InputStream in)
- {
- iIn = in;
- }
-
- public int available() throws
- com.sun.star.io.IOException
- {
-
- int bytesAvail;
-
- try {
- bytesAvail = iIn.available();
- } catch (IOException e) {
- throw new com.sun.star.io.IOException(e);
- }
-
- return bytesAvail;
- }
-
- public void closeInput() throws
- com.sun.star.io.IOException
- {
- try {
- iIn.close();
- } catch (IOException e) {
- throw new com.sun.star.io.IOException(e);
- }
- }
-
- public int readBytes(byte[][] b, int len) throws
- com.sun.star.io.IOException
- {
- try {
- long bytesRead;
- if (len >iIn.available()) {
- bytesRead = iIn.read(b[0], 0, iIn.available());
- }
- else{
- bytesRead = iIn.read(b[0], 0, len);
- }
- // Casting bytesRead to an int is okay, since the user can
- // only pass in an integer length to read, so the bytesRead
- // must <= len.
-
- if (bytesRead <= 0) {
- return 0;
- }
- return ((int)bytesRead);
-
-
- } catch (IOException e) {
- throw new com.sun.star.io.IOException("reader error", e);
- }
- }
-
- public int readSomeBytes(byte[][] b, int len) throws
- com.sun.star.io.IOException
- {
- try {
- long bytesRead;
- if (len >iIn.available()) {
- bytesRead = iIn.read(b[0], 0, iIn.available());
- }
- else{
- bytesRead = iIn.read(b[0], 0, len);
- }
- // Casting bytesRead to an int is okay, since the user can
- // only pass in an integer length to read, so the bytesRead
- // must <= len.
-
- if (bytesRead <= 0) {
- return 0;
- }
- return ((int)bytesRead);
-
-
- } catch (IOException e) {
- throw new com.sun.star.io.IOException("reader error", e);
- }
- }
-
- public void skipBytes(int n) throws
- com.sun.star.io.IOException
- {
- try {
- iIn.available();
- } catch (IOException e) {
- throw new com.sun.star.io.IOException(e);
- }
-
- do {
- try {
- n -= iIn.skip(n);
- } catch (IOException e) {
- throw new com.sun.star.io.IOException(e);
- }
- } while (n > 0);
- }
-}
-
diff --git a/javaunohelper/com/sun/star/lib/uno/adapter/OutputStreamToXOutputStreamAdapter.java b/javaunohelper/com/sun/star/lib/uno/adapter/OutputStreamToXOutputStreamAdapter.java
deleted file mode 100644
index 2842e3df05ce..000000000000
--- a/javaunohelper/com/sun/star/lib/uno/adapter/OutputStreamToXOutputStreamAdapter.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-package com.sun.star.lib.uno.adapter;
-
-import java.io.IOException;
-
-import com.sun.star.io.XOutputStream;
-
-import java.io.OutputStream;
-
-/** The OutputStreamToXOutputStreamAdapter wraps
- a UNO XOutputStream into a Java OutputStream
- object in a Java. This allows users to access an OutputStream
- as if it were an XOutputStream.
- */
-public final class OutputStreamToXOutputStreamAdapter implements XOutputStream {
-
- /**
- * Internal handle to the OutputStream
- */
- OutputStream iOut;
-
- /**
- * Constructor.
- *
- * @param out The XOutputStream to be
- * accessed as an OutputStream.
- */
- public OutputStreamToXOutputStreamAdapter(OutputStream out) {
- iOut = out;
- }
-
- public void closeOutput() throws
- com.sun.star.io.IOException
- {
- try {
- iOut.close();
- } catch (IOException e) {
- throw new com.sun.star.io.IOException(e);
- }
- }
-
- public void flush() throws
- com.sun.star.io.IOException
- {
- try {
- iOut.flush();
- } catch (IOException e) {
- throw new com.sun.star.io.IOException(e);
- }
- }
-
- public void writeBytes(byte[] b) throws
- com.sun.star.io.IOException
- {
-
- try {
- iOut.write(b);
- } catch (IOException e) {
- throw new com.sun.star.io.IOException(e);
- }
- }
-
-}
diff --git a/javaunohelper/com/sun/star/lib/uno/adapter/XInputStreamToInputStreamAdapter.java b/javaunohelper/com/sun/star/lib/uno/adapter/XInputStreamToInputStreamAdapter.java
deleted file mode 100644
index 25f1798fbada..000000000000
--- a/javaunohelper/com/sun/star/lib/uno/adapter/XInputStreamToInputStreamAdapter.java
+++ /dev/null
@@ -1,218 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-package com.sun.star.lib.uno.adapter;
-
-import java.io.IOException;
-
-import com.sun.star.io.XInputStream;
-
-import java.io.InputStream;
-
-/**
- * The XInputStreamToInputStreamAdapter wraps
- * the UNO XInputStream object in a Java
- * InputStream. This allows users to access
- * an XInputStream as if it were an
- * InputStream.
- */
-public final class XInputStreamToInputStreamAdapter extends InputStream {
-
- /**
- * Internal handle to the XInputStream
- */
- private final XInputStream xin;
-
- /**
- * Constructor.
- *
- * @param in The XInputStream to be
- * accessed as an InputStream.
- */
- public XInputStreamToInputStreamAdapter (XInputStream in) {
- xin = in;
- }
-
- @Override
- public int available() throws IOException {
-
- int bytesAvail;
-
- try {
- bytesAvail = xin.available();
- } catch (Exception e) {
- IOException newEx = new IOException(e.getMessage());
- newEx.initCause(e);
- throw newEx;
- }
-
- return bytesAvail;
- }
-
- @Override
- public void close() throws IOException {
- try {
- xin.closeInput();
- } catch (Exception e) {
- IOException newEx = new IOException(e.getMessage());
- newEx.initCause(e);
- throw newEx;
- }
- }
-
- @Override
- public int read () throws IOException {
- byte [][] tmp = new byte [1][1];
- try {
- long bytesRead = xin.readBytes(tmp, 1);
-
- if (bytesRead <= 0) {
- return (-1);
- } else {
- int tmpInt = tmp[0][0];
- if (tmpInt< 0 ){
- tmpInt = 256 +tmpInt;
- }
- return tmpInt;
- }
-
- } catch (Exception e) {
- IOException newEx = new IOException(e.getMessage());
- newEx.initCause(e);
- throw newEx;
- }
- }
-
- @Override
- public int read (byte[] b) throws IOException {
-
- byte [][] tmp = new byte [1][b.length];
- int bytesRead;
-
- try {
- bytesRead = xin.readBytes(tmp, b.length);
- if (bytesRead <= 0) {
- return -1;
- } else if (bytesRead < b.length) {
- System.arraycopy(tmp[0], 0, b, 0, bytesRead);
- } else {
- System.arraycopy(tmp[0], 0, b, 0, b.length);
- }
- } catch (Exception e) {
- IOException newEx = new IOException(e.getMessage());
- newEx.initCause(e);
- throw newEx;
- }
-
- return bytesRead;
- }
-
- @Override
- public int read(byte[] b, int off, int len) throws IOException {
- byte [][] tmp = new byte [1][b.length];
- try {
- long bytesRead;
- int av = xin.available();
- if ( av != 0 && len > av) {
- bytesRead = xin.readBytes(tmp, av);
- }
- else{
- bytesRead = xin.readBytes(tmp,len);
- }
- // Casting bytesRead to an int is okay, since the user can
- // only pass in an integer length to read, so the bytesRead
- // must <= len.
-
- if (bytesRead <= 0) {
- return -1;
- } else if (bytesRead < len) {
- System.arraycopy(tmp[0], 0, b, off, (int)bytesRead);
- } else {
- System.arraycopy(tmp[0], 0, b, off, len);
- }
-
- return ((int)bytesRead);
- } catch (Exception e) {
- IOException newEx = new IOException(e.getMessage());
- newEx.initCause(e);
- throw newEx;
- }
- }
-
- @Override
- public long skip(long n) throws IOException {
-
- int avail;
- long tmpLongVal = n;
- int tmpIntVal;
-
- try {
- avail = xin.available();
- } catch (Exception e) {
- IOException newEx = new IOException(e.getMessage());
- newEx.initCause(e);
- throw newEx;
- }
-
- do {
- if (tmpLongVal >= Integer.MAX_VALUE) {
- tmpIntVal = Integer.MAX_VALUE;
- } else {
- // Casting is safe here.
- tmpIntVal = (int)tmpLongVal;
- }
- tmpLongVal -= tmpIntVal;
-
- try {
- xin.skipBytes(tmpIntVal);
- } catch (Exception e) {
- IOException newEx = new IOException(e.getMessage());
- newEx.initCause(e);
- throw newEx;
- }
- } while (tmpLongVal > 0);
-
- if ( avail != 0 && avail < n) {
- return avail;
- } else {
- return n;
- }
- }
-
- /**
- * Tests if this input stream supports the mark and reset methods.
- * The markSupported method of
- * XInputStreamToInputStreamAdapter returns false.
- *
- * @return false
- */
- @Override
- public boolean markSupported() {
- return false;
- }
-
- @Override
- public synchronized void mark(int readlimit) {
- // Not supported.
- }
-
- @Override
- public synchronized void reset() throws IOException {
- // Not supported.
- }
-}
-
diff --git a/javaunohelper/com/sun/star/lib/uno/adapter/XOutputStreamToByteArrayAdapter.java b/javaunohelper/com/sun/star/lib/uno/adapter/XOutputStreamToByteArrayAdapter.java
deleted file mode 100644
index 48871277a75f..000000000000
--- a/javaunohelper/com/sun/star/lib/uno/adapter/XOutputStreamToByteArrayAdapter.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-package com.sun.star.lib.uno.adapter;
-
-import com.sun.star.io.*;
-import com.sun.star.lib.uno.helper.ComponentBase;
-
-public final class XOutputStreamToByteArrayAdapter
- extends ComponentBase
- implements XOutputStream
-{
- private static final int initialSize = 100240; // 10 kb
- private int size = 0;
- private int position = 0;
- private boolean externalBuffer = false;
- private byte[] buffer;
-
- /** Creates a new instance of ByteArrayXOutputStream */
- public XOutputStreamToByteArrayAdapter() {
- this(null);
- }
-
- public XOutputStreamToByteArrayAdapter(byte[] aBuffer) {
- if (aBuffer != null) {
- externalBuffer = true;
- buffer = aBuffer;
- size = buffer.length;
- } else {
- size = initialSize;
- buffer = new byte[size];
- }
- }
-
- public byte[] getBuffer() {
- return buffer;
- }
-
- public void closeOutput()
- throws com.sun.star.io.NotConnectedException,
- com.sun.star.io.BufferSizeExceededException,
- com.sun.star.io.IOException
- {
- // trim buffer
- if ( buffer.length > position && !externalBuffer )
- {
- byte[] newBuffer = new byte[position];
- System.arraycopy(buffer, 0, newBuffer, 0, position);
- buffer = newBuffer;
- }
- }
-
- public void flush()
- throws com.sun.star.io.NotConnectedException,
- com.sun.star.io.BufferSizeExceededException,
- com.sun.star.io.IOException
- {
- }
-
- public void writeBytes(byte[] values)
- throws com.sun.star.io.NotConnectedException,
- com.sun.star.io.BufferSizeExceededException,
- com.sun.star.io.IOException
- {
- if ( values.length > size-position )
- {
- if ( externalBuffer )
- throw new BufferSizeExceededException("out of buffer space, cannot grow external buffer");
- while ( values.length > size-position ) {
- size *= 2;
- }
- byte[] newBuffer = new byte[size];
- System.arraycopy(buffer, 0, newBuffer, 0, position);
- buffer = newBuffer;
- }
- System.arraycopy(values, 0, buffer, position, values.length);
- position += values.length;
- }
-
-}
diff --git a/javaunohelper/com/sun/star/lib/uno/adapter/XOutputStreamToOutputStreamAdapter.java b/javaunohelper/com/sun/star/lib/uno/adapter/XOutputStreamToOutputStreamAdapter.java
deleted file mode 100644
index 8104cf42fa3c..000000000000
--- a/javaunohelper/com/sun/star/lib/uno/adapter/XOutputStreamToOutputStreamAdapter.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-package com.sun.star.lib.uno.adapter;
-
-import java.io.IOException;
-
-import com.sun.star.io.XOutputStream;
-
-import java.io.OutputStream;
-
-/**
- * The XOutputStreamToOutputStreamAdapter wraps
- * the UNO XOutputStream object in a Java
- * OutputStream. This allows users to access
- * an XOutputStream as if it were an
- * OutputStream.
- */
-public final class XOutputStreamToOutputStreamAdapter extends OutputStream {
-
- /**
- * Internal handle to the XInputStream
- */
- XOutputStream xout;
-
- /**
- * Constructor.
- *
- * @param out The XOutputStream to be
- * accessed as an OutputStream.
- */
- public XOutputStreamToOutputStreamAdapter(XOutputStream out) {
- xout = out;
- }
-
- @Override
- public void close() throws IOException {
- try {
- xout.closeOutput();
- } catch (Exception e) {
- IOException newEx = new IOException(e.getMessage());
- newEx.initCause(e);
- throw newEx;
- }
- }
-
- @Override
- public void flush() throws IOException {
- try {
- xout.flush();
- } catch (Exception e) {
- IOException newEx = new IOException(e.getMessage());
- newEx.initCause(e);
- throw newEx;
- }
- }
-
- @Override
- public void write(byte[] b) throws IOException {
-
- try {
- xout.writeBytes(b);
- } catch (Exception e) {
- IOException newEx = new IOException(e.getMessage());
- newEx.initCause(e);
- throw newEx;
- }
- }
-
- @Override
- public void write(byte[] b, int off, int len) throws IOException {
-
- byte[] tmp = new byte[len];
-
- // Copy the input array into a temp array, and write it out.
-
- System.arraycopy(b, off, tmp, 0, len);
-
- try {
- xout.writeBytes(tmp);
- } catch (Exception e) {
- IOException newEx = new IOException(e.getMessage());
- newEx.initCause(e);
- throw newEx;
- }
- }
-
- @Override
- public void write(int b) throws IOException {
-
- byte [] oneByte = new byte [1];
- oneByte[0] = (byte) b;
-
- try {
- xout.writeBytes(oneByte);
- } catch (Exception e) {
- IOException newEx = new IOException(e.getMessage());
- newEx.initCause(e);
- throw newEx;
- }
- }
-}
diff --git a/javaunohelper/com/sun/star/lib/uno/helper/ComponentBase.java b/javaunohelper/com/sun/star/lib/uno/helper/ComponentBase.java
deleted file mode 100644
index d886ef7020d5..000000000000
--- a/javaunohelper/com/sun/star/lib/uno/helper/ComponentBase.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-package com.sun.star.lib.uno.helper;
-import com.sun.star.lang.XComponent;
-import com.sun.star.lang.XEventListener;
-import com.sun.star.lang.EventObject;
-import com.sun.star.uno.Type;
-
-/** This class can be used as the base class for UNO components. In addition to the functionality ,which
- * is inherited from WeakBase, it implements com.sun.star.lang.XComponent.
- */
-public class ComponentBase extends WeakBase implements XComponent
-{
- private static final boolean DEBUG= false;
- protected MultiTypeInterfaceContainer listenerContainer;
- protected boolean bInDispose= false;
- protected boolean bDisposed= false;
- static final Type EVT_LISTENER_TYPE= new Type(XEventListener.class);
-
-
- /** Creates a new instance of CompBase */
- public ComponentBase()
- {
- super();
- listenerContainer= new MultiTypeInterfaceContainer();
- }
-
- /** Override to perform extra clean-up work. Provided for subclasses. It is
- called during dispose()
- */
- protected void preDisposing()
- {
- }
- /** Override to become notified right before the disposing action is performed.
- */
- protected void postDisposing()
- {
- }
-
-
- /** Method of XComponent. It is called by the owning client when the component is not needed
- * anymore. The registered listeners are notified that this method has been called.
- */
- public void dispose()
- {
- // Determine in a thread-safe way if this is the first call to this method.
- // Only then we proceed with the notification of event listeners.
- // It is an error to call this method more than once.
- boolean bDoDispose= false;
- synchronized (this)
- {
- if ( ! bInDispose && ! bDisposed)
- {
- bDoDispose= true;
- bInDispose= true;
- }
- }
- // The notification occurs in an unsynchronized block in order to avoid
- // deadlocks if one of the listeners calls back in a different thread on
- // a synchronized method which uses the same object.
- if (bDoDispose)
- {
- try
- {
- preDisposing();
- listenerContainer.disposeAndClear(new EventObject(this));
- //notify subclasses that disposing is in progress
- postDisposing();
- }
- finally
- {
- // finally makes sure that the flags are set even if a RuntimeException is thrown.
- // That ensures that this function is only called once.
- synchronized (this)
- {
- bDisposed= true;
- bInDispose= false;
- }
- }
- }
- else
- {
- // in a multithreaded environment, it can't be avoided, that dispose is called twice.
- // However this condition is traced, because it MAY indicate an error.
- if (DEBUG)
- System.out.println("OComponentHelper::dispose() - dispose called twice" );
- }
- }
-
- /** Method of XComponent.
- */
- public void removeEventListener(XEventListener xEventListener)
- {
- listenerContainer.removeInterface( EVT_LISTENER_TYPE, xEventListener);
- }
-
- public void addEventListener(XEventListener listener)
- {
- boolean bDoDispose= false;
- synchronized (this)
- {
- if (bDisposed || bInDispose)
- bDoDispose= true;
- else
- listenerContainer.addInterface(EVT_LISTENER_TYPE, listener);
- }
- if (bDoDispose )
- {
- listener.disposing( new EventObject(this));
- }
- }
-
- @Override
- protected void finalize() throws Throwable
- {
- if ( ! bInDispose && ! bDisposed)
- dispose();
- super.finalize();
- }
-}
diff --git a/javaunohelper/com/sun/star/lib/uno/helper/Factory.java b/javaunohelper/com/sun/star/lib/uno/helper/Factory.java
deleted file mode 100644
index 056d9549d552..000000000000
--- a/javaunohelper/com/sun/star/lib/uno/helper/Factory.java
+++ /dev/null
@@ -1,291 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-package com.sun.star.lib.uno.helper;
-
-import com.sun.star.uno.XComponentContext;
-import com.sun.star.lang.XSingleComponentFactory;
-import com.sun.star.lang.XServiceInfo;
-import com.sun.star.lang.XInitialization;
-import com.sun.star.registry.XRegistryKey;
-import com.sun.star.uno.UnoRuntime;
-
-
-/** Factory helper class supporting com.sun.star.lang.XServiceInfo and
- com.sun.star.lang.XSingleComponentFactory.
-
-
- Note: This factory implementation does not support lang.XSingleServiceFactory.
-
-*/
-public class Factory
- extends ComponentBase
- implements XSingleComponentFactory, XServiceInfo
-{
- private static final boolean DEBUG = false;
-
- /** Creates an object factory supporting interfaces
- com.sun.star.lang.XSingleComponentFactory and
- com.sun.star.lang.XServiceInfo
-
- @param impl_class
- implementation class
- @param impl_name
- implementation name
- @param supported_services
- services implemented
- @return
- object factory
-
- @since UDK 3.2.13
- */
- public static XSingleComponentFactory createComponentFactory(
- Class impl_class, String impl_name, String supported_services [] )
- throws com.sun.star.uno.RuntimeException
- {
- return new Factory( impl_class, impl_name, supported_services );
- }
-
- /** Creates an object factory supporting interfaces
- com.sun.star.lang.XSingleComponentFactory and
- com.sun.star.lang.XServiceInfo
-
- The implementation name is the name of the implementation class.
-
- @param impl_class
- implementation class
- @param supported_services
- services implemented
- @return
- object factory
- */
- public static XSingleComponentFactory createComponentFactory(
- Class impl_class, String supported_services [] )
- throws com.sun.star.uno.RuntimeException
- {
- return createComponentFactory(
- impl_class, impl_class.getName(), supported_services );
- }
- /** Writes component's implementation info to given registry key.
-
- @param impl_name
- name of implementation
- @param supported_services
- supported services of implementation
- @param xKey
- registry key to write to
- @return
- success
- */
- public static boolean writeRegistryServiceInfo(
- String impl_name, String supported_services [], XRegistryKey xKey )
- {
- try
- {
- XRegistryKey xNewKey = xKey.createKey( "/" + impl_name + "/UNO/SERVICES" );
- for ( int nPos = 0; nPos < supported_services.length; ++nPos )
- {
- xNewKey.createKey( supported_services[ nPos ] );
- }
- return true;
- }
- catch (com.sun.star.registry.InvalidRegistryException exc)
- {
- if (DEBUG)
- {
- System.err.println(
- "##### " + Factory.class.getName() + ".writeRegistryServiceInfo -- exc: " +
- exc.toString() );
- }
- }
- return false;
- }
-
-
- private final String m_impl_name;
- private final String [] m_supported_services;
- private final Class> m_impl_class;
- private final java.lang.reflect.Method m_method;
- private final java.lang.reflect.Constructor m_ctor;
-
- private Factory(
- Class impl_class, String impl_name, String supported_services [] )
- throws com.sun.star.uno.DeploymentException
- {
- m_impl_name = impl_name;
- m_supported_services = supported_services;
- m_impl_class = impl_class;
-
- Class params [] = new Class [] { XComponentContext.class };
-
- if (!java.lang.reflect.Modifier.isPublic( impl_class.getModifiers() ))
- {
- throw new com.sun.star.uno.DeploymentException("class " + impl_class + " is not public");
- }
-
- java.lang.reflect.Method tmpMethod = null;
- try
- {
- // seeking for "public static Object __create( XComponentContext )"
- tmpMethod = m_impl_class.getMethod( "__create", params );
- int mod = tmpMethod.getModifiers();
- if (!tmpMethod.getReturnType().equals( Object.class ) ||
- !java.lang.reflect.Modifier.isStatic( mod ) ||
- !java.lang.reflect.Modifier.isPublic( mod ))
- {
- tmpMethod = null;
- }
- }
- catch (Exception exc)
- {
- }
- m_method = tmpMethod;
-
-
- java.lang.reflect.Constructor tmpCtor = null;
- if (null == m_method)
- {
- try
- {
- // ctor with context
- tmpCtor = m_impl_class.getConstructor( params );
- }
- catch (Exception exc)
- {
- }
- if (tmpCtor != null)
- {
- if (!java.lang.reflect.Modifier.isPublic( tmpCtor.getModifiers() ))
- {
- throw new com.sun.star.uno.DeploymentException("constructor with XComponentContext param for class " + impl_class + " is not public");
- }
- }
- else
- {
- // else take default ctor
- java.lang.reflect.Constructor defaultCtor;
- try
- {
- defaultCtor = m_impl_class.getConstructor(new Class[0]);
- }
- catch (Exception exc2)
- {
- throw new com.sun.star.uno.DeploymentException(exc2, "class " + impl_class + " has no means of creating it, cannot find a __create method or a useful constructor.");
- }
- if (!java.lang.reflect.Modifier.isPublic( defaultCtor.getModifiers() ))
- {
- throw new com.sun.star.uno.DeploymentException("default constructor for class " + impl_class + " is not public");
- }
- }
- }
- m_ctor = tmpCtor;
- }
-
-
- private Object instantiate( XComponentContext xContext )
- throws com.sun.star.uno.Exception
- {
- try
- {
- if (DEBUG)
- System.out.print( "instantiating " + m_impl_class.toString() + " using " );
- if (null != m_method)
- {
- if (DEBUG)
- System.out.println( "__create( XComponentContext )..." );
- return m_method.invoke( null, new Object [] { xContext } );
- }
- if (null != m_ctor)
- {
- if (DEBUG)
- System.out.println( "ctor( XComponentContext )..." );
- return m_ctor.newInstance( new Object [] { xContext } );
- }
- if (DEBUG)
- System.out.println( "default ctor..." );
- return m_impl_class.newInstance(); // default ctor
- }
- catch (java.lang.reflect.InvocationTargetException exc)
- {
- Throwable targetException = exc.getTargetException();
- if (targetException instanceof java.lang.RuntimeException)
- throw (java.lang.RuntimeException)targetException;
- else if (targetException instanceof com.sun.star.uno.RuntimeException)
- throw (com.sun.star.uno.RuntimeException)targetException;
- else if (targetException instanceof com.sun.star.uno.Exception)
- throw (com.sun.star.uno.Exception)targetException;
- else
- throw new com.sun.star.uno.Exception(targetException, targetException.getMessage(), this);
- }
- catch (IllegalAccessException exc)
- {
- throw new com.sun.star.uno.RuntimeException( exc, exc.getMessage(), this);
- }
- catch (InstantiationException exc)
- {
- throw new com.sun.star.uno.RuntimeException( exc, exc.getMessage(), this);
- }
- }
- // XSingleComponentFactory impl
-
- public final Object createInstanceWithContext(
- XComponentContext xContext )
- throws com.sun.star.uno.Exception
- {
- return instantiate( xContext );
- }
-
- public final Object createInstanceWithArgumentsAndContext(
- Object arguments [], XComponentContext xContext )
- throws com.sun.star.uno.Exception
- {
- Object inst = instantiate( xContext );
- XInitialization xInit = UnoRuntime.queryInterface(
- XInitialization.class, inst );
- if (null == xInit)
- {
- throw new com.sun.star.lang.IllegalArgumentException(
- "cannot pass arguments to component; no XInitialization implemented!", this,
- (short)0 );
- }
- xInit.initialize( arguments );
- return inst;
- }
-
- // XServiceInfo impl
-
- public final String getImplementationName()
- {
- return m_impl_name;
- }
-
- public final boolean supportsService( String service_name )
- {
- for ( int nPos = 0; nPos < m_supported_services.length; ++nPos )
- {
- if (m_supported_services[ nPos ].equals( service_name ))
- return true;
- }
- return false;
- }
-
- public final String [] getSupportedServiceNames()
- {
- return m_supported_services;
- }
-}
-
diff --git a/javaunohelper/com/sun/star/lib/uno/helper/InterfaceContainer.java b/javaunohelper/com/sun/star/lib/uno/helper/InterfaceContainer.java
deleted file mode 100644
index e858ced81fd8..000000000000
--- a/javaunohelper/com/sun/star/lib/uno/helper/InterfaceContainer.java
+++ /dev/null
@@ -1,864 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-package com.sun.star.lib.uno.helper;
-
-import java.util.Iterator;
-import java.util.ListIterator;
-import java.util.Collection;
-
-import com.sun.star.lang.EventObject;
-import com.sun.star.lang.XEventListener;
-import com.sun.star.uno.UnoRuntime;
-
-/**
- * This class is a container for interfaces.
- *
- * It is intended to be used as storage for UNO interface of a specific type.
- * The client has to ensure that the container contains only elements of the same
- * type. If one needs to store different types, then one uses OMultiTypeInterfaceContainer.
- * When the client calls disposeAndClear, the contained objects are queried for
- * com.sun.star.lang.XEventListener and disposing is called. Afterwards
- * the list cannot be used anymore.
- *
- * This list does not allow null values.
- * All methods are thread-safe. The same holds true for
- * iterators, issued by this class. Several iterators can exist at the same time and can also
- * be modified (java.util.ListIterator.add, java.util.ListIterator.remove etc.). To make this work,
- * the InterfaceContainer provides the iterators with copies of the list's data.
- * The add and remove calls on the iterator modify the data in the iterator's list as well as
- * in InterfaceContainer. Modification on InterfaceContainer, however, are not
- * synchronized with existing iterators. For example
- *
- * InterfaceContainer cont= new InterfaceContainer();
- * ListIterator it= cont.listIterator();
- *
- * cont.add( someInterface);
- * // one cannot obtain someInterface through iterator it,
- * // instead get a new iterator
- * it= cont.listIterator();
- * // it now keeps a fresh copy of cont and hence contains someInterface
- *
- * // Adding an interface on the iterator will cause the interface also to be added
- * // to InterfaceContainer
- * it.add( someOtherInterface);
- * // someOtherInterface is now in it and cont
- * ListIterator it2= cont.listIterator();
- * //someOtherInterface can also be obtained by all newly created iterators, e.g. it2.
- *
- *
- * The add and remove methods of an iterator work on a particular location within a list,
- * dependent on what the value of the iterator's cursor is. After the call the value at the
- * appropriate position has been modified. Since the iterator received a copy of InterfaceContainer's
- * data, InterfaceContainer may have been modified (by List methods or through other iterators).
- * Therefore both data sets may not contain the same elements anymore. Consequently, a List method
- * that modifies data, does not modify InterfaceContainer's data at a certain index
- * (according to the iterators cursor). Instead, new elements are added at the end of list. When
- * Iterator.remove is called, then the first occurrence of that element in InterfaceContainer
- * is removed.
- * ListIterator.set is not supported.
- *
- * A lot of methods resemble those of the to java.util.List interface, although
- * this class does not implement it. However, the list iterators returned, for example by
- * the listIterator method implement the java.util.ListIterator interface.
- * Implementing the List interface would mean to support all none - optional methods as
- * prescribed by the interface declaration. Among those is the subList method which returns
- * a range of values of the list's data wrapped in a List implementation. Changes to the sub
- * list have to cause changes in the main list. This is a problem, since this class is to be
- * used in a multi-threaded environment. The sub list could work on a copy as the iterators
- * do, but all the functions which work on a given index could not be properly supported.
- * Unfortunately, the List interface documentation states that all optional methods implemented
- * by the list have to be implemented in the sub list. That would mean to do without all those
- * critical methods, although they might work well in the "main list" (as opposed to sub list).
- */
-public class InterfaceContainer implements Cloneable
-{
- static final boolean DEBUG= false;
- /**
- * The array buffer into which the elements of the ArrayList are stored.
- * The capacity of the ArrayList is the length of this array buffer.
- */
- Object elementData[];
-
- /**
- * The size of the ArrayList (the number of elements it contains).
- */
- private int size;
-
-
- /** Creates a new instance of InterfaceContainer */
- public InterfaceContainer()
- {
- this(10);
- }
- /**
- * Constructs an empty list with the specified initial capacity.
- *
- * @param initialCapacity the initial capacity of the list.
- * @exception IllegalArgumentException if the specified initial capacity
- * is negative
- */
- public InterfaceContainer(int initialCapacity)
- {
- if (initialCapacity < 0)
- throw new java.lang.IllegalArgumentException("Illegal Capacity: "+
- initialCapacity);
- this.elementData = new Object[initialCapacity];
- }
-
- private InterfaceContainer(Object[] data) {
- elementData = data;
- size = elementData == null ? 0 : elementData.length;
- }
-
- /**
- * Trims the capacity of this ArrayList instance to be the
- * list's current size. An application can use this operation to minimize
- * the storage of an ArrayList instance.
- */
- synchronized public void trimToSize()
- {
- int oldCapacity = elementData.length;
- if (size < oldCapacity)
- {
- Object oldData[] = elementData;
- elementData = new Object[size];
- System.arraycopy(oldData, 0, elementData, 0, size);
- }
- }
-
- /**
- * Increases the capacity of this ArrayList instance, if
- * necessary, to ensure that it can hold at least the number of elements
- * specified by the minimum capacity argument.
- *
- * @param minCapacity the desired minimum capacity.
- */
- synchronized public void ensureCapacity(int minCapacity)
- {
- int oldCapacity = elementData.length;
- if (minCapacity > oldCapacity)
- {
- Object oldData[] = elementData;
- int newCapacity = (oldCapacity * 3)/2 + 1;
- if (newCapacity < minCapacity)
- newCapacity = minCapacity;
- elementData = new Object[newCapacity];
- System.arraycopy(oldData, 0, elementData, 0, size);
- }
- }
-
- /**
- * Appends the specified element to the end of this list.
- *
- * @param o element to be appended to this list.
- * @return true (as per the general contract of Collection.add).
- */
- synchronized public boolean add(Object o)
- {
- boolean ret= false;
- if (elementData != null && o != null)
- {
- ensureCapacity(size + 1); // Increments modCount!!
- elementData[size++] = o;
- ret= true;
- }
- return ret;
- }
-
- /**
- * Inserts the specified element at the specified position in this
- * list. Shifts the element currently at that position (if any) and
- * any subsequent elements to the right (adds one to their indices).
- *
- * @param index index at which the specified element is to be inserted.
- * @param element element to be inserted.
- * @throws IndexOutOfBoundsException if index is out of range
- * (index < 0 || index > size()).
- */
- synchronized public void add(int index, Object element)
- {
- if (elementData != null && element != null)
- {
- if (index > size || index < 0)
- throw new IndexOutOfBoundsException(
- "Index: "+index+", Size: "+size);
-
- ensureCapacity(size+1);
- System.arraycopy(elementData, index, elementData, index + 1,
- size - index);
- elementData[index] = element;
- size++;
- }
- }
-
-
- /**
- * Appends all of the elements in the specified Collection to the end of
- * this list, in the order that they are returned by the
- * specified Collection's Iterator. The behavior of this operation is
- * undefined if the specified Collection is modified while the operation
- * is in progress. (This implies that the behavior of this call is
- * undefined if the specified Collection is this list, and this
- * list is nonempty.)
- *
- * @param c the elements to be inserted into this list.
- * @throws IndexOutOfBoundsException if index out of range (index
- * < 0 || index > size()).
- * @return true if an element was inserted.
- */
- synchronized public boolean addAll(Collection c)
- {
- int numNew = c.size();
- ensureCapacity(size + numNew);
-
- Iterator e = c.iterator();
- for (int i=0; i(index
- * < 0 || index > size()).
- * @return true if an element was inserted.
- */
- synchronized public boolean addAll(int index, Collection c)
- {
- boolean ret= false;
- if (elementData != null)
- {
- if (index > size || index < 0)
- throw new IndexOutOfBoundsException(
- "Index: "+index+", Size: "+size);
- // only add the non-null elements
- int sizeCol= c.size();
- Object[] arColl= new Object[sizeCol];
- Iterator icol= c.iterator();
- int curIndex= 0;
- for (int i=0; i < sizeCol; i++)
- {
- Object o= icol.next();
- if (o != null)
- arColl[curIndex++]= o;
- }
- int numNew = curIndex;
- ensureCapacity(size + numNew); // Increments modCount!!
-
- int numMoved = size - index;
- if (numMoved > 0)
- System.arraycopy(elementData, index, elementData, index + numNew,
- numMoved);
-
- for (int i=0; itrue if this list contains the specified element.
- *
- * @param elem element whose presence in this List is to be tested.
- * @return true if this list contains the specified element.
- */
- synchronized public boolean contains(Object elem)
- {
- return indexOf(elem) >= 0;
- }
-
- synchronized public boolean containsAll(Collection collection)
- {
- boolean retVal= true;
- if (elementData != null && collection != null)
- {
- Iterator it= collection.iterator();
- while (it.hasNext())
- {
- Object obj= it.next();
- if (!contains(obj))
- {
- retVal= false;
- break;
- }
- }
- }
- return retVal;
- }
- /**
- * Returns the element at the specified position in this list.
- *
- * @param index index of element to return.
- * @return the element at the specified position in this list.
- * @throws IndexOutOfBoundsException if index is out of range (index
- * < 0 || index >= size()).
- */
- synchronized public Object get(int index)
- {
- if (elementData != null)
- {
- RangeCheck(index);
- return elementData[index];
- }
- return null;
- }
-
- /**
- * Searches for the first occurrence of the given argument, testing
- * for equality using the equals method.
- *
- * @param elem an object.
- * @return the index of the first occurrence of the argument in this
- * list; returns -1 if the object is not found.
- * @see Object#equals(Object)
- */
- synchronized public int indexOf(Object elem)
- {
- if (elementData == null || elem == null) {
- return -1;
- }
-
- int index= -1;
-
- for (int i = 0; i < size; i++)
- {
- if (elem == elementData[i])
- {
- index= i;
- break;
- }
- }
-
- if (index == -1)
- {
- for (int i = 0; i < size; i++)
- {
- if (UnoRuntime.areSame(elem, elementData[i]))
- {
- index= i;
- break;
- }
- }
- }
- return index;
- }
- /**
- * Tests if this list has no elements.
- *
- * @return true if this list has no elements;
- * false otherwise.
- */
- synchronized public boolean isEmpty()
- {
- return size == 0;
- }
-
- synchronized public Iterator iterator()
- {
- if (elementData != null)
- {
- InterfaceContainer aCopy= (InterfaceContainer) clone();
- return new Itr(aCopy);
- }
- return null;
- }
- /**
- * Returns the index of the last occurrence of the specified object in
- * this list.
- *
- * @param elem the desired element.
- * @return the index of the last occurrence of the specified object in
- * this list; returns -1 if the object is not found.
- */
- synchronized public int lastIndexOf(Object elem)
- {
- if (elementData == null || elem == null) {
- return -1;
- }
-
- int index= -1;
-
- for (int i = size-1; i >= 0; i--)
- {
- if (elem == elementData[i])
- {
- index= i;
- break;
- }
- }
- if (index == -1)
- {
- for (int i = size-1; i >= 0; i--)
- {
- if (UnoRuntime.areSame(elem, elementData[i]))
- {
- index= i;
- break;
- }
- }
- }
- return index;
- }
-
- /**
- * Returns a shallow copy of this ArrayList instance. The contained
- * references are copied but the objects not.
- *
- * @return a clone of this List instance.
- */
- @Override
- synchronized public Object clone()
- {
- Object[] data;
- if (elementData == null) {
- data = null;
- } else {
- data = new Object[size];
- System.arraycopy(elementData, 0, data, 0, size);
- }
- return new InterfaceContainer(data);
- }
- synchronized public ListIterator listIterator()
- {
- return listIterator(0);
- }
-
- /** The iterator keeps a copy of the list. Changes to InterfaceContainer do not
- * affect the data of the iterator. Conversely, changes to the iterator are effect
- * InterfaceContainer.
- * @param index the starting offset into the list.
- * @return a new iterator.
- */
- synchronized public ListIterator listIterator(int index)
- {
- if (elementData != null)
- {
- InterfaceContainer aCopy= (InterfaceContainer) clone();
- return new LstItr(aCopy, index);
- }
- return null;
- }
- /**
- * Removes the element at the specified position in this list.
- * Shifts any subsequent elements to the left (subtracts one from their
- * indices).
- *
- * @param index the index of the element to removed.
- * @return the element that was removed from the list.
- * @throws IndexOutOfBoundsException if index out of range (index
- * < 0 || index >= size()).
- */
- synchronized public Object remove(int index)
- {
- Object ret= null;
- if (elementData != null)
- {
- RangeCheck(index);
- ret= elementData[index];
-
- int numMoved = size - index - 1;
- if (numMoved > 0)
- System.arraycopy(elementData, index+1, elementData, index,
- numMoved);
- elementData[--size] = null; // Let gc do its work
- }
- return ret;
- }
-
-
- /** Parameter obj may... or may not. What did the original author want
- * to tell us here?
- * @param obj the object to be removed.
- * @return true if obj was successfully removed from the list.
- */
- synchronized public boolean remove(Object obj)
- {
- boolean ret= false;
- if (elementData != null && obj != null)
- {
- int index= indexOf(obj);
- if (index != -1)
- {
- ret= true;
- remove(index);
- }
- }
- return ret;
- }
-
- synchronized public boolean removeAll(Collection collection)
- {
- boolean retVal= false;
- if (elementData != null && collection != null)
- {
- Iterator it= collection.iterator();
- while (it.hasNext())
- {
- Object obj= it.next();
- boolean bMod= remove( obj);
- if (bMod)
- retVal= true;
- }
- }
- return retVal;
- }
-
- synchronized public boolean retainAll(Collection collection)
- {
- if (elementData == null || collection == null) {
- return false;
- }
-
- boolean retVal= false;
- // iterate over data
- Object[] arRetained= new Object[size];
- int indexRetained= 0;
- for(int i= 0; i < size; i++)
- {
- Object curElem= elementData[i];
- // try to find the element in collection
- Iterator itColl= collection.iterator();
- boolean bExists= false;
- while (itColl.hasNext())
- {
- if (curElem == itColl.next())
- {
- // current element is in collection
- bExists= true;
- break;
- }
- }
- if (!bExists)
- {
- itColl= collection.iterator();
- while (itColl.hasNext())
- {
- Object o= itColl.next();
- if (o != null && UnoRuntime.areSame(o, curElem))
- {
- bExists= true;
- break;
- }
- }
- }
- if (bExists)
- arRetained[indexRetained++]= curElem;
- }
- retVal= size != indexRetained;
- if (indexRetained > 0)
- {
- elementData= arRetained;
- size= indexRetained;
- }
- return retVal;
- }
-
-
- /** Not supported.
- * @param index index of element to replace.
- * @param element element to be stored at the specified position.
- * @return the element previously at the specified position.
- * @throws IndexOutOfBoundsException if index out of range
- * (index < 0 || index >= size()).
- */
- synchronized public Object set(int index, Object element)
- {
- Object ret= null;
- if (elementData != null && element != null)
- {
- RangeCheck(index);
- ret = elementData[index];
- elementData[index] = element;
- }
- return ret;
- }
-
- /**
- * Returns the number of elements in this list.
- *
- * @return the number of elements in this list.
- */
- synchronized public int size()
- {
- if (elementData != null)
- return size;
- return 0;
- }
-
-
- /**
- * Returns an array containing all of the elements in this list
- * in the correct order.
- *
- * @return an array containing all of the elements in this list
- * in the correct order.
- */
- synchronized public Object[] toArray()
- {
- if (elementData != null)
- {
- Object[] result = new Object[size];
- System.arraycopy(elementData, 0, result, 0, size);
- return result;
- }
- return null;
- }
-
- /**
- * Returns an array containing all of the elements in this list in the
- * correct order. The runtime type of the returned array is that of the
- * specified array. If the list fits in the specified array, it is
- * returned therein. Otherwise, a new array is allocated with the runtime
- * type of the specified array and the size of this list.
- *
- * If the list fits in the specified array with room to spare (i.e., the
- * array has more elements than the list), the element in the array
- * immediately following the end of the collection is set to
- * null. This is useful in determining the length of the list
- * only if the caller knows that the list does not contain any
- * null elements.
- *
- * @param a the array into which the elements of the list are to
- * be stored, if it is big enough; otherwise, a new array of the
- * same runtime type is allocated for this purpose.
- * @return an array containing the elements of the list.
- * @throws ArrayStoreException if the runtime type of a is not a supertype
- * of the runtime type of every element in this list.
- */
- synchronized public Object[] toArray(Object a[])
- {
- if (a.length < size)
- a = (Object[])java.lang.reflect.Array.newInstance(
- a.getClass().getComponentType(), size);
- if (elementData != null)
- System.arraycopy(elementData, 0, a, 0, size);
-
- if (a.length > size)
- a[size] = null;
-
- return a;
- }
-
- /**
- * Check if the given index is in range. If not, throw an appropriate
- * runtime exception.
- */
- private void RangeCheck(int index)
- {
- if (index >= size || index < 0)
- throw new IndexOutOfBoundsException(
- "Index: "+index+", Size: "+size);
- }
-
- public void disposeAndClear(EventObject evt)
- {
- Iterator aIt;
- synchronized (this)
- {
- aIt= iterator();
- // Release containers if new entries occur in disposing;
- // set the member to null, the iterator delete the values
- clear();
- elementData= null;
- size= 0;
- }
- if (aIt != null)
- {
- while( aIt.hasNext() )
- {
- try
- {
- Object o= aIt.next();
- XEventListener evtListener= UnoRuntime.queryInterface(
- XEventListener.class, o);
- if( evtListener != null )
- evtListener.disposing( evt );
- }
- catch ( RuntimeException e)
- {
- // be robust, if e.g. a remote bridge has disposed already.
- // there is no way, to delegate the error to the caller :o(.
- }
- }
- }
- }
-
-
- private class Itr implements Iterator
- {
- InterfaceContainer dataIt;
- /**
- * Index of element to be returned by subsequent call to next.
- */
- int cursor= 0;
- /**
- * Index of element returned by most recent call to next or
- * previous. Reset to -1 if this element is deleted by a call
- * to remove.
- */
- int lastRet = -1;
-
- /** The object that has been returned by most recent call to next
- * or previous. Reset to null if this element is deleted by a call
- * to remove.
- */
- Object lastRetObj= null;
-
- Itr(InterfaceContainer _data)
- {
- dataIt= _data;
- }
-
- synchronized public boolean hasNext()
- {
- return cursor !=dataIt.size();
- }
-
- public synchronized Object next()
- {
- try
- {
- Object next = dataIt.get(cursor);
- lastRet = cursor++;
- lastRetObj= next;
- return next;
- }
- catch(java.lang.IndexOutOfBoundsException e)
- {
- java.util.NoSuchElementException ex2 = new java.util.NoSuchElementException();
- ex2.initCause(e);
- throw ex2;
- }
- }
-
- /** Removes the interface from the list, that has been last returned by a
- * call to next(). This is done according to the specification of the interface
- * method. The element is also removed from InterfaceContainer but independent
- * of the location. If the element is multiple times in InterfaceContainer then
- * it is up to the java.util.ArrayList implementation what element is removed.
- */
- public synchronized void remove()
- {
- if (lastRet == -1)
- throw new IllegalStateException();
- // Remove the entry from InterfaceContainer.
- InterfaceContainer.this.remove(lastRetObj);
- dataIt.remove(lastRet);
-
- if (lastRet < cursor)
- cursor--;
- lastRet = -1;
- lastRetObj= null;
- }
- }
-
- private class LstItr extends Itr implements ListIterator
- {
-
- LstItr(InterfaceContainer _data, int _index)
- {
- super(_data);
- cursor= _index;
- }
-
- /** Inserts an element to the iterators list according to the specification
- * of this interface method. The element is also added to InterfaceContainer
- * but its location within the list cannot be guaranteed.
- */
- public synchronized void add(Object o)
- {
- InterfaceContainer.this.add(o);
- dataIt.add(cursor++, o);
- lastRet = -1;
- lastRetObj= null;
- }
-
- synchronized public boolean hasPrevious()
- {
- return cursor != 0;
- }
-
- synchronized public int nextIndex()
- {
- return cursor;
- }
-
- public synchronized Object previous()
- {
- try
- {
- Object previous = dataIt.get(--cursor);
- lastRet = cursor;
- lastRetObj= previous;
- return previous;
- } catch(IndexOutOfBoundsException e)
- {
- java.util.NoSuchElementException ex2 = new java.util.NoSuchElementException();
- ex2.initCause(e);
- throw ex2;
- }
- }
-
- synchronized public int previousIndex()
- {
- return cursor-1;
- }
-
- /** This is not possible since several iterators can modify InterfaceContainer
- */
- public synchronized void set(Object o)
- {
- throw new UnsupportedOperationException();
- }
-
-
- } // class LstItr
-}
-
diff --git a/javaunohelper/com/sun/star/lib/uno/helper/MultiTypeInterfaceContainer.java b/javaunohelper/com/sun/star/lib/uno/helper/MultiTypeInterfaceContainer.java
deleted file mode 100644
index 9b061f81c217..000000000000
--- a/javaunohelper/com/sun/star/lib/uno/helper/MultiTypeInterfaceContainer.java
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-package com.sun.star.lib.uno.helper;
-import com.sun.star.uno.Type;
-import com.sun.star.lang.EventObject;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Iterator;
-
-public class MultiTypeInterfaceContainer
-{
-
- private final Map