summaryrefslogtreecommitdiff
path: root/cs/demo/Glacier2/callback/Client.cs
diff options
context:
space:
mode:
authorBernard Normier <bernard@zeroc.com>2007-02-01 17:09:49 +0000
committerBernard Normier <bernard@zeroc.com>2007-02-01 17:09:49 +0000
commitabada90e3f84dc703b8ddc9efcbed8a946fadead (patch)
tree2c6f9dccd510ea97cb927a7bd635422efaae547a /cs/demo/Glacier2/callback/Client.cs
parentremoving trace message (diff)
downloadice-abada90e3f84dc703b8ddc9efcbed8a946fadead.tar.bz2
ice-abada90e3f84dc703b8ddc9efcbed8a946fadead.tar.xz
ice-abada90e3f84dc703b8ddc9efcbed8a946fadead.zip
Expanded tabs into spaces
Diffstat (limited to 'cs/demo/Glacier2/callback/Client.cs')
-rw-r--r--cs/demo/Glacier2/callback/Client.cs216
1 files changed, 108 insertions, 108 deletions
diff --git a/cs/demo/Glacier2/callback/Client.cs b/cs/demo/Glacier2/callback/Client.cs
index 0cf11f23ecc..7c86c12137c 100644
--- a/cs/demo/Glacier2/callback/Client.cs
+++ b/cs/demo/Glacier2/callback/Client.cs
@@ -21,8 +21,8 @@ public class Client : Ice.Application
"o: send callback as oneway\n" +
"O: send callback as batch oneway\n" +
"f: flush all batch requests\n" +
- "v: set/reset override context field\n" +
- "F: set/reset fake category\n" +
+ "v: set/reset override context field\n" +
+ "F: set/reset fake category\n" +
"s: shutdown server\n" +
"x: exit\n" +
"?: help\n");
@@ -30,56 +30,56 @@ public class Client : Ice.Application
public override int run(string[] args)
{
- Ice.RouterPrx defaultRouter = communicator().getDefaultRouter();
- if(defaultRouter == null)
- {
- Console.Error.WriteLine("no default router set");
- return 1;
- }
-
- Glacier2.RouterPrx router = Glacier2.RouterPrxHelper.checkedCast(defaultRouter);
- if(router == null)
- {
- Console.Error.WriteLine("configured router is not a Glacier2 router");
- return 1;
- }
+ Ice.RouterPrx defaultRouter = communicator().getDefaultRouter();
+ if(defaultRouter == null)
+ {
+ Console.Error.WriteLine("no default router set");
+ return 1;
+ }
+
+ Glacier2.RouterPrx router = Glacier2.RouterPrxHelper.checkedCast(defaultRouter);
+ if(router == null)
+ {
+ Console.Error.WriteLine("configured router is not a Glacier2 router");
+ return 1;
+ }
- while(true)
- {
- Console.WriteLine("This demo accepts any user-id / password combination.");
+ while(true)
+ {
+ Console.WriteLine("This demo accepts any user-id / password combination.");
- String id;
- Console.Write("user id: ");
- Console.Out.Flush();
- id = Console.In.ReadLine();
-
- String pw;
- Console.Write("password: ");
- Console.Out.Flush();
- pw = Console.In.ReadLine();
-
- try
- {
- router.createSession(id, pw);
- break;
- }
- catch(Glacier2.PermissionDeniedException ex)
- {
- Console.Write("permission denied:\n" + ex.reason);
- }
- catch(Glacier2.CannotCreateSessionException ex)
- {
- Console.Write("cannot create session:\n" + ex.reason);
- }
- }
+ String id;
+ Console.Write("user id: ");
+ Console.Out.Flush();
+ id = Console.In.ReadLine();
+
+ String pw;
+ Console.Write("password: ");
+ Console.Out.Flush();
+ pw = Console.In.ReadLine();
+
+ try
+ {
+ router.createSession(id, pw);
+ break;
+ }
+ catch(Glacier2.PermissionDeniedException ex)
+ {
+ Console.Write("permission denied:\n" + ex.reason);
+ }
+ catch(Glacier2.CannotCreateSessionException ex)
+ {
+ Console.Write("cannot create session:\n" + ex.reason);
+ }
+ }
- String category = router.getCategoryForClient();
- Ice.Identity callbackReceiverIdent = new Ice.Identity();
- callbackReceiverIdent.name = "callbackReceiver";
- callbackReceiverIdent.category = category;
- Ice.Identity callbackReceiverFakeIdent = new Ice.Identity();
- callbackReceiverFakeIdent.name = "callbackReceiver";
- callbackReceiverFakeIdent.category = "fake";
+ String category = router.getCategoryForClient();
+ Ice.Identity callbackReceiverIdent = new Ice.Identity();
+ callbackReceiverIdent.name = "callbackReceiver";
+ callbackReceiverIdent.category = category;
+ Ice.Identity callbackReceiverFakeIdent = new Ice.Identity();
+ callbackReceiverFakeIdent.name = "callbackReceiver";
+ callbackReceiverFakeIdent.category = "fake";
Ice.ObjectPrx @base = communicator().propertyToProxy("Callback.Proxy");
CallbackPrx twoway = CallbackPrxHelper.checkedCast(@base);
@@ -92,14 +92,14 @@ public class Client : Ice.Application
adapter.activate();
CallbackReceiverPrx twowayR = CallbackReceiverPrxHelper.uncheckedCast(
- adapter.createProxy(callbackReceiverIdent));
+ adapter.createProxy(callbackReceiverIdent));
CallbackReceiverPrx onewayR = CallbackReceiverPrxHelper.uncheckedCast(twowayR.ice_oneway());
menu();
string line = null;
- string @override = null;
- bool fake = false;
+ string @override = null;
+ bool fake = false;
do
{
try
@@ -113,73 +113,73 @@ public class Client : Ice.Application
}
if(line.Equals("t"))
{
- Ice.Context context = new Ice.Context();
- context["_fwd"] = "t";
- if(@override != null)
- {
- context["_ovrd"] = @override;
- }
+ Ice.Context context = new Ice.Context();
+ context["_fwd"] = "t";
+ if(@override != null)
+ {
+ context["_ovrd"] = @override;
+ }
twoway.initiateCallback(twowayR, context);
}
else if(line.Equals("o"))
{
- Ice.Context context = new Ice.Context();
- context["_fwd"] = "o";
- if(@override != null)
- {
- context["_ovrd"] = @override;
- }
+ Ice.Context context = new Ice.Context();
+ context["_fwd"] = "o";
+ if(@override != null)
+ {
+ context["_ovrd"] = @override;
+ }
oneway.initiateCallback(onewayR, context);
}
else if(line.Equals("O"))
{
- Ice.Context context = new Ice.Context();
- context["_fwd"] = "O";
- if(@override != null)
- {
- context["_ovrd"] = @override;
- }
- batchOneway.initiateCallback(onewayR, context);
+ Ice.Context context = new Ice.Context();
+ context["_fwd"] = "O";
+ if(@override != null)
+ {
+ context["_ovrd"] = @override;
+ }
+ batchOneway.initiateCallback(onewayR, context);
}
else if(line.Equals("f"))
{
- communicator().flushBatchRequests();
+ communicator().flushBatchRequests();
+ }
+ else if(line.Equals("v"))
+ {
+ if(@override == null)
+ {
+ @override = "some_value";
+ Console.WriteLine("override context field is now `" + @override + "'");
+ }
+ else
+ {
+ @override = null;
+ Console.WriteLine("override context field is empty");
+ }
+ }
+ else if(line.Equals("F"))
+ {
+ fake = !fake;
+
+ if(fake)
+ {
+ twowayR = CallbackReceiverPrxHelper.uncheckedCast(
+ twowayR.ice_identity(callbackReceiverFakeIdent));
+ onewayR = CallbackReceiverPrxHelper.uncheckedCast(
+ onewayR.ice_identity(callbackReceiverFakeIdent));
+ }
+ else
+ {
+ twowayR = CallbackReceiverPrxHelper.uncheckedCast(
+ twowayR.ice_identity(callbackReceiverIdent));
+ onewayR = CallbackReceiverPrxHelper.uncheckedCast(
+ onewayR.ice_identity(callbackReceiverIdent));
+ }
+
+ Console.WriteLine("callback receiver identity: " +
+ communicator().identityToString(twowayR.ice_getIdentity()));
}
- else if(line.Equals("v"))
- {
- if(@override == null)
- {
- @override = "some_value";
- Console.WriteLine("override context field is now `" + @override + "'");
- }
- else
- {
- @override = null;
- Console.WriteLine("override context field is empty");
- }
- }
- else if(line.Equals("F"))
- {
- fake = !fake;
-
- if(fake)
- {
- twowayR = CallbackReceiverPrxHelper.uncheckedCast(
- twowayR.ice_identity(callbackReceiverFakeIdent));
- onewayR = CallbackReceiverPrxHelper.uncheckedCast(
- onewayR.ice_identity(callbackReceiverFakeIdent));
- }
- else
- {
- twowayR = CallbackReceiverPrxHelper.uncheckedCast(
- twowayR.ice_identity(callbackReceiverIdent));
- onewayR = CallbackReceiverPrxHelper.uncheckedCast(
- onewayR.ice_identity(callbackReceiverIdent));
- }
-
- Console.WriteLine("callback receiver identity: " +
- communicator().identityToString(twowayR.ice_getIdentity()));
- }
else if(line.Equals("s"))
{
twoway.shutdown();
@@ -215,6 +215,6 @@ public class Client : Ice.Application
if(status != 0)
{
System.Environment.Exit(status);
- }
+ }
}
}