summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Spruiell <mes@zeroc.com>2010-05-18 20:06:03 -0700
committerMark Spruiell <mes@zeroc.com>2010-05-18 20:06:03 -0700
commitb7300a6afcbb409cf959d88cd0914eb95f334bd0 (patch)
tree80c332b102dd02b61ecf4639b1cf1183b9186bc8
parentAnother fix for IceSSL to work with VC6 as well as VC10 (diff)
downloadice-b7300a6afcbb409cf959d88cd0914eb95f334bd0.tar.bz2
ice-b7300a6afcbb409cf959d88cd0914eb95f334bd0.tar.xz
ice-b7300a6afcbb409cf959d88cd0914eb95f334bd0.zip
adding setConnectContext to Glacier2.SessionFactoryHelper
-rw-r--r--CHANGES4
-rw-r--r--cs/src/Glacier2/SessionFactoryHelper.cs19
-rw-r--r--cs/src/Glacier2/SessionHelper.cs11
-rw-r--r--java/src/Glacier2/SessionFactoryHelper.java16
-rw-r--r--java/src/Glacier2/SessionHelper.java11
5 files changed, 49 insertions, 12 deletions
diff --git a/CHANGES b/CHANGES
index 2987ee47d8b..a693f8e5274 100644
--- a/CHANGES
+++ b/CHANGES
@@ -27,6 +27,10 @@ Changes since version 3.4.0
General Changes
===============
+- Added the setConnectContext method to Glacier2.SessionFactoryHelper,
+ which allows an application to provide a request context to be used
+ when creating a Glacier2 session. (Java and C#)
+
- Fixed IceGrid bug where node observers would not be notified when a
server is re-enabled after it has been updated and if the server was
disabled following an activation failure.
diff --git a/cs/src/Glacier2/SessionFactoryHelper.cs b/cs/src/Glacier2/SessionFactoryHelper.cs
index 66d83be4cdf..54e648f3dde 100644
--- a/cs/src/Glacier2/SessionFactoryHelper.cs
+++ b/cs/src/Glacier2/SessionFactoryHelper.cs
@@ -9,6 +9,7 @@
using System;
using System.Text;
+using System.Collections.Generic;
namespace Glacier2
{
@@ -212,6 +213,19 @@ public class SessionFactoryHelper
}
/// <summary>
+ /// Sets the request context to use while establishing a connection to the Glacier2 router.
+ /// </summary>
+ /// <param name="context">The request context.</param>
+ public void
+ setConnectContext(Dictionary<string, string> context)
+ {
+ lock(this)
+ {
+ _context = context;
+ }
+ }
+
+ /// <summary>
/// Connects to the Glacier2 router using the associated SSL credentials.
///
/// Once the connection is established, SesssionCallback.connected is called on
@@ -225,7 +239,7 @@ public class SessionFactoryHelper
lock(this)
{
SessionHelper session = new SessionHelper(_callback, createInitData());
- session.connect();
+ session.connect(_context);
return session;
}
}
@@ -246,7 +260,7 @@ public class SessionFactoryHelper
lock(this)
{
SessionHelper session = new SessionHelper(_callback, createInitData());
- session.connect(username, password);
+ session.connect(username, password, _context);
return session;
}
}
@@ -317,6 +331,7 @@ public class SessionFactoryHelper
private bool _secure = true;
private int _port = 0;
private int _timeout = 10000;
+ private Dictionary<string, string> _context;
private static int GLACIER2_SSL_PORT = 4064;
private static int GLACIER2_TCP_PORT = 4063;
}
diff --git a/cs/src/Glacier2/SessionHelper.cs b/cs/src/Glacier2/SessionHelper.cs
index bc897e38090..ec76613e162 100644
--- a/cs/src/Glacier2/SessionHelper.cs
+++ b/cs/src/Glacier2/SessionHelper.cs
@@ -10,6 +10,7 @@
using System;
using System.Diagnostics;
using System.Threading;
+using System.Collections.Generic;
namespace Glacier2
{
@@ -289,14 +290,15 @@ public class SessionHelper
/// the callback object; upon failure, SessionCallback.exception is called with
/// the exception.
/// </summary>
+ /// <param name="context">The request context to use when creating the session.</param>
public void
- connect()
+ connect(Dictionary<string, string> context)
{
lock(this)
{
connectImpl(delegate(RouterPrx router)
{
- return router.createSessionFromSecureConnection();
+ return router.createSessionFromSecureConnection(context);
});
}
}
@@ -309,14 +311,15 @@ public class SessionHelper
/// </summary>
/// <param name="username">The user name.</param>
/// <param name="password">The password.</param>
+ /// <param name="context">The request context to use when creating the session.</param>
public void
- connect(string username, string password)
+ connect(string username, string password, Dictionary<string, string> context)
{
lock(this)
{
connectImpl(delegate(RouterPrx router)
{
- return router.createSession(username, password);
+ return router.createSession(username, password, context);
});
}
}
diff --git a/java/src/Glacier2/SessionFactoryHelper.java b/java/src/Glacier2/SessionFactoryHelper.java
index 046f2c5780e..59c424ab7f7 100644
--- a/java/src/Glacier2/SessionFactoryHelper.java
+++ b/java/src/Glacier2/SessionFactoryHelper.java
@@ -217,6 +217,17 @@ public class SessionFactoryHelper
}
/**
+ * Sets the request context to use while establishing a connection to the Glacier2 router.
+ *
+ * @param context The request context.
+ */
+ synchronized public void
+ setConnectContext(final java.util.Map<String, String> context)
+ {
+ _context = context;
+ }
+
+ /**
* Connects to the Glacier2 router using the associated SSL credentials.
*
* Once the connection is established, {@link SessionCallback#connected} is called on the callback object;
@@ -228,7 +239,7 @@ public class SessionFactoryHelper
connect()
{
SessionHelper session = new SessionHelper(_callback, createInitData());
- session.connect();
+ session.connect(_context);
return session;
}
@@ -246,7 +257,7 @@ public class SessionFactoryHelper
connect(final String username, final String password)
{
SessionHelper session = new SessionHelper(_callback, createInitData());
- session.connect(username, password);
+ session.connect(username, password, _context);
return session;
}
@@ -312,6 +323,7 @@ public class SessionFactoryHelper
private boolean _secure = true;
private int _port = 0;
private int _timeout = 10000;
+ private java.util.Map<String, String> _context;
private static final int GLACIER2_SSL_PORT = 4064;
private static final int GLACIER2_TCP_PORT = 4063;
}
diff --git a/java/src/Glacier2/SessionHelper.java b/java/src/Glacier2/SessionHelper.java
index 66b15a4ebd8..e4847745666 100644
--- a/java/src/Glacier2/SessionHelper.java
+++ b/java/src/Glacier2/SessionHelper.java
@@ -272,16 +272,18 @@ public class SessionHelper
*
* 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 context The request context to use when creating the session.
*/
synchronized protected void
- connect()
+ connect(final java.util.Map<String, String> context)
{
connectImpl(new ConnectStrategy()
{
public SessionPrx connect(RouterPrx router)
throws CannotCreateSessionException, PermissionDeniedException
{
- return router.createSessionFromSecureConnection();
+ return router.createSessionFromSecureConnection(context);
}
});
}
@@ -294,16 +296,17 @@ public class SessionHelper
*
* @param username The user name.
* @param password The password.
+ * @param context The request context to use when creating the session.
*/
synchronized protected void
- connect(final String username, final String password)
+ connect(final String username, final String password, final java.util.Map<String, String> context)
{
connectImpl(new ConnectStrategy()
{
public SessionPrx connect(RouterPrx router)
throws CannotCreateSessionException, PermissionDeniedException
{
- return router.createSession(username, password);
+ return router.createSession(username, password, context);
}
});
}