diff options
author | rbuj <robert.buj@gmail.com> | 2014-07-23 18:51:20 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2014-07-24 13:11:41 +0200 |
commit | b01358553082fd6f30781d0641c652f206c90c63 (patch) | |
tree | 24aa9acf9d1331ded2a12aef1cc230b267ea8e49 /jurt | |
parent | c8aa8226962db6ddbca6bfec8e415dfd5ecdda6f (diff) |
jurt: Enhanced For-Loops, code formatting, javadoc & overrides
Signed-off-by: Michael Stahl <mstahl@redhat.com>
Conflicts:
jurt/com/sun/star/lib/uno/environments/remote/JobQueue.java
Change-Id: I6d6324c5597fa472360a1b8bb4153dec647a36f0
Diffstat (limited to 'jurt')
40 files changed, 1221 insertions, 1015 deletions
diff --git a/jurt/com/sun/star/comp/bridgefactory/BridgeFactory.java b/jurt/com/sun/star/comp/bridgefactory/BridgeFactory.java index 9d3920e88f1a..7e370a980174 100644 --- a/jurt/com/sun/star/comp/bridgefactory/BridgeFactory.java +++ b/jurt/com/sun/star/comp/bridgefactory/BridgeFactory.java @@ -36,11 +36,12 @@ 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 - * XBridge component. - * <p> - * This component is only usable for remote bridges. - * <p> + * + * <p>It wrapps the <code>UnoRuntime#getBridgeByName</code>method and delivers a + * XBridge component.</p> + * + * <p>This component is only usable for remote bridges.</p> + * * @see com.sun.star.uno.UnoRuntime * @since UDK1.0 */ @@ -48,18 +49,21 @@ public class BridgeFactory implements XBridgeFactory/*, XEventListener*/ { static private final boolean DEBUG = false; /** - * The name of the service, the <code>JavaLoader</code> acceses this through reflection. + * The name of the service, the <code>JavaLoader</code> acceses this through + * reflection. */ public final static String __serviceName = "com.sun.star.bridge.BridgeFactory"; /** * Gives a factory for creating the service. - * This method is called by the <code>JavaLoader</code> - * <p> - * @return returns a <code>XSingleServiceFactory</code> for creating the component - * @param implName the name of the implementation for which a service is desired - * @param multiFactory the service manager to be uses if needed - * @param regKey the registryKey + * + * <p>This method is called by the <code>JavaLoader</code>.</p> + * + * @param implName the name of the implementation for which a service is desired. + * @param multiFactory the service manager to be uses if needed. + * @param regKey the registryKey. + * @return returns a <code>XSingleServiceFactory</code> for creating the component. + * * @see com.sun.star.comp.loader.JavaLoader */ public static XSingleServiceFactory __getServiceFactory(String implName, @@ -78,11 +82,12 @@ public class BridgeFactory implements XBridgeFactory/*, XEventListener*/ { /** * Creates a remote bridge and memorizes it under <code>sName</code>. - * <p> - * @return the bridge - * @param sName the name to memorize the bridge - * @param sProtocol the protocol the bridge should use - * @param anInstanceProvider the instance provider + * + * @param sName the name to memorize the bridge. + * @param sProtocol the protocol the bridge should use. + * @param anInstanceProvider the instance provider. + * @return the bridge. + * * @see com.sun.star.bridge.XBridgeFactory */ public XBridge createBridge(String sName, String sProtocol, XConnection aConnection, XInstanceProvider anInstanceProvider) throws @@ -132,9 +137,9 @@ public class BridgeFactory implements XBridgeFactory/*, XEventListener*/ { /** * Gets a remote bridge which must already exist. - * <p> - * @return the bridge - * @param sName the name of the bridge + * + * @param sName the name of the bridge. + * @return the bridge. * @see com.sun.star.bridge.XBridgeFactory */ public XBridge getBridge(String sName) throws com.sun.star.uno.RuntimeException { @@ -160,10 +165,10 @@ public class BridgeFactory implements XBridgeFactory/*, XEventListener*/ { } /** - * Gives all created bridges - * <p> - * @return the bridges - * @see com.sun.star.bridge.XBridgeFactory + * Gives all created bridges. + * + * @return the bridges. + * @see com.sun.star.bridge.XBridgeFactory */ public synchronized XBridge[] getExistingBridges() throws com.sun.star.uno.RuntimeException { ArrayList<XBridge> vector = new ArrayList<XBridge>(); @@ -191,6 +196,13 @@ public class BridgeFactory implements XBridgeFactory/*, XEventListener*/ { } } + /** + * Returns a string representation of the object. + * + * @return a string representation of the object. + * @see java.lang.Object#toString + */ + @Override public String toString() { return token; } diff --git a/jurt/com/sun/star/comp/connections/Acceptor.java b/jurt/com/sun/star/comp/connections/Acceptor.java index cc7ce7635bb0..7c8e0e9e494b 100644 --- a/jurt/com/sun/star/comp/connections/Acceptor.java +++ b/jurt/com/sun/star/comp/connections/Acceptor.java @@ -128,7 +128,10 @@ public final class Acceptor implements XAcceptor { return acc.accept(connectionDescription); } - // see com.sun.star.connection.XAcceptor#stopAccepting + /** + * + * @see com.sun.star.connection.XAcceptor#stopAccepting + */ public void stopAccepting() { XAcceptor acc; synchronized (this) { diff --git a/jurt/com/sun/star/comp/connections/ConstantInstanceProvider.java b/jurt/com/sun/star/comp/connections/ConstantInstanceProvider.java index 95f3016f5f71..687f70efe9ad 100644 --- a/jurt/com/sun/star/comp/connections/ConstantInstanceProvider.java +++ b/jurt/com/sun/star/comp/connections/ConstantInstanceProvider.java @@ -31,7 +31,7 @@ import com.sun.star.comp.loader.FactoryHelper; /** * The <code>ConstantInstanceProvider</code> is a component * that implements the <code>XInstanceProvider</code> Interface. - * <p> + * * @see com.sun.star.bridge.XBridge * @see com.sun.star.bridge.XBridgeFactory * @see com.sun.star.bridge.XInstanceProvider @@ -45,18 +45,20 @@ public class ConstantInstanceProvider implements XInstanceProvider { static public final boolean DEBUG = false; /** - * The name of the service, the <code>JavaLoader</code> acceses this through reflection. + * The name of the service, the <code>JavaLoader</code> acceses this through + * reflection. */ static private final String __serviceName = "com.sun.star.comp.connection.InstanceProvider"; /** * Gives a factory for creating the service. - * This method is called by the <code>JavaLoader</code> - * <p> - * @return returns a <code>XSingleServiceFactory</code> for creating the component - * @param implName the name of the implementation for which a service is desired - * @param multiFactory the service manager to be uses if needed - * @param regKey the registryKey + * <p>This method is called by the <code>JavaLoader</code>.</p> + * + * @param implName the name of the implementation for which a service is desired. + * @param multiFactory the service manager to be uses if needed. + * @param regKey the registryKey. + * @return returns a <code>XSingleServiceFactory</code> for creating the component. + * * @see com.sun.star.comp.loader.JavaLoader */ public static XSingleServiceFactory __getServiceFactory(String implName, @@ -86,8 +88,8 @@ public class ConstantInstanceProvider implements XInstanceProvider { /** * Constructs a new <code>ConstantInstanceProvider</code>. - * Uses the provided ServiceManager as the provided instance. - * <p> + * <p>Uses the provided ServiceManager as the provided instance.</p> + * * @param serviceManager the provided service manager */ public ConstantInstanceProvider(XMultiServiceFactory serviceManager) { @@ -99,7 +101,7 @@ public class ConstantInstanceProvider implements XInstanceProvider { /** * Gives an object for the passed instance name. - * <p> + * * @return the desired instance * @param sInstanceName the name of the desired instance */ diff --git a/jurt/com/sun/star/comp/connections/PipedConnection.java b/jurt/com/sun/star/comp/connections/PipedConnection.java index 12f18957db36..d48b2a63df0e 100644 --- a/jurt/com/sun/star/comp/connections/PipedConnection.java +++ b/jurt/com/sun/star/comp/connections/PipedConnection.java @@ -29,11 +29,10 @@ import com.sun.star.lang.XSingleServiceFactory; import com.sun.star.registry.XRegistryKey; /** - * The PipedConnection is a component that implements the + * The <code>PipedConnection</code> is a component that implements the * <code>XConnection</code> Interface. - * It is useful for <code>Thread</code> communication - * in one Process. - * <p> + * <p>It is useful for <code>Thread</code> communication in one Process.</p> + * * @see com.sun.star.connection.XConnection * @see com.sun.star.comp.loader.JavaLoader * @since UDK1.0 @@ -45,18 +44,20 @@ public class PipedConnection implements XConnection { public static final boolean DEBUG = false; /** - * The name of the service, the <code>JavaLoader</code> acceses this through reflection. + * The name of the service, the <code>JavaLoader</code> acceses this through + * reflection. */ static private final String __serviceName = "com.sun.star.connection.PipedConnection"; /** * Gives a factory for creating the service. - * This method is called by the <code>JavaLoader</code> - * <p> - * @return returns a <code>XSingleServiceFactory</code> for creating the component - * @param implName the name of the implementation for which a service is desired - * @param multiFactory the service manager to be uses if needed - * @param regKey the registryKey + * <p>This method is called by the <code>JavaLoader</code>.</p> + * + * @param implName the name of the implementation for which a service is desired. + * @param multiFactory the service manager to be uses if needed. + * @param regKey the registryKey. + * @return returns a <code>XSingleServiceFactory</code> for creating the component. + * * @see com.sun.star.comp.loader.JavaLoader */ public static XSingleServiceFactory __getServiceFactory(String implName, @@ -75,8 +76,7 @@ public class PipedConnection implements XConnection { } /** - * The amount of time in milliseconds, to wait to - * see check the buffers. + * The amount of time in milliseconds, to wait to see check the buffers. */ protected static final int __waitTime = 10000; @@ -87,9 +87,9 @@ public class PipedConnection implements XConnection { protected PipedConnection _otherSide; /** - * Constructs a new <code>PipedConnection</code>, sees if there - * is an other side, which it should be connected to. - * <p> + * Constructs a new <code>PipedConnection</code>, sees if there is an other + * side, which it should be connected to. + * * @param args Another side could be in index 0. */ public PipedConnection(Object args[]) throws com.sun.star.uno.RuntimeException { @@ -105,8 +105,7 @@ public class PipedConnection implements XConnection { } /** - * This is a private method, used to cummunicate - * internal in the pipe. + * This is a private method, used to cummunicate internal in the pipe. */ private synchronized void receive(byte aData[]) throws com.sun.star.io.IOException { int bytesWritten = 0; @@ -155,11 +154,12 @@ public class PipedConnection implements XConnection { /** * Read the required number of bytes. - * <p> - * @return the number of bytes read - * @param aReadBytes the out parameter, where the bytes have to be placed - * @param nBytesToRead the number of bytes to read - * @see com.sun.star.connection.XConnection#read + * + * @param aReadBytes the out parameter, where the bytes have to be placed. + * @param nBytesToRead the number of bytes to read. + * @return the number of bytes read. + * + * @see com.sun.star.connection.XConnection#read */ public synchronized int read(/*OUT*/byte[][] aReadBytes, int nBytesToRead) throws com.sun.star.io.IOException, com.sun.star.uno.RuntimeException { aReadBytes[0] = new byte[nBytesToRead]; @@ -211,18 +211,19 @@ public class PipedConnection implements XConnection { /** * Write bytes. - * <p> - * @param aData the bytes to write - * @see com.sun.star.connection.XConnection#write + * + * @param aData the bytes to write. + * @see com.sun.star.connection.XConnection#write */ public void write(byte aData[]) throws com.sun.star.io.IOException, com.sun.star.uno.RuntimeException { _otherSide.receive(aData); } /** - * Flushes the buffer, notifies if necessary the other side that new data has arrived. - * <p> - * @see com.sun.star.connection.XConnection#flush + * Flushes the buffer, notifies if necessary the other side that new data has + * arrived. + * + * @see com.sun.star.connection.XConnection#flush */ public void flush() throws com.sun.star.io.IOException, com.sun.star.uno.RuntimeException { synchronized(_otherSide) { @@ -232,8 +233,8 @@ public class PipedConnection implements XConnection { /** * Closes the pipe. - * <p> - * @see com.sun.star.connection.XConnection#close() + * + * @see com.sun.star.connection.XConnection#close() */ public synchronized void close() throws com.sun.star.io.IOException, com.sun.star.uno.RuntimeException { if(!_closed) { @@ -247,9 +248,9 @@ public class PipedConnection implements XConnection { /** * Gives a description of this pipe. - * <p> - * @return the description - * @see com.sun.star.connection.XConnection#getDescription + * + * @return the description. + * @see com.sun.star.connection.XConnection#getDescription */ public String getDescription() throws com.sun.star.uno.RuntimeException { return getClass().getName(); diff --git a/jurt/com/sun/star/comp/loader/FactoryHelper.java b/jurt/com/sun/star/comp/loader/FactoryHelper.java index 861f4e910733..191aa1d9e833 100644 --- a/jurt/com/sun/star/comp/loader/FactoryHelper.java +++ b/jurt/com/sun/star/comp/loader/FactoryHelper.java @@ -18,7 +18,6 @@ package com.sun.star.comp.loader; - import java.lang.reflect.Constructor; import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; @@ -39,9 +38,10 @@ import com.sun.star.uno.Type; /** * The purpose of this class to help component implementation. - * This class has default implementations for <code>getServiceFactory</code> - * and <code>writeRegistryServiceInfo</code>. - * <p> + * + * <p>This class has default implementations for <code>getServiceFactory</code> + * and <code>writeRegistryServiceInfo</code>.</p> + * * @see com.sun.star.lang.XMultiServiceFactory * @see com.sun.star.lang.XServiceInfo * @see com.sun.star.lang.XSingleServiceFactory @@ -207,12 +207,9 @@ public class FactoryHelper { break; } - try - { + try { return _constructor.newInstance( args ); - } - catch (InvocationTargetException invocationTargetException) - { + } catch (InvocationTargetException invocationTargetException) { Throwable targetException = invocationTargetException.getTargetException(); if (targetException instanceof java.lang.RuntimeException) @@ -223,13 +220,9 @@ public class FactoryHelper { throw (com.sun.star.uno.RuntimeException)targetException; else throw new com.sun.star.uno.Exception( targetException.toString() ); - } - catch (IllegalAccessException illegalAccessException) - { + } catch (IllegalAccessException illegalAccessException) { throw new com.sun.star.uno.Exception( illegalAccessException.toString() ); - } - catch (InstantiationException instantiationException) - { + } catch (InstantiationException instantiationException) { throw new com.sun.star.uno.Exception( instantiationException.toString() ); } } @@ -280,8 +273,7 @@ public class FactoryHelper { break; } - try - { + try { Object instance = _constructor.newInstance( args ); if (bInitCall) { @@ -293,9 +285,7 @@ public class FactoryHelper { } } return instance; - } - catch (InvocationTargetException invocationTargetException) - { + } catch (InvocationTargetException invocationTargetException) { Throwable targetException = invocationTargetException.getTargetException(); if (targetException instanceof java.lang.RuntimeException) @@ -306,22 +296,18 @@ public class FactoryHelper { throw (com.sun.star.uno.RuntimeException)targetException; else throw new com.sun.star.uno.Exception( targetException.toString() ); - } - catch (IllegalAccessException illegalAccessException) - { + } catch (IllegalAccessException illegalAccessException) { throw new com.sun.star.uno.Exception( illegalAccessException.toString() ); - } - catch (InstantiationException instantiationException) - { + } catch (InstantiationException instantiationException) { 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 + * + * @return returns an instance of the desired service. + * @see com.sun.star.lang.XSingleServiceFactory */ public Object createInstance() throws com.sun.star.uno.Exception, @@ -330,12 +316,13 @@ public class FactoryHelper { return createInstanceWithContext( null ); } - /** + /** * 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 - * @see com.sun.star.lang.XSingleServiceFactory + * + * @param args the args given to the constructor of the service. + * @return returns an instance of the desired service. + * + * @see com.sun.star.lang.XSingleServiceFactory */ public Object createInstanceWithArguments(Object[] args) throws com.sun.star.uno.Exception, @@ -344,31 +331,31 @@ public class FactoryHelper { return createInstanceWithArgumentsAndContext( args, null ); } - /** - * Gives the supported services - * <p> - * @return returns an array of supported services - * @see com.sun.star.lang.XServiceInfo + /** + * Gives the supported services. + * + * @return returns an array of supported services. + * @see com.sun.star.lang.XServiceInfo */ public String[] getSupportedServiceNames() throws com.sun.star.uno.RuntimeException { return new String[]{_serviceName}; } - /** - * Gives the implementation name - * <p> - * @return returns the implementation name - * @see com.sun.star.lang.XServiceInfo + /** + * Gives the implementation name. + * + * @return returns the implementation name. + * @see com.sun.star.lang.XServiceInfo */ public String getImplementationName() throws com.sun.star.uno.RuntimeException { return _implName; } - /** + /** * Indicates if the given service is supported. - * <p> - * @return returns true if the given service is supported - * @see com.sun.star.lang.XServiceInfo + * + * @return returns true if the given service is supported. + * @see com.sun.star.lang.XServiceInfo */ public boolean supportsService(String serviceName) throws com.sun.star.uno.RuntimeException { String services[] = getSupportedServiceNames(); @@ -402,14 +389,14 @@ public class FactoryHelper { /** * Creates a factory for the given class. - * <p> + * + * @param implClass the implementing class. + * @param multiFactory the given multi service factory (service manager). + * @param regKey the given registry key. + * @return returns a factory. + * + * @see com.sun.star.lang.XServiceInfo * @deprecated as of UDK 1.0 - * <p> - * @return returns a factory - * @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, @@ -422,17 +409,14 @@ public class FactoryHelper { try { serviceName = implClass.getField("__serviceName"); - } - catch(NoSuchFieldException noSuchFieldExceptio) { + } catch(NoSuchFieldException noSuchFieldExceptio) { serviceName = implClass.getField("serviceName"); // old style } xSingleServiceFactory = new Factory(implClass, (String)serviceName.get(null), multiFactory, regKey); - } - catch(NoSuchFieldException noSuchFieldException) { + } catch(NoSuchFieldException noSuchFieldException) { System.err.println("##### FactoryHelper.getServiceFactory - exception:" + noSuchFieldException); - } - catch(IllegalAccessException illegalAccessException) { + } catch(IllegalAccessException illegalAccessException) { System.err.println("##### FactoryHelper.getServiceFactory - exception:" + illegalAccessException); } @@ -441,13 +425,14 @@ public class FactoryHelper { /** * Creates a factory for the given class. - * <p> - * @return returns a factory - * @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 + * + * @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. + * + * @return returns a factory. + * @see com.sun.star.lang.XServiceInfo */ static public XSingleServiceFactory getServiceFactory(Class<?> implClass, String serviceName, @@ -457,24 +442,26 @@ public class FactoryHelper { return new Factory(implClass, serviceName, multiFactory, regKey); } - /** Creates a factory for the given class. - - @return returns a factory object - @param implClass the implementing class - */ + /** + * Creates a factory for the given class. + * + * @param implClass the implementing class. + * @return returns a factory object. + */ 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 serviceName the service name - * @param regKey the given registry key - * @see com.sun.star.lang.XServiceInfo + * Writes the registration data into the registry key. + * + * @param implName the name of the implementing class. + * @param serviceName the service name. + * @param regKey the given registry key. + * @return success. + * + * @see com.sun.star.lang.XServiceInfo */ static public boolean writeRegistryServiceInfo(String implName, String serviceName, XRegistryKey regKey) { boolean result = false; @@ -493,35 +480,32 @@ public class FactoryHelper { return result; } - /** Writes the registration data into the registry key. - * Several services are supported. + /** + * Writes the registration data into the registry key. + * + * <p>Several services are supported.</p> * - * @param impl_name name of implementation - * @param supported_services supported services of implementation - * @param xKey registry key to write to - * @return success - */ + * @param impl_name name of implementation. + * @param supported_services supported services of implementation. + * @param xKey registry key to write to. + * @return success. + */ public static boolean writeRegistryServiceInfo( String impl_name, String supported_services [], XRegistryKey xKey ) { - try - { + try { XRegistryKey xNewKey = xKey.createKey( "/" + impl_name + "/UNO/SERVICES" ); - for ( int nPos = 0; nPos < supported_services.length; ++nPos ) - { + for ( int nPos = 0; nPos < supported_services.length; ++nPos ) { xNewKey.createKey( supported_services[ nPos ] ); } return true; - } - catch (com.sun.star.registry.InvalidRegistryException exc) - { - if (DEBUG) - { + } catch (com.sun.star.registry.InvalidRegistryException exc) { + if (DEBUG) { System.err.println( "##### " + Factory.class.getName() + ".writeRegistryServiceInfo -- exc: " + exc.toString() ); } - } + } return false; } diff --git a/jurt/com/sun/star/comp/loader/JavaLoader.java b/jurt/com/sun/star/comp/loader/JavaLoader.java index 98df09b4d4be..bfcb6703e083 100644 --- a/jurt/com/sun/star/comp/loader/JavaLoader.java +++ b/jurt/com/sun/star/comp/loader/JavaLoader.java @@ -19,9 +19,7 @@ package com.sun.star.comp.loader; import java.lang.reflect.Method; - import java.lang.reflect.InvocationTargetException; - import java.net.URLDecoder; import com.sun.star.loader.CannotActivateFactoryException; @@ -49,10 +47,14 @@ import com.sun.star.uno.AnyConverter; /** - * The <code>JavaLoader</code> class provides the functionality of the <code>com.sun.star.loader.Java</code> - * 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> + * The <code>JavaLoader</code> class provides the functionality of the + * <code>com.sun.star.loader.Java</code> service. + * + * <p>Therefor the <code>JavaLoader</code> activates external UNO components + * which are implemented in Java.</p> + * + * <p>The loader is used by the <code>ServiceManger</code>.</p> + * * @see com.sun.star.loader.XImplementationLoader * @see com.sun.star.loader.Java * @see com.sun.star.comp.servicemanager.ServiceManager @@ -77,21 +79,18 @@ public class JavaLoader implements XImplementationLoader, private XMacroExpander m_xMacroExpander = null; private static final String EXPAND_PROTOCOL_PREFIX = "vnd.sun.star.expand:"; - /** Expands macrofied url using the macro expander singleton. + /** + * Expands macrofied url using the macro expander singleton. */ private String expand_url( String url ) throws RuntimeException { - if (url != null && url.startsWith( EXPAND_PROTOCOL_PREFIX )) - { - try - { - if (m_xMacroExpander == null) - { + if (url != null && url.startsWith( EXPAND_PROTOCOL_PREFIX )) { + try { + if (m_xMacroExpander == null) { XPropertySet xProps = UnoRuntime.queryInterface( XPropertySet.class, multiServiceFactory ); - if (xProps == null) - { + if (xProps == null) { throw new com.sun.star.uno.RuntimeException( "service manager does not support XPropertySet!", this ); @@ -113,21 +112,16 @@ public class JavaLoader implements XImplementationLoader, '+', "%2B" ) ); // expand macro string String ret = m_xMacroExpander.expandMacros( macro ); - if (DEBUG) - { + if (DEBUG) { System.err.println( "JavaLoader.expand_url(): " + url + " => " + macro + " => " + ret ); } return ret; - } - catch (com.sun.star.uno.Exception exc) - { + } catch (com.sun.star.uno.Exception exc) { throw new com.sun.star.uno.RuntimeException( exc.getMessage(), this ); - } - catch (java.lang.Exception exc) - { + } catch (java.lang.Exception exc) { throw new com.sun.star.uno.RuntimeException( exc.getMessage(), this ); } @@ -135,22 +129,24 @@ public class JavaLoader implements XImplementationLoader, return url; } - /** default constructor - */ - /** - * Creates a new instance of the <code>JavaLoader</code> class. - * <p> + * Default constructor. + * + * <p>Creates a new instance of the <code>JavaLoader</code> class.</p> */ 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. - * To set the <code>MultiServiceFactory</code> you can use the <code>com.sun.star.lang.XInitialization</code> interface, either. - * <p> - * @param factory the <code>ServiceManager</code> + * Creates a new <code>JavaLoader</code> object. + * + * <p>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.</p> + * + * <p>To set the <code>MultiServiceFactory</code> you can use the + * <code>com.sun.star.lang.XInitialization</code> interface, either.</p> + * + * @param factory the <code>ServiceManager</code>. * @see com.sun.star.comp.servicemanager.ServiceManager * @see com.sun.star.lang.XInitialization */ @@ -159,10 +155,11 @@ public class JavaLoader implements XImplementationLoader, } /** - * 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> + * 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. + * + * @param args - the first parameter (args[0]) specifices the <code>ServiceManager</code>. * @see com.sun.star.lang.XInitialization * @see com.sun.star.comp.servicemanager.ServiceManager */ @@ -170,13 +167,13 @@ public class JavaLoader implements XImplementationLoader, 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"); + 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) { + } catch (ClassCastException castEx) { throw new com.sun.star.lang.IllegalArgumentException( "The argument must be an instance of XMultiServiceFactory"); } @@ -184,8 +181,8 @@ public class JavaLoader implements XImplementationLoader, /** * Supplies the implementation name of the component. - * <p> - * @return the implementation name - here the class name + * + * @return the implementation name - here the class name. * @see com.sun.star.lang.XServiceInfo */ public String getImplementationName() @@ -196,25 +193,27 @@ public class JavaLoader implements XImplementationLoader, /** * Verifies if a given service is supported by the component. - * <p> - * @return true,if service is supported - otherwise false - * @param serviceName the name of the service that should be checked + * + * @param serviceName the name of the service that should be checked. + * @return true,if service is supported - otherwise false. + * * @see com.sun.star.lang.XServiceInfo */ public boolean supportsService(String serviceName) throws com.sun.star.uno.RuntimeException { - for ( int i = 0; i < supportedServices.length; i++ ) { - if ( supportedServices[i].equals(serviceName) ) + for (String supportedService : supportedServices) { + if (supportedService.equals(serviceName)) { return true; + } } return false; } /** - * Supplies a list of all service names supported by the component - * <p> - * @return a String array with all supported services + * Supplies a list of all service names supported by the component. + * + * @return a String array with all supported services. * @see com.sun.star.lang.XServiceInfo */ public String[] getSupportedServiceNames() @@ -225,18 +224,23 @@ public class JavaLoader implements XImplementationLoader, /** * Provides a components factory. - * 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. - * 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 + * + * <p>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.</p> + * + * <p>To get the factory the inspects the class for the optional static member + * functions __getServiceFactory resp. getServiceFactory (DEPRECATED).</p> + * + * <p>If the function can not be found a default factory @see ComponentFactoryWrapper + * will be created.</p> + * + * @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 registry key + * @param locationUrl points to an archive (JAR file) which contains a component. + * @param xKey registry key. + * @return the factory for the component (@see com.sun.star.lang.XSingleServiceFactory) + * * @see com.sun.star.loader.XImplementationLoader * @see com.sun.star.comp.loader.RegistrationClassFinder */ @@ -254,7 +258,7 @@ public class JavaLoader implements XImplementationLoader, DEBUG("try to get factory for " + implementationName); - // first we must get the class of the implementation + // 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. // 2. If only the implementation name is given, the class is loaded with the @@ -274,20 +278,17 @@ public class JavaLoader implements XImplementationLoader, "Cannot find class " + implementationName); } } - } - catch (java.net.MalformedURLException e) { + } catch (java.net.MalformedURLException e) { CannotActivateFactoryException cae = new CannotActivateFactoryException( "Can not activate factory because " + e ); cae.initCause(e); throw cae; - } - catch (java.io.IOException e) { + } catch (java.io.IOException e) { CannotActivateFactoryException cae = new CannotActivateFactoryException( "Can not activate factory because " + e ); cae.initCause(e); throw cae; - } - catch (java.lang.ClassNotFoundException e) { + } catch (java.lang.ClassNotFoundException e) { CannotActivateFactoryException cae = new CannotActivateFactoryException( "Can not activate factory because " + e ); cae.initCause(e); @@ -303,69 +304,56 @@ public class JavaLoader implements XImplementationLoader, // - old style: use the public static method getServiceFactory ( DEPRECATED ) Method compfac_method = null; - try - { + try { compfac_method = clazz.getMethod( "__getComponentFactory", new Class [] { String.class } ); + } catch ( NoSuchMethodException noSuchMethodEx) { + } catch ( SecurityException secEx) { } - catch ( NoSuchMethodException noSuchMethodEx) {} - catch ( SecurityException secEx) {} Method method = null; - if (null == compfac_method) - { + if (null == compfac_method) { try { method = clazz.getMethod("__getServiceFactory", paramTypes); - } - catch ( NoSuchMethodException noSuchMethodEx) { + } catch ( NoSuchMethodException noSuchMethodEx) { method = null; - } - catch ( SecurityException secEx) { + } catch ( SecurityException secEx) { method = null; } } try { - if (null != compfac_method) - { + if (null != compfac_method) { Object ret = compfac_method.invoke( clazz, new Object [] { implementationName } ); if (null == ret || !(ret instanceof XSingleComponentFactory)) - { throw new CannotActivateFactoryException( "No factory object for " + implementationName ); - } + return ret; } - else - { - if ( method == null ) { + else { + if ( method == null ) method = clazz.getMethod("getServiceFactory", paramTypes); - } Object oRet = method.invoke(clazz, params); - if ( (oRet != null) && (oRet instanceof XSingleServiceFactory) ) { + if ( (oRet != null) && (oRet instanceof XSingleServiceFactory) ) returnObject = oRet; - } } - } - catch ( NoSuchMethodException e) { + } catch ( NoSuchMethodException e) { throw new CannotActivateFactoryException("Can not activate the factory for " + implementationName + " because " + e.toString() ); - } - catch ( SecurityException e) { + } catch ( SecurityException e) { throw new CannotActivateFactoryException("Can not activate the factory for " + implementationName + " because " + e.toString() ); - } - catch ( IllegalAccessException e ) { + } catch ( IllegalAccessException e ) { 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 " + implementationName + " because " + e.toString() ); - } - catch ( InvocationTargetException e ) { + } catch ( InvocationTargetException e ) { throw new CannotActivateFactoryException("Can not activate the factory for " + implementationName + " because " + e.getTargetException().toString() ); } @@ -374,14 +362,18 @@ public class JavaLoader implements XImplementationLoader, } /** - * Registers the component in a registry under a given root key. If the component supports the optional - * 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 + * Registers the component in a registry under a given root key. + * + * <p>If the component supports the optional + * methods __writeRegistryServiceInfo, writeRegistryServiceInfo (DEPRECATED), + * the call is delegated to that method. Otherwise a default registration + * will be accomplished.</p> + * * @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 + * @param locationUrl points to an archive (JAR file) which contains a component. + * @return true if registration is successfully - otherwise false. + * * @see ComponentFactoryWrapper */ public boolean writeRegistryInfo( XRegistryKey regKey, @@ -398,10 +390,8 @@ public class JavaLoader implements XImplementationLoader, Class<?> clazz = RegistrationClassFinder.find(locationUrl); if (null == clazz) - { throw new CannotRegisterImplementationException( "Cannot determine registration class!" ); - } Class<?>[] paramTypes = { XRegistryKey.class }; Object[] params = { regKey }; @@ -411,8 +401,7 @@ public class JavaLoader implements XImplementationLoader, if ( (oRet != null) && (oRet instanceof Boolean) ) success = ((Boolean) oRet).booleanValue(); - } - catch (Exception e) { + } catch (Exception e) { CannotRegisterImplementationException e2 = new CannotRegisterImplementationException(e.toString()); e2.initCause(e); @@ -423,12 +412,12 @@ public class JavaLoader implements XImplementationLoader, } /** - * 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 + * Supplies 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>. */ public static XSingleServiceFactory getServiceFactory( String implName, XMultiServiceFactory multiFactory, @@ -442,9 +431,9 @@ public class JavaLoader implements XImplementationLoader, /** * 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. + * @return true if registration succseeded - otherwise false. */ public static boolean writeRegistryServiceInfo(XRegistryKey regKey) { boolean result = false; @@ -452,12 +441,12 @@ public class JavaLoader implements XImplementationLoader, try { XRegistryKey newKey = regKey.createKey("/" + JavaLoader.class.getName() + "/UNO/SERVICE"); - for (int i=0; i<supportedServices.length; i++) - newKey.createKey(supportedServices[i]); + for (String supportedService : supportedServices) { + newKey.createKey(supportedService); + } result = true; - } - catch (Exception ex) { + } catch (Exception ex) { if (DEBUG) System.err.println(">>>JavaLoader.writeRegistryServiceInfo " + ex); } diff --git a/jurt/com/sun/star/comp/loader/JavaLoaderFactory.java b/jurt/com/sun/star/comp/loader/JavaLoaderFactory.java index 954cd66663d9..ce2d0f60162b 100644 --- a/jurt/com/sun/star/comp/loader/JavaLoaderFactory.java +++ b/jurt/com/sun/star/comp/loader/JavaLoaderFactory.java @@ -39,10 +39,6 @@ public class JavaLoaderFactory implements XSingleServiceFactory, XServiceInfo { protected XMultiServiceFactory multiServiceFactory = null; - /** default constructor - */ -// public JavaLoaderFactory() {} - public JavaLoaderFactory(XMultiServiceFactory factory) { multiServiceFactory = factory; } @@ -64,7 +60,8 @@ public class JavaLoaderFactory implements XSingleServiceFactory, XServiceInfo { return loader; } - /** implements the XServiceInfo interface + /** + * Implements the XServiceInfo interface. */ public String getImplementationName() throws com.sun.star.uno.RuntimeException @@ -72,19 +69,22 @@ public class JavaLoaderFactory implements XSingleServiceFactory, XServiceInfo { return JavaLoader.class.getName(); } - /** implements the XServiceInfo interface + /** + * Implements the XServiceInfo interface. */ public boolean supportsService(String serviceName) throws com.sun.star.uno.RuntimeException { - for ( int i = 0; i < supportedServices.length; i++ ) { - if ( supportedServices[i].equals(serviceName) ) + for (String supportedService : supportedServices) { + if (supportedService.equals(serviceName)) { return true; + } } return false; } - /** implements the XServiceInfo interface + /** + * Implements the XServiceInfo interface. */ public String[] getSupportedServiceNames() throws com.sun.star.uno.RuntimeException diff --git a/jurt/com/sun/star/comp/servicemanager/ServiceManager.java b/jurt/com/sun/star/comp/servicemanager/ServiceManager.java index dd595e77f6de..4424de1ec7b3 100644 --- a/jurt/com/sun/star/comp/servicemanager/ServiceManager.java +++ b/jurt/com/sun/star/comp/servicemanager/ServiceManager.java @@ -35,13 +35,14 @@ import com.sun.star.uno.UnoRuntime; import com.sun.star.uno.XComponentContext; /** - * The <code>ServiceManager</code> class is an implmentation of the <code>ServiceManager</code>the central class needed for - * implementing or using UNO components in Java. - * <p> - * The Methods <code>queryInterface</code> and <code>isSame</code> delegate - * calls to the implementing objects and are used instead of casts - * and identity comparisons. - * <p> + * The <code>ServiceManager</code> class is an implmentation of the + * <code>ServiceManager</code>the central class needed for implementing or using + * UNO components in Java. + * + * <p>The Methods <code>queryInterface</code> and <code>isSame</code> delegate + * calls to the implementing objects and are used instead of casts and identity + * comparisons.</p> + * * @see com.sun.star.lang.XMultiServiceFactory * @see com.sun.star.container.XSet * @see com.sun.star.container.XContentEnumerationAccess @@ -90,11 +91,14 @@ public class ServiceManager implements XMultiServiceFactory, } /** - * 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 + * Creates a new instance of a specified service. + * + * <p>Therefor the associated factory of the service is looked up and used + * to instanciate a new component. </p> + * + * @param serviceSpecifier indicates the service or component name. + * @return newly created component. + * * @see com.sun.star.lang.XMultiServiceFactory */ public java.lang.Object createInstance( String serviceSpecifier ) @@ -106,10 +110,12 @@ public class ServiceManager implements XMultiServiceFactory, /** * 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 + * + * <p>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 */ public java.lang.Object createInstanceWithArguments( @@ -119,8 +125,9 @@ public class ServiceManager implements XMultiServiceFactory, if (DEBUG) { System.err.println("createInstanceWithArguments:" ); - for (int i=0; i<args.length; i++) - System.err.print(" "+ args[i]); + for (Object arg : args) { + System.err.print(" " + arg); + } System.err.println(); } @@ -130,11 +137,14 @@ public class ServiceManager implements XMultiServiceFactory, /** * 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 implementation list. - * <p> - * @return the factory of the service / implementation - * @param serviceName indicates the service or implementation name + * + * <p>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 implementation + * list.</p> + * + * @param serviceName indicates the service or implementation name. + * @return the factory of the service / implementation. + * * @see com.sun.star.lang.XMultiServiceFactory */ private Object queryServiceFactory(String serviceName) @@ -171,8 +181,8 @@ public class ServiceManager implements XMultiServiceFactory, /** * Supplies a list of all avialable services names. - * <p> - * @return list of Strings of all service names + * + * @return list of Strings of all service names. * @see com.sun.star.container.XContentEnumerationAccess */ public String[] getAvailableServiceNames() @@ -192,11 +202,11 @@ public class ServiceManager implements XMultiServiceFactory, // XMultiComponentFactory implementation /** Create a service instance with given context. - - @param rServiceSpecifier service name - @param xContext context - @return service instance - */ + * + * @param rServiceSpecifier service name. + * @param xContext context. + * @return service instance. + */ public java.lang.Object createInstanceWithContext( String rServiceSpecifier, com.sun.star.uno.XComponentContext xContext ) @@ -231,13 +241,14 @@ public class ServiceManager implements XMultiServiceFactory, } return null; } - /** Create a service instance with given context and arguments. - - @param rServiceSpecifier service name - @param rArguments arguments - @param xContext context - @return service instance - */ + /** + * Create a service instance with given context and arguments. + * + * @param rServiceSpecifier service name. + * @param rArguments arguments. + * @param xContext context. + * @return service instance. + */ public java.lang.Object createInstanceWithArgumentsAndContext( String rServiceSpecifier, java.lang.Object[] rArguments, @@ -276,8 +287,9 @@ public class ServiceManager implements XMultiServiceFactory, // public String[] getAvailableServiceNames(); /** - * Removes all listeners from the <code>ServiceManager</code> and clears the list of the services. - * <p> + * Removes all listeners from the <code>ServiceManager</code> and clears the + * list of the services. + * * @see com.sun.star.lang.XComponent */ public void dispose() @@ -298,11 +310,14 @@ public class ServiceManager implements XMultiServiceFactory, } /** - * 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> + * Adds a new <code>EventListener</code>. + * + * <p>The listener is notified when a service is added (removed) to (from) + * the <code>ServiceManager</code>.</p> + * + * <p>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 */ @@ -320,11 +335,12 @@ public class ServiceManager implements XMultiServiceFactory, /** * Removes a <code>EventListener</code> from the <code>ServiceManager</code>. - * If the listener is not registered a <code>com.sun.star.uno.RuntimeException</code> - * will be thrown. - * <p> + * + * <p>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 + * @see com.sun.star.lang.XComponent */ public void removeEventListener( XEventListener xListener ) throws com.sun.star.uno.RuntimeException @@ -339,29 +355,31 @@ public class ServiceManager implements XMultiServiceFactory, } /** - * 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. + * Checks if a component is registered at the <code>ServiceManager</code>. + * + * <p>The given object argument must provide a <code>XServiceInfo</code> + * interface.</p> + * * @param object object which provides a <code>XServiceInfo</code> interface. + * @return true if the component is registred otherwise false. + * * @see com.sun.star.container.XSet * @see com.sun.star.lang.XServiceInfo */ public boolean has( Object object ) throws com.sun.star.uno.RuntimeException { - if (object == null) - throw new com.sun.star.uno.RuntimeException("The parameter must not been null"); + if (object == null) + throw new com.sun.star.uno.RuntimeException("The parameter must not been null"); - XServiceInfo xServiceInfo = UnoRuntime.queryInterface(XServiceInfo.class, object); + XServiceInfo xServiceInfo = UnoRuntime.queryInterface(XServiceInfo.class, object); return xServiceInfo != null && UnoRuntime.areSame(factoriesByImplNames.get(xServiceInfo.getImplementationName()), object); - - } + } /** * Adds a <code>SingleServiceFactory</code> to the <code>ServiceManager</code>. - * <p> + * * @param object factory which should be added. * @see com.sun.star.container.XSet * @see com.sun.star.lang.XSingleServiceFactory @@ -394,25 +412,24 @@ public class ServiceManager implements XMultiServiceFactory, String[] serviceNames = xServiceInfo.getSupportedServiceNames(); ArrayList<Object> vec ; - 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 ArrayList<Object>()); + for (String serviceName : serviceNames) { + if (!factoriesByServiceNames.containsKey(serviceName)) { + DEBUG("> no registered services found under " + serviceName + ": adding..."); + factoriesByServiceNames.put(serviceName, new ArrayList<Object>()); } - - vec = factoriesByServiceNames.get( serviceNames[i] ); - - if ( vec.contains( object ) ) + vec = factoriesByServiceNames.get(serviceName); + if (vec.contains( object )) { System.err.println("The implementation " + xServiceInfo.getImplementationName() + - " already registered for the service " + serviceNames[i] + " - ignoring!"); - else + " already registered for the service " + serviceName + " - ignoring!"); + } else { vec.add(object); + } } } /** * Removes a <code>SingleServiceFactory</code> from the <code>ServiceManager</code>. - * <p> + * * @param object factory which should be removed. * @see com.sun.star.container.XSet * @see com.sun.star.lang.XSingleServiceFactory @@ -467,7 +484,7 @@ public class ServiceManager implements XMultiServiceFactory, /** * Provides an enumeration of all registered services. - * <p> + * * @return an enumeration of all available services. * @see com.sun.star.container.XEnumerationAccess */ @@ -479,7 +496,7 @@ 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 @@ -495,7 +512,7 @@ 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 */ @@ -505,9 +522,9 @@ public class ServiceManager implements XMultiServiceFactory, /** * Provides an enumeration of of all factorys for a specified service. - * <p> + * + * @param serviceName name of the requested service. * @return an enumeration for service name. - * @param serviceName name of the requested service * @see com.sun.star.container.XContentEnumerationAccess */ public XEnumeration createContentEnumeration( String serviceName ) @@ -527,7 +544,7 @@ public class ServiceManager implements XMultiServiceFactory, /** * 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 */ @@ -539,9 +556,10 @@ 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. + * @return true if the service is supported - otherwise false. + * * @see com.sun.star.lang.XServiceInfo */ public boolean supportsService( String serviceName ) @@ -556,7 +574,7 @@ public class ServiceManager implements XMultiServiceFactory, /** * Supplies list of all supported services. - * <p> + * * @return a list of all supported service names. * @see com.sun.star.lang.XServiceInfo */ @@ -569,8 +587,9 @@ public class ServiceManager implements XMultiServiceFactory, /** * 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> + * + * <p>It is a inner wrapper for a java.util.Enumeration object.</p> + * * @see com.sun.star.lang.XSingleServiceFactory * @see com.sun.star.lang.XServiceInfo * @since UDK1.0 @@ -586,7 +605,7 @@ public class ServiceManager implements XMultiServiceFactory, /** * Constructs a new instance with a given enumeration. - * <p> + * * @param enumer is the enumeration which should been wrapped. * @see com.sun.star.container.XEnumeration */ @@ -596,7 +615,7 @@ public class ServiceManager implements XMultiServiceFactory, /** * Constructs a new instance with a given enumeration. - * <p> + * * @param enumer is the enumeration which should been wrapped. * @see com.sun.star.container.XEnumeration */ @@ -606,7 +625,7 @@ public class ServiceManager implements XMultiServiceFactory, /** * Checks if the enumeration contains more elements. - * <p> + * * @return true if more elements are available - otherwise false. * @see com.sun.star.container.XEnumeration */ @@ -618,9 +637,11 @@ public class ServiceManager implements XMultiServiceFactory, } /** - * Returns the next element of the enumeration. If no further elements - * available a com.sun.star.container.NoSuchElementException exception will be thrown. - * <p> + * Returns the next element of the enumeration. + * + * <p>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 */ diff --git a/jurt/com/sun/star/comp/urlresolver/UrlResolver.java b/jurt/com/sun/star/comp/urlresolver/UrlResolver.java index 9b34e8c29b8b..cb90e355202c 100644 --- a/jurt/com/sun/star/comp/urlresolver/UrlResolver.java +++ b/jurt/com/sun/star/comp/urlresolver/UrlResolver.java @@ -41,7 +41,7 @@ import com.sun.star.uno.UnoRuntime; /** * This component gives a factory for an <code>UnoUrlResolver</code> service. - * <p> + * * @see com.sun.star.bridge.XBridgeFactory * @see com.sun.star.connection.Connector * @since UDK1.0 @@ -120,12 +120,14 @@ public class UrlResolver { /** * Gives a factory for creating the service. - * This method is called by the <code>JavaLoader</code> - * <p> - * @return returns a <code>XSingleServiceFactory</code> for creating the component - * @param implName the name of the implementation for which a service is desired - * @param multiFactory the service manager to be uses if needed - * @param regKey the registryKey + * + * <p>This method is called by the <code>JavaLoader</code>.</p> + * + * @param implName the name of the implementation for which a service is desired. + * @param multiFactory the service manager to be uses if needed. + * @param regKey the registryKey. + * @return returns a <code>XSingleServiceFactory</code> for creating the component. + * * @see com.sun.star.comp.loader.JavaLoader */ public static XSingleServiceFactory __getServiceFactory(String implName, diff --git a/jurt/com/sun/star/lib/connections/pipe/PipeConnection.java b/jurt/com/sun/star/lib/connections/pipe/PipeConnection.java index 5f1bcb4a9f24..62c4e231018e 100644 --- a/jurt/com/sun/star/lib/connections/pipe/PipeConnection.java +++ b/jurt/com/sun/star/lib/connections/pipe/PipeConnection.java @@ -31,7 +31,7 @@ import com.sun.star.lib.util.NativeLibraryLoader; * The PipeConnection implements the <code>XConnection</code> interface * 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> + * * @see com.sun.star.lib.connections.pipe.pipeAcceptor * @see com.sun.star.lib.connections.pipe.pipeConnector * @see com.sun.star.connection.XConnection @@ -55,8 +55,8 @@ public class PipeConnection implements XConnection, XConnectionBroadcaster { /** * Constructs a new <code>PipeConnection</code>. - * <p> - * @param description the description of the connection + * + * @param description the description of the connection. */ public PipeConnection(String description) throws IOException @@ -69,8 +69,7 @@ public class PipeConnection implements XConnection, XConnectionBroadcaster { // get pipe name from pipe descriptor String aPipeName ; StringTokenizer aTokenizer = new StringTokenizer( description, "," ); - if ( aTokenizer.hasMoreTokens() ) - { + if ( aTokenizer.hasMoreTokens() ) { String aConnType = aTokenizer.nextToken(); if ( !aConnType.equals( "pipe" ) ) throw new RuntimeException( "invalid pipe descriptor: does not start with 'pipe,'" ); @@ -79,19 +78,20 @@ public class PipeConnection implements XConnection, XConnectionBroadcaster { if ( !aPipeNameParam.substring( 0, 5 ).equals( "name=" ) ) throw new RuntimeException( "invalid pipe descriptor: no 'name=' parameter found" ); aPipeName = aPipeNameParam.substring( 5 ); - } + } else throw new RuntimeException( "invalid or empty pipe descriptor" ); // create the pipe - try - { createJNI( aPipeName ); } - catch ( java.lang.NullPointerException aNPE ) - { throw new IOException( aNPE.getMessage() ); } - catch ( com.sun.star.io.IOException aIOE ) - { throw new IOException( aIOE.getMessage() ); } - catch ( java.lang.Exception aE ) - { throw new IOException( aE.getMessage() ); } + try { + createJNI( aPipeName ); + } catch ( java.lang.NullPointerException aNPE ) { + throw new IOException( aNPE.getMessage() ); + } catch ( com.sun.star.io.IOException aIOE ) { + throw new IOException( aIOE.getMessage() ); + } catch ( java.lang.Exception aE ) { + throw new IOException( aE.getMessage() ); + } } public void addStreamListener(XStreamListener aListener ) throws com.sun.star.uno.RuntimeException { @@ -148,11 +148,12 @@ public class PipeConnection implements XConnection, XConnectionBroadcaster { /** * Read the required number of bytes. - * <p> - * @return the number of bytes read - * @param bytes the outparameter, where the bytes have to be placed - * @param nBytesToRead the number of bytes to read - * @see com.sun.star.connection.XConnection#read + * + * @param bytes the outparameter, where the bytes have to be placed. + * @param nBytesToRead the number of bytes to read. + * @return the number of bytes read. + * + * @see com.sun.star.connection.XConnection#read */ public int read(/*OUT*/byte[][] bytes, int nBytesToRead) throws com.sun.star.io.IOException, com.sun.star.uno.RuntimeException @@ -168,9 +169,9 @@ public class PipeConnection implements XConnection, XConnectionBroadcaster { /** * Write bytes. - * <p> - * @param aData the bytes to write - * @see com.sun.star.connection.XConnection#write + * + * @param aData the bytes to write. + * @see com.sun.star.connection.XConnection#write */ public void write(byte aData[]) throws com.sun.star.io.IOException, com.sun.star.uno.RuntimeException @@ -180,8 +181,8 @@ public class PipeConnection implements XConnection, XConnectionBroadcaster { /** * Flushes the buffer. - * <p> - * @see com.sun.star.connection.XConnection#flush + * + * @see com.sun.star.connection.XConnection#flush */ public void flush() throws com.sun.star.io.IOException, com.sun.star.uno.RuntimeException @@ -191,7 +192,7 @@ public class PipeConnection implements XConnection, XConnectionBroadcaster { /** * Closes the connection. - * <p> + * * @see com.sun.star.connection.XConnection#close */ public void close() @@ -205,9 +206,9 @@ public class PipeConnection implements XConnection, XConnectionBroadcaster { /** * Gives a description of the connection. - * <p> - * @return the description - * @see com.sun.star.connection.XConnection#getDescription + * + * @return the description. + * @see com.sun.star.connection.XConnection#getDescription */ public String getDescription() throws com.sun.star.uno.RuntimeException { return _aDescription; diff --git a/jurt/com/sun/star/lib/connections/pipe/pipeAcceptor.java b/jurt/com/sun/star/lib/connections/pipe/pipeAcceptor.java index e483c89c48d8..5d2a7d5d0df0 100644 --- a/jurt/com/sun/star/lib/connections/pipe/pipeAcceptor.java +++ b/jurt/com/sun/star/lib/connections/pipe/pipeAcceptor.java @@ -108,13 +108,16 @@ public final class pipeAcceptor implements XAcceptor { AlreadyAcceptingException, ConnectionSetupException, com.sun.star.lang.IllegalArgumentException { - throw new java.lang.NoSuchMethodError( "pipeAcceptor not fully implemented yet" ); + throw new java.lang.NoSuchMethodError( "pipeAcceptor not fully implemented yet" ); //try { return new PipeConnection( connectionDescription ); } //catch ( java.io.IOException e ) { return null; } } - // see com.sun.star.connection.XAcceptor#stopAccepting + /** + * + * @see com.sun.star.connection.XAcceptor#stopAccepting + */ public void stopAccepting() { } diff --git a/jurt/com/sun/star/lib/connections/pipe/pipeConnector.java b/jurt/com/sun/star/lib/connections/pipe/pipeConnector.java index 57a0d05277ee..425128ce267b 100644 --- a/jurt/com/sun/star/lib/connections/pipe/pipeConnector.java +++ b/jurt/com/sun/star/lib/connections/pipe/pipeConnector.java @@ -101,17 +101,16 @@ public final class pipeConnector implements XConnector { public synchronized XConnection connect(String connectionDescription) throws NoConnectException, ConnectionSetupException { - if (bConnected) { + if (bConnected) throw new ConnectionSetupException("alread connected"); - } - try - { - XConnection xConn = new PipeConnection( connectionDescription ); - bConnected = true; - return xConn; - } - catch ( java.io.IOException e ) { throw new NoConnectException(); } + try { + XConnection xConn = new PipeConnection( connectionDescription ); + bConnected = true; + return xConn; + } catch ( java.io.IOException e ) { + throw new NoConnectException(); + } } private boolean bConnected = false; diff --git a/jurt/com/sun/star/lib/connections/socket/ConnectionDescriptor.java b/jurt/com/sun/star/lib/connections/socket/ConnectionDescriptor.java index 82b0c7c47754..f362dac800db 100644 --- a/jurt/com/sun/star/lib/connections/socket/ConnectionDescriptor.java +++ b/jurt/com/sun/star/lib/connections/socket/ConnectionDescriptor.java @@ -19,8 +19,7 @@ package com.sun.star.lib.connections.socket; /** - * Helper class for <code>socketAcceptor</code> and - * <code>socketConnector</code>. + * Helper class for <code>socketAcceptor</code> and <code>socketConnector</code>. * * <p>FIXME: Once those classes have been moved from <code>jurt</code> to * <code>javaunohelper</code>, they should use diff --git a/jurt/com/sun/star/lib/connections/socket/SocketConnection.java b/jurt/com/sun/star/lib/connections/socket/SocketConnection.java index 8e878ee83a45..e849d8b387e9 100644 --- a/jurt/com/sun/star/lib/connections/socket/SocketConnection.java +++ b/jurt/com/sun/star/lib/connections/socket/SocketConnection.java @@ -34,8 +34,9 @@ import com.sun.star.io.XStreamListener; /** * The SocketConnection implements the <code>XConnection</code> interface * 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> + * + * <p>This class is not part of the provided <code>api</code>.</p> + * * @see com.sun.star.lib.connections.socket.socketAcceptor * @see com.sun.star.lib.connections.socket.socketConnector * @see com.sun.star.connection.XConnection @@ -56,9 +57,9 @@ public class SocketConnection implements XConnection, XConnectionBroadcaster { /** * Constructs a new <code>SocketConnection</code>. - * <p> - * @param description the description of the connection - * @param socket the socket of the connection + * + * @param description the description of the connection. + * @param socket the socket of the connection. */ public SocketConnection(String description, Socket socket) throws IOException { if (DEBUG) System.err.println("##### " + getClass().getName() + " - instantiated " + description + " " + socket); @@ -77,14 +78,13 @@ public class SocketConnection implements XConnection, XConnectionBroadcaster { _firstRead = true; } - - - - public void addStreamListener(XStreamListener aListener ) throws com.sun.star.uno.RuntimeException { + public void addStreamListener(XStreamListener aListener ) + throws com.sun.star.uno.RuntimeException { _listeners.add(aListener); } - public void removeStreamListener(XStreamListener aListener ) throws com.sun.star.uno.RuntimeException { + public void removeStreamListener(XStreamListener aListener ) + throws com.sun.star.uno.RuntimeException { _listeners.remove(aListener); } @@ -112,16 +112,17 @@ public class SocketConnection implements XConnection, XConnectionBroadcaster { } } - /** * Read the required number of bytes. - * <p> - * @return the number of bytes read - * @param bytes the outparameter, where the bytes have to be placed - * @param nBytesToRead the number of bytes to read - * @see com.sun.star.connection.XConnection#read + * + * @param bytes the outparameter, where the bytes have to be placed. + * @param nBytesToRead the number of bytes to read. + * @return the number of bytes read. + * + * @see com.sun.star.connection.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(_firstRead) { _firstRead = false; @@ -144,8 +145,7 @@ public class SocketConnection implements XConnection, XConnectionBroadcaster { read_bytes += count; } while(read_bytes >= 0 && read_bytes < nBytesToRead && count >= 0); - } - catch(IOException ioException) { + } catch(IOException ioException) { if(DEBUG) { System.err.println("##### " + getClass().getName() + ".read - exception occurred:" + ioException); ioException.printStackTrace(); @@ -168,15 +168,15 @@ public class SocketConnection implements XConnection, XConnectionBroadcaster { /** * Write bytes. - * <p> - * @param aData the bytes to write + * + * @param aData the bytes to write. * @see com.sun.star.connection.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 { try { _outputStream.write(aData); - } - catch(IOException ioException) { + } catch(IOException ioException) { com.sun.star.io.IOException unoIOException = new com.sun.star.io.IOException(ioException.toString()); notifyListeners_error(unoIOException); @@ -188,14 +188,14 @@ public class SocketConnection implements XConnection, XConnectionBroadcaster { /** * Flushes the buffer. - * <p> + * * @see com.sun.star.connection.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 { try { _outputStream.flush(); - } - catch(IOException ioException) { + } catch(IOException ioException) { com.sun.star.io.IOException unoIOException = new com.sun.star.io.IOException(ioException.toString()); notifyListeners_error(unoIOException); @@ -205,14 +205,14 @@ public class SocketConnection implements XConnection, XConnectionBroadcaster { /** * Closes the connection. - * <p> + * * @see com.sun.star.connection.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 { try { _socket.close(); - } - catch(IOException ioException) { + } catch(IOException ioException) { com.sun.star.io.IOException unoIOException = new com.sun.star.io.IOException(ioException.toString()); notifyListeners_error(unoIOException); @@ -225,8 +225,8 @@ public class SocketConnection implements XConnection, XConnectionBroadcaster { /** * Gives a description of the connection. - * <p> - * @return the description + * + * @return the description. * @see com.sun.star.connection.XConnection#getDescription */ public String getDescription() throws com.sun.star.uno.RuntimeException { diff --git a/jurt/com/sun/star/lib/connections/socket/socketAcceptor.java b/jurt/com/sun/star/lib/connections/socket/socketAcceptor.java index 32f0f2018e67..22dbfa4737bd 100644 --- a/jurt/com/sun/star/lib/connections/socket/socketAcceptor.java +++ b/jurt/com/sun/star/lib/connections/socket/socketAcceptor.java @@ -161,7 +161,10 @@ public final class socketAcceptor implements XAcceptor { } } - // see com.sun.star.connection.XAcceptor#stopAccepting + /** + * + * @see com.sun.star.connection.XAcceptor#stopAccepting + */ public void stopAccepting() { ServerSocket serv; synchronized (this) { diff --git a/jurt/com/sun/star/lib/connections/socket/socketConnector.java b/jurt/com/sun/star/lib/connections/socket/socketConnector.java index 74fb1695e3fb..48d87b71fd93 100644 --- a/jurt/com/sun/star/lib/connections/socket/socketConnector.java +++ b/jurt/com/sun/star/lib/connections/socket/socketConnector.java @@ -106,18 +106,18 @@ public final class socketConnector implements XConnector { public synchronized XConnection connect(String connectionDescription) throws NoConnectException, ConnectionSetupException { - if (connected) { + if (connected) throw new ConnectionSetupException("alread connected"); - } + ConnectionDescriptor desc; try { desc = new ConnectionDescriptor(connectionDescription); } catch (com.sun.star.lang.IllegalArgumentException e) { throw new ConnectionSetupException(e.toString()); } - if (desc.getHost() == null) { + + if (desc.getHost() == null) throw new ConnectionSetupException("host parameter missing"); - } // Try all (IPv4 and IPv6) addresses, in case this client is on a // dual-stack host and the server process is an IPv4-only process, also // on a dual-stack host (see Stevens, Fenner, Rudoff: "Unix Network @@ -135,16 +135,15 @@ public final class socketConnector implements XConnector { socket = new Socket(adr[i], desc.getPort()); break; } catch (IOException e) { - if (i == adr.length - 1) { + if (i == adr.length - 1) throw new NoConnectException(e.toString()); - } } } XConnection con; try { - if (desc.getTcpNoDelay() != null) { + if (desc.getTcpNoDelay() != null) socket.setTcpNoDelay(desc.getTcpNoDelay().booleanValue()); - } + con = new SocketConnection(connectionDescription, socket); } catch (IOException e) { throw new NoConnectException(e.toString()); 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 776296dd6d85..639e9f6532fd 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 @@ -28,9 +28,9 @@ public final class BridgedObject { * Obtains the bridge associated with a bridged object. * * @param obj a reference to a (Java representation of a) UNO object; - * must not be null + * must not be null. * @return the bridge associated with the given object, if it is indeed - * bridged; otherwise, null is returned + * bridged; otherwise, null is returned. */ public static XBridge getBridge(Object obj) { return ProxyFactory.getBridge(obj); 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 1d45cb950b74..a189115b47ec 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 @@ -40,13 +40,11 @@ class XConnectionInputStream_Adapter extends InputStream { } public int read() throws IOException { - - int len ; + int len; try { len = _xConnection.read(_bytes, 1); - } - catch(com.sun.star.io.IOException ioException) { + } catch(com.sun.star.io.IOException ioException) { throw new IOException(ioException.toString()); } @@ -55,13 +53,13 @@ class XConnectionInputStream_Adapter extends InputStream { return len == 0 ? -1 : _bytes[0][0] & 0xff; } + @Override public int read(byte[] b, int off, int len) throws IOException { // byte bytes[][] = new byte[1][]; try { len = _xConnection.read(_bytes, len - off); - } - catch(com.sun.star.io.IOException ioException) { + } catch(com.sun.star.io.IOException ioException) { throw new IOException(ioException.toString()); } 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 999970e4c5c1..3bc7e49975a5 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 @@ -42,21 +42,20 @@ class XConnectionOutputStream_Adapter extends OutputStream { try { _xConnection.write(_bytes); - } - catch(com.sun.star.io.IOException ioException) { + } catch(com.sun.star.io.IOException ioException) { throw new IOException(ioException.toString()); } if(DEBUG) System.err.println("#### " + this.getClass() + " - one byte written:" + _bytes[0]); } + @Override public void write(byte[] b, int off, int len) throws IOException { byte bytes[] ; - if(off == 0 && len == b.length) + if(off == 0 && len == b.length) { bytes = b; - - else { + } else { bytes = new byte[len]; System.arraycopy(b, off, bytes, 0, len); @@ -64,17 +63,16 @@ class XConnectionOutputStream_Adapter extends OutputStream { try { _xConnection.write(bytes); - } - catch(com.sun.star.io.IOException ioException) { + } catch(com.sun.star.io.IOException ioException) { throw new IOException(ioException.toString()); } } + @Override public void flush() throws IOException { try { _xConnection.flush(); - } - catch(com.sun.star.io.IOException ioException) { + } catch(com.sun.star.io.IOException ioException) { throw new IOException(ioException.toString()); } } 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 841cd7cda412..4f76c5c304ce 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 @@ -22,7 +22,6 @@ import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; - import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; @@ -63,12 +62,13 @@ import com.sun.star.uno.TypeClass; import com.sun.star.uno.Any; /** - * This class implements a remote bridge. Therefor - * various interfaces are implemented. - * <p> - * The protocol to used is passed by name, the bridge - * then looks for it under <code>com.sun.star.lib.uno.protocols</code>. - * <p> + * This class implements a remote bridge. + * + * <p>Therefor various interfaces are implemented.</p> + * + * <p>The protocol to used is passed by name, the bridge + * then looks for it under <code>com.sun.star.lib.uno.protocols</code>.</p> + * * @since UDK1.0 */ public class java_remote_bridge @@ -185,10 +185,13 @@ public class java_remote_bridge return _iProtocol; } - // The ref holder stuff strongly holds objects mapped out via this bridge - // (the java_environment only holds them weakly). When this bridge is - // disposed, all remaining ref holder entries are released. - + /** + * The ref holder stuff strongly holds objects mapped out via this bridge + * (the java_environment only holds them weakly). + * + * <p>When this bridge is disposed, all remaining ref holder entries are + * released.</p> + */ private static final class RefHolder { public RefHolder(Type type, Object object) { this.type = type; @@ -219,8 +222,7 @@ public class java_remote_bridge synchronized (refHolders) { LinkedList<RefHolder> l = refHolders.get(oid); if (l != null) { - for (Iterator<RefHolder> i = l.iterator(); i.hasNext();) { - RefHolder rh = i.next(); + for (RefHolder rh : l) { if (type.isSupertypeOf(rh.getType())) { return true; } @@ -256,8 +258,7 @@ public class java_remote_bridge synchronized (refHolders) { LinkedList<RefHolder> l = refHolders.get(oid); if (l != null) { - for (Iterator<RefHolder> i = l.iterator(); i.hasNext();) { - RefHolder rh = i.next(); + for (RefHolder rh : l) { if (rh.getType().equals(type)) { try { if (rh.release()) { @@ -353,19 +354,22 @@ public class java_remote_bridge /** * Constructs a new bridge. - * <p> - * This method is not part of the provided <code>api</code> - * and should only be used by the UNO runtime. - * <p> + * <p> This method is not part of the provided <code>api</code> + * and should only be used by the UNO runtime.</p> + * + * @param args the custom parameters: arg[0] == protocol_name, + * arg[1] == xConnection, arg[2] == xInstanceProvider. + * * @deprecated as of UDK 1.0 - * <p> - * @param args the custom parameters: arg[0] == protocol_name, arg[1] == xConnection, arg[2] == xInstanceProvider */ public java_remote_bridge(Object args[]) throws Exception { this(UnoRuntime.getEnvironment("java", null), UnoRuntime.getEnvironment("remote", null), args); } - // @see com.sun.star.uno.IBridge#mapInterfaceTo + /** + * + * @see com.sun.star.uno.IBridge#mapInterfaceTo + */ public Object mapInterfaceTo(Object object, Type type) { checkDisposed(); if (object == null) { @@ -397,10 +401,11 @@ public class java_remote_bridge /** * Maps an object from destination environment to the source environment. - * <p> - * @return the object in the source environment - * @param oId the object to map - * @param type the interface under which is to be mapped + * + * @param oId the object to map. + * @param type the interface under which is to be mapped. + * @return the object in the source environment. + * * @see com.sun.star.uno.IBridge#mapInterfaceFrom */ public Object mapInterfaceFrom(Object oId, Type type) { @@ -423,8 +428,8 @@ public class java_remote_bridge /** * Gives the source environment. - * <p> - * @return the source environment of this bridge + * + * @return the source environment of this bridge. * @see com.sun.star.uno.IBridge#getSourceEnvironment */ public IEnvironment getSourceEnvironment() { @@ -433,8 +438,8 @@ public class java_remote_bridge /** * Gives the destination environment. - * <p> - * @return the destination environment of this bridge + * + * @return the destination environment of this bridge. * @see com.sun.star.uno.IBridge#getTargetEnvironment */ public IEnvironment getTargetEnvironment() { @@ -443,7 +448,7 @@ public class java_remote_bridge /** * Increases the life count. - * <p> + * * @see com.sun.star.uno.IBridge#acquire */ public synchronized void acquire() { @@ -454,8 +459,9 @@ public class java_remote_bridge /** * Decreases the life count. - * If the life count drops to zero, the bridge disposes itself. - * <p> + * + * <p>If the life count drops to zero, the bridge disposes itself.</p> + * * @see com.sun.star.uno.IBridge#release */ public void release() { @@ -552,7 +558,10 @@ public class java_remote_bridge } } - // @see com.sun.star.bridge.XBridge#getInstance + /** + * + * @see com.sun.star.bridge.XBridge#getInstance + */ public Object getInstance(String instanceName) { Type t = new Type(XInterface.class); return sendInternalRequest( @@ -560,9 +569,9 @@ public class java_remote_bridge } /** - * Gives the name of this bridge - * <p> - * @return the name of this bridge + * Gives the name of this bridge. + * + * @return the name of this bridge. * @see com.sun.star.bridge.XBridge#getName */ public String getName() { @@ -570,9 +579,9 @@ public class java_remote_bridge } /** - * Gives a description of the connection type and protocol used - * <p> - * @return connection type and protocol + * Gives a description of the connection type and protocol used. + * + * @return connection type and protocol. * @see com.sun.star.bridge.XBridge#getDescription */ public String getDescription() { @@ -664,7 +673,9 @@ public class java_remote_bridge } } - // Methods XComponent + /** + * Methods XComponent. + */ public void addEventListener(XEventListener xEventListener) { _listeners.add(xEventListener); } @@ -673,7 +684,10 @@ public class java_remote_bridge _listeners.remove(xEventListener); } - // @see NotifyDispose.addDisposeListener + /** + * + * @see NotifyDispose.addDisposeListener + */ public void addDisposeListener(DisposeListener listener) { synchronized (this) { if (!disposed) { @@ -684,7 +698,9 @@ public class java_remote_bridge listener.notifyDispose(this); } - // This function must only be called while synchronized on this object: + /** + * This function must only be called while synchronized on this object. + */ private synchronized void checkDisposed() { if (disposed) { throw new DisposedException("java_remote_bridge " + this 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 522ca8c2408b..e02f0cebf2c9 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 @@ -43,17 +43,26 @@ public final class java_environment implements IEnvironment { this.context = context; } - // @see com.sun.star.uno.IEnvironment#getContext + /** + * + * @see com.sun.star.uno.IEnvironment#getContext + */ public Object getContext() { return context; } - // @see com.sun.star.uno.IEnvironment#getName + /** + * + * @see com.sun.star.uno.IEnvironment#getName + */ public String getName() { return "java"; } - // @see com.sun.star.uno.IEnvironment#registerInterface + /** + * + * @see com.sun.star.uno.IEnvironment#registerInterface + */ public Object registerInterface(Object object, String[] oid, Type type) { if (oid[0] == null) { oid[0] = UnoRuntime.generateOid(object); @@ -66,8 +75,8 @@ public final class java_environment implements IEnvironment { * You have to revoke ANY interface that has been registered via this * method. * - * @param oid object id of interface to be revoked - * @param type the type description of the interface + * @param oid object id of interface to be revoked. + * @param type the type description of the interface. * @see com.sun.star.uno.IEnvironment#revokeInterface */ public void revokeInterface(String oid, Type type) { @@ -80,8 +89,8 @@ public final class java_environment implements IEnvironment { * Retrieves an interface identified by its object id and type from this * environment. * - * @param oid object id of interface to be retrieved - * @param type the type description of the interface to be retrieved + * @param oid object id of interface to be retrieved. + * @param type the type description of the interface to be retrieved. * @see com.sun.star.uno.IEnvironment#getRegisteredInterface */ public Object getRegisteredInterface(String oid, Type type) { @@ -96,14 +105,17 @@ public final class java_environment implements IEnvironment { * Retrieves the object identifier for a registered interface from this * environment. * - * @param object a registered interface + * @param object a registered interface. * @see com.sun.star.uno.IEnvironment#getRegisteredObjectIdentifier */ public String getRegisteredObjectIdentifier(Object object) { return UnoRuntime.generateOid(object); } - // @see com.sun.star.uno.IEnvironment#list + /** + * + * @see com.sun.star.uno.IEnvironment#list + */ public void list() { // TODO??? // synchronized (proxies) { 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 1409787567d2..f736142e0b20 100644 --- a/jurt/com/sun/star/lib/uno/environments/remote/IProtocol.java +++ b/jurt/com/sun/star/lib/uno/environments/remote/IProtocol.java @@ -51,24 +51,24 @@ public interface IProtocol { * synchronized.</p> * * @return a non-null message; if the input stream is exhausted, a - * <code>java.io.IOException</code> is thrown instead + * <code>java.io.IOException</code> is thrown instead. */ Message readMessage() throws IOException; /** * Writes a request message. * - * @param oid a non-null OID - * @param type a non-null UNO type + * @param oid a non-null OID. + * @param type a non-null UNO type. * @param function a non-null function (the name of a UNO interface method * or attribute compatible with the given <code>type</code>, or either - * <code>"queryInterface"</code> or <code>"release"</code>) - * @param tid a non-null TID + * <code>"queryInterface"</code> or <code>"release"</code>). + * @param tid a non-null TID. * @param arguments a list of UNO arguments compatible with the given * <code>type</code> and <code>function</code>; may be null to represent - * an empty list + * an empty list. * @return <code>true</code> if the request message is sent as a synchronous - * request + * request. */ boolean writeRequest( String oid, TypeDescription type, String function, ThreadId tid, @@ -79,11 +79,11 @@ public interface IProtocol { * Writes a reply message. * * @param exception <code>true</code> if the reply corresponds to a raised - * exception - * @param tid a non-null TID + * exception. + * @param tid a non-null TID. * @param result if <code>exception</code> is <code>true</code>, a non-null * UNO exception; otherwise, a UNO return value, which may be null to - * represent a <code>VOID</code> return value + * represent a <code>VOID</code> return value. */ void writeReply(boolean exception, ThreadId tid, Object result) throws IOException; 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 e9a03783c5e2..385b79c2c230 100644 --- a/jurt/com/sun/star/lib/uno/environments/remote/IThreadPool.java +++ b/jurt/com/sun/star/lib/uno/environments/remote/IThreadPool.java @@ -19,9 +19,8 @@ package com.sun.star.lib.uno.environments.remote; /** - * This interface is an abstraction of the various - * threadpool implementations. - * <p> + * This interface is an abstraction of the various threadpool implementations. + * * @see com.sun.star.lib.uno.environments.remote.ThreadPoolFactory * @see com.sun.star.lib.uno.environments.remote.IThreadPoolFactory * @since UDK1.0 @@ -29,25 +28,25 @@ package com.sun.star.lib.uno.environments.remote; public interface IThreadPool { /** * Retrieves the global threadId for the current thread. - * <p> - * @return the thread id + * + * @return the thread id. */ ThreadId getThreadId(); /** * Attaches this thread to the thread pool. - * <p> + * * @see #enter */ public void attach(); /** - * As above, but hands in an already existing - * instance of the threadid of the current thread. - * Returns a handle which can be used in enter and - * detach calls.<p> - * The function exists for performance - * optimization reasons. + * As above, but hands in an already existing instance of the threadid of + * the current thread. + * + * <p>The function exists for performance.</p> + * + * @return Returns a handle which can be used in enter and detach calls. * @see #attach */ public Object attach( ThreadId id ); @@ -59,11 +58,11 @@ public interface IThreadPool { public void detach(); /** - * As above, but hands in an already existing - * instance of the threadid of the current thread - * and a handle returned by attach. - * The function exists for performance - * optimization reasons. + * As above, but hands in an already existing instance of the threadid of + * the current thread and a handle returned by attach. + * + * <p>The function exists for performance.</p> + * * @see #attach() * @see #detach() */ @@ -71,45 +70,44 @@ public interface IThreadPool { /** * Lets this thread enter the thread pool. - * This thread then executes all jobs put via - * <code>putJob</code> until a reply job arrives. - * <p> + * + * <p>This thread then executes all jobs put via <code>putJob</code> until + * a reply job arrives.</p> + * * @see #putJob */ public Object enter() throws Throwable; /** - * as above but hands in an already existing - * instance of the threadid of the current thread - * and a handle returned by attach. - * This thread then executes all jobs put via - * <code>putJob</code> until a reply job arrives. - * <p> + * As above but hands in an already existing instance of the threadid of + * the current thread and a handle returned by attach. + * + * <p>This thread then executes all jobs put via <code>putJob</code> until + * a reply job arrives.</p> + * * @see #putJob */ public Object enter( Object handle, ThreadId id ) throws Throwable; /** - * Queues a job into the jobQueue of the thread belonging - * to the jobs threadId. - * <p> + * Queues a job into the jobQueue of the thread belonging to the jobs + * threadId. + * * @param job the job */ public void putJob(Job job); /** - * Disposes this thread pool, thus releasing - * all threads by throwing a <code>DisposedException</code> with the given - * <code>Throwable</code> cause. - * <p> + * Disposes this thread pool, thus releasing all threads by throwing a + * <code>DisposedException</code> with the given <code>Throwable</code> cause. + * * @param throwable the cause */ public void dispose(Throwable throwable); /** - * Destroys the thread pool and tries - * to join all created threads immediately. + * Destroys the thread pool and tries to join all created threads immediately. */ public void destroy(); } 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 0b6c8afc0f04..c43bcfa465f7 100644 --- a/jurt/com/sun/star/lib/uno/environments/remote/JavaThreadPool.java +++ b/jurt/com/sun/star/lib/uno/environments/remote/JavaThreadPool.java @@ -20,7 +20,7 @@ package com.sun.star.lib.uno.environments.remote; /** * This class implements a java thread pool. - * <p> + * * @see com.sun.star.uno.UnoRuntime * @see com.sun.star.lib.uno.environments.remote.ThreadPool * @see com.sun.star.lib.uno.environments.remote.IThreadPool 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 29287190fbf1..47fc03342ef2 100644 --- a/jurt/com/sun/star/lib/uno/environments/remote/Job.java +++ b/jurt/com/sun/star/lib/uno/environments/remote/Job.java @@ -22,7 +22,6 @@ package com.sun.star.lib.uno.environments.remote; import java.io.PrintWriter; import java.io.StringWriter; - import java.lang.reflect.InvocationTargetException; import com.sun.star.lib.uno.typedesc.MethodDescription; @@ -35,7 +34,7 @@ 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> + * * @see com.sun.star.lib.uno.environments.remote.ThreadId * @see com.sun.star.lib.uno.environments.remote.IReceiver * @since UDK1.0 @@ -56,9 +55,9 @@ public class Job { } /** - * Dispatches a <code>queryInterface</code> call - * <p> - * @return the result of the call (should be an <code>Any</code>) + * Dispatches a <code>queryInterface</code> call. + * + * @return the result of the call (should be an <code>Any</code>). */ protected Object dispatch_queryInterface(Type type) { Class<?> zInterface = type.getTypeDescription().getZClass(); @@ -153,8 +152,10 @@ public class Job { // _disposeId = null; } - // The name of this method is chosen to generate a somewhat self-explanatory - // stack trace: + /** + * The name of this method is chosen to generate a somewhat self-explanatory + * stack trace. + */ private Exception remoteUnoRequestRaisedException(Object exception) { Exception e = (Exception) exception; e.fillInStackTrace(); 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 c8e246f74eeb..b5e240bc3a0a 100644 --- a/jurt/com/sun/star/lib/uno/environments/remote/JobQueue.java +++ b/jurt/com/sun/star/lib/uno/environments/remote/JobQueue.java @@ -22,13 +22,15 @@ import com.sun.star.lang.DisposedException; /** * The <code>JobQueue</code> implements a queue for jobs. - * For every jobs thread id exists a job queue which is registered - * at the <code>ThreadPool</code>. - * A JobQueue is splitted in a sync job queue and an async job queue. + * + * <p>For every jobs thread id exists a job queue which is registered + * at the <code>ThreadPool</code>.</p> + * + * <p>A JobQueue is splitted in a sync job queue and an async job queue. * The sync job queue is the registered queue, it delegates async jobs * (put by <code>putjob</code>) into the async queue, which is only - * known by the sync queue. - * <p> + * known by the sync queue.</p> + * * @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 @@ -61,7 +63,7 @@ public class JobQueue { protected JavaThreadPoolFactory _javaThreadPoolFactory; /** - * A thread for dispatching jobs + * A thread for dispatching jobs. */ class JobDispatcher extends Thread { Object _disposeId; @@ -81,8 +83,7 @@ public class JobQueue { try { enter(2000, _disposeId); - } - catch(Throwable throwable) { + } catch(Throwable throwable) { if(_head != null || _active) { // there was a job in progress, so give a stack System.err.println(getClass().getName() + " - exception occurred:" + throwable); throwable.printStackTrace(System.err); @@ -107,10 +108,10 @@ public class JobQueue { /** - * Constructs a async job queue with the given thread id - * which belongs to the given sync job queue. - * <p> - * @param threadId the thread id + * Constructs a async job queue with the given thread id which belongs to + * the given sync job queue. + * + * @param threadId the thread id. * @see com.sun.star.lib.uno.environments.remote.ThreadId */ JobQueue(JavaThreadPoolFactory javaThreadPoolFactory, ThreadId threadId) { @@ -135,9 +136,9 @@ public class JobQueue { /** * Constructs a sync job queue with the given thread id and the given thread. - * <p> - * @param threadId the thread id - * @param createThread if true, the queue creates a worker thread if needed + * + * @param threadId the thread id. + * @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){ @@ -150,9 +151,9 @@ public class JobQueue { } /** - * Gives the thread id of this queue - * <p> - * @return the thread id + * Gives the thread id of this queue. + * + * @return the thread id. * @see com.sun.star.lib.uno.environments.remote.ThreadId */ ThreadId getThreadId() { @@ -185,9 +186,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. + * @return a job or null if timed out. */ private Job removeJob(int waitTime) { if(DEBUG) System.err.println("##### " + getClass().getName() + ".removeJob:" + _head + " " + _threadId); @@ -209,8 +210,7 @@ public class JobQueue { try { // wait for new job wait(waitTime); - } - catch(InterruptedException interruptedException) { + } catch(InterruptedException interruptedException) { throw new com.sun.star.uno.RuntimeException(getClass().getName() + ".removeJob - unexpected:" + interruptedException); } @@ -246,8 +246,7 @@ public class JobQueue { try { _async_jobQueue.wait(); - } - catch(InterruptedException interruptedException) { + } catch(InterruptedException interruptedException) { throw new com.sun.star.uno.RuntimeException(getClass().getName() + ".removeJob - unexpected:" + interruptedException); } } @@ -259,9 +258,9 @@ public class JobQueue { /** * Puts a job into the queue. - * <p> - * @param job the job - * @param disposeId a dispose id + * + * @param job the job. + * @param disposeId a dispose id. */ synchronized void putJob(Job job, Object disposeId) { if(DEBUG) System.err.println("##### " + getClass().getName() + ".putJob todoes: " + " job:" + job); @@ -287,9 +286,9 @@ public class JobQueue { /** * Enters the job queue. - * <p> - * @return the result of the final job (reply) - * @param disposeId a dispose id + * + * @param disposeId a dispose id. + * @return the result of the final job (reply). */ Object enter(Object disposeId) throws Throwable { return enter(0, disposeId); // wait infinitly @@ -297,10 +296,10 @@ public class JobQueue { /** * Enters the job queue. - * <p> - * @return the result of the final job (reply) - * @param waitTime the maximum amount of time to wait for a job (0 means wait infinitly) - * @param disposeId a dispose id + * + * @param waitTime the maximum amount of time to wait for a job (0 means wait infinitly). + * @param disposeId a dispose id. + * @return the result of the final job (reply). */ Object enter(int waitTime, Object disposeId) throws Throwable { if(DEBUG) System.err.println("#####" + getClass().getName() + ".enter: " + _threadId); @@ -367,10 +366,9 @@ public class JobQueue { } /** - * If the given disposeId is registered, - * interrups the worker thread. - * <p> - * @param disposeId the dispose id + * If the given disposeId is registered, interrups the worker thread. + * + * @param disposeId the dispose id. */ synchronized void dispose(Object disposeId, Throwable throwable) { if(_sync_jobQueue == null) { // dispose only sync queues 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 e1fa6a712670..f679d76b41bc 100644 --- a/jurt/com/sun/star/lib/uno/environments/remote/Message.java +++ b/jurt/com/sun/star/lib/uno/environments/remote/Message.java @@ -23,8 +23,8 @@ import com.sun.star.uno.ITypeDescription; import com.sun.star.uno.XCurrentContext; /** - A remote request or reply message. -*/ + * A remote request or reply message. + */ public class Message { public Message( ThreadId threadId, boolean request, String objectId, @@ -45,130 +45,130 @@ public class Message { } /** - Returns the thread ID of the message. - - <p>Valid for all kinds of messages.</p> - - @return the (non-<code>null</code>) thread ID - */ + * Returns the thread ID of the message. + * + * <p>Valid for all kinds of messages.</p> + * + * @return the (non-<code>null</code>) thread ID. + */ public final ThreadId getThreadId() { return threadId; } /** - Returns whether the message is a request or a reply. - - <p>Valid for all kinds of messages.</p> - - @return <code>true</code> for a request, <code>false</code> for a reply - */ + * Returns whether the message is a request or a reply. + * + * <p>Valid for all kinds of messages.</p> + * + * @return <code>true</code> for a request, <code>false</code> for a reply. + */ public final boolean isRequest() { return request; } /** - Returns the object ID of a request message. - - <p>Valid only for request messages.</p> - - @return the (non-<code>null</code>) object ID for a request, - <code>null</code> for a reply - */ + * Returns the object ID of a request message. + * + * <p>Valid only for request messages.</p> + * + * @return the (non-<code>null</code>) object ID for a request, + * <code>null</code> for a reply. + */ public final String getObjectId() { return objectId; } /** - Returns the type of a request message. - - <p>Valid only for request messages.</p> - - @return the (non-<code>null</code>) type for a request, <code>null</code> - for a reply - */ + * Returns the type of a request message. + * + * <p>Valid only for request messages.</p> + * + * @return the (non-<code>null</code>) type for a request, <code>null</code> + * for a reply. + */ public final ITypeDescription getType() { return type; } /** - Returns the method description of a request message. - - <p>Valid only for request messages. The returned - <code>IMethodDescription</code> is consistent with the type of the - message.</p> - - @return the (non-<code>null</code>) method description for a request, - <code>null</code> for a reply - */ + * Returns the method description of a request message. + * + * <p>Valid only for request messages. The returned + * <code>IMethodDescription</code> is consistent with the type of the + * message.</p> + * + * @return the (non-<code>null</code>) method description for a request, + * <code>null</code> for a reply. + */ public final IMethodDescription getMethod() { return method; } /** - Returns whether the request message is synchronous. - - <p>Valid only for request messages.</p> - - @return <code>true</code> for a synchronous request, <code>false</code> - for an asynchronous request or a reply - */ + * Returns whether the request message is synchronous. + * + * <p>Valid only for request messages.</p> + * + * @return <code>true</code> for a synchronous request, <code>false</code> + * for an asynchronous request or a reply. + */ public final boolean isSynchronous() { return synchronous; } /** - Returns the current context of a request message. - - <p>Valid only for request messages.</p> - - @return the current context (which may be <code>null</code>) for a - request, <code>null</code> for a reply - */ + * Returns the current context of a request message. + * + * <p>Valid only for request messages.</p> + * + * @return the current context (which may be <code>null</code>) for a + * request, <code>null</code> for a reply. + */ public XCurrentContext getCurrentContext() { return currentContext; } /** - Returns whether the reply message represents abnormal termination. - - <p>Valid only for reply messages.</p> - - @return <code>true</code> for a reply that represents abnormal - termination, <code>false</code> for a reply that represents normal - termination or a request - */ + * Returns whether the reply message represents abnormal termination. + * + * <p>Valid only for reply messages.</p> + * + * @return <code>true</code> for a reply that represents abnormal + * termination, <code>false</code> for a reply that represents normal + * termination or a request. + */ public final boolean isAbnormalTermination() { return abnormalTermination; } /** - Returns the result of a reply message. - - <p>Valid only for reply messages.</p> - - @return any (possibly <code>null</code>) return value for a reply that - represents normal termination, the (non-<code>null</code>) exception for - a reply that represents abnormal termination, <code>null</code> for a - request - */ + * Returns the result of a reply message. + * + * <p>Valid only for reply messages.</p> + * + * @return any (possibly <code>null</code>) return value for a reply that + * represents normal termination, the (non-<code>null</code>) exception for + * a reply that represents abnormal termination, <code>null</code> for a + * request. + */ public final Object getResult() { return result; } /** - Returns the arguments of a message. - - <p>Valid only for request messages and reply messages that represent - normal termination. Any returned array must not be modified.</p> - - @return the in and in&ndash { - }out arguments for a request (possibly - <code>null</code> for a paramterless function), the out and in&dash { - }out - arguments for a reply that represents normal termination (possibly - <code>null</code> for a parameterless function), <code>null</code> for a - reply that represents abnormal termination - */ + * Returns the arguments of a message. + * + * <p>Valid only for request messages and reply messages that represent + * normal termination. Any returned array must not be modified.</p> + * + * @return the in and in&ndash { + * }out arguments for a request (possibly + * <code>null</code> for a paramterless function), the out and in&dash { + * }out + * arguments for a reply that represents normal termination (possibly + * <code>null</code> for a parameterless function), <code>null</code> for a + * reply that represents abnormal termination. + */ public final Object[] getArguments() { return arguments; } 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 7e2a9ad013f2..b652aaf130c0 100644 --- a/jurt/com/sun/star/lib/uno/environments/remote/ThreadId.java +++ b/jurt/com/sun/star/lib/uno/environments/remote/ThreadId.java @@ -41,11 +41,28 @@ public final class ThreadId { this.id = id; } + /** + * Indicates whether some other object is equal to this one. + * + * @param obj the reference object with which to compare. + * @return <code>true</code> if this object is the same as the obj argument; + * <code>false</code> otherwise. + * + * @see java.lang.Object#equals + */ + @Override public boolean equals(Object obj) { return obj instanceof ThreadId && Arrays.equals(id, ((ThreadId) obj).id); } + /** + * Returns a hash code value for the object. + * + * @return a hash code value for this object. + * @see java.lang.Object#hashCode + */ + @Override public int hashCode() { int h = hash; if (h == 0) { @@ -60,6 +77,13 @@ public final class ThreadId { return h; } + /** + * Returns a string representation of the object. + * + * @return a string representation of the object. + * @see java.lang.Object#toString + */ + @Override public String toString() { StringBuffer b = new StringBuffer("[ThreadId:"); for (int i = 0; i < id.length; ++i) { 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 45711eaf6e3d..9718264be379 100644 --- a/jurt/com/sun/star/lib/uno/environments/remote/ThreadPoolManager.java +++ b/jurt/com/sun/star/lib/uno/environments/remote/ThreadPoolManager.java @@ -39,7 +39,7 @@ public final class ThreadPoolManager { /** * Creates a thread pool instance. * - * @return a new thread pool instance; will never be <CODE>null</CODE> + * @return a new thread pool instance; will never be <CODE>null</CODE>. */ public static synchronized IThreadPool create() { if (useNative) { @@ -56,7 +56,7 @@ public final class ThreadPoolManager { * Leads to using the native thread pool factory, unless a Java thread pool * has already been created. * - * @return <CODE>false</CODE> if a Java thread pool has already been created + * @return <CODE>false</CODE> if a Java thread pool has already been created. */ public static synchronized boolean useNative() { useNative = javaFactory == null; 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 14affb5bd974..544a06406648 100644 --- a/jurt/com/sun/star/lib/uno/protocols/urp/Cache.java +++ b/jurt/com/sun/star/lib/uno/protocols/urp/Cache.java @@ -21,18 +21,18 @@ package com.sun.star.lib.uno.protocols.urp; import java.util.HashMap; /** - An LRU cache for arbitrary objects. - - This class is not synchronized, as any necessary synchronization will already - take place in the client. -*/ + * An LRU cache for arbitrary objects. + * + * <p>This class is not synchronized, as any necessary synchronization will already + * take place in the client.</p> + */ final class Cache { /** - Create a cache. - - @param size the maximum cache size, must be between 0, inclusive, and - NOT_CACHED, exclusive - */ + * Create a cache. + * + * @param size the maximum cache size, must be between 0, inclusive, and + * NOT_CACHED, exclusive. + */ public Cache(int size) { maxSize = size; } 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 aac00536db92..08e7ef3380a2 100644 --- a/jurt/com/sun/star/lib/uno/protocols/urp/urp.java +++ b/jurt/com/sun/star/lib/uno/protocols/urp/urp.java @@ -46,10 +46,11 @@ import java.util.ArrayList; import java.util.Random; import java.util.StringTokenizer; -// This class internally relies on the availability of Java UNO type information -// for the interface type com.sun.star.bridge.XProtocolProperties, even though -// URP itself does not rely on that type. - +/** + * This class internally relies on the availability of Java UNO type information + * for the interface type <code>com.sun.star.bridge.XProtocolProperties</code>, + * even though URP itself does not rely on that type. + */ public final class urp implements IProtocol { public urp( IBridge bridge, String attributes, InputStream input, @@ -62,7 +63,10 @@ public final class urp implements IProtocol { forceSynchronous = parseAttributes(attributes); } - // @see IProtocol#init + /** + * + * @see IProtocol#init + */ public void init() throws IOException { synchronized (monitor) { if (state == STATE_INITIAL0) { @@ -71,7 +75,10 @@ public final class urp implements IProtocol { } } - // @see IProtocol#terminate + /** + * + * @see IProtocol#terminate + */ public void terminate() { synchronized (monitor) { state = STATE_TERMINATED; @@ -80,7 +87,10 @@ public final class urp implements IProtocol { } } - // @see IProtocol#readMessage + /** + * + * @see IProtocol#readMessage + */ public Message readMessage() throws IOException { for (;;) { if (!unmarshal.hasMore()) { @@ -108,7 +118,10 @@ public final class urp implements IProtocol { } } - // @see IProtocol#writeRequest + /** + * + * @see IProtocol#writeRequest + */ public boolean writeRequest( String oid, TypeDescription type, String function, ThreadId tid, Object[] arguments) @@ -133,7 +146,10 @@ public final class urp implements IProtocol { } } - // @see IProtocol#writeReply + /** + * + * @see IProtocol#writeReply + */ public void writeReply(boolean exception, ThreadId tid, Object result) throws IOException { diff --git a/jurt/com/sun/star/lib/util/AsynchronousFinalizer.java b/jurt/com/sun/star/lib/util/AsynchronousFinalizer.java index 8839b1194255..1657ecfc3199 100644 --- a/jurt/com/sun/star/lib/util/AsynchronousFinalizer.java +++ b/jurt/com/sun/star/lib/util/AsynchronousFinalizer.java @@ -21,28 +21,28 @@ package com.sun.star.lib.util; import java.util.LinkedList; /** - Helper class to asynchronously execute finalize methods. - - Current JVMs seem not to be robust against long-running finalize methods, in - that such long-running finalize methods may lead to OutOfMemoryErrors. This - class mitigates the problem by asynchronously shifting the bodies of - potentially long-running finalize methods into an extra thread. Classes that - make use of this in their finalize methods are the proxies used in the - intra-process JNI UNO bridge and the inter-process Java URP UNO bridge (where - in both cases finalizers lead to synchronous UNO release calls). - - If JVMs are getting more mature and should no longer have problems with - long-running finalize mehtods, this class could be removed again. -*/ + * Helper class to asynchronously execute finalize methods. + * + * <p>Current JVMs seem not to be robust against long-running finalize methods, + * in that such long-running finalize methods may lead to OutOfMemoryErrors. This + * class mitigates the problem by asynchronously shifting the bodies of + * potentially long-running finalize methods into an extra thread. Classes that + * make use of this in their finalize methods are the proxies used in the + * intra-process JNI UNO bridge and the inter-process Java URP UNO bridge (where + * in both cases finalizers lead to synchronous UNO release calls).</p> + * + * <p>If JVMs are getting more mature and should no longer have problems with + * long-running finalize mehtods, this class could be removed again.</p> + */ public final class AsynchronousFinalizer { /** - Add a job to be executed asynchronously. - - The run method of the given job is called exactly once. If it terminates - abnormally by throwing any Throwable, that is ignored. - - @param job represents the body of some finalize method; must not be null. - */ + * Add a job to be executed asynchronously. + * + * <p>The run method of the given job is called exactly once. If it terminates + * abnormally by throwing any Throwable, that is ignored.</p> + * + * @param job represents the body of some finalize method; must not be null. + */ public static void add(Job job) { synchronized (queue) { boolean first = queue.isEmpty(); @@ -54,11 +54,12 @@ public final class AsynchronousFinalizer { } /** - An interface to represent bodies of finalize methods. - - Similar to Runnable, except that the run method may throw any Throwable - (which is effectively ignored by AsynchronousFinalizer.add, similar to - any Throwables raised by finalize being ignored). + * An interface to represent bodies of finalize methods. + * + * Similar to <code>Runnable</code>, except that the run method may throw any + * <code>Throwable</code> (which is effectively ignored by + * <code>AsynchronousFinalizer.add</code>, similar to any <code>Throwables</code> + * raised by finalize being ignored). */ public interface Job { void run() throws Throwable; diff --git a/jurt/com/sun/star/lib/util/NativeLibraryLoader.java b/jurt/com/sun/star/lib/util/NativeLibraryLoader.java index 749dcb1378c3..c6c4c014a536 100644 --- a/jurt/com/sun/star/lib/util/NativeLibraryLoader.java +++ b/jurt/com/sun/star/lib/util/NativeLibraryLoader.java @@ -21,26 +21,27 @@ import java.io.File; import java.net.URL; import java.net.URLClassLoader; -/** Helper functions to locate and load native files. - - The methods in this class are designed to find the requested resources in as - many cases as possible. They search various places, roughly from most - specific to most general. This works well if a component is known to bring - with it a certain resource, and that resource has to be found. However, it - might not work very well in cases where you want to check whether a - component brings with it a certain resource or not: a similarly named - resource from another component might be found by the eager search - algorithm. +/** + * Helper functions to locate and load native files. + * + * <p>The methods in this class are designed to find the requested resources in + * as many cases as possible. They search various places, roughly from most + * specific to most general. This works well if a component is known to bring + * with it a certain resource, and that resource has to be found. However, it + * might not work very well in cases where you want to check whether a + * component brings with it a certain resource or not: a similarly named + * resource from another component might be found by the eager search + * algorithm.</p> */ public final class NativeLibraryLoader { - /** Load a system library, using a given class loader to locate the library. - - This is similar to System.loadLibrary. - - @param loader a class loader; may be null - - @param libname the library name; how this name is mapped to a system - library name is system dependent + /** + * Load a system library, using a given class loader to locate the library. + * + * <p>This is similar to <code>System.loadLibrary</code>.</p> + * + * @param loader a class loader; may be null. + * @param libname the library name; how this name is mapped to a system + * library name is system dependent. */ public static void loadLibrary(ClassLoader loader, String libname) { String sysname = System.mapLibraryName(libname); @@ -62,18 +63,17 @@ public final class NativeLibraryLoader { } } - /** Locate a system resource, using a given class loader. - - This is similar to ClassLoader.getResource, but only works for local - resources (local files), and adds additional functionality for - URLClassLoaders. - - @param loader a class loader; may be null - - @param name a resource name (that is, the name of a file) - - @return a File locating the resource, or null if the resource was not - found + /** + * Locate a system resource, using a given class loader. + * + * <p>This is similar to <code>ClassLoader.getResource</code>, but only works + * for local resources (local files), and adds additional functionality for + * <code>URLClassLoaders</code>.</p> + * + * @param loader a class loader; may be null. + * @param name a resource name (that is, the name of a file). + * @return a File locating the resource, or null if the resource was not + * found. */ public static File getResource(ClassLoader loader, String name) { if (loader != null) { diff --git a/jurt/com/sun/star/lib/util/StringHelper.java b/jurt/com/sun/star/lib/util/StringHelper.java index 060f8f125ffa..cbe44e2e0442 100644 --- a/jurt/com/sun/star/lib/util/StringHelper.java +++ b/jurt/com/sun/star/lib/util/StringHelper.java @@ -18,7 +18,8 @@ package com.sun.star.lib.util; -/** jurt.jar internal string helper methods. +/** + * jurt.jar internal string helper methods. */ public final class StringHelper { diff --git a/jurt/com/sun/star/lib/util/UrlToFileMapper.java b/jurt/com/sun/star/lib/util/UrlToFileMapper.java index 0cf5ead06754..8354b852ee1a 100644 --- a/jurt/com/sun/star/lib/util/UrlToFileMapper.java +++ b/jurt/com/sun/star/lib/util/UrlToFileMapper.java @@ -116,8 +116,6 @@ public final class UrlToFileMapper { } } - - private static String encode(String url) { StringBuffer buf = new StringBuffer(); for (int i = 0; i < url.length(); ++i) { diff --git a/jurt/com/sun/star/uno/AnyConverter.java b/jurt/com/sun/star/uno/AnyConverter.java index 8d23dfd41c22..4e741ba258ec 100644 --- a/jurt/com/sun/star/uno/AnyConverter.java +++ b/jurt/com/sun/star/uno/AnyConverter.java @@ -18,19 +18,25 @@ package com.sun.star.uno; -/** This class provides static methods which aim at exploring the contents of an - * Any and extracting its value. All public methods take an Object argument that - * either is the immediate object, such as Boolean, Type, interface implementation, - * or an Any that contains an object. <br>The methods which extract the value do a - * widening conversion. See the method comments for the respective conversions. +/** + * This class provides static methods which aim at exploring the contents of an + * Any and extracting its value. + * + * <p>All public methods take an Object argument that either is the immediate object, + * such as Boolean, Type, interface implementation, or an Any that contains an + * object.</p> + * + * <p>The methods which extract the value do a widening conversion. See the + * method comments for the respective conversions.</p> */ public class AnyConverter { - /** Determines the type of an any object. - - @param object any object - @return type object - */ + /** + * Determines the type of an any object. + * + * @param object any object. + * @return type object. + */ static public Type getType( Object object ) { Type t; @@ -52,109 +58,138 @@ 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 + /** + * 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. */ static public boolean isVoid(Object object){ return containsType(TypeClass.VOID, object); } - /** checks if the any contains a value of the idl type <code>char</code>. - @param object the object to check - @return true when the any contains a char, false otherwise. + /** + * Checks if the any contains a value of the idl type <code>char</code>. + * + * @param object the object to check. + * @return true when the any contains a char, false otherwise. */ static public boolean isChar(Object object){ return containsType(TypeClass.CHAR, object); } - /** checks if the any contains a value of the idl type <code>boolean</code>. - @param object the object to check - @return true when the any contains a boolean, false otherwise. + /** + * Checks if the any contains a value of the idl type <code>boolean</code>. + * + * @param object the object to check. + * @return true when the any contains a boolean, false otherwise. */ static public boolean isBoolean(Object object){ return containsType(TypeClass.BOOLEAN, object); } - /** checks if the any contains a value of the idl type <code>byte</code>. - @param object the object to check - @return true when the any contains a byte, false otherwise. + /** + * Checks if the any contains a value of the idl type <code>byte</code>. + * + * @param object the object to check. + * @return true when the any contains a byte, false otherwise. */ static public boolean isByte(Object object){ return containsType(TypeClass.BYTE, object); } - /** checks if the any contains a value of the idl type <code>short</code>. - @param object the object to check - @return true when the any contains a short, false otherwise. + /** + * Checks if the any contains a value of the idl type <code>short</code>. + * + * @param object the object to check. + * @return true when the any contains a short, false otherwise. */ static public boolean isShort(Object object){ return containsType(TypeClass.SHORT, object); } - /** checks if the any contains a value of the idl type <code>long</code> (which maps to a java-int). - @param object the object to check - @return true when the any contains a int, false otherwise. + /** + * Checks if the any contains a value of the idl type <code>long</code> + * (which maps to a java-int). + * + * @param object the object to check. + * @return true when the any contains a int, false otherwise. */ 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 - @return true when the any contains a long, false otherwise. + /** + * 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. + * @return true when the any contains a long, false otherwise. */ static public boolean isLong(Object object){ return containsType(TypeClass.HYPER, object); } - /** checks if the any contains a value of the idl type <code>float</code>. - @param object the object to check - @return true when the any contains a float, false otherwise. + /** + * Checks if the any contains a value of the idl type <code>float</code>. + * + * @param object the object to check. + * @return true when the any contains a float, false otherwise. */ static public boolean isFloat(Object object){ return containsType(TypeClass.FLOAT, object); } - /** checks if the any contains a value of the idl type <code>double</code>. - @param object the object to check - @return true when the any contains a double, false otherwise. + /** + * Checks if the any contains a value of the idl type <code>double</code>. + * + * @param object the object to check. + * @return true when the any contains a double, false otherwise. */ 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 - @return true when the any contains a string, false otherwise. + /** + * Checks if the any contains a value of the idl type <code>string</code>. + * + * @param object the object to check. + * @return true when the any contains a string, false otherwise. */ 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 + /** + * 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. */ static public boolean isEnum(Object object) { return containsType(TypeClass.ENUM, object); } - /** checks if the any contains a value of the idl type <code>type</code>. - @param object the object to check - @return true when the any contains a type, false otherwise. + /** + * Checks if the any contains a value of the idl type <code>type</code>. + * + * @param object the object to check. + * @return true when the any contains a type, false otherwise. */ 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 - the any contains a null reference. This is because interfaces are allowed to have - a null value contrary to other UNO types. - @param object the object to check - @return true if the any contains an object + /** + * Checks if the any contains an interface, struct, exception, sequence or enum. + * + * <p>If <em>object</em> is an any with an interface type, then true is also + * returned if the any contains a null reference. This is because interfaces + * are allowed to havea null value contrary to other UNO types.</p> + * + * @param object the object to check. + * @return true if the any contains an object. */ static public boolean isObject(Object object) { @@ -166,64 +201,92 @@ public class AnyConverter 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 - @return true when the any contains an object which implements interfaces, false otherwise. + /** + * 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. + * @return true when the any contains an object which implements interfaces, + * false otherwise. */ static public boolean isArray(Object object){ return containsType(TypeClass.SEQUENCE, object); } - /** converts an Char object or an Any object containing a Char object into a simple char. - @param object the object to convert - @return the char contained within the object - @throws com.sun.star.lang.IllegalArgumentException in case no char is contained within object - @see #isChar - */ + /** + * Converts an Char object or an Any object containing a Char object into a + * simple char. + * + * @param object the object to convert. + * @return the char contained within the object. + * @throws com.sun.star.lang.IllegalArgumentException in case no char is + * contained within object. + * + * @see #isChar + */ static public char toChar(Object object) throws com.sun.star.lang.IllegalArgumentException{ Character ret= (Character)convertSimple(TypeClass.CHAR, null, object); return ret.charValue(); } - /** converts an Boolean object or an Any object containing a Boolean object into a simple boolean. - @param object the object to convert - @return the boolean contained within the object - @throws com.sun.star.lang.IllegalArgumentException in case no boolean is contained within object - @see #isBoolean + /** + * Converts an Boolean object or an Any object containing a Boolean object + * into a simple boolean. + * + * @param object the object to convert. + * @return the boolean contained within the object + * @throws com.sun.star.lang.IllegalArgumentException in case no boolean is + * contained within object + * + * @see #isBoolean */ static public boolean toBoolean(Object object) throws com.sun.star.lang.IllegalArgumentException{ Boolean ret= (Boolean)convertSimple(TypeClass.BOOLEAN, null, object); return ret.booleanValue(); } - /** converts an Byte object or an Any object containing a Byte object into a simple byte. - @param object the object to convert - @return the boolean contained within the object - @throws com.sun.star.lang.IllegalArgumentException in case no byte is contained within object - @see #isBoolean - */ + /** + * Converts an Byte object or an Any object containing a Byte object into a + * simple byte. + * + * @param object the object to convert. + * @return the boolean contained within the object. + * @throws com.sun.star.lang.IllegalArgumentException in case no byte is + * contained within object. + * + * @see #isBoolean + */ static public byte toByte(Object object) throws com.sun.star.lang.IllegalArgumentException{ 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 + /** + * Converts a number object into a simple short and allows widening conversions. + * + * <p>Allowed argument types are Byte, Short or Any containing these types.</p> + * + * @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(); } - /** converts a number object into an idl unsigned short and allows widening conversions. - Allowed argument types are Anies containing idl unsigned short values. - @param object the object to convert - @throws com.sun.star.lang.IllegalArgumentException - in case no idl unsigned short is contained within Any - @return an (unsigned) short + /** + * Converts a number object into an idl unsigned short and allows widening + * conversions. + * + * <p>Allowed argument types are Anies containing idl unsigned short values.</p> + * + * @param object the object to convert. + * @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 @@ -232,22 +295,34 @@ public class AnyConverter return ret.shortValue(); } - /** converts a number object into a simple int and allows widening conversions. - Allowed argument types are Byte, Short, Integer or Any containing these types. - @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 + /** + * Converts a number object into a simple int and allows widening conversions. + * + * <p>Allowed argument types are Byte, Short, Integer or Any containing these + * types.</p> + * + * @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(); } - /** converts a number object into an idl unsigned long and allows widening conversions. - Allowed argument types are Anies containing idl unsigned short or unsigned long values. - @param object the object to convert - @throws com.sun.star.lang.IllegalArgumentException - in case no idl unsigned short nor unsigned long is contained within Any - @return an (unsigned) int + /** + * Converts a number object into an idl unsigned long and allows widening + * conversions. + * + * <p>Allowed argument types are Anies containing idl unsigned short or + * unsigned long values.</p> + * + * @param object the object to convert. + * @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 @@ -256,25 +331,34 @@ public class AnyConverter return ret.intValue(); } - /** converts a number object into a simple long and allows widening conversions. - Allowed argument types are Byte, Short, Integer, Long or Any containing these types. - @param object the object to convert - @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 + /** + * Converts a number object into a simple long and allows widening conversions. + * + * <p>Allowed argument types are Byte, Short, Integer, Long or Any containing + * these types.</p> + * + * @param object the object to convert. + * @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(); } - /** converts a number object into an idl unsigned hyper and allows widening conversions. - Allowed argument types are Anies containing idl unsigned short, unsigned long or - unsigned hyper values. - @param object the object to convert - @throws com.sun.star.lang.IllegalArgumentException - in case no idl unsigned short, nor unsigned long nor unsigned hyper - is contained within object. - @return an (unsigned) long + /** + * Converts a number object into an idl unsigned hyper and allows widening + * conversions. + * + * <p>Allowed argument types are Anies containing idl unsigned short, unsigned + * long or unsigned hyper values.</p> + * + * @param object the object to convert. + * @throws com.sun.star.lang.IllegalArgumentException 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 @@ -283,76 +367,105 @@ public class AnyConverter return ret.longValue(); } - /** converts a number object into a simple float and allows widening conversions. - Allowed argument types are Byte, Short, Float or Any containing these types. - @param object the object to convert - @throws com.sun.star.lang.IllegalArgumentException in case no byte, short or float - is contained within object. - @return the float contained within the object + /** + * Converts a number object into a simple float and allows widening conversions. + * + * <p>Allowed argument types are Byte, Short, Float or Any containing these + * types.</p> + * + * @param object the object to convert. + * @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(); } - /** converts a number object into a simple double and allows widening conversions. - Allowed argument types are Byte, Short, Int, Float, Double or Any containing these types. - @param object the object to convert - @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 + /** + * Converts a number object into a simple double and allows widening conversions. + * + * <p>Allowed argument types are Byte, Short, Int, Float, Double or Any + * containing these types.</p> + * + * @param object the object to convert. + * @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 + /** + * 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 + /** + * 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. + /** + * 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. + * + * <p> For interfaces, the argument <em>object</em> is queried for the interface + * specified by the <em>type</em> argument.</p> * - * @param type type of the returned value - * @param object the object that is to be converted - * @return destination object - * @throws com.sun.star.lang.IllegalArgumentException - * in case conversion is not possible + * <p>That query (UnoRuntime.queryInterface) might return null, if the interface + * is not implemented or a null-ref or a VOID any is given.</p> + * + * @param type type of the returned value. + * @param object the object that is to be converted. + * @throws com.sun.star.lang.IllegalArgumentException in case conversion is + * not possible. + * + * @return destination object. */ static public Object toObject(Type type, Object object) throws com.sun.star.lang.IllegalArgumentException { return convertSimple( type.getTypeClass(), type, 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 clazz class of the returned value - * @param object the object that is to be converted - * @return destination object - * @throws com.sun.star.lang.IllegalArgumentException - * in case conversion is not possible + /** + * 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. + * + * <p>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.</p> + * + * @param clazz class of the returned value. + * @param object the object that is to be converted. + * @throws com.sun.star.lang.IllegalArgumentException in case conversion is + * not possible. + * + * @return destination object. */ static public Object toObject(Class<?> clazz, Object object) throws com.sun.star.lang.IllegalArgumentException @@ -360,20 +473,26 @@ 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 + /** + * 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 - contained object is matched against the type. - */ + * Examines the argument <em>object</em> if is correspond to the type in + * argument <em>what</em>. + * + * <p><em>object</em> is either matched directly against the type or if it is + * an any then the contained object is matched against the type.</p> + */ static private boolean containsType( TypeClass what, Object object){ return (getType(object).getTypeClass().getValue() == what.getValue()); } @@ -385,8 +504,7 @@ public class AnyConverter { Object object; Type type; - if (object_ instanceof Any) - { + if (object_ instanceof Any) { // unbox Any a = (Any)object_; object = a.getObject(); @@ -394,9 +512,7 @@ public class AnyConverter // nested any if (TypeClass.ANY_value == type.getTypeClass().getValue()) return convertSimple( destTClass, destType, object ); - } - else - { + } else { object = object_; type = (null == object ? m_XInterface_type : new Type( object.getClass() )); } @@ -404,16 +520,12 @@ public class AnyConverter int tc = type.getTypeClass().getValue(); int dest_tc = destTClass.getValue(); - if (null == object) - { + if (null == object) { // special for interfaces if (TypeClass.INTERFACE_value == tc && dest_tc == tc) return null; - } - else - { - switch (dest_tc) - { + } else { + switch (dest_tc) { case TypeClass.CHAR_value: if (tc == TypeClass.CHAR_value) return object; @@ -427,8 +539,7 @@ public class AnyConverter return object; break; case TypeClass.SHORT_value: - switch (tc) - { + switch (tc) { case TypeClass.BYTE_value: return new Short( ((Byte)object).byteValue() ); case TypeClass.SHORT_value: @@ -436,15 +547,13 @@ public class AnyConverter } break; case TypeClass.UNSIGNED_SHORT_value: - switch (tc) - { + switch (tc) { case TypeClass.UNSIGNED_SHORT_value: return object; } break; case TypeClass.LONG_value: - switch (tc) - { + switch (tc) { case TypeClass.BYTE_value: return new Integer( ((Byte)object).byteValue() ); case TypeClass.SHORT_value: @@ -455,8 +564,7 @@ public class AnyConverter } break; case TypeClass.UNSIGNED_LONG_value: - switch (tc) - { + switch (tc) { case TypeClass.UNSIGNED_SHORT_value: return new Integer( ((Short)object).shortValue() ); case TypeClass.UNSIGNED_LONG_value: @@ -464,8 +572,7 @@ public class AnyConverter } break; case TypeClass.HYPER_value: - switch (tc) - { + switch (tc) { case TypeClass.BYTE_value: return new Long( ((Byte)object).byteValue() ); case TypeClass.SHORT_value: @@ -479,8 +586,7 @@ public class AnyConverter } break; case TypeClass.UNSIGNED_HYPER_value: - switch (tc) - { + switch (tc) { case TypeClass.UNSIGNED_SHORT_value: return new Long( ((Short)object).shortValue() ); case TypeClass.UNSIGNED_LONG_value: @@ -490,8 +596,7 @@ public class AnyConverter } break; case TypeClass.FLOAT_value: - switch (tc) - { + switch (tc) { case TypeClass.BYTE_value: return new Float( ((Byte)object).byteValue() ); case TypeClass.SHORT_value: @@ -501,8 +606,7 @@ public class AnyConverter } break; case TypeClass.DOUBLE_value: - switch (tc) - { + switch (tc) { case TypeClass.BYTE_value: return new Double( ((Byte)object).byteValue() ); case TypeClass.SHORT_value: diff --git a/jurt/com/sun/star/uno/Ascii.java b/jurt/com/sun/star/uno/Ascii.java index 09dc8d671e57..7b294c4e22c7 100644 --- a/jurt/com/sun/star/uno/Ascii.java +++ b/jurt/com/sun/star/uno/Ascii.java @@ -20,17 +20,17 @@ package com.sun.star.uno; /** * The Ascii class represents the IDL build in type <code>ascii</code>. - * <p> - * @deprecated do not use + * + * @deprecated do not use. */ public final class Ascii { public final char ascii; /** * Constructs a new <code>Ascii</code>. - * <p> - * @deprecated do not use - * @param c the char value + * + * @deprecated do not use. + * @param c the char value. */ public Ascii(char c) { ascii = c; diff --git a/jurt/com/sun/star/uno/AsciiString.java b/jurt/com/sun/star/uno/AsciiString.java index 235547258bf7..5c031f4785a3 100644 --- a/jurt/com/sun/star/uno/AsciiString.java +++ b/jurt/com/sun/star/uno/AsciiString.java @@ -20,17 +20,17 @@ package com.sun.star.uno; /** * The Ascii class represents the IDL build in type <code>asciistring</code>. - * <p> - * @deprecated do not use + * + * @deprecated do not use. */ public final class AsciiString { public final String asciistring; /** * Constructs a new <code>AsciiString</code>. - * <p> - * @deprecated do not use - * @param s the String value + * + * @deprecated do not use. + * @param s the String value. */ public AsciiString(String s) { asciistring = s; diff --git a/jurt/com/sun/star/uno/MappingException.java b/jurt/com/sun/star/uno/MappingException.java index c1054ce9a8e8..216682a626ef 100644 --- a/jurt/com/sun/star/uno/MappingException.java +++ b/jurt/com/sun/star/uno/MappingException.java @@ -21,12 +21,14 @@ package com.sun.star.uno; /** * The mapping Exception. - * The exception is replaced by the com.sun.star.lang.DisposedException. - * @deprecated since UDK 3.0.2 - * <p> + * + * <p>The exception is replaced by the com.sun.star.lang.DisposedException.</p> + * * @see com.sun.star.uno.UnoRuntime * @see com.sun.star.uno.IQueryInterface * @see com.sun.star.uno.IBridge + * + * @deprecated since UDK 3.0.2 */ public class MappingException extends com.sun.star.uno.RuntimeException { /** @@ -38,7 +40,7 @@ public class MappingException extends com.sun.star.uno.RuntimeException { /** * Contructs an <code>MappingException</code> with a detail message. - * <p> + * * @param message the detail message. */ public MappingException(String message) { @@ -46,9 +48,9 @@ public class MappingException extends com.sun.star.uno.RuntimeException { } /** - * Contructs an <code>MappingException</code> with a detail message - * and a context. - * <p> + * Contructs an <code>MappingException</code> with a detail message and a + * context. + * * @param message the detail message. * @param context the context. */ diff --git a/jurt/com/sun/star/uno/WeakReference.java b/jurt/com/sun/star/uno/WeakReference.java index 9d39e61029ee..5057f2a65d0c 100644 --- a/jurt/com/sun/star/uno/WeakReference.java +++ b/jurt/com/sun/star/uno/WeakReference.java @@ -23,8 +23,11 @@ import com.sun.star.uno.UnoRuntime; import com.sun.star.uno.XAdapter; import com.sun.star.uno.XReference; -/** This class holds weak reference to an object. It actually holds a reference to a - com.sun.star.XAdapter implementation and obtains a hard reference if necessary. +/** + * This class holds weak reference to an object. + * + * <p>It actually holds a reference to a <code>com.sun.star.XAdapter</code> + * implementation and obtains a hard reference if necessary. */ public class WeakReference { @@ -39,8 +42,10 @@ public class WeakReference // 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 + /** + * Creates an instance of this class. + * + * @param obj another instance that is to be copied. */ public WeakReference(WeakReference obj) { @@ -60,8 +65,10 @@ public class WeakReference } } - /** Creates an instance of this class. - *@param obj XWeak implementation + /** + * Creates an instance of this class. + * + * @param obj XWeak implementation. */ public WeakReference(Object obj) { @@ -73,8 +80,11 @@ public class WeakReference m_listener= new OWeakRefListener(adapter); } } - /** Returns a hard reference to the object that is kept weak by this class. - *@return a hard reference to the XWeak implementation. + + /** + * Returns a hard reference to the object that is kept weak by this class. + * + * @return a hard reference to the XWeak implementation. */ public Object get() { @@ -84,25 +94,34 @@ 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 - * occurs on notification by the adapter and the adapter is released. +/** + * Implementation of com.sun.star.uno.XReference for use with WeakReference. + * + * <p>It keeps the XAdapter implementation and registers always with it. + * Deregistering occurs on notification by the adapter and the adapter is + * released.</p> */ 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. + /** + * The constructor registered this object with adapter. + * + * @param adapter the XAdapter implementation. */ OWeakRefListener( XAdapter adapter) { m_adapter= adapter; m_adapter.addReference(this); } - /** Method of com.sun.star.uno.XReference. When called, it deregisteres this - * object with the adapter and releases the reference to it. + + /** + * Method of <code>com.sun.star.uno.XReference</code>. + * + * <p>When called, it deregisteres this object with the adapter and releases + * the reference to it.</p> */ synchronized public void dispose() { @@ -113,9 +132,11 @@ class OWeakRefListener implements XReference } } - /** 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. + /** + * 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. */ synchronized Object get() { |