diff options
author | Jose <jose@zeroc.com> | 2009-10-03 01:25:11 +0200 |
---|---|---|
committer | Jose <jose@zeroc.com> | 2009-10-03 01:25:11 +0200 |
commit | f5932cf9712186c1bca0efec29e0ff78f3450a10 (patch) | |
tree | e192a0d61663b4ec66b3cc4169227046b10cf923 /java/src | |
parent | 4190 - Add header to generated files to indicate they are autogenerated. (diff) | |
download | ice-f5932cf9712186c1bca0efec29e0ff78f3450a10.tar.bz2 ice-f5932cf9712186c1bca0efec29e0ff78f3450a10.tar.xz ice-f5932cf9712186c1bca0efec29e0ff78f3450a10.zip |
Fix issues in bug 3772
commit 69d72505e82f9e88b2e24f4d9a669cd39b17e2f4
Author: Jose <jose@zeroc.com>
Date: Sat Oct 3 01:20:23 2009 +0200
Diffstat (limited to 'java/src')
-rw-r--r-- | java/src/Glacier2/SessionCallback.java | 52 | ||||
-rw-r--r-- | java/src/Glacier2/SessionFactoryHelper.java | 65 | ||||
-rw-r--r-- | java/src/Glacier2/SessionHelper.java | 16 |
3 files changed, 70 insertions, 63 deletions
diff --git a/java/src/Glacier2/SessionCallback.java b/java/src/Glacier2/SessionCallback.java new file mode 100644 index 00000000000..942c172756b --- /dev/null +++ b/java/src/Glacier2/SessionCallback.java @@ -0,0 +1,52 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +package Glacier2; + +/** + * A callback class to get notifications of status changes in the Glacier2 session. + * All callbacks on the <code>Callback</code> interface occur in the main swing thread. + */ +public interface SessionCallback +{ + /** + * Notifies the application that the communicator was created. + * + * @param session The Glacier2 session. + */ + void + createdCommunicator(SessionHelper session); + + /** + * Notifies the application that the Glacier2 session has been established. + * + * @param session The established session. + */ + void + connected(SessionHelper session) + throws SessionNotExistException; + + /** + * Notifies the application that the Glacier2 session has been disconnected. + * + * @param session The disconnected session. + */ + void + disconnected(SessionHelper session); + + /** + * Notifies the application that the Glacier2 session establishment failed. + * + * @param session The session reporting the connection + * failure. + * @param ex The exception. + */ + void + connectFailed(SessionHelper session, Throwable ex); +} diff --git a/java/src/Glacier2/SessionFactoryHelper.java b/java/src/Glacier2/SessionFactoryHelper.java index ac77170b677..28745183155 100644 --- a/java/src/Glacier2/SessionFactoryHelper.java +++ b/java/src/Glacier2/SessionFactoryHelper.java @@ -20,56 +20,13 @@ package Glacier2; public class SessionFactoryHelper { /** - * A callback class to get notifications of status changes in the Glacier2 session. - * All callbacks on the <code>Callback</code> interface occur in the main swing thread. - */ - public interface Callback - { - /** - * Notifies the application that the communicator was created. - * - * @param session The Glacier2 session. - */ - void - createdCommunicator(SessionHelper session); - - /** - * Notifies the application that the Glacier2 session has been established. - * - * @param session The established session. - */ - - void - connected(SessionHelper session) - throws SessionNotExistException; - - /** - * Notifies the application that the Glacier2 session has been disconnected. - * - * @param session The disconnected session. - */ - void - disconnected(SessionHelper session); - - /** - * Notifies the application that the Glacier2 session establishment failed. - * - * @param session The session reporting the connection - * failure. - * @param ex The exception. - */ - void - connectFailed(SessionHelper session, Throwable ex); - } - - /** * Creates a SessionFactory object. * * @param callback The callback object for notifications. * @throws {@link Ice.InitializationException} */ public - SessionFactoryHelper(Callback callback) throws Ice.InitializationException + SessionFactoryHelper(SessionCallback callback) throws Ice.InitializationException { initialize(callback, new Ice.InitializationData(), Ice.Util.createProperties()); } @@ -82,7 +39,7 @@ public class SessionFactoryHelper * @throws {@link Ice.InitializationException} */ public - SessionFactoryHelper(Ice.InitializationData initData, Callback callback) throws Ice.InitializationException + SessionFactoryHelper(Ice.InitializationData initData, SessionCallback callback) throws Ice.InitializationException { initialize(callback, initData, initData.properties); } @@ -95,18 +52,18 @@ public class SessionFactoryHelper * @throws {@link Ice.InitializationException} */ public - SessionFactoryHelper(Ice.Properties properties, Callback callback) throws Ice.InitializationException + SessionFactoryHelper(Ice.Properties properties, SessionCallback callback) throws Ice.InitializationException { initialize(callback, new Ice.InitializationData(), properties); } private void - initialize(Callback callback, Ice.InitializationData initData, Ice.Properties properties) + initialize(SessionCallback callback, Ice.InitializationData initData, Ice.Properties properties) throws Ice.InitializationException { if(callback == null) { - throw new Ice.InitializationException("Attempt to create a SessionFactoryHelper with a null Callback" + + throw new Ice.InitializationException("Attempt to create a SessionFactoryHelper with a null SessionCallback" + "argument"); } @@ -136,7 +93,7 @@ public class SessionFactoryHelper /** * Set the router object identity. * - * @return The Glacier2 router's identity. + * @param identity The Glacier2 router's identity. */ synchronized public void setRouterIdentity(Ice.Identity identity) @@ -259,8 +216,8 @@ public class SessionFactoryHelper /** * Connects to the Glacier2 router using the associated SSL credentials. * - * Once the connection is established, {@link Callback#connected} is called on the callback object; - * upon failure, {@link Callback#connectFailed} is called with the exception. + * Once the connection is established, {@link SessionCallback#connected} is called on the callback object; + * upon failure, {@link SessionCallback#connectFailed} is called with the exception. * * @return The connected session. */ @@ -275,8 +232,8 @@ public class SessionFactoryHelper /** * Connect the Glacier2 session using user name and password credentials. * - * Once the connection is established, {@link Callback#connected} is called on the callback object; - * upon failure, {@link Callback#connectFailed) is called with the exception. + * Once the connection is established, {@link SessionCallback#connected} is called on the callback object; + * upon failure, {@link SessionCallback#connectFailed) is called with the exception. * * @param username The user name. * @param password The password. @@ -343,7 +300,7 @@ public class SessionFactoryHelper return initData; } - private Callback _callback; + private SessionCallback _callback; private String _routerHost = "127.0.0.1"; private Ice.InitializationData _initData; private Ice.Identity _identity = new Ice.Identity("router", "Glacier2"); diff --git a/java/src/Glacier2/SessionHelper.java b/java/src/Glacier2/SessionHelper.java index bea4a5dec15..0fb447a359e 100644 --- a/java/src/Glacier2/SessionHelper.java +++ b/java/src/Glacier2/SessionHelper.java @@ -10,8 +10,6 @@ package Glacier2; import javax.swing.SwingUtilities; -import Glacier2.SessionFactoryHelper.Callback; - /** * A helper class for using Glacier2 with GUI applications. */ @@ -87,7 +85,7 @@ public class SessionHelper * @param callback The callback for notifications about session establishment. * @param initData The {@link Ice.InitializationData} for initializing the communicator. */ - public SessionHelper(SessionFactoryHelper.Callback callback, Ice.InitializationData initData) + public SessionHelper(SessionCallback callback, Ice.InitializationData initData) { _callback = callback; _initData = initData; @@ -96,7 +94,7 @@ public class SessionHelper /** * Destroys the Glacier2 session. * - * Once the session has been destroyed, {@link Callback.disconnected} is called on + * Once the session has been destroyed, {@link SessionCallback.disconnected} is called on * the associated callback object. */ synchronized public void @@ -261,8 +259,8 @@ public class SessionHelper /** * Connects to the Glacier2 router using the associated SSL credentials. * - * Once the connection is established, {@link Callback#connected} is called on the callback object; - * upon failure, {@link Callback#exception} is called with the exception. + * Once the connection is established, {@link SessionCallback#connected} is called on the callback object; + * upon failure, {@link SessionCallback#exception} is called with the exception. */ synchronized protected void connect() @@ -280,8 +278,8 @@ public class SessionHelper /** * Connects a Glacier2 session using user name and password credentials. * - * Once the connection is established, {@link Callback#connected} is called on the callback object; - * upon failure {@link Callback.exception} is called with the exception. + * Once the connection is established, {@link SessionCallback#connected} is called on the callback object; + * upon failure {@link SessionCallback.exception} is called with the exception. * * @param username The user name. * @param password The password. @@ -489,7 +487,7 @@ public class SessionHelper private Glacier2.SessionPrx _session; private SessionRefreshThread _refreshThread; - private SessionFactoryHelper.Callback _callback; + private SessionCallback _callback; private boolean _destroy = false; private boolean _connected = false; private Thread _shutdownHook; |