diff options
Diffstat (limited to 'jurt')
87 files changed, 1027 insertions, 953 deletions
diff --git a/jurt/com/sun/star/comp/bridgefactory/BridgeFactory.java b/jurt/com/sun/star/comp/bridgefactory/BridgeFactory.java index 1c4819326268..89174467af02 100644 --- a/jurt/com/sun/star/comp/bridgefactory/BridgeFactory.java +++ b/jurt/com/sun/star/comp/bridgefactory/BridgeFactory.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -51,13 +51,13 @@ import com.sun.star.uno.UnoRuntime; /** * The BridgeFactory class implements the <code>XBridgeFactory</code> Interface. - * It wrapps the <code>UnoRuntime#getBridgeByName</code>method and delivers a + * It wrapps the <code>UnoRuntime#getBridgeByName</code>method and delivers a * XBridge component. * <p> * This component is only usable for remote bridges. * <p> - * @version $Revision: 1.11 $ $ $Date: 2008-04-11 11:07:51 $ - * @author Kay Ramme + * @version $Revision: 1.11 $ $ $Date: 2008-04-11 11:07:51 $ + * @author Kay Ramme * @see com.sun.star.uno.UnoRuntime * @since UDK1.0 */ @@ -79,19 +79,31 @@ public class BridgeFactory implements XBridgeFactory/*, XEventListener*/ { * @param regKey the registryKey * @see com.sun.star.comp.loader.JavaLoader */ - public static XSingleServiceFactory __getServiceFactory(String implName, - XMultiServiceFactory multiFactory, + public static XSingleServiceFactory __getServiceFactory(String implName, + XMultiServiceFactory multiFactory, XRegistryKey regKey) { XSingleServiceFactory xSingleServiceFactory = null; if (implName.equals(BridgeFactory.class.getName()) ) xSingleServiceFactory = FactoryHelper.getServiceFactory(BridgeFactory.class, - multiFactory, + multiFactory, regKey); - + return xSingleServiceFactory; } + + /** + * Writes the service information into the given registry key. + * This method is called by the <code>JavaLoader</code> + * <p> + * @return returns true if the operation succeeded + * @param regKey the registryKey + * @see com.sun.star.comp.loader.JavaLoader + */ + public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) { + return FactoryHelper.writeRegistryServiceInfo(BridgeFactory.class.getName(), __serviceName, regKey); + } /** * Creates a remote bridge and memorizes it under <code>sName</code>. @@ -102,9 +114,9 @@ public class BridgeFactory implements XBridgeFactory/*, XEventListener*/ { * @param anInstanceProvider the instance provider * @see com.sun.star.bridge.XBridgeFactory */ - public XBridge createBridge(String sName, String sProtocol, XConnection aConnection, XInstanceProvider anInstanceProvider) throws - BridgeExistsException, - com.sun.star.lang.IllegalArgumentException, + public XBridge createBridge(String sName, String sProtocol, XConnection aConnection, XInstanceProvider anInstanceProvider) throws + BridgeExistsException, + com.sun.star.lang.IllegalArgumentException, com.sun.star.uno.RuntimeException { boolean hasName = sName.length() != 0; @@ -161,13 +173,13 @@ public class BridgeFactory implements XBridgeFactory/*, XEventListener*/ { if(xBridge != null) { if(xBridge.getName().equals(sName)) break; - + else xBridge = null; } } - + if(DEBUG) System.err.println("##### " + getClass().getName() + ".getBridge:" + sName + " " + xBridge); return xBridge; diff --git a/jurt/com/sun/star/comp/connections/Acceptor.java b/jurt/com/sun/star/comp/connections/Acceptor.java index 2dcfbc507d7b..2539bb528d25 100644 --- a/jurt/com/sun/star/comp/connections/Acceptor.java +++ b/jurt/com/sun/star/comp/connections/Acceptor.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -84,6 +84,21 @@ public final class Acceptor implements XAcceptor { } /** + * Writes the service information into the given registry key. + * + * <p>This method is called by the <code>JavaLoader</code>.</p> + * + * @param regKey the registry key. + * @return <code>true</code> if the operation succeeded. + * + * @see com.sun.star.comp.loader.JavaLoader + */ + public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) { + return FactoryHelper.writeRegistryServiceInfo(Acceptor.class.getName(), + __serviceName, regKey); + } + + /** * Constructs a new <code>Acceptor</code> that uses the given service * factory to create a specific <code>XAcceptor</code>. * diff --git a/jurt/com/sun/star/comp/connections/Connector.java b/jurt/com/sun/star/comp/connections/Connector.java index a9e0a2c5cc84..6f0f351e2893 100644 --- a/jurt/com/sun/star/comp/connections/Connector.java +++ b/jurt/com/sun/star/comp/connections/Connector.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -84,6 +84,21 @@ public class Connector implements XConnector { } /** + * Writes the service information into the given registry key. + * + * <p>This method is called by the <code>JavaLoader</code>.</p> + * + * @param regKey the registry key. + * @return <code>true</code> if the operation succeeded. + * + * @see com.sun.star.comp.loader.JavaLoader + */ + public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) { + return FactoryHelper.writeRegistryServiceInfo(Connector.class.getName(), + __serviceName, regKey); + } + + /** * Constructs a new <code>Connector</code> that uses the given service * factory to create a specific <code>XConnector</code>. * diff --git a/jurt/com/sun/star/comp/connections/ConstantInstanceProvider.java b/jurt/com/sun/star/comp/connections/ConstantInstanceProvider.java index b801cb36d8a5..d3e188f3f73d 100644 --- a/jurt/com/sun/star/comp/connections/ConstantInstanceProvider.java +++ b/jurt/com/sun/star/comp/connections/ConstantInstanceProvider.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -38,11 +38,11 @@ import com.sun.star.comp.loader.FactoryHelper; /** - * The <code>ConstantInstanceProvider</code> is a component + * The <code>ConstantInstanceProvider</code> is a component * that implements the <code>XInstanceProvider</code> Interface. * <p> - * @version $Revision: 1.3 $ $ $Date: 2008-04-11 11:08:55 $ - * @author Kay Ramme + * @version $Revision: 1.3 $ $ $Date: 2008-04-11 11:08:55 $ + * @author Kay Ramme * @see com.sun.star.bridge.XBridge * @see com.sun.star.bridge.XBridgeFactory * @see com.sun.star.bridge.XInstanceProvider @@ -70,8 +70,8 @@ public class ConstantInstanceProvider implements XInstanceProvider { * @param regKey the registryKey * @see com.sun.star.comp.loader.JavaLoader */ - public static XSingleServiceFactory __getServiceFactory(String implName, - XMultiServiceFactory multiFactory, + public static XSingleServiceFactory __getServiceFactory(String implName, + XMultiServiceFactory multiFactory, XRegistryKey regKey) { XSingleServiceFactory xSingleServiceFactory = null; @@ -79,11 +79,25 @@ public class ConstantInstanceProvider implements XInstanceProvider { if (implName.equals(ConstantInstanceProvider.class.getName()) ) xSingleServiceFactory = FactoryHelper.getServiceFactory(ConstantInstanceProvider.class, __serviceName, - multiFactory, + multiFactory, regKey); - + return xSingleServiceFactory; } + + /** + * Writes the service information into the given registry key. + * This method is called by the <code>JavaLoader</code> + * <p> + * @return returns true if the operation succeeded + * @param regKey the registryKey + * @see com.sun.star.comp.loader.JavaLoader + */ + public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) { + return FactoryHelper.writeRegistryServiceInfo(ConstantInstanceProvider.class.getName(), __serviceName, regKey); + } + + protected XMultiServiceFactory _serviceManager; protected String _serviceName; diff --git a/jurt/com/sun/star/comp/connections/Implementation.java b/jurt/com/sun/star/comp/connections/Implementation.java index 466ea9741766..05fe4c750928 100644 --- a/jurt/com/sun/star/comp/connections/Implementation.java +++ b/jurt/com/sun/star/comp/connections/Implementation.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite diff --git a/jurt/com/sun/star/comp/connections/PipedConnection.java b/jurt/com/sun/star/comp/connections/PipedConnection.java index f5a839ea78c5..ee772124e39e 100644 --- a/jurt/com/sun/star/comp/connections/PipedConnection.java +++ b/jurt/com/sun/star/comp/connections/PipedConnection.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -43,8 +43,8 @@ import com.sun.star.registry.XRegistryKey; * It is useful for <code>Thread</code> communication * in one Process. * <p> - * @version $Revision: 1.3 $ $ $Date: 2008-04-11 11:09:30 $ - * @author Kay Ramme + * @version $Revision: 1.3 $ $ $Date: 2008-04-11 11:09:30 $ + * @author Kay Ramme * @see com.sun.star.connections.XConnection * @see com.sun.star.loader.JavaLoader * @since UDK1.0 @@ -70,8 +70,8 @@ public class PipedConnection implements XConnection { * @param regKey the registryKey * @see com.sun.star.comp.loader.JavaLoader */ - public static XSingleServiceFactory __getServiceFactory(String implName, - XMultiServiceFactory multiFactory, + public static XSingleServiceFactory __getServiceFactory(String implName, + XMultiServiceFactory multiFactory, XRegistryKey regKey) { XSingleServiceFactory xSingleServiceFactory = null; @@ -79,11 +79,24 @@ public class PipedConnection implements XConnection { if (implName.equals(PipedConnection.class.getName()) ) xSingleServiceFactory = FactoryHelper.getServiceFactory(PipedConnection.class, __serviceName, - multiFactory, + multiFactory, regKey); - + return xSingleServiceFactory; } + + /** + * Writes the service information into the given registry key. + * This method is called by the <code>JavaLoader</code> + * <p> + * @return returns true if the operation succeeded + * @param regKey the registryKey + * @see com.sun.star.comp.loader.JavaLoader + */ + public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) { + return FactoryHelper.writeRegistryServiceInfo(PipedConnection.class.getName(), __serviceName, regKey); + } + /** * The amount of time in milliseconds, to wait to @@ -91,14 +104,14 @@ public class PipedConnection implements XConnection { */ protected static final int __waitTime = 10000; - protected byte _buffer[] = new byte[4096]; - protected int _in, + protected byte _buffer[] = new byte[4096]; + protected int _in, _out; - protected boolean _closed; + protected boolean _closed; protected PipedConnection _otherSide; /** - * Constructs a new <code>PipedConnection</code>, sees if there + * Constructs a new <code>PipedConnection</code>, sees if there * is an other side, which it should be connected to. * <p> * @param args Another side could be in index 0. @@ -108,7 +121,7 @@ public class PipedConnection implements XConnection { _otherSide = (args.length == 1) ? (PipedConnection)args[0] : null; if(_otherSide != null) { - if(_otherSide == this) + if(_otherSide == this) throw new RuntimeException("can not connect to myself"); _otherSide._otherSide = this; @@ -116,7 +129,7 @@ public class PipedConnection implements XConnection { } /** - * This is a private method, used to cummunicate + * This is a private method, used to cummunicate * internal in the pipe. */ private synchronized void receive(byte aData[]) throws com.sun.star.io.IOException { @@ -153,7 +166,7 @@ public class PipedConnection implements XConnection { else { bytes = Math.min(aData.length - bytesWritten, _buffer.length - _out - 1); } - + System.arraycopy(aData, bytesWritten, _buffer, _out, bytes); } @@ -249,7 +262,7 @@ public class PipedConnection implements XConnection { public synchronized void close() throws com.sun.star.io.IOException, com.sun.star.uno.RuntimeException { if(!_closed) { _closed = true; - + _otherSide.close(); notify(); diff --git a/jurt/com/sun/star/comp/loader/FactoryHelper.java b/jurt/com/sun/star/comp/loader/FactoryHelper.java index 29b484631670..4bd6ef595f21 100644 --- a/jurt/com/sun/star/comp/loader/FactoryHelper.java +++ b/jurt/com/sun/star/comp/loader/FactoryHelper.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -51,8 +51,8 @@ import com.sun.star.uno.Type; * This class has default implementations for <code>getServiceFactory</code> * and <code>writeRegistryServiceInfo</code>. * <p> - * @version $Revision: 1.9 $ $ $Date: 2008-04-11 11:10:09 $ - * @author Kay Ramme + * @version $Revision: 1.9 $ $ $Date: 2008-04-11 11:10:09 $ + * @author Kay Ramme * @see com.sun.star.lang.XMultiServiceFactory * @see com.sun.star.lang.XServiceInfo * @see com.sun.star.lang.XSingleServiceFactory @@ -80,19 +80,19 @@ public class FactoryHelper { // private static final boolean DEBUG = false; protected XMultiServiceFactory _xMultiServiceFactory; - protected XRegistryKey _xRegistryKey; + protected XRegistryKey _xRegistryKey; protected int _nCode; - protected Constructor _constructor; + protected Constructor _constructor; protected String _implName; protected String _serviceName; // keeps the Id for XTypeProvider protected static Object _mutex= new Object(); private static byte[] _implementationId; - protected Factory(Class implClass, - String serviceName, - XMultiServiceFactory xMultiServiceFactory, - XRegistryKey xRegistryKey) + protected Factory(Class implClass, + String serviceName, + XMultiServiceFactory xMultiServiceFactory, + XRegistryKey xRegistryKey) { _xMultiServiceFactory = xMultiServiceFactory; _xRegistryKey = xRegistryKey; @@ -109,7 +109,7 @@ public class FactoryHelper { && parameters[2].equals(__objectArray)) { _nCode = 0; _constructor = constructors[i]; - } + } else if(parameters.length == 2 && parameters[0].equals(XComponentContext.class) && parameters[1].equals(XRegistryKey.class)) { @@ -122,7 +122,7 @@ public class FactoryHelper { _nCode = 2; _constructor = constructors[i]; } - else if(parameters.length == 1 + else if(parameters.length == 1 && parameters[0].equals(XComponentContext.class)) { _nCode = 3; _constructor = constructors[i]; @@ -134,7 +134,7 @@ public class FactoryHelper { && parameters[2].equals(__objectArray)) { _nCode = 4; _constructor = constructors[i]; - } + } else if(parameters.length == 2 && parameters[0].equals(XMultiServiceFactory.class) && parameters[1].equals(XRegistryKey.class)) { @@ -147,7 +147,7 @@ public class FactoryHelper { _nCode = 6; _constructor = constructors[i]; } - else if(parameters.length == 1 + else if(parameters.length == 1 && parameters[0].equals(XMultiServiceFactory.class)) { _nCode = 7; _constructor = constructors[i]; @@ -179,7 +179,7 @@ public class FactoryHelper { return _xMultiServiceFactory; } } - + // XComponentContext impl //______________________________________________________________________________________________ public Object createInstanceWithContext( @@ -220,7 +220,7 @@ public class FactoryHelper { args = new Object [ 0 ]; break; } - + try { return _constructor.newInstance( args ); @@ -228,7 +228,7 @@ public class FactoryHelper { catch (InvocationTargetException invocationTargetException) { Throwable targetException = invocationTargetException.getTargetException(); - + if (targetException instanceof java.lang.RuntimeException) throw (java.lang.RuntimeException)targetException; else if (targetException instanceof com.sun.star.uno.Exception) @@ -293,7 +293,7 @@ public class FactoryHelper { args = new Object [ 0 ]; break; } - + try { Object instance = _constructor.newInstance( args ); @@ -311,7 +311,7 @@ public class FactoryHelper { catch (InvocationTargetException invocationTargetException) { Throwable targetException = invocationTargetException.getTargetException(); - + if (targetException instanceof java.lang.RuntimeException) throw (java.lang.RuntimeException)targetException; else if (targetException instanceof com.sun.star.uno.Exception) @@ -330,15 +330,15 @@ public class FactoryHelper { throw new com.sun.star.uno.Exception( instantiationException.toString() ); } } - + /** * Creates an instance of the desired service. * <p> * @return returns an instance of the desired service * @see com.sun.star.lang.XSingleServiceFactory */ - public Object createInstance() - throws com.sun.star.uno.Exception, + public Object createInstance() + throws com.sun.star.uno.Exception, com.sun.star.uno.RuntimeException { return createInstanceWithContext( null ); @@ -348,16 +348,16 @@ public class FactoryHelper { * Creates an instance of the desired service. * <p> * @return returns an instance of the desired service - * @param args the args given to the constructor of the service + * @param args the args given to the constructor of the service * @see com.sun.star.lang.XSingleServiceFactory */ - public Object createInstanceWithArguments(Object[] args) - throws com.sun.star.uno.Exception, - com.sun.star.uno.RuntimeException + public Object createInstanceWithArguments(Object[] args) + throws com.sun.star.uno.Exception, + com.sun.star.uno.RuntimeException { return createInstanceWithArgumentsAndContext( args, null ); } - + /** * Gives the supported services * <p> @@ -394,7 +394,7 @@ public class FactoryHelper { return found; } - + //XTypeProvider public byte[] getImplementationId() { @@ -416,7 +416,7 @@ public class FactoryHelper { for (int i= 0; i < nNameLength; i++) { _implementationId[4 + i]= arName[i]; - } + } } } return _implementationId; @@ -432,7 +432,7 @@ public class FactoryHelper { }; return t; } - + } /** @@ -441,13 +441,13 @@ public class FactoryHelper { * @deprecated as of UDK 1.0 * <p> * @return returns a factory - * @param implClass the implementing class + * @param implClass the implementing class * @param multiFactory the given multi service factory (service manager) * @param regKey the given registry key * @see com.sun.star.lang.XServiceInfo */ - static public XSingleServiceFactory getServiceFactory(Class implClass, - XMultiServiceFactory multiFactory, + static public XSingleServiceFactory getServiceFactory(Class implClass, + XMultiServiceFactory multiFactory, XRegistryKey regKey) { XSingleServiceFactory xSingleServiceFactory = null; @@ -461,7 +461,7 @@ public class FactoryHelper { catch(NoSuchFieldException noSuchFieldExceptio) { serviceName = implClass.getField("serviceName"); // old style } - + xSingleServiceFactory = new Factory(implClass, (String)serviceName.get(null), multiFactory, regKey); } catch(NoSuchFieldException noSuchFieldException) { @@ -470,67 +470,67 @@ public class FactoryHelper { catch(IllegalAccessException illegalAccessException) { System.err.println("##### FactoryHelper.getServiceFactory - exception:" + illegalAccessException); } - + return xSingleServiceFactory; } - + /** * Creates a factory for the given class. * <p> * @return returns a factory - * @param implClass the implementing class + * @param implClass the implementing class * @param serviceName the service name of the implementing class * @param multiFactory the given multi service factory (service manager) * @param regKey the given registry key * @see com.sun.star.lang.XServiceInfo */ - static public XSingleServiceFactory getServiceFactory(Class implClass, + static public XSingleServiceFactory getServiceFactory(Class implClass, String serviceName, - XMultiServiceFactory multiFactory, + XMultiServiceFactory multiFactory, XRegistryKey regKey) { return new Factory(implClass, serviceName, multiFactory, regKey); } - + /** Creates a factory for the given class. - + @return returns a factory object - @param implClass the implementing class + @param implClass the implementing class */ static public Object createComponentFactory( Class implClass, String serviceName ) { return new Factory( implClass, serviceName, null, null ); } - + /** * Writes the registration data into the registry key * <p> * @return success - * @param implName the name of the implementing class + * @param implName the name of the implementing class * @param serviceName the service name * @param regKey the given registry key * @see com.sun.star.lang.XServiceInfo */ static public boolean writeRegistryServiceInfo(String implName, String serviceName, XRegistryKey regKey) { boolean result = false; - + try { XRegistryKey newKey = regKey.createKey("/" + implName + "/UNO/SERVICES"); - + newKey.createKey(serviceName); - + result = true; } catch (Exception ex) { System.err.println(">>>Connection_Impl.writeRegistryServiceInfo " + ex); } - + return result; } /** Writes the registration data into the registry key. * Several services are supported. - * + * * @param impl_name name of implementation * @param supported_services supported services of implementation * @param xKey registry key to write to diff --git a/jurt/com/sun/star/comp/loader/JavaLoader.java b/jurt/com/sun/star/comp/loader/JavaLoader.java index 47723b208497..2fec17bfe6d4 100644 --- a/jurt/com/sun/star/comp/loader/JavaLoader.java +++ b/jurt/com/sun/star/comp/loader/JavaLoader.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -62,30 +62,30 @@ import com.sun.star.uno.AnyConverter; * service. Therefor the <code>JavaLoader</code> activates external UNO components which are implemented in Java. * The loader is used by the <code>ServiceManger</code>. * <p> - * @version $Revision: 1.16 $ $ $Date: 2008-04-11 11:10:31 $ - * @author Markus Herzog + * @version $Revision: 1.16 $ $ $Date: 2008-04-11 11:10:31 $ + * @author Markus Herzog * @see com.sun.star.loader.XImplementationLoader * @see com.sun.star.loader.Java * @see com.sun.star.comp.servicemanager.ServiceManager - * @see com.sun.star.lang.ServiceManager + * @see com.sun.star.lang.ServiceManager * @since UDK1.0 - */ -public class JavaLoader implements XImplementationLoader, + */ +public class JavaLoader implements XImplementationLoader, XServiceInfo, XInitialization { private static final boolean DEBUG = false; - + private static final void DEBUG(String dbg) { if (DEBUG) System.err.println( dbg ); } - + private static String[] supportedServices = { "com.sun.star.loader.Java" }; - + protected XMultiServiceFactory multiServiceFactory = null; - + private XMacroExpander m_xMacroExpander = null; private static final String EXPAND_PROTOCOL_PREFIX = "vnd.sun.star.expand:"; @@ -146,51 +146,51 @@ public class JavaLoader implements XImplementationLoader, } return url; } - + /** default constructor */ - + /** * Creates a new instance of the <code>JavaLoader</code> class. * <p> - * @return new instance + * @return new instance */ public JavaLoader() {} - + /** * Creates a new <code>JavaLoader</code> object. The specified <code>com.sun.star.lang.XMultiServiceFactory</code> * is the <code>ServiceManager</code> service which can be deliviert to all components the <code>JavaLoader</code> is - * loading. + * loading. * To set the <code>MultiServiceFactory</code> you can use the <code>com.sun.star.lang.XInitialization</code> interface, either. * <p> - * @return new instance - * @param factory the <code>ServiceManager</code> - * @see com.sun.star.lang.ServiceManager - * @see com.sun.star.lang.ServiceManager - * @see com.sun.star.lang.XInitialization + * @return new instance + * @param factory the <code>ServiceManager</code> + * @see com.sun.star.lang.ServiceManager + * @see com.sun.star.lang.ServiceManager + * @see com.sun.star.lang.XInitialization */ public JavaLoader(XMultiServiceFactory factory) { multiServiceFactory = factory; } /** - * Unlike the original intention, the method could be called every time a new + * Unlike the original intention, the method could be called every time a new * <code>com.sun.star.lang.XMultiServiceFactory</code> should be set at the loader. * <p> - * @param args - the first parameter (args[0]) specifices the <code>ServiceManager</code> - * @see com.sun.star.lang.XInitialization - * @see com.sun.star.lang.ServiceManager + * @param args - the first parameter (args[0]) specifices the <code>ServiceManager</code> + * @see com.sun.star.lang.XInitialization + * @see com.sun.star.lang.ServiceManager */ - public void initialize( java.lang.Object[] args ) - throws com.sun.star.uno.Exception, + public void initialize( java.lang.Object[] args ) + throws com.sun.star.uno.Exception, com.sun.star.uno.RuntimeException - { + { if (args.length == 0) throw new com.sun.star.lang.IllegalArgumentException("No arguments specified"); - + try { multiServiceFactory = (XMultiServiceFactory) AnyConverter.toObject( new Type(XMultiServiceFactory.class), args[0]); - } + } catch (ClassCastException castEx) { throw new com.sun.star.lang.IllegalArgumentException( "The argument must be an instance of XMultiServiceFactory"); @@ -201,23 +201,23 @@ public class JavaLoader implements XImplementationLoader, * Supplies the implementation name of the component. * <p> * @return the implementation name - here the class name - * @see com.sun.star.lang.XServiceInfo + * @see com.sun.star.lang.XServiceInfo */ - public String getImplementationName() - throws com.sun.star.uno.RuntimeException + public String getImplementationName() + throws com.sun.star.uno.RuntimeException { return getClass().getName(); } - + /** * Verifies if a given service is supported by the component. * <p> - * @return true,if service is suported - otherwise false - * @param serviceName the name of the service that should be checked - * @see com.sun.star.lang.XServiceInfo + * @return true,if service is suported - otherwise false + * @param serviceName the name of the service that should be checked + * @see com.sun.star.lang.XServiceInfo */ - public boolean supportsService(String serviceName) - throws com.sun.star.uno.RuntimeException + public boolean supportsService(String serviceName) + throws com.sun.star.uno.RuntimeException { for ( int i = 0; i < supportedServices.length; i++ ) { if ( supportedServices[i].equals(serviceName) ) @@ -225,50 +225,50 @@ public class JavaLoader implements XImplementationLoader, } return false; } - + /** * Supplies a list of all service names supported by the component * <p> - * @return a String array with all supported services - * @see com.sun.star.lang.XServiceInfo + * @return a String array with all supported services + * @see com.sun.star.lang.XServiceInfo */ - public String[] getSupportedServiceNames() - throws com.sun.star.uno.RuntimeException + public String[] getSupportedServiceNames() + throws com.sun.star.uno.RuntimeException { return supportedServices; } - + /** * Provides a components factory. - * The <code>JavaLoader</code> tries to load the class first. If a loacation URL is given the + * The <code>JavaLoader</code> tries to load the class first. If a loacation URL is given the * RegistrationClassFinder is used to load the class. Otherwise the class is loaded thru the Class.forName * method. - * To get the factory the inspects the class for the optional static member functions __getServiceFactory resp. + * To get the factory the inspects the class for the optional static member functions __getServiceFactory resp. * getServiceFactory (DEPRECATED). * If the function can not be found a default factory @see ComponentFactoryWrapper will be created. * <p> - * @return the factory for the component (@see com.sun.star.lang.XSingleServiceFactory) - * @param implementationName the implementation (class) name of the component - * @param implementationLoaderUrl the URL of the implementation loader. Not used. - * @param locationUrl points to an archive (JAR file) which contains a component - * @param xKey - * @see com.sun.star.lang.XImplementationLoader - * @see com.sun.star.com.loader.RegistrationClassFinder + * @return the factory for the component (@see com.sun.star.lang.XSingleServiceFactory) + * @param implementationName the implementation (class) name of the component + * @param implementationLoaderUrl the URL of the implementation loader. Not used. + * @param locationUrl points to an archive (JAR file) which contains a component + * @param xKey + * @see com.sun.star.lang.XImplementationLoader + * @see com.sun.star.com.loader.RegistrationClassFinder */ - public java.lang.Object activate( String implementationName, - String implementationLoaderUrl, - String locationUrl, - XRegistryKey xKey ) - throws CannotActivateFactoryException, - com.sun.star.uno.RuntimeException + public java.lang.Object activate( String implementationName, + String implementationLoaderUrl, + String locationUrl, + XRegistryKey xKey ) + throws CannotActivateFactoryException, + com.sun.star.uno.RuntimeException { locationUrl = expand_url( locationUrl ); - + Object returnObject = null; Class clazz = null; - + DEBUG("try to get factory for " + implementationName); - + // first we must get the class of the implementation // 1. If a location URL is given it is assumed that this points to a JAR file. // The components class name is stored in the manifest file. @@ -283,7 +283,7 @@ public class JavaLoader implements XImplementationLoader, else { // 2. clazz = Class.forName( implementationName ); - } + } } catch (java.net.MalformedURLException e) { CannotActivateFactoryException cae = new CannotActivateFactoryException( @@ -312,10 +312,10 @@ public class JavaLoader implements XImplementationLoader, cae.fillInStackTrace(); throw cae; } - - Class[] paramTypes = {String.class, XMultiServiceFactory.class, XRegistryKey.class}; + + Class[] paramTypes = {String.class, XMultiServiceFactory.class, XRegistryKey.class}; Object[] params = { implementationName, multiServiceFactory, xKey }; - + // try to get factory from implemetation class // latest style: use the public static method __getComponentFactory // - new style: use the public static method __getServiceFactory @@ -327,23 +327,23 @@ public class JavaLoader implements XImplementationLoader, compfac_method = clazz.getMethod( "__getComponentFactory", new Class [] { String.class } ); } - catch ( NoSuchMethodException noSuchMethodEx) {} + catch ( NoSuchMethodException noSuchMethodEx) {} catch ( SecurityException secEx) {} - + Method method = null; if (null == compfac_method) { try { method = clazz.getMethod("__getServiceFactory", paramTypes); - } + } catch ( NoSuchMethodException noSuchMethodEx) { method = null; - } + } catch ( SecurityException secEx) { method = null; } } - + try { if (null != compfac_method) { @@ -360,35 +360,35 @@ public class JavaLoader implements XImplementationLoader, if ( method == null ) { method = clazz.getMethod("getServiceFactory", paramTypes); } - + Object oRet = method.invoke(clazz, params); - + if ( (oRet != null) && (oRet instanceof XSingleServiceFactory) ) { - returnObject = (XSingleServiceFactory) oRet; + returnObject = (XSingleServiceFactory) oRet; } } } catch ( NoSuchMethodException e) { - throw new CannotActivateFactoryException("Can not activate the factory for " + throw new CannotActivateFactoryException("Can not activate the factory for " + implementationName + " because " + e.toString() ); - } + } catch ( SecurityException e) { - throw new CannotActivateFactoryException("Can not activate the factory for " + throw new CannotActivateFactoryException("Can not activate the factory for " + implementationName + " because " + e.toString() ); } catch ( IllegalAccessException e ) { - throw new CannotActivateFactoryException("Can not activate the factory for " + throw new CannotActivateFactoryException("Can not activate the factory for " + implementationName + " because " + e.toString() ); } catch ( IllegalArgumentException e ) { - throw new CannotActivateFactoryException("Can not activate the factory for " + throw new CannotActivateFactoryException("Can not activate the factory for " + implementationName + " because " + e.toString() ); } catch ( InvocationTargetException e ) { - throw new CannotActivateFactoryException("Can not activate the factory for " + throw new CannotActivateFactoryException("Can not activate the factory for " + implementationName + " because " + e.getTargetException().toString() ); } - + return returnObject; } @@ -397,24 +397,24 @@ public class JavaLoader implements XImplementationLoader, * methods __writeRegistryServiceInfo, writeRegistryServiceInfo (DEPRECATED), the call is delegated to that * method. Otherwise a default registration will be accomplished. * <p> - * @return true if registration is successfully - otherwise false - * @param regKey the root key under that the component should be registred. - * @param implementationLoaderUrl specifies the loader, the component is loaded by. - * @param locationUrl points to an archive (JAR file) which contains a component - * @see ComponentFactoryWrapper + * @return true if registration is successfully - otherwise false + * @param regKey the root key under that the component should be registred. + * @param implementationLoaderUrl specifies the loader, the component is loaded by. + * @param locationUrl points to an archive (JAR file) which contains a component + * @see ComponentFactoryWrapper */ - public boolean writeRegistryInfo( XRegistryKey regKey, - String implementationLoaderUrl, + public boolean writeRegistryInfo( XRegistryKey regKey, + String implementationLoaderUrl, String locationUrl ) - throws CannotRegisterImplementationException, + throws CannotRegisterImplementationException, com.sun.star.uno.RuntimeException { locationUrl = expand_url( locationUrl ); - - boolean success = false; - + + boolean success = false; + try { - + Class clazz = RegistrationClassFinder.find(locationUrl); if (null == clazz) { @@ -426,57 +426,57 @@ public class JavaLoader implements XImplementationLoader, Object[] params = { regKey }; Method method = clazz.getMethod("__writeRegistryServiceInfo", paramTypes); - Object oRet = method.invoke(clazz, params); + Object oRet = method.invoke(clazz, params); if ( (oRet != null) && (oRet instanceof Boolean) ) success = ((Boolean) oRet).booleanValue(); - } + } catch (Exception e) { throw new CannotRegisterImplementationException( e.getMessage()); } - + return success; } - + /** * Supplies the factory for the <code>JavaLoader</code> * <p> - * @return the factory for the <code>JavaLoader</code> - * @param implName the name of the desired component - * @param multiFactory the <code>ServiceManager</code> is delivered to the factory - * @param regKey not used - can be null + * @return the factory for the <code>JavaLoader</code> + * @param implName the name of the desired component + * @param multiFactory the <code>ServiceManager</code> is delivered to the factory + * @param regKey not used - can be null */ - public static XSingleServiceFactory getServiceFactory( String implName, - XMultiServiceFactory multiFactory, + public static XSingleServiceFactory getServiceFactory( String implName, + XMultiServiceFactory multiFactory, XRegistryKey regKey) - { + { if ( implName.equals(JavaLoader.class.getName()) ) return new JavaLoaderFactory( multiFactory ); - + return null; } - + /** * Registers the <code>JavaLoader</code> at the registry. * <p> * @return true if registration succseeded - otherwise false - * @param regKey root key under which the <code>JavaLoader</code> should be regidstered + * @param regKey root key under which the <code>JavaLoader</code> should be regidstered */ public static boolean writeRegistryServiceInfo(XRegistryKey regKey) { boolean result = false; - + try { XRegistryKey newKey = regKey.createKey("/" + JavaLoader.class.getName() + "/UNO/SERVICE"); - + for (int i=0; i<supportedServices.length; i++) newKey.createKey(supportedServices[i]); - + result = true; } catch (Exception ex) { if (DEBUG) System.err.println(">>>JavaLoader.writeRegistryServiceInfo " + ex); } - + return result; } } diff --git a/jurt/com/sun/star/comp/loader/JavaLoaderFactory.java b/jurt/com/sun/star/comp/loader/JavaLoaderFactory.java index 22981f2081e3..f3f6de9e6637 100644 --- a/jurt/com/sun/star/comp/loader/JavaLoaderFactory.java +++ b/jurt/com/sun/star/comp/loader/JavaLoaderFactory.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -40,51 +40,51 @@ public class JavaLoaderFactory implements XSingleServiceFactory, XServiceInfo { }; private static final boolean DEBUG = false; - + private static final void DEBUG(String dbg) { if (DEBUG) System.err.println(" >>> JavaLoaderFactory - " + dbg); } - + protected XMultiServiceFactory multiServiceFactory = null; - + /** default constructor */ -// public JavaLoaderFactory() {} - +// public JavaLoaderFactory() {} + public JavaLoaderFactory(XMultiServiceFactory factory) { multiServiceFactory = factory; } - - public java.lang.Object createInstance() - throws com.sun.star.uno.Exception, + + public java.lang.Object createInstance() + throws com.sun.star.uno.Exception, com.sun.star.uno.RuntimeException { return new JavaLoader(multiServiceFactory); } - public java.lang.Object createInstanceWithArguments( java.lang.Object[] args ) - throws com.sun.star.uno.Exception, + public java.lang.Object createInstanceWithArguments( java.lang.Object[] args ) + throws com.sun.star.uno.Exception, com.sun.star.uno.RuntimeException { JavaLoader loader = new JavaLoader(); loader.initialize(args); - + return loader; } - + /** implements the XServiceInfo interface */ - public String getImplementationName() - throws com.sun.star.uno.RuntimeException + public String getImplementationName() + throws com.sun.star.uno.RuntimeException { return JavaLoader.class.getName(); } - + /** implements the XServiceInfo interface */ - public boolean supportsService(String serviceName) - throws com.sun.star.uno.RuntimeException + public boolean supportsService(String serviceName) + throws com.sun.star.uno.RuntimeException { for ( int i = 0; i < supportedServices.length; i++ ) { if ( supportedServices[i].equals(serviceName) ) @@ -92,11 +92,11 @@ public class JavaLoaderFactory implements XSingleServiceFactory, XServiceInfo { } return false; } - + /** implements the XServiceInfo interface */ - public String[] getSupportedServiceNames() - throws com.sun.star.uno.RuntimeException + public String[] getSupportedServiceNames() + throws com.sun.star.uno.RuntimeException { return supportedServices; } diff --git a/jurt/com/sun/star/comp/loader/RegistrationClassFinder.java b/jurt/com/sun/star/comp/loader/RegistrationClassFinder.java index 3a40daab866b..e3c3190e9139 100644 --- a/jurt/com/sun/star/comp/loader/RegistrationClassFinder.java +++ b/jurt/com/sun/star/comp/loader/RegistrationClassFinder.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite diff --git a/jurt/com/sun/star/comp/servicemanager/ServiceManager.java b/jurt/com/sun/star/comp/servicemanager/ServiceManager.java index 6914ee5228e0..cb60885443e0 100644 --- a/jurt/com/sun/star/comp/servicemanager/ServiceManager.java +++ b/jurt/com/sun/star/comp/servicemanager/ServiceManager.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -58,8 +58,8 @@ import java.lang.reflect.InvocationTargetException; * calls to the implementing objects and are used instead of casts * and identity comparisons. * <p> - * @version $Revision: 1.10 $ $ $Date: 2008-04-11 11:11:46 $ - * @author Markus Herzog + * @version $Revision: 1.10 $ $ $Date: 2008-04-11 11:11:46 $ + * @author Markus Herzog * @see com.sun.star.lang.XMultiServiceFactory * @see com.sun.star.container.XSet * @see com.sun.star.container.XContentEnumerationAccess @@ -67,21 +67,21 @@ import java.lang.reflect.InvocationTargetException; * @see com.sun.star.lang.XServiceInfo * @see com.sun.star.lang.XInitialization * @since UDK1.0 - */ + */ public class ServiceManager implements XMultiServiceFactory, - XMultiComponentFactory, - XSet, - XContentEnumerationAccess, - XComponent, + XMultiComponentFactory, + XSet, + XContentEnumerationAccess, + XComponent, XServiceInfo, XInitialization { private static final boolean DEBUG = false; - + private static final void DEBUG (String dbg) { if (DEBUG) System.err.println( dbg ); } - + private static com.sun.star.uno.Type UNO_TYPE = null; XImplementationLoader loader = null; @@ -93,10 +93,10 @@ public class ServiceManager implements XMultiServiceFactory, java.util.Vector eventListener; java.util.Hashtable factoriesByImplNames; - java.util.Hashtable factoriesByServiceNames; // keys: - + java.util.Hashtable factoriesByServiceNames; // keys: + private com.sun.star.uno.XComponentContext m_xDefaultContext; - + /** * Creates a new instance of the <code>ServiceManager</code>. */ @@ -115,77 +115,77 @@ public class ServiceManager implements XMultiServiceFactory, factoriesByServiceNames = new java.util.Hashtable(); m_xDefaultContext = xContext; } - + /** - * Returns the service factory for the <code>ServiceManager</code>. If the given implementation name + * Returns the service factory for the <code>ServiceManager</code>. If the given implementation name * does not equal to the <code>ServiceManagers</code> class name null will be returned. * <p> * @return the factory for the <code>ServiceManager</code>. - * @param implName the implementation name of the of the service. + * @param implName the implementation name of the of the service. * Must be equal to <code>com.sun.star.comp.servicemanager.ServicManager</code> - * @param multiFactory refernce of the <code>MultiServiceFactory</code>. This parameter will be ignored. - * @param regKey the root key of the registry. This parameter will be ignored. + * @param multiFactory refernce of the <code>MultiServiceFactory</code>. This parameter will be ignored. + * @param regKey the root key of the registry. This parameter will be ignored. */ - public static XSingleServiceFactory getServiceFactory( String implName, - XMultiServiceFactory multiFactory, + public static XSingleServiceFactory getServiceFactory( String implName, + XMultiServiceFactory multiFactory, XRegistryKey regKey) - { + { if ( implName.equals(ServiceManager.class.getName()) ) return new ServiceManagerFactory(); - + return null; } - + /** * Supplies a Java component loader. The loader component must be enlisted at the <code>ServiceManager</code> before. * <p> - * @return a new instance of the Java component loader - * @see com.sun.star.loader.Java - */ - private XImplementationLoader getLoader() - throws com.sun.star.uno.Exception, + * @return a new instance of the Java component loader + * @see com.sun.star.loader.Java + */ + private XImplementationLoader getLoader() + throws com.sun.star.uno.Exception, com.sun.star.uno.RuntimeException { - Object[] param = { this }; - DEBUG("make loader"); + Object[] param = { this }; + DEBUG("make loader"); Object loaderObj = createInstanceWithArgumentsAndContext( "com.sun.star.loader.Java", param, m_xDefaultContext ); - + if (loaderObj == null) throw new com.sun.star.uno.Exception("Can get an instance of com.sun.star.loader.Java"); - + return UnoRuntime.queryInterface( XImplementationLoader.class, loaderObj ); } /** * Registers a list of components given by their class names. - * <p> - * @param newImpls list of the components that should be registered, given by their class names. - * If any exception occurred during the registration, the process will be canceled. - * @see com.sun.star.container.XSet + * <p> + * @param newImpls list of the components that should be registered, given by their class names. + * If any exception occured during the registration, the process will be canceled. + * @see com.sun.star.container.XSet */ - private void xaddFactories( String[] newImpls ) + private void xaddFactories( String[] newImpls ) throws com.sun.star.uno.Exception { - for (int i=0; i<newImpls.length; i++) { + for (int i=0; i<newImpls.length; i++) { DEBUG ("try to add " + newImpls[i] ); Object newFactory = null; - + try { if (loader == null) loader = getLoader(); - + newFactory = loader.activate( newImpls[i], null, null, null ); - } + } catch (com.sun.star.uno.Exception e) { - + //****************************** BEGIN DEPRECATED ****************************************** - + try { // try to get the class of the implementation Class clazz = Class.forName( newImpls[i] ); - + Class[] methodClassParam = { String.class, XMultiServiceFactory.class, XRegistryKey.class }; java.lang.reflect.Method getFactoryMeth = null; try { @@ -197,12 +197,12 @@ public class ServiceManager implements XMultiServiceFactory, catch (SecurityException securityExc) { getFactoryMeth = null; } - + if (getFactoryMeth == null) getFactoryMeth = clazz.getMethod("getServiceFactory", methodClassParam); - - Object[] methodParams = { newImpls[i], this, null }; - newFactory = getFactoryMeth.invoke( clazz, methodParams ); + + Object[] methodParams = { newImpls[i], this, null }; + newFactory = getFactoryMeth.invoke( clazz, methodParams ); } catch (NoSuchMethodException ex) {} catch (SecurityException ex) {} @@ -210,13 +210,13 @@ public class ServiceManager implements XMultiServiceFactory, catch (IllegalAccessException ex) {} catch (IllegalArgumentException ex) {} catch (InvocationTargetException ex) {} - + //****************************** END DEPRECATED ****************************************** } - + if ( newFactory == null ) throw new com.sun.star.loader.CannotActivateFactoryException("Can not get factory for " + newImpls[i]); - + insert( newFactory ); } // end of for ... } @@ -225,13 +225,13 @@ public class ServiceManager implements XMultiServiceFactory, * The method is used to add components to the <code>ServiceManager</code>. The first argument indicates a <code>SimpleRegistry</code>. * The components which should be added will be searched under the <i>Implementations</i> key in the registry. * <p> - * @param args the first argument ( args[0] ) specifices the SimpleRegistry object - * @see com.sun.star.lang.XInitialization - * @see com.sun.star.lang.RegistryServiceManager - * @see com.sun.star.lang.XSimpleRegistry + * @param args the first argument ( args[0] ) specifices the SimpleRegistry object + * @see com.sun.star.lang.XInitialization + * @see com.sun.star.lang.RegistryServiceManager + * @see com.sun.star.lang.XSimpleRegistry */ - public void initialize( Object args[] ) - throws com.sun.star.uno.Exception, + public void initialize( Object args[] ) + throws com.sun.star.uno.Exception, com.sun.star.uno.RuntimeException { XSimpleRegistry xSimpleRegistry = null; try { @@ -239,17 +239,17 @@ public class ServiceManager implements XMultiServiceFactory, if (xSimpleRegistry != null) { XRegistryKey rootkey = xSimpleRegistry.getRootKey(); - + XRegistryKey implkey_xRegistryKey = rootkey.openKey("Implementations"); if(implkey_xRegistryKey != null) { XRegistryKey xRegistryKeys[] = implkey_xRegistryKey.openKeys(); - + for(int i = 0; i < xRegistryKeys.length; ++ i) { xaddFactories(new String[]{xRegistryKeys[i].getStringValue()}); } } } - + if (args.length > 1) { m_xDefaultContext = (XComponentContext)args[ 1 ]; @@ -260,29 +260,29 @@ public class ServiceManager implements XMultiServiceFactory, throw new com.sun.star.lang.IllegalArgumentException("Argument must not be null."); } } - + /** - * Creates a new instance of a specified service. Therefor the associated factory of the service is + * Creates a new instance of a specified service. Therefor the associated factory of the service is * looked up and used to instanciate a new component. * <p> - * @return newly created component - * @param serviceSpecifier indicates the service or component name - * @see com.sun.star.lang.XMultiServiceFactory + * @return newly created component + * @param serviceSpecifier indicates the service or component name + * @see com.sun.star.lang.XMultiServiceFactory */ - public java.lang.Object createInstance( String serviceSpecifier ) - throws com.sun.star.uno.Exception, + public java.lang.Object createInstance( String serviceSpecifier ) + throws com.sun.star.uno.Exception, com.sun.star.uno.RuntimeException { return createInstanceWithContext( serviceSpecifier, m_xDefaultContext ); } - + /** - * Creates a new instance of a specified service with the given parameters. + * Creates a new instance of a specified service with the given parameters. * Therefor the associated factory of the service is looked up and used to instanciate a new component. * <p> - * @return newly created component - * @param serviceSpecifier indicates the service or component name - * @see com.sun.star.lang.XMultiServiceFactory + * @return newly created component + * @param serviceSpecifier indicates the service or component name + * @see com.sun.star.lang.XMultiServiceFactory */ public java.lang.Object createInstanceWithArguments( String serviceSpecifier, Object[] args ) @@ -290,52 +290,52 @@ public class ServiceManager implements XMultiServiceFactory, { if (DEBUG) { System.err.println("createInstanceWithArguments:" ); - + for (int i=0; i<args.length; i++) System.err.print(" "+ args[i]); - + System.err.println(); } - + return createInstanceWithArgumentsAndContext( serviceSpecifier, args, m_xDefaultContext ); } - + /** * Look up the factory for a given service or implementation name. * First the requested service name is search in the list of avaible services. If it can not be found - * the name is looked up in the the implementation list. + * the name is looked up in the the implementation list. * <p> - * @return the factory of the service / implementation - * @param serviceSpecifier indicates the service or implementation name - * @see com.sun.star.lang.XMultiServiceFactory + * @return the factory of the service / implementation + * @param serviceSpecifier indicates the service or implementation name + * @see com.sun.star.lang.XMultiServiceFactory */ private Object queryServiceFactory(String serviceName) - throws com.sun.star.uno.Exception, + throws com.sun.star.uno.Exception, com.sun.star.uno.RuntimeException { DEBUG("queryServiceFactory for name " + serviceName ); Object factory = null; - + if ( factoriesByServiceNames.containsKey( serviceName ) ) { java.util.Vector aviableFact = (java.util.Vector) factoriesByServiceNames.get( serviceName ); - + DEBUG(""); DEBUG("aviable factories for " + serviceName +" "+ aviableFact); DEBUG(""); - + if ( !aviableFact.isEmpty() ) factory = aviableFact.lastElement(); - + } else // not found in list of services - now try the implementations factory = factoriesByImplNames.get( serviceName ); // return null if none is aviable - + if (DEBUG) { if (factory == null) System.err.println("service not registered"); else System.err.println("service found:" + factory + " " + UnoRuntime.queryInterface(XSingleServiceFactory.class, factory)); } - - if (factory == null) + + if (factory == null) throw new com.sun.star.uno.Exception("Query for service factory for " + serviceName + " failed."); return factory; @@ -344,20 +344,20 @@ public class ServiceManager implements XMultiServiceFactory, /** * Supplies a list of all avialable services names. * <p> - * @return list of Strings of all service names - * @see com.sun.star.container.XContentEnumerationAccess - */ - public String[] getAvailableServiceNames() - throws com.sun.star.uno.RuntimeException + * @return list of Strings of all service names + * @see com.sun.star.container.XContentEnumerationAccess + */ + public String[] getAvailableServiceNames() + throws com.sun.star.uno.RuntimeException { int i = 0; String[] availableServiceNames = new String[factoriesByServiceNames.size()]; - + java.util.Enumeration keys = factoriesByServiceNames.keys(); - + while (keys.hasMoreElements()) availableServiceNames[i++] = (String) keys.nextElement(); - + return availableServiceNames; } @@ -446,47 +446,47 @@ public class ServiceManager implements XMultiServiceFactory, return null; } // public String[] getAvailableServiceNames(); - + /** * Removes all listeners from the <code>ServiceManager</code> and clears the list of the services. * <p> - * @see com.sun.star.lang.XComponent + * @see com.sun.star.lang.XComponent */ - public void dispose() + public void dispose() throws com.sun.star.uno.RuntimeException { if (eventListener != null) { java.util.Enumeration enumer = eventListener.elements(); - + while (enumer.hasMoreElements()) { XEventListener listener = (XEventListener) enumer.nextElement(); listener.disposing(new com.sun.star.lang.EventObject(this)); } } - + eventListener.removeAllElements(); - factoriesByServiceNames.clear(); + factoriesByServiceNames.clear(); factoriesByImplNames.clear(); } /** - * Adds a new <code>EventListener</code>. The listener is notified when a - * service is added (removed) to (from) the <code>ServiceManager</code>. - * If the listener is already registred a + * Adds a new <code>EventListener</code>. The listener is notified when a + * service is added (removed) to (from) the <code>ServiceManager</code>. + * If the listener is already registred a * <code>com.sun.star.uno.RuntimeException</code> will be thrown. * <p> - * @param xListener the new listener which should been added. - * @see com.sun.star.lang.XComponent + * @param xListener the new listener which should been added. + * @see com.sun.star.lang.XComponent */ - public void addEventListener( XEventListener xListener ) + public void addEventListener( XEventListener xListener ) throws com.sun.star.uno.RuntimeException { if (xListener == null) throw new com.sun.star.uno.RuntimeException("Listener must not be null"); - + if ( eventListener.contains(xListener) ) - throw new com.sun.star.uno.RuntimeException("Listener already registred."); - + throw new com.sun.star.uno.RuntimeException("Listener already registred."); + eventListener.addElement(xListener); } @@ -495,158 +495,158 @@ public class ServiceManager implements XMultiServiceFactory, * If the listener is not registered a <code>com.sun.star.uno.RuntimeException</code> * will be thrown. * <p> - * @param xListener the new listener which should been removed. - * @see com.sun.star.lang.XComponent + * @param xListener the new listener which should been removed. + * @see com.sun.star.lang.XComponent */ - public void removeEventListener( XEventListener xListener ) + public void removeEventListener( XEventListener xListener ) throws com.sun.star.uno.RuntimeException { if (xListener == null) throw new com.sun.star.uno.RuntimeException("Listener must not be null"); - + if ( !eventListener.contains(xListener) ) - throw new com.sun.star.uno.RuntimeException("Listener is not registered."); - - eventListener.removeElement(xListener); + throw new com.sun.star.uno.RuntimeException("Listener is not registered."); + + eventListener.removeElement(xListener); } /** * Checks if a component is registered at the <code>ServiceManager</code>. The given object argument must * provide a <code>XServiceInfo</code> interface. * <p> - * @return true if the component is registred otherwise false. - * @param object object which provides a <code>XServiceInfo</code> interface. - * @see com.sun.star.container.XSet - * @see com.sun.star.lang.XServiceInfo + * @return true if the component is registred otherwise false. + * @param object object which provides a <code>XServiceInfo</code> interface. + * @see com.sun.star.container.XSet + * @see com.sun.star.lang.XServiceInfo */ - public boolean has( Object object ) + public boolean has( Object object ) throws com.sun.star.uno.RuntimeException { - if (object == null) + if (object == null) throw new com.sun.star.uno.RuntimeException("The parameter must not been null"); - + XServiceInfo xServiceInfo = UnoRuntime.queryInterface(XServiceInfo.class, object); - + if (xServiceInfo != null) { return UnoRuntime.areSame(factoriesByImplNames.get(xServiceInfo.getImplementationName()), object); - } - + } + return false; } /** * Adds a <code>SingleServiceFactory</code> to the <code>ServiceManager</code>. * <p> - * @param object factory which should be added. + * @param object factory which should be added. * @see com.sun.star.container.XSet - * @see com.sun.star.lang.XSingleServiceFactory + * @see com.sun.star.lang.XSingleServiceFactory */ - public void insert( Object object ) - throws com.sun.star.lang.IllegalArgumentException, - com.sun.star.container.ElementExistException, + public void insert( Object object ) + throws com.sun.star.lang.IllegalArgumentException, + com.sun.star.container.ElementExistException, com.sun.star.uno.RuntimeException { if (object == null) throw new com.sun.star.lang.IllegalArgumentException(); - - XServiceInfo xServiceInfo = + + XServiceInfo xServiceInfo = UnoRuntime.queryInterface(XServiceInfo.class, object); - - if (xServiceInfo == null) + + if (xServiceInfo == null) throw new com.sun.star.lang.IllegalArgumentException( "The given object does not implement the XServiceInfo interface." ); - + if ( factoriesByImplNames.containsKey( xServiceInfo.getImplementationName() ) ) { throw new com.sun.star.container.ElementExistException( xServiceInfo.getImplementationName() + " already registred" ); } - + DEBUG("add factory " + object.toString() + " for " + xServiceInfo.getImplementationName()); factoriesByImplNames.put( xServiceInfo.getImplementationName(), object ); - - + + String[] serviceNames = xServiceInfo.getSupportedServiceNames(); java.util.Vector vec = null; - - for (int i=0; i<serviceNames.length; i++) { + + for (int i=0; i<serviceNames.length; i++) { if ( !factoriesByServiceNames.containsKey( serviceNames[i] ) ) { DEBUG("> no registered services found under " + serviceNames[i] + ": adding..." ); factoriesByServiceNames.put(serviceNames[i], new java.util.Vector()); } - - vec = (java.util.Vector) factoriesByServiceNames.get( serviceNames[i] ); - + + vec = (java.util.Vector) factoriesByServiceNames.get( serviceNames[i] ); + if ( vec.contains( object ) ) System.err.println("The implementation " + xServiceInfo.getImplementationName() + " already registered for the service " + serviceNames[i] + " - ignoring!"); - else - vec.addElement(object); - } + else + vec.addElement(object); + } } /** * Removes a <code>SingleServiceFactory</code> from the <code>ServiceManager</code>. * <p> - * @param object factory which should be removed. + * @param object factory which should be removed. * @see com.sun.star.container.XSet - * @see com.sun.star.lang.XSingleServiceFactory + * @see com.sun.star.lang.XSingleServiceFactory */ - public void remove( Object object ) - throws com.sun.star.lang.IllegalArgumentException, - com.sun.star.container.NoSuchElementException, + public void remove( Object object ) + throws com.sun.star.lang.IllegalArgumentException, + com.sun.star.container.NoSuchElementException, com.sun.star.uno.RuntimeException { - if (object == null) + if (object == null) throw new com.sun.star.lang.IllegalArgumentException( "The given object must not be null." ); - - XServiceInfo xServiceInfo = + + XServiceInfo xServiceInfo = UnoRuntime.queryInterface(XServiceInfo.class, object); - + if (xServiceInfo == null) throw new com.sun.star.lang.IllegalArgumentException( "The given object does not implement the XServiceInfo interface." ); - - XSingleServiceFactory xSingleServiceFactory = + + XSingleServiceFactory xSingleServiceFactory = UnoRuntime.queryInterface(XSingleServiceFactory.class, object); - - if (xSingleServiceFactory == null) + + if (xSingleServiceFactory == null) throw new com.sun.star.lang.IllegalArgumentException( "The given object does not implement the XSingleServiceFactory interface." ); - + if ( factoriesByImplNames.remove( xServiceInfo.getImplementationName() ) == null ) throw new com.sun.star.container.NoSuchElementException( - xServiceInfo.getImplementationName() + + xServiceInfo.getImplementationName() + " is not registered as an implementation." ); - + String[] serviceNames = xServiceInfo.getSupportedServiceNames(); - + for ( int i=0; i<serviceNames.length; i++ ) { if ( factoriesByServiceNames.containsKey( serviceNames[i] ) ) { java.util.Vector vec = (java.util.Vector) factoriesByServiceNames.get(serviceNames[i]); - - if ( !vec.removeElement(object) ) + + if ( !vec.removeElement(object) ) System.err.println("The implementation " + xServiceInfo.getImplementationName() + " is not registered for the service " + serviceNames[i] + " - ignoring!"); - + if ( vec.isEmpty() ) // remove the vector if no implementations aviable for the service - factoriesByServiceNames.remove( serviceNames[i] ); - } + factoriesByServiceNames.remove( serviceNames[i] ); + } } } /** * Provides an enumeration of all registred services. * <p> - * @return an enumeration of all avialable services. - * @see com.sun.star.conatiner.XEnumerationAccess + * @return an enumeration of all avialable services. + * @see com.sun.star.conatiner.XEnumerationAccess */ - public XEnumeration createEnumeration() + public XEnumeration createEnumeration() throws com.sun.star.uno.RuntimeException { return new ServiceEnumerationImpl( factoriesByImplNames.elements() ); @@ -655,9 +655,9 @@ public class ServiceManager implements XMultiServiceFactory, /** * Provides the UNO type of the <code>ServiceManager</code> * <p> - * @return the UNO type of the <code>ServiceManager</code>. - * @see com.sun.star.container.XElementAccess - * @see com.sun.star.uno.TypeClass + * @return the UNO type of the <code>ServiceManager</code>. + * @see com.sun.star.container.XElementAccess + * @see com.sun.star.uno.TypeClass */ public com.sun.star.uno.Type getElementType() throws com.sun.star.uno.RuntimeException @@ -671,8 +671,8 @@ public class ServiceManager implements XMultiServiceFactory, /** * Checks if the any componets are registered. * <p> - * @return true - if the list of the registred components is not empty - otherwise false. - * @see com.sun.star.container.XElementAccess + * @return true - if the list of the registred components is not empty - otherwise false. + * @see com.sun.star.container.XElementAccess */ public boolean hasElements() { return ! factoriesByImplNames.isEmpty(); @@ -681,33 +681,33 @@ public class ServiceManager implements XMultiServiceFactory, /** * Provides an enumeration of of all factorys for a specified service. * <p> - * @return an enumeration for service name. - * @param serviceName name of the requested service - * @see com.sun.star.container.XContentEnumerationAccess + * @return an enumeration for service name. + * @param serviceName name of the requested service + * @see com.sun.star.container.XContentEnumerationAccess */ public XEnumeration createContentEnumeration( String serviceName ) throws com.sun.star.uno.RuntimeException { XEnumeration enumer = null; - + java.util.Vector serviceList = (java.util.Vector) factoriesByServiceNames.get(serviceName); - + if (serviceList != null) enumer = new ServiceEnumerationImpl( serviceList.elements() ); - else + else enumer = new ServiceEnumerationImpl(); - + return enumer; } - + /** * Returns the implementation name of the <code>ServiceManager</code> component. * <p> - * @return the class name of the <code>ServiceManager</code>. - * @see com.sun.star.lang.XServiceInfo + * @return the class name of the <code>ServiceManager</code>. + * @see com.sun.star.lang.XServiceInfo */ - public String getImplementationName() - throws com.sun.star.uno.RuntimeException + public String getImplementationName() + throws com.sun.star.uno.RuntimeException { return getClass().getName(); } @@ -715,132 +715,132 @@ public class ServiceManager implements XMultiServiceFactory, /** * Checks if the <code>ServiceManager</code> supports a service. * <p> - * @return true if the service is supported - otherwise false. - * @param serviceName service name which should be checked. - * @see com.sun.star.lang.XServiceInfo + * @return true if the service is supported - otherwise false. + * @param serviceName service name which should be checked. + * @see com.sun.star.lang.XServiceInfo */ public boolean supportsService( String serviceName ) - throws com.sun.star.uno.RuntimeException + throws com.sun.star.uno.RuntimeException { for (int i=0; i<supportedServiceNames.length; i++) if (supportedServiceNames[i].equals( serviceName )) return true; - + if (getImplementationName().equals( serviceName )) return true; - + return false; } - + /** - * Supplies list of all supported services. + * Supplies list of all supported services. * <p> - * @return a list of all supported service names. - * @see com.sun.star.lang.XServiceInfo + * @return a list of all supported service names. + * @see com.sun.star.lang.XServiceInfo */ public String[] getSupportedServiceNames() - throws com.sun.star.uno.RuntimeException - { + throws com.sun.star.uno.RuntimeException + { return supportedServiceNames; } - + /** - * The <code>ServiceEnumerationImpl</code> class provides an - * implementation of the @see com.sun.star.container.XEnumeration interface. + * The <code>ServiceEnumerationImpl</code> class provides an + * implementation of the @see com.sun.star.container.XEnumeration interface. * It is a inner wrapper for a java.util.Enumeration object. * <p> - * @version $Revision: 1.10 $ $ $Date: 2008-04-11 11:11:46 $ - * @author Markus Herzog + * @version $Revision: 1.10 $ $ $Date: 2008-04-11 11:11:46 $ + * @author Markus Herzog * @see com.sun.star.lang.XSingleServiceFactory * @see com.sun.star.lang.XServiceInfo * @since UDK1.0 */ class ServiceEnumerationImpl implements XEnumeration { java.util.Enumeration enumeration = null; - + /** * Constructs a new empty instance. */ public ServiceEnumerationImpl() { } - + /** * Constructs a new instance with a given enumeration. * <p> - * @param enumer is the enumeration which should been wrapped. - * @see com.sun.star.container.XEnumeration + * @param enumer is the enumeration which should been wrapped. + * @see com.sun.star.container.XEnumeration */ public ServiceEnumerationImpl(java.util.Enumeration enumer) { enumeration = enumer; } - + /** * Checks if the enumeration contains more elements. * <p> - * @return true if more elements are available - otherwise false. - * @see com.sun.star.container.XEnumeration + * @return true if more elements are available - otherwise false. + * @see com.sun.star.container.XEnumeration */ - public boolean hasMoreElements() - throws com.sun.star.uno.RuntimeException + public boolean hasMoreElements() + throws com.sun.star.uno.RuntimeException { if (enumeration != null) return enumeration.hasMoreElements(); - + return false; } - + /** * Returns the next element of the enumeration. If no further elements * available a com.sun.star.container.NoSuchElementException exception will be thrown. * <p> - * @return the next element. - * @see com.sun.star.container.XEnumeration + * @return the next element. + * @see com.sun.star.container.XEnumeration */ - public Object nextElement() - throws com.sun.star.container.NoSuchElementException, - com.sun.star.lang.WrappedTargetException, + public Object nextElement() + throws com.sun.star.container.NoSuchElementException, + com.sun.star.lang.WrappedTargetException, com.sun.star.uno.RuntimeException { if (enumeration == null) throw new com.sun.star.container.NoSuchElementException(); - + try { return enumeration.nextElement(); } catch (java.util.NoSuchElementException e) { - com.sun.star.container.NoSuchElementException ex = + com.sun.star.container.NoSuchElementException ex = new com.sun.star.container.NoSuchElementException(); ex.fillInStackTrace(); - + throw ex; } } } } /** - * The <code>ServiceManagerFactory</code> is the factory class for the - * <code>ServiceManager</code>. As all factories it implments the + * The <code>ServiceManagerFactory</code> is the factory class for the + * <code>ServiceManager</code>. As all factories it implments the * com.sun.star.lang.XSingleServiceFactory and the com.sun.star.lang.XServiceInfo * interfaces. * <p> - * @version $Revision: 1.10 $ $ $Date: 2008-04-11 11:11:46 $ - * @author Markus Herzog + * @version $Revision: 1.10 $ $ $Date: 2008-04-11 11:11:46 $ + * @author Markus Herzog * @see com.sun.star.lang.XSingleServiceFactory * @see com.sun.star.lang.XServiceInfo * @since UDK1.0 */ -class ServiceManagerFactory implements XServiceInfo, XSingleComponentFactory, XSingleServiceFactory +class ServiceManagerFactory implements XServiceInfo, XSingleComponentFactory, XSingleServiceFactory { /** * Creates a new instance of the <code>ServiceManagerFactory</code>. */ public ServiceManagerFactory() { } - + /** * Supplies the implementation name of the <code>ServiceManager</code>. * <p> - * @return <code>ServiceManager</code> class name. + * @return <code>ServiceManager</code> class name. * @see com.sun.star.lang.XServiceInfo */ - public String getImplementationName() + public String getImplementationName() throws com.sun.star.uno.RuntimeException { return ServiceManager.class.getName(); @@ -849,28 +849,28 @@ class ServiceManagerFactory implements XServiceInfo, XSingleComponentFactory, X /** * Checks wether or not a service is supported. * <p> - * @return true - if the service is supported, otherwise false. - * @param serviceName the name of the service that should be checked. + * @return true - if the service is supported, otherwise false. + * @param serviceName the name of the service that should be checked. * @see com.sun.star.lang.XServiceInfo */ - public boolean supportsService( String serviceName ) + public boolean supportsService( String serviceName ) throws com.sun.star.uno.RuntimeException { for ( int i=0; i<ServiceManager.supportedServiceNames.length; i++ ) if ( ServiceManager.supportedServiceNames[i].equals(serviceName) ) return true; - + if ( getImplementationName().equals(serviceName) ) return true; - + return false; } /** * Returns all service names which are supported by <code>ServiceManager</code>. * <p> - * @return a list aof all supported service names. + * @return a list aof all supported service names. * @see com.sun.star.lang.XServiceInfo */ - public String[] getSupportedServiceNames() + public String[] getSupportedServiceNames() throws com.sun.star.uno.RuntimeException { return ServiceManager.supportedServiceNames; @@ -879,11 +879,11 @@ class ServiceManagerFactory implements XServiceInfo, XSingleComponentFactory, X /** * Creates a new instance of the <code>ServiceManager</code>. * <p> - * @return newly created <code>ServiceManager</code> object. + * @return newly created <code>ServiceManager</code> object. * @see com.sun.star.lang.XSingleServiceFactory */ - public java.lang.Object createInstance() - throws com.sun.star.uno.Exception, + public java.lang.Object createInstance() + throws com.sun.star.uno.Exception, com.sun.star.uno.RuntimeException { return new ServiceManager(); @@ -895,17 +895,17 @@ class ServiceManagerFactory implements XServiceInfo, XSingleComponentFactory, X * because there is no the <code>ServiceManager</code> has no constructor with * arguments. * <p> - * @return null - allways throws an exception - * @param aArguments arguments for new instance. + * @return null - allways throws an exception + * @param aArguments arguments for new instance. * @see com.sun.star.lang.XSingleServiceFactory */ - public java.lang.Object createInstanceWithArguments( java.lang.Object[] aArguments ) - throws com.sun.star.uno.Exception, + public java.lang.Object createInstanceWithArguments( java.lang.Object[] aArguments ) + throws com.sun.star.uno.Exception, com.sun.star.uno.RuntimeException { throw new com.sun.star.lang.NoSuchMethodException("Constructor with arguments is not supported."); } - + // XSingleComponentFactory impl //______________________________________________________________________________________________ public Object createInstanceWithContext( XComponentContext xContext ) diff --git a/jurt/com/sun/star/comp/urlresolver/UrlResolver.java b/jurt/com/sun/star/comp/urlresolver/UrlResolver.java index 538315638553..a73b24098642 100644 --- a/jurt/com/sun/star/comp/urlresolver/UrlResolver.java +++ b/jurt/com/sun/star/comp/urlresolver/UrlResolver.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -51,8 +51,8 @@ import com.sun.star.uno.UnoRuntime; /** * This component gives a factory for an <code>UnoUrlResolver</code> service. * <p> - * @version $Revision: 1.6 $ $ $Date: 2008-04-11 11:12:25 $ - * @author Kay Ramme + * @version $Revision: 1.6 $ $ $Date: 2008-04-11 11:12:25 $ + * @author Kay Ramme * @see com.sun.star.brige.XBrideFactory * @see com.sun.star.connection.Connector * @since UDK1.0 @@ -74,7 +74,7 @@ public class UrlResolver { String conDcp = null; String protDcp = null; String rootOid = null; - + if(dcp.indexOf(';') == -1) {// use old style conDcp = dcp; protDcp = "iiop"; @@ -84,28 +84,28 @@ public class UrlResolver { int index = dcp.indexOf(':'); String url = dcp.substring(0, index).trim(); dcp = dcp.substring(index + 1).trim(); - + index = dcp.indexOf(';'); conDcp = dcp.substring(0, index).trim(); dcp = dcp.substring(index + 1).trim(); - + index = dcp.indexOf(';'); protDcp = dcp.substring(0, index).trim(); dcp = dcp.substring(index + 1).trim(); - + rootOid = dcp.trim().trim(); } Object rootObject = null; XBridgeFactory xBridgeFactory= null; try { - xBridgeFactory = UnoRuntime.queryInterface(XBridgeFactory.class, + xBridgeFactory = UnoRuntime.queryInterface(XBridgeFactory.class, _xMultiServiceFactory.createInstance("com.sun.star.bridge.BridgeFactory")); } catch (com.sun.star.uno.Exception e) { throw new com.sun.star.uno.RuntimeException(e.getMessage()); } XBridge xBridge = xBridgeFactory.getBridge(conDcp + ";" + protDcp); - + if(xBridge == null) { Object connector= null; try { @@ -113,9 +113,9 @@ public class UrlResolver { } catch (com.sun.star.uno.Exception e) { throw new com.sun.star.uno.RuntimeException(e.getMessage()); } - + XConnector connector_xConnector = UnoRuntime.queryInterface(XConnector.class, connector); - + // connect to the server XConnection xConnection = connector_xConnector.connect(conDcp); try { @@ -140,8 +140,8 @@ public class UrlResolver { * @param regKey the registryKey * @see com.sun.star.comp.loader.JavaLoader */ - public static XSingleServiceFactory __getServiceFactory(String implName, - XMultiServiceFactory multiFactory, + public static XSingleServiceFactory __getServiceFactory(String implName, + XMultiServiceFactory multiFactory, XRegistryKey regKey) { XSingleServiceFactory xSingleServiceFactory = null; @@ -149,9 +149,23 @@ public class UrlResolver { if (implName.equals(UrlResolver.class.getName()) ) xSingleServiceFactory = FactoryHelper.getServiceFactory(_UrlResolver.class, _UrlResolver.__serviceName, - multiFactory, + multiFactory, regKey); - + return xSingleServiceFactory; } + + /** + * Writes the service information into the given registry key. + * This method is called by the <code>JavaLoader</code> + * <p> + * @return returns true if the operation succeeded + * @param regKey the registryKey + * @see com.sun.star.comp.loader.JavaLoader + */ + public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) { + return FactoryHelper.writeRegistryServiceInfo(_UrlResolver.class.getName(), _UrlResolver.__serviceName, regKey); + } + } + diff --git a/jurt/com/sun/star/lib/connections/pipe/PipeConnection.java b/jurt/com/sun/star/lib/connections/pipe/PipeConnection.java index 455e3aab6502..ea5057365377 100644 --- a/jurt/com/sun/star/lib/connections/pipe/PipeConnection.java +++ b/jurt/com/sun/star/lib/connections/pipe/PipeConnection.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -44,8 +44,8 @@ import com.sun.star.connection.XConnectionBroadcaster; * and is uses by the <code>PipeConnector</code> and the <code>PipeAcceptor</code>. * This class is not part of the provided <code>api</code>. * <p> - * @version $Revision: 1.7 $ $ $Date: 2008-04-11 11:13:00 $ - * @author Kay Ramme + * @version $Revision: 1.7 $ $ $Date: 2008-04-11 11:13:00 $ + * @author Kay Ramme * @see com.sun.star.comp.connections.PipeAcceptor * @see com.sun.star.comp.connections.PipeConnector * @see com.sun.star.connections.XConnection @@ -62,10 +62,10 @@ public class PipeConnection implements XConnection, XConnectionBroadcaster { NativeLibraryLoader.loadLibrary(PipeConnection.class.getClassLoader(), "jpipe"); } - protected String _aDescription; - protected long _nPipeHandle; - protected Vector _aListeners; - protected boolean _bFirstRead; + protected String _aDescription; + protected long _nPipeHandle; + protected Vector _aListeners; + protected boolean _bFirstRead; /** * Constructs a new <code>PipeConnection</code>. @@ -73,7 +73,7 @@ public class PipeConnection implements XConnection, XConnectionBroadcaster { * @param description the description of the connection * @param pipe the pipe of the connection */ - public PipeConnection(String description) + public PipeConnection(String description) throws IOException { if (DEBUG) System.err.println("##### " + getClass().getName() + " - instantiated " + description ); @@ -84,7 +84,7 @@ public class PipeConnection implements XConnection, XConnectionBroadcaster { // get pipe name from pipe descriptor String aPipeName = null; StringTokenizer aTokenizer = new StringTokenizer( description, "," ); - if ( aTokenizer.hasMoreTokens() ) + if ( aTokenizer.hasMoreTokens() ) { String aConnType = aTokenizer.nextToken(); if ( !aConnType.equals( "pipe" ) ) @@ -99,7 +99,7 @@ public class PipeConnection implements XConnection, XConnectionBroadcaster { throw new RuntimeException( "invalid or empty pipe descriptor" ); // create the pipe - try + try { createJNI( aPipeName ); } catch ( java.lang.NullPointerException aNPE ) { throw new IOException( aNPE.getMessage() ); } @@ -132,7 +132,7 @@ public class PipeConnection implements XConnection, XConnectionBroadcaster { xStreamListener.closed(); } } - + private void notifyListeners_error(com.sun.star.uno.Exception exception) { Enumeration elements = _aListeners.elements(); while(elements.hasMoreElements()) { @@ -144,21 +144,21 @@ public class PipeConnection implements XConnection, XConnectionBroadcaster { // JNI implementation to create the pipe private native int createJNI( String name ) throws com.sun.star.io.IOException, com.sun.star.uno.RuntimeException; - + // JNI implementation to read from the pipe - private native int readJNI(/*OUT*/byte[][] bytes, int nBytesToRead) + private native int readJNI(/*OUT*/byte[][] bytes, int nBytesToRead) throws com.sun.star.io.IOException, com.sun.star.uno.RuntimeException; - + // JNI implementation to write to the pipe - private native void writeJNI(byte aData[]) + private native void writeJNI(byte aData[]) throws com.sun.star.io.IOException, com.sun.star.uno.RuntimeException; - + // JNI implementation to flush the pipe - private native void flushJNI() + private native void flushJNI() throws com.sun.star.io.IOException, com.sun.star.uno.RuntimeException; // JNI implementation to close the pipe - private native void closeJNI() + private native void closeJNI() throws com.sun.star.io.IOException, com.sun.star.uno.RuntimeException; /** @@ -169,8 +169,8 @@ public class PipeConnection implements XConnection, XConnectionBroadcaster { * @param nBytesToRead the number of bytes to read * @see com.sun.star.connections.XConnection#read */ - public int read(/*OUT*/byte[][] bytes, int nBytesToRead) - throws com.sun.star.io.IOException, com.sun.star.uno.RuntimeException + public int read(/*OUT*/byte[][] bytes, int nBytesToRead) + throws com.sun.star.io.IOException, com.sun.star.uno.RuntimeException { if(_bFirstRead) { _bFirstRead = false; @@ -187,8 +187,8 @@ public class PipeConnection implements XConnection, XConnectionBroadcaster { * @param aData the bytes to write * @see com.sun.star.connections.XConnection#write */ - public void write(byte aData[]) - throws com.sun.star.io.IOException, com.sun.star.uno.RuntimeException + public void write(byte aData[]) + throws com.sun.star.io.IOException, com.sun.star.uno.RuntimeException { writeJNI( aData ); } @@ -198,8 +198,8 @@ public class PipeConnection implements XConnection, XConnectionBroadcaster { * <p> * @see com.sun.star.connections.XConnection#flush */ - public void flush() - throws com.sun.star.io.IOException, com.sun.star.uno.RuntimeException + public void flush() + throws com.sun.star.io.IOException, com.sun.star.uno.RuntimeException { flushJNI(); } @@ -209,8 +209,8 @@ public class PipeConnection implements XConnection, XConnectionBroadcaster { * <p> * @see com.sun.star.connections.XConnection#close */ - public void close() - throws com.sun.star.io.IOException, com.sun.star.uno.RuntimeException + public void close() + throws com.sun.star.io.IOException, com.sun.star.uno.RuntimeException { if (DEBUG) System.out.print( "PipeConnection::close() " ); closeJNI(); diff --git a/jurt/com/sun/star/lib/connections/pipe/pipeAcceptor.java b/jurt/com/sun/star/lib/connections/pipe/pipeAcceptor.java index 25b2ec4abfe3..f9e2a43bcf72 100644 --- a/jurt/com/sun/star/lib/connections/pipe/pipeAcceptor.java +++ b/jurt/com/sun/star/lib/connections/pipe/pipeAcceptor.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -84,6 +84,21 @@ public final class pipeAcceptor implements XAcceptor { } /** + * Writes the service information into the given registry key. + * + * <p>This method is called by the <code>JavaLoader</code>.</p> + * + * @param regKey the registry key. + * @return <code>true</code> if the operation succeeded. + * + * @see com.sun.star.comp.loader.JavaLoader + */ + public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) { + return FactoryHelper.writeRegistryServiceInfo( + pipeAcceptor.class.getName(), __serviceName, regKey); + } + + /** * Accepts a connection request via the described pipe. * * <p>This call blocks until a connection has been established.</p> diff --git a/jurt/com/sun/star/lib/connections/pipe/pipeConnector.java b/jurt/com/sun/star/lib/connections/pipe/pipeConnector.java index 9856fb2e116e..7128a5b3fce9 100644 --- a/jurt/com/sun/star/lib/connections/pipe/pipeConnector.java +++ b/jurt/com/sun/star/lib/connections/pipe/pipeConnector.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -84,6 +84,21 @@ public final class pipeConnector implements XConnector { } /** + * Writes the service information into the given registry key. + * + * <p>This method is called by the <code>JavaLoader</code>.</p> + * + * @param regKey the registry key. + * @return <code>true</code> if the operation succeeded. + * + * @see com.sun.star.comp.loader.JavaLoader + */ + public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) { + return FactoryHelper.writeRegistryServiceInfo( + pipeConnector.class.getName(), __serviceName, regKey); + } + + /** * Connects via the described pipe to a waiting server. * * <p>The connection description has the following format: @@ -113,10 +128,10 @@ public final class pipeConnector implements XConnector { if (bConnected) { throw new ConnectionSetupException("alread connected"); } - - try - { - XConnection xConn = new PipeConnection( connectionDescription ); + + try + { + XConnection xConn = new PipeConnection( connectionDescription ); bConnected = true; return xConn; } diff --git a/jurt/com/sun/star/lib/connections/socket/ConnectionDescriptor.java b/jurt/com/sun/star/lib/connections/socket/ConnectionDescriptor.java index c38faed73e41..57e101449b0c 100644 --- a/jurt/com/sun/star/lib/connections/socket/ConnectionDescriptor.java +++ b/jurt/com/sun/star/lib/connections/socket/ConnectionDescriptor.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite diff --git a/jurt/com/sun/star/lib/connections/socket/SocketConnection.java b/jurt/com/sun/star/lib/connections/socket/SocketConnection.java index 8512bdb49fe1..3d766389b15f 100644 --- a/jurt/com/sun/star/lib/connections/socket/SocketConnection.java +++ b/jurt/com/sun/star/lib/connections/socket/SocketConnection.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -49,8 +49,8 @@ import com.sun.star.connection.XConnectionBroadcaster; * and is uses by the <code>SocketConnector</code> and the <code>SocketAcceptor</code>. * This class is not part of the provided <code>api</code>. * <p> - * @version $Revision: 1.6 $ $ $Date: 2008-04-11 11:14:31 $ - * @author Kay Ramme + * @version $Revision: 1.6 $ $ $Date: 2008-04-11 11:14:31 $ + * @author Kay Ramme * @see com.sun.star.comp.connections.SocketAcceptor * @see com.sun.star.comp.connections.SocketConnector * @see com.sun.star.connections.XConnection @@ -118,7 +118,7 @@ public class SocketConnection implements XConnection, XConnectionBroadcaster { xStreamListener.closed(); } } - + private void notifyListeners_error(com.sun.star.uno.Exception exception) { Enumeration elements = _listeners.elements(); while(elements.hasMoreElements()) { diff --git a/jurt/com/sun/star/lib/connections/socket/socketAcceptor.java b/jurt/com/sun/star/lib/connections/socket/socketAcceptor.java index bf9456d0058a..930eeecf4c60 100644 --- a/jurt/com/sun/star/lib/connections/socket/socketAcceptor.java +++ b/jurt/com/sun/star/lib/connections/socket/socketAcceptor.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -89,6 +89,21 @@ public final class socketAcceptor implements XAcceptor { } /** + * Writes the service information into the given registry key. + * + * <p>This method is called by the <code>JavaLoader</code>.</p> + * + * @param regKey the registry key. + * @return <code>true</code> if the operation succeeded. + * + * @see com.sun.star.comp.loader.JavaLoader + */ + public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) { + return FactoryHelper.writeRegistryServiceInfo( + socketAcceptor.class.getName(), __serviceName, regKey); + } + + /** * Accepts a connection request via the described socket. * * <p>This call blocks until a connection has been established.</p> diff --git a/jurt/com/sun/star/lib/connections/socket/socketConnector.java b/jurt/com/sun/star/lib/connections/socket/socketConnector.java index 3a7bf183d223..2872743565ae 100644 --- a/jurt/com/sun/star/lib/connections/socket/socketConnector.java +++ b/jurt/com/sun/star/lib/connections/socket/socketConnector.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -89,6 +89,21 @@ public final class socketConnector implements XConnector { } /** + * Writes the service information into the given registry key. + * + * <p>This method is called by the <code>JavaLoader</code>.</p> + * + * @param regKey the registry key. + * @return <code>true</code> if the operation succeeded. + * + * @see com.sun.star.comp.loader.JavaLoader + */ + public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) { + return FactoryHelper.writeRegistryServiceInfo( + socketConnector.class.getName(), __serviceName, regKey); + } + + /** * Connects via the described socket to a waiting server. * * <p>The connection description has the following format: diff --git a/jurt/com/sun/star/lib/uno/Proxy.java b/jurt/com/sun/star/lib/uno/Proxy.java index f2a7326c81c0..4f0f5db14b8d 100644 --- a/jurt/com/sun/star/lib/uno/Proxy.java +++ b/jurt/com/sun/star/lib/uno/Proxy.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite diff --git a/jurt/com/sun/star/lib/uno/bridges/java_remote/BridgedObject.java b/jurt/com/sun/star/lib/uno/bridges/java_remote/BridgedObject.java index 90f037d5ae42..3fd65cde4842 100644 --- a/jurt/com/sun/star/lib/uno/bridges/java_remote/BridgedObject.java +++ b/jurt/com/sun/star/lib/uno/bridges/java_remote/BridgedObject.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite diff --git a/jurt/com/sun/star/lib/uno/bridges/java_remote/ProxyFactory.java b/jurt/com/sun/star/lib/uno/bridges/java_remote/ProxyFactory.java index ae2719f1c07d..631bda3a19b2 100644 --- a/jurt/com/sun/star/lib/uno/bridges/java_remote/ProxyFactory.java +++ b/jurt/com/sun/star/lib/uno/bridges/java_remote/ProxyFactory.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -148,22 +148,11 @@ final class ProxyFactory { private Object request(String operation, Object[] args) throws Throwable { - Object res = requestHandler.sendRequest(oid, type, operation, args); - // Avoid early finalization of this object, while an invoke -> - // request call is still ongoing; as finalize also calls request, - // this should fulfil the condition from The Java Language - // Specification, 3rd ed., that "if an object's finalizer can result - // in synchronization on that object, then that object must be alive - // and considered reachable whenever a lock is held on it:" - synchronized (this) { - ++dummy; - } - return res; + return requestHandler.sendRequest(oid, type, operation, args); } private final String oid; private final Type type; - private int dummy = 0; } private static final Method METHOD_EQUALS; diff --git a/jurt/com/sun/star/lib/uno/bridges/java_remote/RequestHandler.java b/jurt/com/sun/star/lib/uno/bridges/java_remote/RequestHandler.java index 5bfe57a95299..ca0e80d4c78d 100644 --- a/jurt/com/sun/star/lib/uno/bridges/java_remote/RequestHandler.java +++ b/jurt/com/sun/star/lib/uno/bridges/java_remote/RequestHandler.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite diff --git a/jurt/com/sun/star/lib/uno/bridges/java_remote/XConnectionInputStream_Adapter.java b/jurt/com/sun/star/lib/uno/bridges/java_remote/XConnectionInputStream_Adapter.java index e663a96d1ea7..9ba019199f69 100644 --- a/jurt/com/sun/star/lib/uno/bridges/java_remote/XConnectionInputStream_Adapter.java +++ b/jurt/com/sun/star/lib/uno/bridges/java_remote/XConnectionInputStream_Adapter.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -41,7 +41,7 @@ class XConnectionInputStream_Adapter extends InputStream { protected byte _bytes[][] = new byte[1][]; XConnectionInputStream_Adapter(XConnection xConnection) { - if(xConnection == null) throw new NullPointerException("the XConnection must not be null"); + if(xConnection == null) throw new NullPointerException("the XConnection must not be null"); if(DEBUG) System.err.println("#### " + getClass().getName() + " - instantiated "); @@ -65,7 +65,7 @@ class XConnectionInputStream_Adapter extends InputStream { } public int read(byte[] b, int off, int len) throws IOException { -// byte bytes[][] = new byte[1][]; +// byte bytes[][] = new byte[1][]; try { len = _xConnection.read(_bytes, len - off); diff --git a/jurt/com/sun/star/lib/uno/bridges/java_remote/XConnectionOutputStream_Adapter.java b/jurt/com/sun/star/lib/uno/bridges/java_remote/XConnectionOutputStream_Adapter.java index 51f3594330ee..388f5bc08630 100644 --- a/jurt/com/sun/star/lib/uno/bridges/java_remote/XConnectionOutputStream_Adapter.java +++ b/jurt/com/sun/star/lib/uno/bridges/java_remote/XConnectionOutputStream_Adapter.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite diff --git a/jurt/com/sun/star/lib/uno/bridges/java_remote/java_remote_bridge.java b/jurt/com/sun/star/lib/uno/bridges/java_remote/java_remote_bridge.java index 221870b0b035..12ea6bd2e735 100644 --- a/jurt/com/sun/star/lib/uno/bridges/java_remote/java_remote_bridge.java +++ b/jurt/com/sun/star/lib/uno/bridges/java_remote/java_remote_bridge.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -80,8 +80,8 @@ import com.sun.star.uno.Any; * The protocol to used is passed by name, the bridge * then looks for it under <code>com.sun.star.lib.uno.protocols</code>. * <p> - * @version $Revision: 1.45 $ $ $Date: 2008-04-11 11:18:08 $ - * @author Kay Ramme + * @version $Revision: 1.45 $ $ $Date: 2008-04-11 11:18:08 $ + * @author Kay Ramme * @since UDK1.0 */ public class java_remote_bridge @@ -155,7 +155,7 @@ public class java_remote_bridge new Job(obj, java_remote_bridge.this, msg)); } } catch (Throwable e) { - dispose(e); + dispose(new DisposedException(e.toString())); } } @@ -478,12 +478,12 @@ public class java_remote_bridge dispose = _life_count <= 0; } if (dispose) { - dispose(new Throwable("end of life")); + dispose(new com.sun.star.uno.RuntimeException("end of life")); } } public void dispose() { - dispose(new Throwable("user dispose")); + dispose(new com.sun.star.uno.RuntimeException("user dispose")); } private void dispose(Throwable throwable) { @@ -499,8 +499,6 @@ public class java_remote_bridge ((DisposeListener) i.next()).notifyDispose(this); } - _iProtocol.terminate(); - try { _messageDispatcher.terminate(); @@ -551,7 +549,7 @@ public class java_remote_bridge } _java_environment.list(); } - + // clear members _xConnection = null; _java_environment = null; @@ -604,8 +602,7 @@ public class java_remote_bridge _iProtocol.writeReply(exception, threadId, result); } catch (IOException e) { dispose(e); - throw (DisposedException) - (new DisposedException("unexpected " + e).initCause(e)); + throw new DisposedException("unexpected " + e); } catch (RuntimeException e) { dispose(e); throw e; @@ -634,16 +631,16 @@ public class java_remote_bridge oid, TypeDescription.getTypeDescription(type), operation, threadId, params); } catch (IOException e) { - dispose(e); - throw (DisposedException) - new DisposedException(e.toString()).initCause(e); + DisposedException d = new DisposedException(e.toString()); + dispose(d); + throw d; } if (sync && Thread.currentThread() != _messageDispatcher) { result = _iThreadPool.enter(handle, threadId); } } finally { _iThreadPool.detach(handle, threadId); - if(operation.equals("release")) + if(operation.equals("release")) release(); // kill this bridge, if this was the last proxy } diff --git a/jurt/com/sun/star/lib/uno/environments/java/java_environment.java b/jurt/com/sun/star/lib/uno/environments/java/java_environment.java index 7be0f9e5366d..e9f6344ce14a 100644 --- a/jurt/com/sun/star/lib/uno/environments/java/java_environment.java +++ b/jurt/com/sun/star/lib/uno/environments/java/java_environment.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite diff --git a/jurt/com/sun/star/lib/uno/environments/remote/IProtocol.java b/jurt/com/sun/star/lib/uno/environments/remote/IProtocol.java index de581ea86c7b..afb5fc586104 100644 --- a/jurt/com/sun/star/lib/uno/environments/remote/IProtocol.java +++ b/jurt/com/sun/star/lib/uno/environments/remote/IProtocol.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -51,8 +51,6 @@ public interface IProtocol { */ void init() throws IOException; - void terminate(); - /** * Reads a request or reply message. * diff --git a/jurt/com/sun/star/lib/uno/environments/remote/IReceiver.java b/jurt/com/sun/star/lib/uno/environments/remote/IReceiver.java index be4548e5ebc0..402726188b18 100644 --- a/jurt/com/sun/star/lib/uno/environments/remote/IReceiver.java +++ b/jurt/com/sun/star/lib/uno/environments/remote/IReceiver.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite diff --git a/jurt/com/sun/star/lib/uno/environments/remote/IThreadPool.java b/jurt/com/sun/star/lib/uno/environments/remote/IThreadPool.java index 71961737fd55..20017ed247e8 100644 --- a/jurt/com/sun/star/lib/uno/environments/remote/IThreadPool.java +++ b/jurt/com/sun/star/lib/uno/environments/remote/IThreadPool.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -31,9 +31,9 @@ package com.sun.star.lib.uno.environments.remote; * This interface is an abstraction of the various * threadpool implementations. * <p> - * @version $Revision: 1.7 $ $ $Date: 2008-04-11 11:20:01 $ - * @author Joerg Budischewski - * @author Kay Ramme + * @version $Revision: 1.7 $ $ $Date: 2008-04-11 11:20:01 $ + * @author Joerg Budischewski + * @author Kay Ramme * @see com.sun.star.lib.uno.environments.remote.ThreadPoolFactory * @see com.sun.star.lib.uno.environments.remote.IThreadPoolFactory * @since UDK1.0 @@ -101,7 +101,7 @@ public interface IThreadPool { public Object enter( Object handle, ThreadId id ) throws Throwable; /** - * Queues a job into the jobQueue of the thread belonging + * Queues a job into the jobQueue of the thread belonging * to the jobs threadId. * <p> * @param job the job @@ -110,10 +110,10 @@ public interface IThreadPool { /** * Disposes this thread pool, thus releasing - * all threads by throwing a <code>DisposedException</code> with the given - * <code>Throwable</code> cause. + * all threads by throwing the given + * <code>Throwable</code>. * <p> - * @param throwing the cause + * @param throwing the Throwable */ public void dispose(Throwable throwable); diff --git a/jurt/com/sun/star/lib/uno/environments/remote/JavaThreadPool.java b/jurt/com/sun/star/lib/uno/environments/remote/JavaThreadPool.java index 3b1fee02b87d..4869d216c0c6 100644 --- a/jurt/com/sun/star/lib/uno/environments/remote/JavaThreadPool.java +++ b/jurt/com/sun/star/lib/uno/environments/remote/JavaThreadPool.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -30,8 +30,8 @@ package com.sun.star.lib.uno.environments.remote; /** * This class implements a java thread pool. * <p> - * @version $Revision: 1.13 $ $ $Date: 2008-04-11 11:20:22 $ - * @author Kay Ramme + * @version $Revision: 1.13 $ $ $Date: 2008-04-11 11:20:22 $ + * @author Kay Ramme * @see com.sun.star.uno.UnoRuntime * @see com.sun.star.lib.uno.environments.remote.ThreadPool * @see com.sun.star.lib.uno.environments.remote.IThreadPool @@ -66,7 +66,7 @@ public class JavaThreadPool implements IThreadPool { jobQueue.acquire(); return jobQueue; } - + public void attach() { attach( getThreadId() ); } @@ -75,13 +75,13 @@ public class JavaThreadPool implements IThreadPool { { ((JobQueue)handle).release(); } - + public void detach() { ThreadId threadId = getThreadId(); detach(_javaThreadPoolFactory.getJobQueue(threadId), threadId ); } - + public Object enter( ) throws Throwable { ThreadId threadId = getThreadId(); return enter( _javaThreadPoolFactory.getJobQueue( threadId ), threadId ); @@ -96,7 +96,7 @@ public class JavaThreadPool implements IThreadPool { JobQueue jobQueue = _javaThreadPoolFactory.getJobQueue(job.getThreadId()); // this has not be synchronized, cause - // sync jobs can only come over one bridge + // sync jobs can only come over one bridge // (cause the thread blocks on other side) if(jobQueue == null) jobQueue = new JobQueue(_javaThreadPoolFactory, job.getThreadId(), true); diff --git a/jurt/com/sun/star/lib/uno/environments/remote/JavaThreadPoolFactory.java b/jurt/com/sun/star/lib/uno/environments/remote/JavaThreadPoolFactory.java index 868a4559a577..1ba1fc64179b 100644 --- a/jurt/com/sun/star/lib/uno/environments/remote/JavaThreadPoolFactory.java +++ b/jurt/com/sun/star/lib/uno/environments/remote/JavaThreadPoolFactory.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite diff --git a/jurt/com/sun/star/lib/uno/environments/remote/Job.java b/jurt/com/sun/star/lib/uno/environments/remote/Job.java index 41cf9706f2b6..ef99a187da7f 100644 --- a/jurt/com/sun/star/lib/uno/environments/remote/Job.java +++ b/jurt/com/sun/star/lib/uno/environments/remote/Job.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -45,8 +45,8 @@ import com.sun.star.uno.XCurrentContext; * The Job is an abstraction for tasks which have to be done * remotely because of a method invocation. * <p> - * @version $Revision: 1.17 $ $ $Date: 2008-04-11 11:21:00 $ - * @author Kay Ramme + * @version $Revision: 1.17 $ $ $Date: 2008-04-11 11:21:00 $ + * @author Kay Ramme * @see com.sun.star.lib.uno.environments.remote.ThreadID * @see com.sun.star.lib.uno.environments.remote.IReceiver * @since UDK1.0 @@ -159,15 +159,15 @@ public class Job { } public void dispose() { -// _oId = null; -// _iReceiver = null; -// _threadId = null; -// _object = null; -// _operation = null; -// _param = null; -// _exception = null; -// _zInterface = null; -// _disposeId = null; +// _oId = null; +// _iReceiver = null; +// _threadId = null; +// _object = null; +// _operation = null; +// _param = null; +// _exception = null; +// _zInterface = null; +// _disposeId = null; } // The name of this method is chosen to generate a somewhat self-explanatory diff --git a/jurt/com/sun/star/lib/uno/environments/remote/JobQueue.java b/jurt/com/sun/star/lib/uno/environments/remote/JobQueue.java index 62e49cc44f16..b8700b61f5c3 100644 --- a/jurt/com/sun/star/lib/uno/environments/remote/JobQueue.java +++ b/jurt/com/sun/star/lib/uno/environments/remote/JobQueue.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -27,7 +27,6 @@ package com.sun.star.lib.uno.environments.remote; -import com.sun.star.lang.DisposedException; /** * The <code>JobQueue</code> implements a queue for jobs. @@ -35,11 +34,11 @@ import com.sun.star.lang.DisposedException; * at the <code>ThreadPool</code>. * A JobQueue is splitted in a sync job queue and an async job queue. * The sync job queue is the registerd queue, it delegates async jobs - * (put by <code>putjob</code>) into the async queue, which is only + * (put by <code>putjob</code>) into the async queue, which is only * known by the sync queue. * <p> - * @version $Revision: 1.19 $ $ $Date: 2008-04-11 11:21:18 $ - * @author Kay Ramme + * @version $Revision: 1.19 $ $ $Date: 2008-04-11 11:21:18 $ + * @author Kay Ramme * @see com.sun.star.lib.uno.environments.remote.ThreadPool * @see com.sun.star.lib.uno.environments.remote.Job * @see com.sun.star.lib.uno.environments.remote.ThreadID @@ -89,7 +88,7 @@ public class JobQueue { public void run() { if(DEBUG) System.err.println("ThreadPool$JobDispatcher.run: " + Thread.currentThread()); - + try { enter(2000, _disposeId); } @@ -105,14 +104,14 @@ public class JobQueue { if(DEBUG) System.err.println("##### " + getClass().getName() + ".run - exit:" + _threadId); -// try { -// Object object = new Object(); -// synchronized(object) { -// object.wait(); -// } -// } -// catch(InterruptedException interruptedException) { -// } +// try { +// Object object = new Object(); +// synchronized(object) { +// object.wait(); +// } +// } +// catch(InterruptedException interruptedException) { +// } } } @@ -152,7 +151,7 @@ public class JobQueue { * @param createThread if true, the queue creates a worker thread if needed * @see com.sun.star.lib.uno.environments.remote.ThreadID */ - JobQueue(JavaThreadPoolFactory javaThreadPoolFactory, ThreadId threadId, boolean createThread){ + JobQueue(JavaThreadPoolFactory javaThreadPoolFactory, ThreadId threadId, boolean createThread){ _javaThreadPoolFactory = javaThreadPoolFactory; _threadId = threadId; _createThread = createThread; @@ -173,7 +172,7 @@ public class JobQueue { synchronized void acquire() { // add only synchronous queues . - if(_ref_count <= 0 && _sync_jobQueue == null ) + if(_ref_count <= 0 && _sync_jobQueue == null ) _javaThreadPoolFactory.addJobQueue(this); ++ _ref_count; @@ -184,7 +183,7 @@ public class JobQueue { if(_ref_count <= 0) { // only synchronous queues needs to be removed . - if( _sync_jobQueue == null ) + if( _sync_jobQueue == null ) _javaThreadPoolFactory.removeJobQueue(this); @@ -199,9 +198,9 @@ public class JobQueue { * Removes a job from the queue. * <p> * @return a job or null if timed out - * @param waitTime the maximum amount of time to wait for a job + * @param waitTime the maximum amount of time to wait for a job */ - private Job removeJob(int waitTime) { + private Job removeJob(int waitTime) throws Throwable { if(DEBUG) System.err.println("##### " + getClass().getName() + ".removeJob:" + _head + " " + _threadId); Job job = null; @@ -211,8 +210,7 @@ public class JobQueue { while(_head == null && (waitTime == 0 || !waited)) { if(_doDispose == _disposeId) { _doDispose = null; - throw (DisposedException) - new DisposedException().initCause(_throwable); + throw _throwable; } // notify sync queues @@ -225,7 +223,7 @@ public class JobQueue { catch(InterruptedException interruptedException) { throw new com.sun.star.uno.RuntimeException(getClass().getName() + ".removeJob - unexpected:" + interruptedException); } - + // signal that we have already waited once waited = true; } @@ -234,10 +232,10 @@ public class JobQueue { if(_head != null) { Job current = _head; _head = _head._next; - + if(_head == null) _tail = null; - + job = current; _active = true; } @@ -245,15 +243,14 @@ public class JobQueue { // always wait for asynchron jobqueue to be finished ! if(job != null && _async_jobQueue != null) { - synchronized(_async_jobQueue) { + synchronized(_async_jobQueue) { // wait for async queue to be empty and last job to be done while(_async_jobQueue._active || _async_jobQueue._head != null) { if(DEBUG) System.err.println("waiting for async:" + _async_jobQueue._head + " " + _async_jobQueue._worker_thread); if(_doDispose == _disposeId) { _doDispose = null; - throw (DisposedException) - new DisposedException().initCause(_throwable); + throw _throwable; } try { @@ -277,12 +274,12 @@ public class JobQueue { */ synchronized void putJob(Job job, Object disposeId) { if(DEBUG) System.err.println("##### " + getClass().getName() + ".putJob todoes: " + " job:" + job); - - if(_tail != null) + + if(_tail != null) _tail._next = job; else _head = job; - + _tail = job; if(_worker_thread == null && _createThread && _createThread_now) { // if there is no thread, which dispatches and if shall create one, create one @@ -329,10 +326,10 @@ public class JobQueue { while(!quit) { Job job = null; - + try { job = removeJob(waitTime); - + if(job != null) { try { result = job.execute(); @@ -352,7 +349,7 @@ public class JobQueue { else quit = true; - + } finally { // ensure that this queue becomes disposed, if necessary if(DEBUG) System.err.println("##### " + getClass().getName() + ".enter leaving: " + _threadId + " " + _worker_thread + " " + hold_worker_thread + " " + result); @@ -362,7 +359,7 @@ public class JobQueue { _worker_thread = hold_worker_thread; _createThread_now = true; - + _disposeId = hold_disposeId; if(_sync_jobQueue != null) @@ -388,10 +385,10 @@ public class JobQueue { if(_sync_jobQueue == null) { // dispose only sync queues _doDispose = disposeId; _throwable = throwable; - + // get thread out of wait and let it throw the throwable if(DEBUG) System.err.println(getClass().getName() + ".dispose - notifying thread"); - + notifyAll(); } } diff --git a/jurt/com/sun/star/lib/uno/environments/remote/Message.java b/jurt/com/sun/star/lib/uno/environments/remote/Message.java index 918b9b1282ad..310bfc6ce488 100644 --- a/jurt/com/sun/star/lib/uno/environments/remote/Message.java +++ b/jurt/com/sun/star/lib/uno/environments/remote/Message.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite diff --git a/jurt/com/sun/star/lib/uno/environments/remote/NativeThreadPool.java b/jurt/com/sun/star/lib/uno/environments/remote/NativeThreadPool.java index 06afce7f1e5d..91f0bd411ee8 100644 --- a/jurt/com/sun/star/lib/uno/environments/remote/NativeThreadPool.java +++ b/jurt/com/sun/star/lib/uno/environments/remote/NativeThreadPool.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite diff --git a/jurt/com/sun/star/lib/uno/environments/remote/ThreadId.java b/jurt/com/sun/star/lib/uno/environments/remote/ThreadId.java index 0b570991c11f..e194198d8397 100644 --- a/jurt/com/sun/star/lib/uno/environments/remote/ThreadId.java +++ b/jurt/com/sun/star/lib/uno/environments/remote/ThreadId.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite diff --git a/jurt/com/sun/star/lib/uno/environments/remote/ThreadPoolManager.java b/jurt/com/sun/star/lib/uno/environments/remote/ThreadPoolManager.java index 6187eb4b1c4e..c43ec4bad66d 100644 --- a/jurt/com/sun/star/lib/uno/environments/remote/ThreadPoolManager.java +++ b/jurt/com/sun/star/lib/uno/environments/remote/ThreadPoolManager.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite diff --git a/jurt/com/sun/star/lib/uno/environments/remote/remote_environment.java b/jurt/com/sun/star/lib/uno/environments/remote/remote_environment.java index 0a782783c00f..81cbf1bc4622 100644 --- a/jurt/com/sun/star/lib/uno/environments/remote/remote_environment.java +++ b/jurt/com/sun/star/lib/uno/environments/remote/remote_environment.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite diff --git a/jurt/com/sun/star/lib/uno/protocols/urp/Cache.java b/jurt/com/sun/star/lib/uno/protocols/urp/Cache.java index d9c57af30cce..437b2006207e 100644 --- a/jurt/com/sun/star/lib/uno/protocols/urp/Cache.java +++ b/jurt/com/sun/star/lib/uno/protocols/urp/Cache.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -52,7 +52,7 @@ final class Cache { if (e == null) { if (map.size() < maxSize) { // There is still room for a new entry at the front: - e = new Entry(content, map.size(), null, first); + e = new Entry(content, map.size(), last, null); if (first == null) { last = e; } else { diff --git a/jurt/com/sun/star/lib/uno/protocols/urp/Marshal.java b/jurt/com/sun/star/lib/uno/protocols/urp/Marshal.java index 2a43041916ce..a400614bf39c 100644 --- a/jurt/com/sun/star/lib/uno/protocols/urp/Marshal.java +++ b/jurt/com/sun/star/lib/uno/protocols/urp/Marshal.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite diff --git a/jurt/com/sun/star/lib/uno/protocols/urp/PendingRequests.java b/jurt/com/sun/star/lib/uno/protocols/urp/PendingRequests.java index ac3e039224aa..e42a045204fa 100644 --- a/jurt/com/sun/star/lib/uno/protocols/urp/PendingRequests.java +++ b/jurt/com/sun/star/lib/uno/protocols/urp/PendingRequests.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite diff --git a/jurt/com/sun/star/lib/uno/protocols/urp/Unmarshal.java b/jurt/com/sun/star/lib/uno/protocols/urp/Unmarshal.java index 5a500ad3a0c1..36a0720ea83f 100644 --- a/jurt/com/sun/star/lib/uno/protocols/urp/Unmarshal.java +++ b/jurt/com/sun/star/lib/uno/protocols/urp/Unmarshal.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite diff --git a/jurt/com/sun/star/lib/uno/protocols/urp/UrpMessage.java b/jurt/com/sun/star/lib/uno/protocols/urp/UrpMessage.java index 57770dcb0401..2e2c6b96ada9 100644 --- a/jurt/com/sun/star/lib/uno/protocols/urp/UrpMessage.java +++ b/jurt/com/sun/star/lib/uno/protocols/urp/UrpMessage.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite diff --git a/jurt/com/sun/star/lib/uno/protocols/urp/urp.java b/jurt/com/sun/star/lib/uno/protocols/urp/urp.java index a158e1138db1..3e33a6657b3b 100644 --- a/jurt/com/sun/star/lib/uno/protocols/urp/urp.java +++ b/jurt/com/sun/star/lib/uno/protocols/urp/urp.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -30,7 +30,6 @@ package com.sun.star.lib.uno.protocols.urp; import com.sun.star.bridge.InvalidProtocolChangeException; import com.sun.star.bridge.ProtocolProperty; import com.sun.star.bridge.XProtocolProperties; -import com.sun.star.lang.DisposedException; import com.sun.star.lib.uno.environments.remote.IProtocol; import com.sun.star.lib.uno.environments.remote.Message; import com.sun.star.lib.uno.environments.remote.ThreadId; @@ -80,15 +79,6 @@ public final class urp implements IProtocol { } } - // @see IProtocol#terminate - public void terminate() { - synchronized (monitor) { - state = STATE_TERMINATED; - initialized = true; - monitor.notifyAll(); - } - } - // @see IProtocol#readMessage public Message readMessage() throws IOException { for (;;) { @@ -135,9 +125,6 @@ public final class urp implements IProtocol { throw new RuntimeException(e.toString()); } } - if (state == STATE_TERMINATED) { - throw new DisposedException(); - } return writeRequest(false, oid, type, function, tid, arguments); } } @@ -388,6 +375,7 @@ public final class urp implements IProtocol { if ((header & HEADER_NEWTID) != 0) { inL1Tid = unmarshal.readThreadId(); } + //TODO: check HEADER_IGNORECACHE return readRequest(funId, sync); } @@ -696,6 +684,7 @@ public final class urp implements IProtocol { private static final int HEADER_NEWOID = 0x10; private static final int HEADER_NEWTID = 0x08; private static final int HEADER_FUNCTIONID16 = 0x04; + private static final int HEADER_IGNORECACHE = 0x02; private static final int HEADER_MOREFLAGS = 0x01; private static final int HEADER_MUSTREPLY = 0x80; private static final int HEADER_SYNCHRONOUS = 0x40; @@ -712,7 +701,6 @@ public final class urp implements IProtocol { private static final int STATE_REQUESTED = 2; private static final int STATE_COMMITTED = 3; private static final int STATE_WAIT = 4; - private static final int STATE_TERMINATED = 5; private static final int MAX_RELEASE_QUEUE_SIZE = 100; diff --git a/jurt/com/sun/star/lib/util/AsynchronousFinalizer.java b/jurt/com/sun/star/lib/util/AsynchronousFinalizer.java index 32303775b191..9b002a16afb2 100644 --- a/jurt/com/sun/star/lib/util/AsynchronousFinalizer.java +++ b/jurt/com/sun/star/lib/util/AsynchronousFinalizer.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite diff --git a/jurt/com/sun/star/lib/util/NativeLibraryLoader.java b/jurt/com/sun/star/lib/util/NativeLibraryLoader.java index 05455a87814d..da2298066995 100644 --- a/jurt/com/sun/star/lib/util/NativeLibraryLoader.java +++ b/jurt/com/sun/star/lib/util/NativeLibraryLoader.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite diff --git a/jurt/com/sun/star/lib/util/StringHelper.java b/jurt/com/sun/star/lib/util/StringHelper.java index 5962d19e7b14..3ff2abfb78fd 100644 --- a/jurt/com/sun/star/lib/util/StringHelper.java +++ b/jurt/com/sun/star/lib/util/StringHelper.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite diff --git a/jurt/com/sun/star/lib/util/UrlToFileMapper.java b/jurt/com/sun/star/lib/util/UrlToFileMapper.java index 22b6ccf0a745..c356e8410b2c 100644 --- a/jurt/com/sun/star/lib/util/UrlToFileMapper.java +++ b/jurt/com/sun/star/lib/util/UrlToFileMapper.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -40,7 +40,7 @@ import java.net.URLEncoder; * @since UDK 3.2.8 */ public final class UrlToFileMapper { - + // java.net.URLEncoder.encode(String, String) and java.net.URI are only // available since Java 1.4: private static Method urlEncoderEncode; @@ -155,7 +155,7 @@ public final class UrlToFileMapper { } } return buf.toString(); - } + } private UrlToFileMapper() {} } diff --git a/jurt/com/sun/star/uno/AnyConverter.java b/jurt/com/sun/star/uno/AnyConverter.java index cbd13fe8589a..d2d01cc64806 100644 --- a/jurt/com/sun/star/uno/AnyConverter.java +++ b/jurt/com/sun/star/uno/AnyConverter.java @@ -33,7 +33,7 @@ public class AnyConverter } return t; } - + /** checks if the any contains the idl type <code>void</code>. @param object the object to check @return true when the any is void, false otherwise @@ -80,7 +80,7 @@ public class AnyConverter */ static public boolean isInt(Object object){ return containsType(TypeClass.LONG, object); - } + } /** checks if the any contains a value of the idl type <code>hyper</code> (which maps to a java-long). @param object the object to check @@ -104,7 +104,7 @@ public class AnyConverter */ static public boolean isDouble(Object object){ return containsType(TypeClass.DOUBLE, object); - } + } /** checks if the any contains a value of the idl type <code>string</code>. @param object the object to check @@ -113,7 +113,7 @@ public class AnyConverter static public boolean isString(Object object){ return containsType(TypeClass.STRING, object); } - + /** checks if the any contains a value of the idl type <code>enum</code>. @param object the object to check @return true if the any contains an enum, false otherwise @@ -129,7 +129,7 @@ public class AnyConverter */ static public boolean isType(Object object){ return containsType(TypeClass.TYPE, object); - } + } /** checks if the any contains an interface, struct, exception, sequence or enum. If <em>object</em> is an any with an interface type, then true is also returned if @@ -147,7 +147,7 @@ public class AnyConverter TypeClass.SEQUENCE_value == tc || TypeClass.ENUM_value == tc); } - + /** checks if the any contains UNO idl sequence value (meaning a java array containing elements which are values of UNO idl types). @param object the object to check @@ -189,16 +189,16 @@ public class AnyConverter Byte ret= (Byte)convertSimple(TypeClass.BYTE, null, object); return ret.byteValue(); } - + /** converts a number object into a simple short and allows widening conversions. Allowed argument types are Byte, Short or Any containing these types. @param object the object to convert @throws com.sun.star.lang.IllegalArgumentException in case no short or byte is contained within object @return the short contained within the object - */ + */ static public short toShort(Object object) throws com.sun.star.lang.IllegalArgumentException{ Short ret= (Short)convertSimple(TypeClass.SHORT, null, object); - return ret.shortValue(); + return ret.shortValue(); } /** converts a number object into an idl unsigned short and allows widening conversions. Allowed argument types are Anies containing idl unsigned short values. @@ -206,7 +206,7 @@ public class AnyConverter @throws com.sun.star.lang.IllegalArgumentException in case no idl unsigned short is contained within Any @return an (unsigned) short - */ + */ static public short toUnsignedShort(Object object) throws com.sun.star.lang.IllegalArgumentException { @@ -219,7 +219,7 @@ public class AnyConverter @param object the object to convert @throws com.sun.star.lang.IllegalArgumentException in case no short, byte or int is contained within object. @return the int contained within the object - */ + */ static public int toInt(Object object) throws com.sun.star.lang.IllegalArgumentException{ Integer ret= (Integer) convertSimple( TypeClass.LONG, null, object); return ret.intValue(); @@ -230,7 +230,7 @@ public class AnyConverter @throws com.sun.star.lang.IllegalArgumentException in case no idl unsigned short nor unsigned long is contained within Any @return an (unsigned) int - */ + */ static public int toUnsignedInt(Object object) throws com.sun.star.lang.IllegalArgumentException { @@ -244,7 +244,7 @@ public class AnyConverter @throws com.sun.star.lang.IllegalArgumentException in case no short, byte, int or long is contained within object. @return the long contained within the object - */ + */ static public long toLong(Object object) throws com.sun.star.lang.IllegalArgumentException{ Long ret= (Long) convertSimple( TypeClass.HYPER, null, object); return ret.longValue(); @@ -257,7 +257,7 @@ public class AnyConverter in case no idl unsigned short, nor unsigned long nor unsigned hyper is contained within object. @return an (unsigned) long - */ + */ static public long toUnsignedLong(Object object) throws com.sun.star.lang.IllegalArgumentException { @@ -271,7 +271,7 @@ public class AnyConverter @throws com.sun.star.lang.IllegalArgumentException in case no byte, short or float is contained within object. @return the float contained within the object - */ + */ static public float toFloat(Object object) throws com.sun.star.lang.IllegalArgumentException{ Float ret= (Float) convertSimple( TypeClass.FLOAT,null, object); return ret.floatValue(); @@ -283,36 +283,36 @@ public class AnyConverter @throws com.sun.star.lang.IllegalArgumentException in case no byte, short, int, float or double is contained within object. @return the double contained within the object - */ + */ static public double toDouble(Object object) throws com.sun.star.lang.IllegalArgumentException { Double ret= (Double) convertSimple( TypeClass.DOUBLE, null, object); return ret.doubleValue(); } - + /** converts a string or an any containing a string into a string. @param object the object to convert @throws com.sun.star.lang.IllegalArgumentException in case no string is contained within object. @return the string contained within the object - */ + */ static public String toString(Object object) throws com.sun.star.lang.IllegalArgumentException { return (String) convertSimple( TypeClass.STRING, null, object); } - + /** converts a Type or an any containing a Type into a Type. @param object the object to convert @throws com.sun.star.lang.IllegalArgumentException in case no type is contained within object. @return the type contained within the object - */ + */ static public Type toType(Object object) throws com.sun.star.lang.IllegalArgumentException { return (Type) convertSimple( TypeClass.TYPE, null, object); } - + /** converts a UNO object (struct, exception, sequence, enum or interface) or an Any containing * these types into an UNO object of a specified destination type. * For interfaces, the argument <em>object</em> is queried for the interface specified * by the <em>type</em> argument. That query (UnoRuntime.queryInterface) might return null, * if the interface is not implemented or a null-ref or a VOID any is given. - * + * * @param type type of the returned value * @param object the object that is to be converted * @return destination object @@ -329,7 +329,7 @@ public class AnyConverter * For interfaces, the argument <em>object</em> is queried for the interface specified * by the <em>type</em> argument. That query (UnoRuntime.queryInterface) might return null, * if the interface is not implemented or a null-ref or a VOID any is given. - * + * * @param clazz class of the returned value * @param object the object that is to be converted * @return destination object @@ -341,16 +341,16 @@ public class AnyConverter { return toObject( new Type( clazz ), object ); } - + /** converts an array or an any containing an array into an array. @param object the object to convert @throws com.sun.star.lang.IllegalArgumentException in case no array is contained within object. @return the array contained within the object - */ + */ static public Object toArray( Object object) throws com.sun.star.lang.IllegalArgumentException { return convertSimple( TypeClass.SEQUENCE, null, object); } - + /** Examines the argument <em>object</em> if is correspond to the type in argument <em>what</em>. <em>object</em> is either matched directly against the type or if it is an any then the @@ -359,9 +359,9 @@ public class AnyConverter static private boolean containsType( TypeClass what, Object object){ return (getType(object).getTypeClass().getValue() == what.getValue()); } - + static private final Type m_XInterface_type = new Type( XInterface.class ); - + static private Object convertSimple( TypeClass destTClass, Type destType, Object object_ ) throws com.sun.star.lang.IllegalArgumentException { @@ -382,10 +382,10 @@ public class AnyConverter object = object_; type = (null == object ? m_XInterface_type : new Type( object.getClass() )); } - + int tc = type.getTypeClass().getValue(); int dest_tc = destTClass.getValue(); - + if (null == object) { // special for interfaces @@ -423,7 +423,7 @@ public class AnyConverter case TypeClass.UNSIGNED_SHORT_value: return object; } - break; + break; case TypeClass.LONG_value: switch (tc) { diff --git a/jurt/com/sun/star/uno/Ascii.java b/jurt/com/sun/star/uno/Ascii.java index 866bcf3960b3..c9eac0a22569 100644 --- a/jurt/com/sun/star/uno/Ascii.java +++ b/jurt/com/sun/star/uno/Ascii.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -27,16 +27,16 @@ package com.sun.star.uno; -/** +/** * The Ascii class represents the IDL build in type <code>ascii</code>. * <p> - * @version $Revision: 1.5 $ $ $Date: 2008-04-11 11:27:21 $ - * @author Markus Meyer - * @deprecated do not use + * @version $Revision: 1.5 $ $ $Date: 2008-04-11 11:27:21 $ + * @author Markus Meyer + * @deprecated do not use */ public final class Ascii { public final char ascii; - + /** * Constructs a new <code>Ascii</code>. * <p> diff --git a/jurt/com/sun/star/uno/AsciiString.java b/jurt/com/sun/star/uno/AsciiString.java index 245375cf1fab..741f0f8917e5 100644 --- a/jurt/com/sun/star/uno/AsciiString.java +++ b/jurt/com/sun/star/uno/AsciiString.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -27,20 +27,20 @@ package com.sun.star.uno; -/** +/** * The Ascii class represents the IDL build in type <code>asciistring</code>. * <p> - * @version $Revision: 1.5 $ $ $Date: 2008-04-11 11:27:42 $ - * @author Markus Meyer - * @deprecated do not use + * @version $Revision: 1.5 $ $ $Date: 2008-04-11 11:27:42 $ + * @author Markus Meyer + * @deprecated do not use */ public final class AsciiString { - public final String asciistring; + public final String asciistring; /** * Constructs a new <code>AsciiString</code>. * <p> - * @deprecated do not use + * @deprecated do not use * @param s the String value */ public AsciiString(String s) { diff --git a/jurt/com/sun/star/uno/MappingException.java b/jurt/com/sun/star/uno/MappingException.java index dc65676e1181..6f9591cfb491 100644 --- a/jurt/com/sun/star/uno/MappingException.java +++ b/jurt/com/sun/star/uno/MappingException.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -33,7 +33,7 @@ package com.sun.star.uno; * The exception is replaced by the com.sun.star.lang.DisposedException. * @deprecated since UDK 3.0.2 * <p> - * @version $Revision: 1.6 $ $ $Date: 2008-04-11 11:28:00 $ + * @version $Revision: 1.6 $ $ $Date: 2008-04-11 11:28:00 $ * @see com.sun.star.uno.UnoRuntime * @see com.sun.star.uno.IQueryInterface * @see com.sun.star.uno.IBridge diff --git a/jurt/com/sun/star/uno/WeakReference.java b/jurt/com/sun/star/uno/WeakReference.java index 904524d8c049..c9065078ab86 100644 --- a/jurt/com/sun/star/uno/WeakReference.java +++ b/jurt/com/sun/star/uno/WeakReference.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -47,7 +47,7 @@ public class WeakReference // ref would not be notified (XReference.dispose()) because it did not register // itself. Therefore the XAdapter would be kept aliver although this is not // necessary. - + /** Creates an instance of this class. *@param obj - another instance that is to be copied */ @@ -68,7 +68,7 @@ public class WeakReference } } } - + /** Creates an instance of this class. *@param obj XWeak implementation */ @@ -94,14 +94,14 @@ public class WeakReference } /** Implementation of com.sun.star.uno.XReference for use with WeakReference. - * It keeps the XAdapter implementation and registers always with it. Deregistering + * It keeps the XAdapter implementation and registers always with it. Deregistering * occurs on notification by the adapter and the adapter is released. */ class OWeakRefListener implements XReference { private final boolean DEBUG= false; private XAdapter m_adapter; - + /** The constructor registered this object with adapter. *@param adapter the XAdapter implementation. */ @@ -110,7 +110,7 @@ class OWeakRefListener implements XReference m_adapter= adapter; m_adapter.addReference(this); } - /** Method of com.sun.star.uno.XReference. When called, it deregisteres this + /** Method of com.sun.star.uno.XReference. When called, it deregisteres this * object with the adapter and releases the reference to it. */ synchronized public void dispose() @@ -121,8 +121,8 @@ class OWeakRefListener implements XReference m_adapter= null; } } - - /** Obtains a hard reference to the object which is kept weak by the adapter + + /** Obtains a hard reference to the object which is kept weak by the adapter * and returns it. * @return hard reference to the otherwise weakly kept object. */ @@ -136,7 +136,7 @@ class OWeakRefListener implements XReference { // If this object registered as listener with XAdapter while it was notifying // the listeners then this object might not have been notified. If queryAdapted - // returned null then the weak kept object is dead and the listeners have already + // returned null then the weak kept object is dead and the listeners have already // been notified. And we missed it. m_adapter.removeReference(this); m_adapter= null; diff --git a/jurt/demo/com/sun/star/demo/DemoServer.java b/jurt/demo/com/sun/star/demo/DemoServer.java index 53f258b5bd46..d36919ba4082 100644 --- a/jurt/demo/com/sun/star/demo/DemoServer.java +++ b/jurt/demo/com/sun/star/demo/DemoServer.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -54,7 +54,7 @@ public class DemoServer { } static public void main(String args[]) throws Exception { - if(args.length != 1) { + if(args.length != 1) { System.err.println("usage : SCalc uno:connection;protocol;objectName"); System.exit(-1); } @@ -64,7 +64,7 @@ public class DemoServer { String rootOid = null; String dcp = args[0]; - + if(dcp.indexOf(';') == -1) {// use old style conDcp = dcp; protDcp = "iiop"; diff --git a/jurt/demo/com/sun/star/demo/TestOffice.java b/jurt/demo/com/sun/star/demo/TestOffice.java index 5ff3fa77d9e8..7fd08768ce87 100644 --- a/jurt/demo/com/sun/star/demo/TestOffice.java +++ b/jurt/demo/com/sun/star/demo/TestOffice.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -68,8 +68,8 @@ public class TestOffice { bytes[0] = 42; rOut.writeBytes(bytes); } - - + + { byte bytes[][] = new byte[1][]; @@ -96,7 +96,7 @@ public class TestOffice { byte pcText[] = new byte[1024]; pcText[0] = 0; System.err.println("pleast type any text\n"); - while(true) { + while(true) { System.in.read(pcText); String string = new String(pcText); @@ -125,16 +125,16 @@ public class TestOffice { "www.heise.de\n", }; - for(int i = 0; i < urls.length; ++ i) { + for(int i = 0; i < urls.length; ++ i) { System.err.println("press any key to open " + docu[i]); System.in.read(); while(System.in.available() > 0) System.in.read(); - XComponent rComponent = rLoader.loadComponentFromURL(urls[i], "_blank", 0, new PropertyValue[0]); + XComponent rComponent = rLoader.loadComponentFromURL(urls[i], "_blank", 0, new PropertyValue[0]); -// testWriter(rComponent); +// testWriter(rComponent); System.err.println("press any key to close the document"); System.in.read(); while(System.in.available() > 0) @@ -150,11 +150,11 @@ public class TestOffice { if(rName != null) { System.err.println("got the remote naming service !"); Object rXsmgr = rName.getRegisteredObject("StarOffice.ServiceManager"); - + XMultiServiceFactory rSmgr = UnoRuntime.queryInterface(XMultiServiceFactory.class, rXsmgr); if(rSmgr != null) { System.err.println("got the remote service manager !"); -// testPipe(rSmgr); +// testPipe(rSmgr); testDocument(rSmgr); } } @@ -171,7 +171,7 @@ public class TestOffice { }; public static void main(String argv[]) throws Exception { - if(argv.length != 1) { + if(argv.length != 1) { System.err.println("usage : testoffice uno:connection;protocol;objectName"); System.exit(-1); } diff --git a/jurt/demo/com/sun/star/demo/makefile.mk b/jurt/demo/com/sun/star/demo/makefile.mk index c009a2afa183..6bc3e1ae9da7 100644 --- a/jurt/demo/com/sun/star/demo/makefile.mk +++ b/jurt/demo/com/sun/star/demo/makefile.mk @@ -34,7 +34,6 @@ TARGET := com_sun_star_demo RDB=$(SOLARBINDIR)$/applicat.rdb # --- Settings ----------------------------------------------------- - .INCLUDE : settings.mk #Files -------------------------------------------------------- @@ -54,4 +53,5 @@ JAVAFILES= $(subst,$(CLASSDIR)$/$(PACKAGE)$/, $(subst,.class,.java $(JAVACLASSFI # --- Targets ------------------------------------------------------ + .INCLUDE : target.mk diff --git a/jurt/prj/build.lst b/jurt/prj/build.lst index 6ba92a9ec6b6..9b9b722bc3ae 100644 --- a/jurt/prj/build.lst +++ b/jurt/prj/build.lst @@ -17,4 +17,3 @@ ju jurt\com\sun\star\comp\urlresolver nmake - all ju_urlres ju_co_loader NULL ju jurt\source\pipe nmake - all ju_src_pipe NULL ju jurt\source\pipe\wrapper nmake - w ju_src_pipe_wrapper NULL ju jurt\util nmake - all ju_ut ju_brid_jrm ju_co_bfactr ju_con ju_con_sock ju_con_pipe ju_cssl_uno ju_env_java ju_prot_urp ju_servman ju_urlres ju_src_pipe ju_libutil ju_uno NULL -ju jurt\test\com\sun\star\lib\uno\protocols\urp nmake - all ju_test_css_lib_uno_protocols_urp NULL diff --git a/jurt/prj/d.lst b/jurt/prj/d.lst index 499812e28a93..a55c9fa3572c 100644 --- a/jurt/prj/d.lst +++ b/jurt/prj/d.lst @@ -3,6 +3,5 @@ ..\%__SRC%\bin\jpipx.dll %_DEST%\bin%_EXT%\jpipx.dll ..\%__SRC%\lib\libjpipe*.so %_DEST%\lib%_EXT%\libjpipe*.so ..\%__SRC%\lib\libjpipe.jnilib %_DEST%\lib%_EXT%\libjpipe.jnilib -..\%__SRC%\lib\libjpipe*.jnilib %_DEST%\lib%_EXT%\libjpipe*.jnilib ..\%__SRC%\bin\jurt_src.zip %COMMON_DEST%\bin%_EXT%\jurt_src.zip diff --git a/jurt/source/pipe/com_sun_star_lib_connections_pipe_PipeConnection.c b/jurt/source/pipe/com_sun_star_lib_connections_pipe_PipeConnection.c index 0866e452424e..bf88fd32e645 100644 --- a/jurt/source/pipe/com_sun_star_lib_connections_pipe_PipeConnection.c +++ b/jurt/source/pipe/com_sun_star_lib_connections_pipe_PipeConnection.c @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -69,9 +69,9 @@ static rtl_uString * jstring2ustring(JNIEnv * env, jstring jstr); static oslPipe getPipe(JNIEnv * env, jobject obj_this) { - jclass tclass; - jfieldID fid; - tclass = (*env)->GetObjectClass(env, obj_this); + jclass tclass; + jfieldID fid; + tclass = (*env)->GetObjectClass(env, obj_this); if (tclass == NULL) { ThrowException(env, @@ -80,7 +80,7 @@ static oslPipe getPipe(JNIEnv * env, jobject obj_this) return NULL; } - fid = (*env)->GetFieldID(env, tclass, "_nPipeHandle", "J"); + fid = (*env)->GetFieldID(env, tclass, "_nPipeHandle", "J"); if (fid == NULL) { ThrowException(env, @@ -97,9 +97,9 @@ static oslPipe getPipe(JNIEnv * env, jobject obj_this) static rtl_uString * jstring2ustring(JNIEnv * env, jstring jstr) { - const char * cstr; - rtl_uString * ustr = NULL; - cstr = (*env)->GetStringUTFChars(env, jstr, NULL); + const char * cstr; + rtl_uString * ustr = NULL; + cstr = (*env)->GetStringUTFChars(env, jstr, NULL); rtl_uString_newFromAscii(&ustr, cstr); (*env)->ReleaseStringUTFChars(env, jstr, cstr); return ustr; @@ -120,20 +120,20 @@ JNICALL Java_com_sun_star_lib_connections_pipe_PipeConnection_createJNI (JNIEnv * env, jobject obj_this, jstring name) { enum { - START = 0, + START = 0, INMONITOR, GOTNAME, CREATED }; - short state = START; + short state = START; - jclass tclass; - jfieldID fid; + jclass tclass; + jfieldID fid; oslSecurity psec = osl_getCurrentSecurity(); - oslPipe npipe = NULL; - rtl_uString * pname = NULL; + oslPipe npipe = NULL; + rtl_uString * pname = NULL; if ((*env)->MonitorEnter(env, obj_this) != 0) { ThrowException(env, @@ -141,10 +141,10 @@ JNICALL Java_com_sun_star_lib_connections_pipe_PipeConnection_createJNI "native pipe cannot synchronize on the object"); goto error; } - state = INMONITOR; + state = INMONITOR; /* check connection state */ - npipe = getPipe(env, obj_this); + npipe = getPipe(env, obj_this); if ((*env)->ExceptionOccurred(env) != NULL) goto error; if (npipe != NULL) @@ -156,7 +156,7 @@ JNICALL Java_com_sun_star_lib_connections_pipe_PipeConnection_createJNI } /* save the pipe name */ - tclass = (*env)->GetObjectClass(env, obj_this); + tclass = (*env)->GetObjectClass(env, obj_this); if (tclass == NULL) { ThrowException(env, @@ -165,7 +165,7 @@ JNICALL Java_com_sun_star_lib_connections_pipe_PipeConnection_createJNI goto error; } - fid = (*env)->GetFieldID(env, tclass, + fid = (*env)->GetFieldID(env, tclass, "_aDescription", "Ljava/lang/String;"); if (fid == NULL) { @@ -178,7 +178,7 @@ JNICALL Java_com_sun_star_lib_connections_pipe_PipeConnection_createJNI (*env)->SetObjectField(env, obj_this, fid, (jobject)name); /* convert pipe name to rtl_uString */ - pname = jstring2ustring(env, name); + pname = jstring2ustring(env, name); if (pname == NULL) { ThrowException(env, @@ -186,10 +186,10 @@ JNICALL Java_com_sun_star_lib_connections_pipe_PipeConnection_createJNI "native pipe cannot convert name"); goto error; } - state = GOTNAME; + state = GOTNAME; /* try to connect */ - npipe = osl_createPipe(pname, osl_Pipe_OPEN, psec); + npipe = osl_createPipe(pname, osl_Pipe_OPEN, psec); if (npipe == NULL) { ThrowException(env, @@ -197,10 +197,10 @@ JNICALL Java_com_sun_star_lib_connections_pipe_PipeConnection_createJNI "cannot create native pipe"); goto error; } - state = CREATED; + state = CREATED; /* save the pipe */ - tclass = (*env)->GetObjectClass(env, obj_this); + tclass = (*env)->GetObjectClass(env, obj_this); if (tclass == NULL) { ThrowException(env, @@ -209,7 +209,7 @@ JNICALL Java_com_sun_star_lib_connections_pipe_PipeConnection_createJNI goto error; } - fid = (*env)->GetFieldID(env, tclass, "_nPipeHandle", "J"); + fid = (*env)->GetFieldID(env, tclass, "_nPipeHandle", "J"); if (fid == NULL) { ThrowException(env, @@ -259,14 +259,14 @@ JNICALL Java_com_sun_star_lib_connections_pipe_PipeConnection_closeJNI (JNIEnv * env, jobject obj_this) { enum { - START = 0, + START = 0, INMONITOR }; - short state = START; - oslPipe npipe; /* native pipe */ - jclass tclass; /* this class */ - jfieldID fid; /* a field identifier */ + short state = START; + oslPipe npipe; /* native pipe */ + jclass tclass; /* this class */ + jfieldID fid; /* a field identifier */ if ((*env)->MonitorEnter(env, obj_this) != 0) { @@ -275,10 +275,10 @@ JNICALL Java_com_sun_star_lib_connections_pipe_PipeConnection_closeJNI "native pipe cannot synchronize on the object"); goto error; } - state = INMONITOR; + state = INMONITOR; /* check connection state */ - npipe = getPipe(env, obj_this); + npipe = getPipe(env, obj_this); if ((*env)->ExceptionOccurred(env) != NULL) goto error; if (npipe == NULL) @@ -290,7 +290,7 @@ JNICALL Java_com_sun_star_lib_connections_pipe_PipeConnection_closeJNI } /* remove the reference to the pipe */ - tclass = (*env)->GetObjectClass(env, obj_this); + tclass = (*env)->GetObjectClass(env, obj_this); if (tclass == NULL) { ThrowException(env, @@ -299,7 +299,7 @@ JNICALL Java_com_sun_star_lib_connections_pipe_PipeConnection_closeJNI goto error; } - fid = (*env)->GetFieldID(env, tclass, "_nPipeHandle", "J"); + fid = (*env)->GetFieldID(env, tclass, "_nPipeHandle", "J"); if (fid == NULL) { ThrowException(env, @@ -345,13 +345,13 @@ JNICALL Java_com_sun_star_lib_connections_pipe_PipeConnection_readJNI (JNIEnv * env, jobject obj_this, jobjectArray buffer, jint len) { enum { - START = 0, + START = 0, INMONITOR, AQUIRED, GOTBUFFER }; - short state = START; + short state = START; oslPipe npipe; /* native pipe */ void * nbuff = NULL; /* native read buffer */ jbyteArray bytes; /* java read buffer */ @@ -368,7 +368,7 @@ JNICALL Java_com_sun_star_lib_connections_pipe_PipeConnection_readJNI state = INMONITOR; /* check connection state */ - npipe = getPipe(env, obj_this); + npipe = getPipe(env, obj_this); if ((*env)->ExceptionOccurred(env) != NULL) goto error; if (npipe == NULL) @@ -412,7 +412,7 @@ JNICALL Java_com_sun_star_lib_connections_pipe_PipeConnection_readJNI /* copy buffer */ if (nread >= 0) { - bytes = (*env)->NewByteArray(env, len); + bytes = (*env)->NewByteArray(env, len); if (bytes == NULL) { ThrowException(env, @@ -465,12 +465,12 @@ JNICALL Java_com_sun_star_lib_connections_pipe_PipeConnection_writeJNI (JNIEnv * env, jobject obj_this, jbyteArray buffer) { enum { - START = 0, + START = 0, INMONITOR, GOTBUFFER }; - short state = START; + short state = START; oslPipe npipe; /* native pipe */ long count; /* number of bytes has been written */ jsize nwrite; /* number of bytes to write */ @@ -483,10 +483,10 @@ JNICALL Java_com_sun_star_lib_connections_pipe_PipeConnection_writeJNI "native pipe cannot synchronize on the object"); goto error; } - state = INMONITOR; + state = INMONITOR; /* check connection state */ - npipe = getPipe(env, obj_this); + npipe = getPipe(env, obj_this); if ((*env)->ExceptionOccurred(env) != NULL) goto error; if (npipe == NULL) @@ -497,10 +497,10 @@ JNICALL Java_com_sun_star_lib_connections_pipe_PipeConnection_writeJNI goto error; } - nwrite = (*env)->GetArrayLength(env, buffer); + nwrite = (*env)->GetArrayLength(env, buffer); if (nwrite > 0) { - nbuff = (*env)->GetByteArrayElements(env, buffer, NULL); + nbuff = (*env)->GetByteArrayElements(env, buffer, NULL); if (nbuff == NULL) { ThrowException(env, @@ -508,11 +508,11 @@ JNICALL Java_com_sun_star_lib_connections_pipe_PipeConnection_writeJNI "native pipe out of memory"); goto error; } - state = GOTBUFFER; + state = GOTBUFFER; (*env)->MonitorExit(env, obj_this); /* writing */ - count = osl_writePipe(npipe, nbuff, nwrite); + count = osl_writePipe(npipe, nbuff, nwrite); if ((*env)->MonitorEnter(env, obj_this) != 0) { ThrowException(env, diff --git a/jurt/source/pipe/makefile.mk b/jurt/source/pipe/makefile.mk index 4a6dc59c89c2..5be6f1ebfd10 100644 --- a/jurt/source/pipe/makefile.mk +++ b/jurt/source/pipe/makefile.mk @@ -41,7 +41,6 @@ SHL1TARGET = jpipe .END SHL1CODETYPE = C -SHL1CREATEJNILIB=TRUE SHL1IMPLIB = i$(SHL1TARGET) SHL1OBJS = $(SLO)/com_sun_star_lib_connections_pipe_PipeConnection.obj SHL1RPATH = URELIB diff --git a/jurt/test/com/sun/star/comp/bridgefactory/BridgeFactory_Test.java b/jurt/test/com/sun/star/comp/bridgefactory/BridgeFactory_Test.java index d027a412ca5c..781f97e697c2 100644 --- a/jurt/test/com/sun/star/comp/bridgefactory/BridgeFactory_Test.java +++ b/jurt/test/com/sun/star/comp/bridgefactory/BridgeFactory_Test.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite diff --git a/jurt/test/com/sun/star/comp/connections/PipedConnection_Test.java b/jurt/test/com/sun/star/comp/connections/PipedConnection_Test.java index 68f9461745e1..41a2e56f3fee 100644 --- a/jurt/test/com/sun/star/comp/connections/PipedConnection_Test.java +++ b/jurt/test/com/sun/star/comp/connections/PipedConnection_Test.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -46,7 +46,7 @@ public final class PipedConnection_Test extends ComplexTestCase { Reader reader = new Reader(rightSide, theByte); Writer writer = new Writer(leftSide, theByte, reader); - + reader.start(); writer.start(); @@ -74,16 +74,16 @@ public final class PipedConnection_Test extends ComplexTestCase { public void run() { try { byte bytes[][] = new byte[1][]; - + while(!_quit) { int read = _pipedConnection.read(bytes, 1); - + if(read == 1) { // System.err.println("read :" + bytes[0][0]); - + if(_theByte[0] != bytes[0][0]) throw new NullPointerException(); - + synchronized(this) { notifyAll(); } @@ -91,7 +91,7 @@ public final class PipedConnection_Test extends ComplexTestCase { else _quit = true; // EOF } - + _pipedConnection.close(); _state = true; } @@ -122,7 +122,7 @@ public final class PipedConnection_Test extends ComplexTestCase { _pipedConnection.write(_theByte); _pipedConnection.flush(); // System.err.println("written :" + _theByte[0]); - + _reader.wait(); } ++ _theByte[0]; diff --git a/jurt/test/com/sun/star/lib/uno/bridges/java_remote/BridgedObject_Test.java b/jurt/test/com/sun/star/lib/uno/bridges/java_remote/BridgedObject_Test.java index 5327993fa65b..f56ab6679635 100644 --- a/jurt/test/com/sun/star/lib/uno/bridges/java_remote/BridgedObject_Test.java +++ b/jurt/test/com/sun/star/lib/uno/bridges/java_remote/BridgedObject_Test.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite diff --git a/jurt/test/com/sun/star/lib/uno/bridges/java_remote/ProxyFactory_Test.java b/jurt/test/com/sun/star/lib/uno/bridges/java_remote/ProxyFactory_Test.java index 8d0fa09a657a..a83131c0baa3 100644 --- a/jurt/test/com/sun/star/lib/uno/bridges/java_remote/ProxyFactory_Test.java +++ b/jurt/test/com/sun/star/lib/uno/bridges/java_remote/ProxyFactory_Test.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite diff --git a/jurt/test/com/sun/star/lib/uno/bridges/java_remote/java_remote_bridge_Test.java b/jurt/test/com/sun/star/lib/uno/bridges/java_remote/java_remote_bridge_Test.java index 42187fa2277c..040cf7063c15 100644 --- a/jurt/test/com/sun/star/lib/uno/bridges/java_remote/java_remote_bridge_Test.java +++ b/jurt/test/com/sun/star/lib/uno/bridges/java_remote/java_remote_bridge_Test.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite diff --git a/jurt/test/com/sun/star/lib/uno/environments/java/java_environment_Test.java b/jurt/test/com/sun/star/lib/uno/environments/java/java_environment_Test.java index 162c1636c720..80896445e3e4 100644 --- a/jurt/test/com/sun/star/lib/uno/environments/java/java_environment_Test.java +++ b/jurt/test/com/sun/star/lib/uno/environments/java/java_environment_Test.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -42,7 +42,7 @@ public final class java_environment_Test extends ComplexTestCase { public void test() { java_environment env = new java_environment(null); - + Object obj = new Integer(3); String[] oid = new String[1]; diff --git a/jurt/test/com/sun/star/lib/uno/environments/remote/JavaThreadPoolFactory_Test.java b/jurt/test/com/sun/star/lib/uno/environments/remote/JavaThreadPoolFactory_Test.java index 8dc1a767b5fa..1434caed3c58 100644 --- a/jurt/test/com/sun/star/lib/uno/environments/remote/JavaThreadPoolFactory_Test.java +++ b/jurt/test/com/sun/star/lib/uno/environments/remote/JavaThreadPoolFactory_Test.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite diff --git a/jurt/test/com/sun/star/lib/uno/environments/remote/JobQueue_Test.java b/jurt/test/com/sun/star/lib/uno/environments/remote/JobQueue_Test.java index 5e83098b8ecd..83829cd955e1 100644 --- a/jurt/test/com/sun/star/lib/uno/environments/remote/JobQueue_Test.java +++ b/jurt/test/com/sun/star/lib/uno/environments/remote/JobQueue_Test.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite diff --git a/jurt/test/com/sun/star/lib/uno/environments/remote/TestIWorkAt.java b/jurt/test/com/sun/star/lib/uno/environments/remote/TestIWorkAt.java index 1c616a84541b..c4946208ffec 100644 --- a/jurt/test/com/sun/star/lib/uno/environments/remote/TestIWorkAt.java +++ b/jurt/test/com/sun/star/lib/uno/environments/remote/TestIWorkAt.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -35,12 +35,12 @@ import com.sun.star.uno.XInterface; public interface TestIWorkAt extends XInterface { void syncCall() throws Throwable ; void asyncCall() throws Throwable ; - + void increment() throws Throwable; - + void notifyme(); - public static final TypeInfo UNOTYPEINFO[] = { + public static final TypeInfo UNOTYPEINFO[] = { new MethodTypeInfo("increment", 0, 0), new MethodTypeInfo("notifyme", 1, 0), new MethodTypeInfo("syncCall", 2, 0), diff --git a/jurt/test/com/sun/star/lib/uno/environments/remote/TestMessage.java b/jurt/test/com/sun/star/lib/uno/environments/remote/TestMessage.java index f47048e423ed..c4bc556960d7 100644 --- a/jurt/test/com/sun/star/lib/uno/environments/remote/TestMessage.java +++ b/jurt/test/com/sun/star/lib/uno/environments/remote/TestMessage.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -40,7 +40,7 @@ class TestMessage implements IMessage { Object _result; String _operation; Object _params[]; - + TestMessage(boolean synchron, ITypeDescription iTypeDescription, String oid, ThreadId threadId, Object result, String operation, Object params[]) { _synchron = synchron; _iTypeDescription = iTypeDescription; @@ -50,39 +50,39 @@ class TestMessage implements IMessage { _operation = operation; _params = params; } - + public String getOperation() { return _operation; } - + public ThreadId getThreadId() { return _threadId; } - + public ITypeDescription getInterface() { return _iTypeDescription; } - + public boolean isSynchron() { return _synchron; } - + public boolean mustReply() { return _synchron; } - + public boolean isException() { return false; } - + public String getOid() { return _oid; } - + public Object getData(Object params[][]) { params[0] = _params; return _result; -// return new Integer(_requestId); +// return new Integer(_requestId); } } diff --git a/jurt/test/com/sun/star/lib/uno/environments/remote/TestReceiver.java b/jurt/test/com/sun/star/lib/uno/environments/remote/TestReceiver.java index 32ba5ba7473b..0a42d4f2db41 100644 --- a/jurt/test/com/sun/star/lib/uno/environments/remote/TestReceiver.java +++ b/jurt/test/com/sun/star/lib/uno/environments/remote/TestReceiver.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite diff --git a/jurt/test/com/sun/star/lib/uno/environments/remote/TestWorkAt.java b/jurt/test/com/sun/star/lib/uno/environments/remote/TestWorkAt.java index 322d7573c697..c45b020dafce 100644 --- a/jurt/test/com/sun/star/lib/uno/environments/remote/TestWorkAt.java +++ b/jurt/test/com/sun/star/lib/uno/environments/remote/TestWorkAt.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -37,10 +37,10 @@ class TestWorkAt implements TestIWorkAt { int _counter; - + int _sync_counter; int _async_counter; - + Thread _sync_thread; Thread _async_thread; @@ -49,48 +49,48 @@ class TestWorkAt implements TestIWorkAt { public void syncCall() throws Throwable { ++ _sync_counter; - - if(_async_counter != MESSAGES) + + if(_async_counter != MESSAGES) _passedAync = false; - + if(_sync_thread == null) _sync_thread = Thread.currentThread(); -// if(_sync_thread != Thread.currentThread()) -// _passedAync = false; +// if(_sync_thread != Thread.currentThread()) +// _passedAync = false; if(DEBUG) System.err.println("syncCall:" + _sync_counter + " " + _passedAync + " " + Thread.currentThread()); } - + public void asyncCall() throws Throwable { -// Thread.sleep(50); - +// Thread.sleep(50); + ++ _async_counter; if(_async_thread == null) _async_thread = Thread.currentThread(); -// if(_async_thread != Thread.currentThread()) -// _passedAync = false; +// if(_async_thread != Thread.currentThread()) +// _passedAync = false; if(DEBUG) System.err.println("asyncCall:" + _async_counter + " " + Thread.currentThread()); } - + public synchronized void increment() throws Throwable { if(DEBUG) System.err.println("increment - " + Thread.currentThread()); - + ++ _counter; notifyAll(); } - + public synchronized void notifyme() { if(DEBUG) System.err.println("\t\t\tnotifying me" + Thread.currentThread()); - + notifyAll(); _notified = true; } - + public boolean passedAsyncTest() { return _passedAync && (_sync_counter == MESSAGES); } diff --git a/jurt/test/com/sun/star/lib/uno/environments/remote/ThreadId_Test.java b/jurt/test/com/sun/star/lib/uno/environments/remote/ThreadId_Test.java index d9154ce6b0ef..b3ff1c75789a 100644 --- a/jurt/test/com/sun/star/lib/uno/environments/remote/ThreadId_Test.java +++ b/jurt/test/com/sun/star/lib/uno/environments/remote/ThreadId_Test.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite diff --git a/jurt/test/com/sun/star/lib/uno/environments/remote/ThreadPool_Test.java b/jurt/test/com/sun/star/lib/uno/environments/remote/ThreadPool_Test.java index bed90acfbbcb..45c05e72d0f8 100644 --- a/jurt/test/com/sun/star/lib/uno/environments/remote/ThreadPool_Test.java +++ b/jurt/test/com/sun/star/lib/uno/environments/remote/ThreadPool_Test.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite diff --git a/jurt/test/com/sun/star/lib/uno/protocols/urp/Cache_Test.java b/jurt/test/com/sun/star/lib/uno/protocols/urp/Cache_Test.java index 2deb525adeac..650b65f0e544 100644 --- a/jurt/test/com/sun/star/lib/uno/protocols/urp/Cache_Test.java +++ b/jurt/test/com/sun/star/lib/uno/protocols/urp/Cache_Test.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -27,114 +27,80 @@ package com.sun.star.lib.uno.protocols.urp; -import org.junit.Test; -import static org.junit.Assert.*; +import complexlib.ComplexTestCase; + +public final class Cache_Test extends ComplexTestCase { + public String[] getTestMethodNames() { + return new String[] { "test0", "test1", "test2", "test3" }; + } -public final class Cache_Test { - @Test public void test0() { + public void test0() { Cache c = new Cache(0); boolean[] f = new boolean[1]; int i; i = c.add(f, "a"); - assertTrue(i == Cache.NOT_CACHED && !f[0]); + assure("1", i == Cache.NOT_CACHED && !f[0]); i = c.add(f, "a"); - assertTrue(i == Cache.NOT_CACHED && !f[0]); + assure("2", i == Cache.NOT_CACHED && !f[0]); i = c.add(f, "b"); - assertTrue(i == Cache.NOT_CACHED && !f[0]); + assure("3", i == Cache.NOT_CACHED && !f[0]); i = c.add(f, "a"); - assertTrue(i == Cache.NOT_CACHED && !f[0]); + assure("4", i == Cache.NOT_CACHED && !f[0]); } - @Test public void test1() { + public void test1() { Cache c = new Cache(1); boolean[] f = new boolean[1]; int i; i = c.add(f, "a"); - assertTrue(i == 0 && !f[0]); + assure("1", i == 0 && !f[0]); i = c.add(f, "a"); - assertTrue(i == 0 && f[0]); + assure("2", i == 0 && f[0]); i = c.add(f, "b"); - assertTrue(i == 0 && !f[0]); + assure("3", i == 0 && !f[0]); i = c.add(f, "b"); - assertTrue(i == 0 && f[0]); + assure("4", i == 0 && f[0]); i = c.add(f, "a"); - assertTrue(i == 0 && !f[0]); + assure("5", i == 0 && !f[0]); } - @Test public void test2() { + public void test2() { Cache c = new Cache(2); boolean[] f = new boolean[1]; int i; i = c.add(f, "a"); - assertTrue(i == 0 && !f[0]); + assure("1", i == 0 && !f[0]); i = c.add(f, "a"); - assertTrue(i == 0 && f[0]); + assure("2", i == 0 && f[0]); i = c.add(f, "b"); - assertTrue(i == 1 && !f[0]); + assure("3", i == 1 && !f[0]); i = c.add(f, "b"); - assertTrue(i == 1 && f[0]); + assure("4", i == 1 && f[0]); i = c.add(f, "a"); - assertTrue(i == 0 && f[0]); + assure("5", i == 0 && f[0]); i = c.add(f, "c"); - assertTrue(i == 1 && !f[0]); + assure("6", i == 1 && !f[0]); i = c.add(f, "b"); - assertTrue(i == 0 && !f[0]); + assure("7", i == 0 && !f[0]); } - @Test public void test3() { + public void test3() { Cache c = new Cache(3); boolean[] f = new boolean[1]; int i; i = c.add(f, "a"); - assertTrue(i == 0 && !f[0]); + assure("1", i == 0 && !f[0]); i = c.add(f, "a"); - assertTrue(i == 0 && f[0]); + assure("3", i == 0 && f[0]); i = c.add(f, "b"); - assertTrue(i == 1 && !f[0]); + assure("5", i == 1 && !f[0]); i = c.add(f, "a"); - assertTrue(i == 0 && f[0]); + assure("3", i == 0 && f[0]); i = c.add(f, "c"); - assertTrue(i == 2 && !f[0]); + assure("7", i == 2 && !f[0]); i = c.add(f, "d"); - assertTrue(i == 1 && !f[0]); + assure("9", i == 1 && !f[0]); i = c.add(f, "d"); - assertTrue(i == 1 && f[0]); - } - - @Test public void testNothingLostFromLruList() { - // Regardless in what order arbitrary values from 0, ..., 3 are inserted - // into a size-4 cache, afterwards adding -1, ..., -4 must return each - // possible index in the range from 0, ..., 3 exactly once (so their sum - // must be 6); this code systematically tests all such arbitrary ways up - // to length 8 (the code arguably violates recommendations for writing - // good tests, but actually helped track down an error in the Cache - // implementation): - int[] a = new int[8]; - for (int i = 0; i < a.length; ++i) { - for (int j = 0; j < i; ++j) { - a[j] = 0; - } - for (;;) { - Cache c = new Cache(4); - for (int k = 0; k < i; ++k) { - c.add(new boolean[1], a[k]); - } - assertEquals( - 6, - (c.add(new boolean[1], -1) + c.add(new boolean[1], -2) + - c.add(new boolean[1], -3) + c.add(new boolean[1], -4))); - int j = i - 1; - while (j >= 0 && a[j] == 3) { - --j; - } - if (j < 0) { - break; - } - ++a[j]; - for (int k = j + 1; k < i; ++k) { - a[k] = 0; - } - } - } + assure("11", i == 1 && f[0]); } } diff --git a/jurt/test/com/sun/star/lib/uno/protocols/urp/Marshaling_Test.java b/jurt/test/com/sun/star/lib/uno/protocols/urp/Marshaling_Test.java index 2621006faf95..20bc5bca3df0 100644 --- a/jurt/test/com/sun/star/lib/uno/protocols/urp/Marshaling_Test.java +++ b/jurt/test/com/sun/star/lib/uno/protocols/urp/Marshaling_Test.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -32,14 +32,21 @@ import com.sun.star.uno.IBridge; import com.sun.star.uno.Type; import com.sun.star.uno.TypeClass; import com.sun.star.uno.XInterface; +import complexlib.ComplexTestCase; import java.lang.reflect.Array; import java.lang.reflect.Field; import java.lang.reflect.Modifier; -import org.junit.Test; -import static org.junit.Assert.*; -public final class Marshaling_Test { - @Test public void test() throws Exception { +public final class Marshaling_Test extends ComplexTestCase { + public String getTestObjectName() { + return getClass().getName(); + } + + public String[] getTestMethodNames() { + return new String[] { "test" }; + } + + public void test() throws Exception { short cacheSize = (short)256; TestBridge testBridge = new TestBridge(); Marshal marshal = new Marshal(testBridge, cacheSize); @@ -232,7 +239,7 @@ public final class Marshaling_Test { if(op1 instanceof Any) op1 = ((Any)op1).getObject(); - assertTrue(compareObjects(op1, op2)); + assure("", compareObjects(op1, op2)); } } diff --git a/jurt/test/com/sun/star/lib/uno/protocols/urp/Protocol_Test.java b/jurt/test/com/sun/star/lib/uno/protocols/urp/Protocol_Test.java index 6a74710625e9..d9da63b5a7fd 100644 --- a/jurt/test/com/sun/star/lib/uno/protocols/urp/Protocol_Test.java +++ b/jurt/test/com/sun/star/lib/uno/protocols/urp/Protocol_Test.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -34,17 +34,20 @@ import com.sun.star.uno.Any; import com.sun.star.uno.IBridge; import com.sun.star.uno.Type; import com.sun.star.uno.XInterface; +import complexlib.ComplexTestCase; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PipedInputStream; import java.io.PipedOutputStream; import java.util.LinkedList; -import org.junit.Test; -import static org.junit.Assert.*; -public final class Protocol_Test { - @Test public void test() throws Exception { +public final class Protocol_Test extends ComplexTestCase { + public String[] getTestMethodNames() { + return new String[] { "test" }; + } + + public void test() throws Exception { IBridge iBridge = new TestBridge(); PipedInputStream inA = new PipedInputStream(); PipedOutputStream outA = new PipedOutputStream(inA); @@ -90,7 +93,7 @@ public final class Protocol_Test { new Object[] { "hallo" }); Message iMessage = iReceiver.readMessage(); Object[] t_params = iMessage.getArguments(); - assertEquals("hallo", (String)t_params[0]); + assure("", "hallo".equals((String)t_params[0])); // send a reply iReceiver.writeReply(false, new ThreadId(new byte[] { 0, 1 }), null); @@ -115,7 +118,7 @@ public final class Protocol_Test { iReceiver.writeReply(false, new ThreadId(new byte[] { 0, 1 }), null); iSender.readMessage(); - assertEquals("testString", ((String [])params[0])[0]); + assure("", "testString".equals(((String [])params[0])[0])); } public void testCallWithInOutParameter( @@ -130,7 +133,7 @@ public final class Protocol_Test { Object[] t_params = iMessage.getArguments(); - assertEquals("inString", ((String [])t_params[0])[0]); + assure("", "inString".equals(((String [])t_params[0])[0])); // provide reply ((String [])t_params[0])[0] = "outString"; @@ -139,7 +142,7 @@ public final class Protocol_Test { iReceiver.writeReply(false, new ThreadId(new byte[] { 0, 1 }), null); iSender.readMessage(); - assertEquals("outString", ((String [])params[0])[0]); + assure("", "outString".equals(((String [])params[0])[0])); } public void testCallWithResult( @@ -158,7 +161,7 @@ public final class Protocol_Test { Message iMessage = iSender.readMessage(); Object result = iMessage.getResult(); - assertEquals("resultString", result); + assure("", "resultString".equals(result)); } public void testCallWhichRaisesException( @@ -178,7 +181,7 @@ public final class Protocol_Test { Object result = iMessage.getResult(); - assertTrue(result instanceof com.sun.star.uno.RuntimeException); + assure("", result instanceof com.sun.star.uno.RuntimeException); } public void testCallWithIn_Out_InOut_Paramters_and_result( @@ -193,9 +196,9 @@ public final class Protocol_Test { Object[] t_params = iMessage.getArguments(); - assertEquals("hallo", (String)t_params[0]); + assure("", "hallo".equals((String)t_params[0])); - assertEquals("inOutString", ((String [])t_params[2])[0]); + assure("", "inOutString".equals(((String [])t_params[2])[0])); ((String [])t_params[1])[0] = "outString"; ((String [])t_params[2])[0] = "inOutString_res"; @@ -206,11 +209,11 @@ public final class Protocol_Test { iMessage = iSender.readMessage(); Object result = iMessage.getResult(); - assertEquals("outString", ((String [])params[1])[0]); + assure("", "outString".equals(((String [])params[1])[0])); - assertEquals("inOutString_res", ((String [])params[2])[0]); + assure("", "inOutString_res".equals(((String [])params[2])[0])); - assertEquals("resultString", result); + assure("", "resultString".equals(result)); } public void testCallWhichReturnsAny( @@ -226,11 +229,9 @@ public final class Protocol_Test { false, new ThreadId(new byte[] { 0, 1 }), Any.VOID); Message iMessage = iSender.readMessage(); Object result = iMessage.getResult(); - assertTrue( - result instanceof Any && - ((TypeDescription.getTypeDescription(((Any) result).getType()). - getZClass()) == - void.class)); + assure("", result instanceof Any + && (TypeDescription.getTypeDescription(((Any) result).getType()). + getZClass() == void.class)); // send an ordinary request iSender.writeRequest( @@ -243,7 +244,7 @@ public final class Protocol_Test { new Any(XInterface.class, null)); iMessage = iSender.readMessage(); result = iMessage.getResult(); - assertNull(result); + assure("", result == null); // send an ordinary request iSender.writeRequest( @@ -255,7 +256,7 @@ public final class Protocol_Test { false, new ThreadId(new byte[] { 0, 1 }), new Integer(501)); iMessage = iSender.readMessage(); result = iMessage.getResult(); - assertEquals(501, result); + assure("", result.equals(new Integer(501))); } private static final class Endpoint { diff --git a/jurt/test/com/sun/star/lib/uno/protocols/urp/TestBridge.java b/jurt/test/com/sun/star/lib/uno/protocols/urp/TestBridge.java index 34f864ae3085..ab84a983fe45 100644 --- a/jurt/test/com/sun/star/lib/uno/protocols/urp/TestBridge.java +++ b/jurt/test/com/sun/star/lib/uno/protocols/urp/TestBridge.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -40,9 +40,9 @@ class TestBridge implements IBridge { static public final boolean DEBUG = false; Hashtable _hashtable = new Hashtable(); - + IEnvironment _source ;//= new com.sun.star.lib.uno.environments.java.java_environment(null); - + class MyEnv implements IEnvironment { public Object getContext() { @@ -75,7 +75,7 @@ class TestBridge implements IBridge { public void list() { } } - + TestBridge() { _source = new MyEnv(); } @@ -92,24 +92,24 @@ class TestBridge implements IBridge { public Object mapInterfaceFrom(Object object, Type type) { String oid = (String)object; - + return _hashtable.get(oid); } - + public IEnvironment getSourceEnvironment() { return _source; } - + public IEnvironment getTargetEnvironment() { return null; } - + public void acquire() {} public void release() {} - + public void reset() throws IOException {} - + public void dispose() throws InterruptedException, IOException {} } diff --git a/jurt/test/com/sun/star/lib/uno/protocols/urp/TestObject.java b/jurt/test/com/sun/star/lib/uno/protocols/urp/TestObject.java index f6be37207765..c2ff8a58d4c7 100644 --- a/jurt/test/com/sun/star/lib/uno/protocols/urp/TestObject.java +++ b/jurt/test/com/sun/star/lib/uno/protocols/urp/TestObject.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite diff --git a/jurt/test/com/sun/star/lib/uno/protocols/urp/interfaces.idl b/jurt/test/com/sun/star/lib/uno/protocols/urp/interfaces.idl index 1b267c434a0f..b1aba4cf7224 100644 --- a/jurt/test/com/sun/star/lib/uno/protocols/urp/interfaces.idl +++ b/jurt/test/com/sun/star/lib/uno/protocols/urp/interfaces.idl @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -103,7 +103,7 @@ module protocols { module urp { string MethodWithIn_Out_InOut_Paramters_and_result([in] string text, [out] string outtext, [inout] string inouttext) raises( com::sun::star::uno::Exception ); }; - struct TestInterfaceStruct + struct TestInterfaceStruct { com::sun::star::uno::XInterface hallo; diff --git a/jurt/test/com/sun/star/lib/uno/protocols/urp/makefile.mk b/jurt/test/com/sun/star/lib/uno/protocols/urp/makefile.mk index 8403b2bd71ed..c6e66558b65d 100644 --- a/jurt/test/com/sun/star/lib/uno/protocols/urp/makefile.mk +++ b/jurt/test/com/sun/star/lib/uno/protocols/urp/makefile.mk @@ -24,16 +24,10 @@ # for a copy of the LGPLv3 License. # #************************************************************************* - -.IF "$(OOO_SUBSEQUENT_TESTS)" == "" -nothing .PHONY: -.ELSE - PRJ := ..$/..$/..$/..$/..$/..$/..$/.. PRJNAME := jurt TARGET := test_com_sun_star_lib_uno_protocols_urp -.IF "$(OOO_JUNIT_JAR)" != "" PACKAGE := com$/sun$/star$/lib$/uno$/protocols$/urp JAVATESTFILES := \ Cache_Test.java \ @@ -44,8 +38,5 @@ JAVAFILES := \ TestObject.java JARFILES := ridl.jar IDLTESTFILES := interfaces.idl -.END .INCLUDE: javaunittest.mk - -.END diff --git a/jurt/test/com/sun/star/lib/util/NativeLibraryLoader_Test.java b/jurt/test/com/sun/star/lib/util/NativeLibraryLoader_Test.java index fbb92f9b88ee..723d2e0d055a 100644 --- a/jurt/test/com/sun/star/lib/util/NativeLibraryLoader_Test.java +++ b/jurt/test/com/sun/star/lib/util/NativeLibraryLoader_Test.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite diff --git a/jurt/test/com/sun/star/uno/AnyConverter_Test.java b/jurt/test/com/sun/star/uno/AnyConverter_Test.java index 126b009c4e9a..73c972867694 100644 --- a/jurt/test/com/sun/star/uno/AnyConverter_Test.java +++ b/jurt/test/com/sun/star/uno/AnyConverter_Test.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite diff --git a/jurt/test/com/sun/star/uno/UnoRuntime_EnvironmentTest.java b/jurt/test/com/sun/star/uno/UnoRuntime_EnvironmentTest.java index 0ee0e1d32ccd..eef51f5bb5bd 100644 --- a/jurt/test/com/sun/star/uno/UnoRuntime_EnvironmentTest.java +++ b/jurt/test/com/sun/star/uno/UnoRuntime_EnvironmentTest.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite diff --git a/jurt/test/com/sun/star/uno/WeakReference_Test.java b/jurt/test/com/sun/star/uno/WeakReference_Test.java index 6520803cb22c..bc81141ddbcc 100644 --- a/jurt/test/com/sun/star/uno/WeakReference_Test.java +++ b/jurt/test/com/sun/star/uno/WeakReference_Test.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite diff --git a/jurt/workbench/com/sun/star/comp/urlresolver/UrlResolver_Test.java b/jurt/workbench/com/sun/star/comp/urlresolver/UrlResolver_Test.java index a78a2dffd1ad..52c3659c6478 100644 --- a/jurt/workbench/com/sun/star/comp/urlresolver/UrlResolver_Test.java +++ b/jurt/workbench/com/sun/star/comp/urlresolver/UrlResolver_Test.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite |