diff options
author | Dwayne Boone <dwayne@zeroc.com> | 2009-09-08 11:08:23 -0230 |
---|---|---|
committer | Dwayne Boone <dwayne@zeroc.com> | 2009-09-08 11:08:23 -0230 |
commit | eacb6e3d3af43be2cb40bb64264f3542af37b892 (patch) | |
tree | 6f7f072cdce60320fd974400af293797ce152664 | |
parent | Added mcpp patch instructions (diff) | |
download | ice-eacb6e3d3af43be2cb40bb64264f3542af37b892.tar.bz2 ice-eacb6e3d3af43be2cb40bb64264f3542af37b892.tar.xz ice-eacb6e3d3af43be2cb40bb64264f3542af37b892.zip |
Bug 4244 - simplify callback demo
-rw-r--r-- | cpp/demo/Ice/callback/Client.cpp | 85 | ||||
-rw-r--r-- | cpp/demo/Ice/callback/Server.cpp | 2 | ||||
-rw-r--r-- | cpp/demo/Ice/callback/config.client | 4 | ||||
-rw-r--r-- | cpp/demo/Ice/callback/config.server | 2 | ||||
-rw-r--r-- | cs/demo/Ice/callback/Client.cs | 106 | ||||
-rw-r--r-- | cs/demo/Ice/callback/Server.cs | 2 | ||||
-rw-r--r-- | cs/demo/Ice/callback/config.client | 4 | ||||
-rw-r--r-- | cs/demo/Ice/callback/config.server | 2 | ||||
-rw-r--r-- | demoscript/Ice/callback.py | 51 | ||||
-rw-r--r-- | java/demo/Ice/callback/Client.java | 85 | ||||
-rw-r--r-- | java/demo/Ice/callback/Server.java | 2 | ||||
-rw-r--r-- | java/demo/Ice/callback/config.client | 4 | ||||
-rw-r--r-- | java/demo/Ice/callback/config.server | 2 | ||||
-rwxr-xr-x | py/demo/Ice/callback/Client.py | 61 | ||||
-rwxr-xr-x | py/demo/Ice/callback/Server.py | 2 | ||||
-rw-r--r-- | py/demo/Ice/callback/config.client | 4 | ||||
-rw-r--r-- | py/demo/Ice/callback/config.server | 2 | ||||
-rw-r--r-- | vb/demo/Ice/callback/Client.vb | 73 | ||||
-rw-r--r-- | vb/demo/Ice/callback/Server.vb | 2 | ||||
-rw-r--r-- | vb/demo/Ice/callback/config.client | 10 | ||||
-rw-r--r-- | vb/demo/Ice/callback/config.server | 2 |
21 files changed, 65 insertions, 442 deletions
diff --git a/cpp/demo/Ice/callback/Client.cpp b/cpp/demo/Ice/callback/Client.cpp index 0577bb0156d..ced5dbd506d 100644 --- a/cpp/demo/Ice/callback/Client.cpp +++ b/cpp/demo/Ice/callback/Client.cpp @@ -71,30 +71,21 @@ CallbackClient::run(int argc, char* argv[]) return EXIT_FAILURE; } - CallbackSenderPrx twoway = CallbackSenderPrx::checkedCast( + CallbackSenderPrx sender = CallbackSenderPrx::checkedCast( communicator()->propertyToProxy("CallbackSender.Proxy")->ice_twoway()->ice_timeout(-1)->ice_secure(false)); - if(!twoway) + if(!sender) { cerr << appName() << ": invalid proxy" << endl; return EXIT_FAILURE; } - CallbackSenderPrx oneway = CallbackSenderPrx::uncheckedCast(twoway->ice_oneway()); - CallbackSenderPrx batchOneway = CallbackSenderPrx::uncheckedCast(twoway->ice_batchOneway()); - CallbackSenderPrx datagram = CallbackSenderPrx::uncheckedCast(twoway->ice_datagram()); - CallbackSenderPrx batchDatagram = CallbackSenderPrx::uncheckedCast(twoway->ice_batchDatagram()); Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("Callback.Client"); CallbackReceiverPtr cr = new CallbackReceiverI; adapter->add(cr, communicator()->stringToIdentity("callbackReceiver")); adapter->activate(); - CallbackReceiverPrx twowayR = CallbackReceiverPrx::uncheckedCast( + CallbackReceiverPrx receiver = CallbackReceiverPrx::uncheckedCast( adapter->createProxy(communicator()->stringToIdentity("callbackReceiver"))); - CallbackReceiverPrx onewayR = CallbackReceiverPrx::uncheckedCast(twowayR->ice_oneway()); - CallbackReceiverPrx datagramR = CallbackReceiverPrx::uncheckedCast(twowayR->ice_datagram()); - - bool secure = false; - string secureStr = ""; menu(); @@ -107,69 +98,11 @@ CallbackClient::run(int argc, char* argv[]) cin >> c; if(c == 't') { - twoway->initiateCallback(twowayR); - } - else if(c == 'o') - { - oneway->initiateCallback(onewayR); - } - else if(c == 'O') - { - batchOneway->initiateCallback(onewayR); - } - else if(c == 'd') - { - if(secure) - { - cout << "secure datagrams are not supported" << endl; - } - else - { - datagram->initiateCallback(datagramR); - } - } - else if(c == 'D') - { - if(secure) - { - cout << "secure datagrams are not supported" << endl; - } - else - { - batchDatagram->initiateCallback(datagramR); - } - } - else if(c == 'f') - { - communicator()->flushBatchRequests(); - } - else if(c == 'S') - { - secure = !secure; - secureStr = secure ? "s" : ""; - - twoway = CallbackSenderPrx::uncheckedCast(twoway->ice_secure(secure)); - oneway = CallbackSenderPrx::uncheckedCast(oneway->ice_secure(secure)); - batchOneway = CallbackSenderPrx::uncheckedCast(batchOneway->ice_secure(secure)); - datagram = CallbackSenderPrx::uncheckedCast(datagram->ice_secure(secure)); - batchDatagram = CallbackSenderPrx::uncheckedCast(batchDatagram->ice_secure(secure)); - - twowayR = CallbackReceiverPrx::uncheckedCast(twowayR->ice_secure(secure)); - onewayR = CallbackReceiverPrx::uncheckedCast(onewayR->ice_secure(secure)); - datagramR = CallbackReceiverPrx::uncheckedCast(datagramR->ice_secure(secure)); - - if(secure) - { - cout << "secure mode is now on" << endl; - } - else - { - cout << "secure mode is now off" << endl; - } + sender->initiateCallback(receiver); } else if(c == 's') { - twoway->shutdown(); + sender->shutdown(); } else if(c == 'x') { @@ -200,13 +133,7 @@ CallbackClient::menu() { cout << "usage:\n" - "t: send callback as twoway\n" - "o: send callback as oneway\n" - "O: send callback as batch oneway\n" - "d: send callback as datagram\n" - "D: send callback as batch datagram\n" - "f: flush all batch requests\n" - "S: switch secure mode on/off\n" + "t: send callback\n" "s: shutdown server\n" "x: exit\n" "?: help\n"; diff --git a/cpp/demo/Ice/callback/Server.cpp b/cpp/demo/Ice/callback/Server.cpp index 378f833ca90..3b1d95c545d 100644 --- a/cpp/demo/Ice/callback/Server.cpp +++ b/cpp/demo/Ice/callback/Server.cpp @@ -38,7 +38,7 @@ CallbackServer::run(int argc, char* argv[]) Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("Callback.Server"); CallbackSenderPtr cbs = new CallbackSenderI; - adapter->add(cbs, communicator()->stringToIdentity("callback")); + adapter->add(cbs, communicator()->stringToIdentity("callbackSender")); adapter->activate(); communicator()->waitForShutdown(); return EXIT_SUCCESS; diff --git a/cpp/demo/Ice/callback/config.client b/cpp/demo/Ice/callback/config.client index 8ff53d14554..495b947356b 100644 --- a/cpp/demo/Ice/callback/config.client +++ b/cpp/demo/Ice/callback/config.client @@ -2,14 +2,14 @@ # The client reads this property to create the reference to the # "CallbackSender" object in the server. # -CallbackSender.Proxy=callback:tcp -p 10000:udp -p 10000:ssl -p 10001 +CallbackSender.Proxy=callbackSender:default -p 10000 # # The client creates one single object adapter with the name # "Callback.Client". The following line sets the endpoints for this # adapter. # -Callback.Client.Endpoints=tcp:udp:ssl +Callback.Client.Endpoints=default # # Warn about connection exceptions. diff --git a/cpp/demo/Ice/callback/config.server b/cpp/demo/Ice/callback/config.server index d45dbd27e46..a8875b5348e 100644 --- a/cpp/demo/Ice/callback/config.server +++ b/cpp/demo/Ice/callback/config.server @@ -3,7 +3,7 @@ # "Callback.Server". The following line sets the endpoints for this # adapter. # -Callback.Server.Endpoints=tcp -p 10000:udp -p 10000:ssl -p 10001 +Callback.Server.Endpoints=default -p 10000 # # Warn about connection exceptions diff --git a/cs/demo/Ice/callback/Client.cs b/cs/demo/Ice/callback/Client.cs index dcffb2da02e..ce8c1f8bd53 100644 --- a/cs/demo/Ice/callback/Client.cs +++ b/cs/demo/Ice/callback/Client.cs @@ -24,19 +24,10 @@ public class Client private static void menu() { Console.Out.Write("usage:\n" - + "t: send callback as twoway\n" - + "o: send callback as oneway\n" - + "O: send callback as batch oneway\n" - + "d: send callback as datagram\n" - + "D: send callback as batch datagram\n" - + "f: flush all batch requests"); - if(_haveSSL) - { - Console.Out.Write("\nS: switch secure mode on/off"); - } - Console.Out.WriteLine("\ns: shutdown server\n" - + "x: exit\n" - + "?: help\n"); + + "t: send callback\n" + + "s: shutdown server\n" + + "x: exit\n" + + "?: help\n"); } public override int run(string[] args) @@ -47,39 +38,21 @@ public class Client return 1; } - try - { - communicator().getPluginManager().getPlugin("IceSSL"); - _haveSSL = true; - } - catch(Ice.NotRegisteredException) - { - } - - CallbackSenderPrx twoway = CallbackSenderPrxHelper.checkedCast( + CallbackSenderPrx sender = CallbackSenderPrxHelper.checkedCast( communicator().propertyToProxy("CallbackSender.Proxy"). ice_twoway().ice_timeout(-1).ice_secure(false)); - if(twoway == null) + if(sender == null) { Console.Error.WriteLine("invalid proxy"); return 1; } - CallbackSenderPrx oneway = CallbackSenderPrxHelper.uncheckedCast(twoway.ice_oneway()); - CallbackSenderPrx batchOneway = CallbackSenderPrxHelper.uncheckedCast(twoway.ice_batchOneway()); - CallbackSenderPrx datagram = CallbackSenderPrxHelper.uncheckedCast(twoway.ice_datagram()); - CallbackSenderPrx batchDatagram = CallbackSenderPrxHelper.uncheckedCast(twoway.ice_batchDatagram()); Ice.ObjectAdapter adapter = communicator().createObjectAdapter("Callback.Client"); adapter.add(new CallbackReceiverI(), communicator().stringToIdentity("callbackReceiver")); adapter.activate(); - CallbackReceiverPrx twowayR = CallbackReceiverPrxHelper.uncheckedCast( - adapter.createProxy(communicator().stringToIdentity("callbackReceiver"))); - CallbackReceiverPrx onewayR = CallbackReceiverPrxHelper.uncheckedCast( - twowayR.ice_oneway()); - CallbackReceiverPrx datagramR = CallbackReceiverPrxHelper.uncheckedCast(twowayR.ice_datagram()); - - bool secure = false; + CallbackReceiverPrx receiver = CallbackReceiverPrxHelper.uncheckedCast( + adapter.createProxy(communicator().stringToIdentity("callbackReceiver"))); menu(); @@ -97,68 +70,11 @@ public class Client } if(line.Equals("t")) { - twoway.initiateCallback(twowayR); - } - else if(line.Equals("o")) - { - oneway.initiateCallback(onewayR); - } - else if(line.Equals("O")) - { - batchOneway.initiateCallback(onewayR); - } - else if(line.Equals("d")) - { - if(secure) - { - Console.Out.WriteLine("secure datagrams are not supported"); - } - else - { - datagram.initiateCallback(datagramR); - } - } - else if(line.Equals("D")) - { - if(secure) - { - Console.Out.WriteLine("secure datagrams are not supported"); - } - else - { - batchDatagram.initiateCallback(datagramR); - } - } - else if(line.Equals("f")) - { - communicator().flushBatchRequests(); - } - else if(_haveSSL && line.Equals("S")) - { - secure = !secure; - - twoway = CallbackSenderPrxHelper.uncheckedCast(twoway.ice_secure(secure)); - oneway = CallbackSenderPrxHelper.uncheckedCast(oneway.ice_secure(secure)); - batchOneway = CallbackSenderPrxHelper.uncheckedCast(batchOneway.ice_secure(secure)); - datagram = CallbackSenderPrxHelper.uncheckedCast(datagram.ice_secure(secure)); - batchDatagram = CallbackSenderPrxHelper.uncheckedCast(batchDatagram.ice_secure(secure)); - - twowayR = CallbackReceiverPrxHelper.uncheckedCast(twowayR.ice_secure(secure)); - onewayR = CallbackReceiverPrxHelper.uncheckedCast(onewayR.ice_secure(secure)); - datagramR = CallbackReceiverPrxHelper.uncheckedCast(datagramR.ice_secure(secure)); - - if(secure) - { - Console.Out.WriteLine("secure mode is now on"); - } - else - { - Console.Out.WriteLine("secure mode is now off"); - } + sender.initiateCallback(receiver); } else if(line.Equals("s")) { - twoway.shutdown(); + sender.shutdown(); } else if(line.Equals("x")) { @@ -183,8 +99,6 @@ public class Client return 0; } - - private static bool _haveSSL = false; } public static void Main(string[] args) diff --git a/cs/demo/Ice/callback/Server.cs b/cs/demo/Ice/callback/Server.cs index 2486ae3cd79..120da43dc00 100644 --- a/cs/demo/Ice/callback/Server.cs +++ b/cs/demo/Ice/callback/Server.cs @@ -30,7 +30,7 @@ public class Server } Ice.ObjectAdapter adapter = communicator().createObjectAdapter("Callback.Server"); - adapter.add(new CallbackSenderI(), communicator().stringToIdentity("callback")); + adapter.add(new CallbackSenderI(), communicator().stringToIdentity("callbackSender")); adapter.activate(); communicator().waitForShutdown(); return 0; diff --git a/cs/demo/Ice/callback/config.client b/cs/demo/Ice/callback/config.client index a50845b11d7..3fe8f9d2b64 100644 --- a/cs/demo/Ice/callback/config.client +++ b/cs/demo/Ice/callback/config.client @@ -2,14 +2,14 @@ # The client reads this property to create the reference to the # "CallbackSender" object in the server. # -CallbackSender.Proxy=callback:tcp -p 10000:udp -p 10000:ssl -p 10001 +CallbackSender.Proxy=callbackSender:default -p 10000 # # The client creates one single object adapter with the name # "Callback.Client". The following line sets the endpoints for this # adapter. # -Callback.Client.Endpoints=tcp:udp:ssl +Callback.Client.Endpoints=default # # Warn about connection exceptions diff --git a/cs/demo/Ice/callback/config.server b/cs/demo/Ice/callback/config.server index 71642b4b445..77168b5ab7c 100644 --- a/cs/demo/Ice/callback/config.server +++ b/cs/demo/Ice/callback/config.server @@ -3,7 +3,7 @@ # "Callback.Server". The following line sets the endpoints for this # adapter. # -Callback.Server.Endpoints=tcp -p 10000:udp -p 10000:ssl -p 10001 +Callback.Server.Endpoints=default -p 10000 # # Warn about connection exceptions diff --git a/demoscript/Ice/callback.py b/demoscript/Ice/callback.py index 2a37edbaa6c..747d16490db 100644 --- a/demoscript/Ice/callback.py +++ b/demoscript/Ice/callback.py @@ -12,60 +12,19 @@ import sys from demoscript import * from scripts import Expect -def runtests(client, server, secure): - print "testing twoway", +def run(client, server): + print "testing...", sys.stdout.flush() + client.sendline('t') server.expect('initiating callback') client.expect('received callback') - print "oneway", - sys.stdout.flush() - client.sendline('o') - server.expect('initiating callback') - client.expect('received callback') - if not secure: - print "datagram", - sys.stdout.flush() - client.sendline('d') - server.expect('initiating callback') - client.expect('received callback') - print "... ok" - print "testing batch oneway", - sys.stdout.flush() - client.sendline('O') - try: - server.expect('initiating callback', timeout=1) - except Expect.TIMEOUT: - pass - client.sendline('O') - client.sendline('f') - server.expect('initiating callback') - client.expect('received callback') + client.sendline('t') server.expect('initiating callback') client.expect('received callback') - if not secure: - print "datagram", - sys.stdout.flush() - client.sendline('D') - try: - server.expect('initiating callback', timeout=1) - except Expect.TIMEOUT: - pass - client.sendline('D') - client.sendline('f') - server.expect('initiating callback') - client.expect('received callback') - server.expect('initiating callback') - client.expect('received callback') - print "... ok" - -def run(client, server): - runtests(client, server, False) - print "repeating tests with SSL" - client.sendline('S') - runtests(client, server, True) + print "ok" client.sendline('s') server.waitTestSuccess() diff --git a/java/demo/Ice/callback/Client.java b/java/demo/Ice/callback/Client.java index 4928f346213..43847ea951b 100644 --- a/java/demo/Ice/callback/Client.java +++ b/java/demo/Ice/callback/Client.java @@ -32,13 +32,7 @@ public class Client extends Ice.Application { System.out.println( "usage:\n" + - "t: send callback as twoway\n" + - "o: send callback as oneway\n" + - "O: send callback as batch oneway\n" + - "d: send callback as datagram\n" + - "D: send callback as batch datagram\n" + - "f: flush all batch requests\n" + - "S: switch secure mode on/off\n" + + "t: send callback\n" + "s: shutdown server\n" + "x: exit\n" + "?: help\n"); @@ -60,31 +54,22 @@ public class Client extends Ice.Application // setInterruptHook(new ShutdownHook()); - CallbackSenderPrx twoway = CallbackSenderPrxHelper.checkedCast( + CallbackSenderPrx sender = CallbackSenderPrxHelper.checkedCast( communicator().propertyToProxy("CallbackSender.Proxy"). ice_twoway().ice_timeout(-1).ice_secure(false)); - if(twoway == null) + if(sender == null) { System.err.println("invalid proxy"); return 1; } - CallbackSenderPrx oneway = CallbackSenderPrxHelper.uncheckedCast(twoway.ice_oneway()); - CallbackSenderPrx batchOneway = CallbackSenderPrxHelper.uncheckedCast(twoway.ice_batchOneway()); - CallbackSenderPrx datagram = CallbackSenderPrxHelper.uncheckedCast(twoway.ice_datagram()); - CallbackSenderPrx batchDatagram = CallbackSenderPrxHelper.uncheckedCast(twoway.ice_batchDatagram()); Ice.ObjectAdapter adapter = communicator().createObjectAdapter("Callback.Client"); adapter.add(new CallbackReceiverI(), communicator().stringToIdentity("callbackReceiver")); adapter.activate(); - CallbackReceiverPrx twowayR = + CallbackReceiverPrx receiver = CallbackReceiverPrxHelper.uncheckedCast(adapter.createProxy( communicator().stringToIdentity("callbackReceiver"))); - CallbackReceiverPrx onewayR = CallbackReceiverPrxHelper.uncheckedCast(twowayR.ice_oneway()); - CallbackReceiverPrx datagramR = CallbackReceiverPrxHelper.uncheckedCast(twowayR.ice_datagram()); - - boolean secure = false; - String secureStr = ""; menu(); @@ -104,69 +89,11 @@ public class Client extends Ice.Application } if(line.equals("t")) { - twoway.initiateCallback(twowayR); - } - else if(line.equals("o")) - { - oneway.initiateCallback(onewayR); - } - else if(line.equals("O")) - { - batchOneway.initiateCallback(onewayR); - } - else if(line.equals("d")) - { - if(secure) - { - System.out.println("secure datagrams are not supported"); - } - else - { - datagram.initiateCallback(datagramR); - } - } - else if(line.equals("D")) - { - if(secure) - { - System.out.println("secure datagrams are not supported"); - } - else - { - batchDatagram.initiateCallback(datagramR); - } - } - else if(line.equals("S")) - { - secure = !secure; - secureStr = secure ? "s" : ""; - - twoway = CallbackSenderPrxHelper.uncheckedCast(twoway.ice_secure(secure)); - oneway = CallbackSenderPrxHelper.uncheckedCast(oneway.ice_secure(secure)); - batchOneway = CallbackSenderPrxHelper.uncheckedCast(batchOneway.ice_secure(secure)); - datagram = CallbackSenderPrxHelper.uncheckedCast(datagram.ice_secure(secure)); - batchDatagram = CallbackSenderPrxHelper.uncheckedCast(batchDatagram.ice_secure(secure)); - - twowayR = CallbackReceiverPrxHelper.uncheckedCast(twowayR.ice_secure(secure)); - onewayR = CallbackReceiverPrxHelper.uncheckedCast(onewayR.ice_secure(secure)); - datagramR = CallbackReceiverPrxHelper.uncheckedCast(datagramR.ice_secure(secure)); - - if(secure) - { - System.out.println("secure mode is now on"); - } - else - { - System.out.println("secure mode is now off"); - } - } - else if(line.equals("f")) - { - communicator().flushBatchRequests(); + sender.initiateCallback(receiver); } else if(line.equals("s")) { - twoway.shutdown(); + sender.shutdown(); } else if(line.equals("x")) { diff --git a/java/demo/Ice/callback/Server.java b/java/demo/Ice/callback/Server.java index 293f95f002c..3c93bf3fe13 100644 --- a/java/demo/Ice/callback/Server.java +++ b/java/demo/Ice/callback/Server.java @@ -21,7 +21,7 @@ public class Server extends Ice.Application } Ice.ObjectAdapter adapter = communicator().createObjectAdapter("Callback.Server"); - adapter.add(new CallbackSenderI(), communicator().stringToIdentity("callback")); + adapter.add(new CallbackSenderI(), communicator().stringToIdentity("callbackSender")); adapter.activate(); communicator().waitForShutdown(); return 0; diff --git a/java/demo/Ice/callback/config.client b/java/demo/Ice/callback/config.client index 19804b15607..d138919f5a3 100644 --- a/java/demo/Ice/callback/config.client +++ b/java/demo/Ice/callback/config.client @@ -2,14 +2,14 @@ # The client reads this property to create the reference to the # "CallbackSender" object in the server. # -CallbackSender.Proxy=callback:tcp -p 10000:udp -p 10000:ssl -p 10001 +CallbackSender.Proxy=callbackSender:default -p 10000 # # The client creates one single object adapter with the name # "Callback.Client". The following line sets the endpoints for this # adapter. # -Callback.Client.Endpoints=tcp:udp:ssl +Callback.Client.Endpoints=default # # Warn about connection exceptions diff --git a/java/demo/Ice/callback/config.server b/java/demo/Ice/callback/config.server index 8cbf6a72a4b..b7c69a101f7 100644 --- a/java/demo/Ice/callback/config.server +++ b/java/demo/Ice/callback/config.server @@ -3,7 +3,7 @@ # "Callback.Server". The following line sets the endpoints for this # adapter. # -Callback.Server.Endpoints=tcp -p 10000:udp -p 10000:ssl -p 10001 +Callback.Server.Endpoints=default -p 10000 # # Warn about connection exceptions diff --git a/py/demo/Ice/callback/Client.py b/py/demo/Ice/callback/Client.py index 394ce69ba08..412045513fa 100755 --- a/py/demo/Ice/callback/Client.py +++ b/py/demo/Ice/callback/Client.py @@ -16,13 +16,7 @@ import Demo def menu(): print """ usage: -t: send callback as twoway -o: send callback as oneway -O: send callback as batch oneway -d: send callback as datagram -D: send callback as batch datagram -f: flush all batch requests -S: switch secure mode on/off +t: send callback s: shutdown server x: exit ?: help @@ -38,29 +32,19 @@ class Client(Ice.Application): print self.appName() + ": too many arguments" return 1 - twoway = Demo.CallbackSenderPrx.checkedCast( + sender = Demo.CallbackSenderPrx.checkedCast( self.communicator().propertyToProxy('CallbackSender.Proxy'). ice_twoway().ice_timeout(-1).ice_secure(False)) - if not twoway: + if not sender: print self.appName() + ": invalid proxy" return 1 - oneway = Demo.CallbackSenderPrx.uncheckedCast(twoway.ice_oneway()) - batchOneway = Demo.CallbackSenderPrx.uncheckedCast(twoway.ice_batchOneway()) - datagram = Demo.CallbackSenderPrx.uncheckedCast(twoway.ice_datagram()) - batchDatagram = Demo.CallbackSenderPrx.uncheckedCast(twoway.ice_batchDatagram()) - adapter = self.communicator().createObjectAdapter("Callback.Client") adapter.add(CallbackReceiverI(), self.communicator().stringToIdentity("callbackReceiver")) adapter.activate() - twowayR = Demo.CallbackReceiverPrx.uncheckedCast( + receiver = Demo.CallbackReceiverPrx.uncheckedCast( adapter.createProxy(self.communicator().stringToIdentity("callbackReceiver"))) - onewayR = Demo.CallbackReceiverPrx.uncheckedCast(twowayR.ice_oneway()) - datagramR = Demo.CallbackReceiverPrx.uncheckedCast(twowayR.ice_datagram()) - - secure = False - secureStr = '' menu() @@ -69,42 +53,9 @@ class Client(Ice.Application): try: c = raw_input("==> ") if c == 't': - twoway.initiateCallback(twowayR) - elif c == 'o': - oneway.initiateCallback(onewayR) - elif c == 'O': - batchOneway.initiateCallback(onewayR) - elif c == 'd': - if secure: - print "secure datagrams are not supported" - else: - datagram.initiateCallback(datagramR) - elif c == 'D': - if secure: - print "secure datagrams are not supported" - else: - batchDatagram.initiateCallback(datagramR) - elif c == 'f': - self.communicator().flushBatchRequests() - elif c == 'S': - secure = not secure - - twoway = Demo.CallbackSenderPrx.uncheckedCast(twoway.ice_secure(secure)) - oneway = Demo.CallbackSenderPrx.uncheckedCast(oneway.ice_secure(secure)) - batchOneway = Demo.CallbackSenderPrx.uncheckedCast(batchOneway.ice_secure(secure)) - datagram = Demo.CallbackSenderPrx.uncheckedCast(datagram.ice_secure(secure)) - batchDatagram = Demo.CallbackSenderPrx.uncheckedCast(batchDatagram.ice_secure(secure)) - - twowayR = Demo.CallbackReceiverPrx.uncheckedCast(twowayR.ice_secure(secure)) - onewayR = Demo.CallbackReceiverPrx.uncheckedCast(onewayR.ice_secure(secure)) - datagramR = Demo.CallbackReceiverPrx.uncheckedCast(datagramR.ice_secure(secure)) - - if secure: - print "secure mode is now on" - else: - print "secure mode is now off" + sender.initiateCallback(receiver) elif c == 's': - twoway.shutdown() + sender.shutdown() elif c == 'x': pass # Nothing to do elif c == '?': diff --git a/py/demo/Ice/callback/Server.py b/py/demo/Ice/callback/Server.py index b048c253fc7..8233049a2f5 100755 --- a/py/demo/Ice/callback/Server.py +++ b/py/demo/Ice/callback/Server.py @@ -35,7 +35,7 @@ class Server(Ice.Application): return 1 adapter = self.communicator().createObjectAdapter("Callback.Server") - adapter.add(CallbackSenderI(), self.communicator().stringToIdentity("callback")) + adapter.add(CallbackSenderI(), self.communicator().stringToIdentity("callbackSender")) adapter.activate() self.communicator().waitForShutdown() return 0 diff --git a/py/demo/Ice/callback/config.client b/py/demo/Ice/callback/config.client index 9906a3191f3..b85432c1c47 100644 --- a/py/demo/Ice/callback/config.client +++ b/py/demo/Ice/callback/config.client @@ -2,14 +2,14 @@ # The client reads this property to create the reference to the # "CallbackSender" object in the server. # -CallbackSender.Proxy=callback:tcp -p 10000:udp -p 10000:ssl -p 10001 +CallbackSender.Proxy=callbackSender:default -p 10000 # # The client creates one single object adapter with the name # "Callback.Client". The following line sets the endpoints for this # adapter. # -Callback.Client.Endpoints=tcp:udp:ssl +Callback.Client.Endpoints=default # # Warn about connection exceptions diff --git a/py/demo/Ice/callback/config.server b/py/demo/Ice/callback/config.server index d45dbd27e46..a8875b5348e 100644 --- a/py/demo/Ice/callback/config.server +++ b/py/demo/Ice/callback/config.server @@ -3,7 +3,7 @@ # "Callback.Server". The following line sets the endpoints for this # adapter. # -Callback.Server.Endpoints=tcp -p 10000:udp -p 10000:ssl -p 10001 +Callback.Server.Endpoints=default -p 10000 # # Warn about connection exceptions diff --git a/vb/demo/Ice/callback/Client.vb b/vb/demo/Ice/callback/Client.vb index 6302ae342a9..bbfc95d9b69 100644 --- a/vb/demo/Ice/callback/Client.vb +++ b/vb/demo/Ice/callback/Client.vb @@ -15,15 +15,7 @@ Module CallbackC Private Sub menu() Console.Out.WriteLine("usage:") - Console.Out.WriteLine("t: send callback as twoway") - Console.Out.WriteLine("o: send callback as oneway") - Console.Out.WriteLine("O: send callback as batch oneway") - Console.Out.WriteLine("d: send callback as datagram") - Console.Out.WriteLine("D: send callback as batch datagram") - Console.Out.WriteLine("f: flush all batch requests") - If _haveSSL Then - Console.Out.WriteLine("S: switch secure mode on/off")
- End If + Console.Out.WriteLine("t: send callback") Console.Out.WriteLine("s: shutdown server") Console.Out.WriteLine("x: exit") Console.Out.WriteLine("?: help") @@ -35,33 +27,18 @@ Module CallbackC Return 1 End If - Try - communicator().getPluginManager().getPlugin("IceSSL")
- _haveSSL = True
- Catch ex As Ice.NotRegisteredException
- End Try - - Dim twoway As CallbackSenderPrx = CallbackSenderPrxHelper.checkedCast(communicator().propertyToProxy("Callback.CallbackServer").ice_twoway().ice_timeout(-1).ice_secure(False)) - If twoway Is Nothing Then + Dim sender As CallbackSenderPrx = CallbackSenderPrxHelper.checkedCast(communicator().propertyToProxy("Callback.CallbackServer").ice_twoway().ice_timeout(-1).ice_secure(False)) + If sender Is Nothing Then Console.Error.WriteLine("invalid proxy") Return 1 End If - Dim oneway As CallbackSenderPrx = CallbackSenderPrxHelper.uncheckedCast(twoway.ice_oneway()) - Dim batchOneway As CallbackSenderPrx = CallbackSenderPrxHelper.uncheckedCast(twoway.ice_batchOneway()) - Dim datagram As CallbackSenderPrx = CallbackSenderPrxHelper.uncheckedCast(twoway.ice_datagram()) - Dim batchDatagram As CallbackSenderPrx = CallbackSenderPrxHelper.uncheckedCast(twoway.ice_batchDatagram()) Dim adapter As Ice.ObjectAdapter = communicator().createObjectAdapter("Callback.Client") adapter.add(New CallbackReceiverI, communicator().stringToIdentity("callbackReceiver")) adapter.activate() - Dim twowayR As CallbackReceiverPrx = CallbackReceiverPrxHelper.uncheckedCast( _ + Dim receiver As CallbackReceiverPrx = CallbackReceiverPrxHelper.uncheckedCast( _ adapter.createProxy(communicator().stringToIdentity("callbackReceiver"))) - Dim onewayR As CallbackReceiverPrx = CallbackReceiverPrxHelper.uncheckedCast( _ - twowayR.ice_oneway()) - Dim datagramR As CallbackReceiverPrx = CallbackReceiverPrxHelper.uncheckedCast(twowayR.ice_datagram()) - - Dim secure As Boolean = False menu() @@ -75,45 +52,9 @@ Module CallbackC Exit Do End If If line.Equals("t") Then - twoway.initiateCallback(twowayR) - ElseIf line.Equals("o") Then - oneway.initiateCallback(onewayR) - ElseIf line.Equals("O") Then - batchOneway.initiateCallback(onewayR) - ElseIf line.Equals("d") Then - If secure Then - Console.WriteLine("secure datagrams are not supported") - Else - datagram.initiateCallback(datagramR) - End If - ElseIf line.Equals("D") Then - If secure Then - Console.WriteLine("secure datagrams are not supported") - Else - batchDatagram.initiateCallback(datagramR) - End If - ElseIf line.Equals("f") Then - communicator().flushBatchRequests() - ElseIf _haveSSL And line.Equals("S") Then - secure = Not secure - - twoway = CallbackSenderPrxHelper.uncheckedCast(twoway.ice_secure(secure)) - oneway = CallbackSenderPrxHelper.uncheckedCast(oneway.ice_secure(secure)) - batchOneway = CallbackSenderPrxHelper.uncheckedCast(batchOneway.ice_secure(secure)) - datagram = CallbackSenderPrxHelper.uncheckedCast(datagram.ice_secure(secure)) - batchDatagram = CallbackSenderPrxHelper.uncheckedCast(batchDatagram.ice_secure(secure)) - - twowayR = CallbackReceiverPrxHelper.uncheckedCast(twowayR.ice_secure(secure)) - onewayR = CallbackReceiverPrxHelper.uncheckedCast(onewayR.ice_secure(secure)) - datagramR = CallbackReceiverPrxHelper.uncheckedCast(datagramR.ice_secure(secure)) - - If secure Then - Console.Out.WriteLine("secure mode is now on") - Else - Console.Out.WriteLine("secure mode is now off") - End If + sender.initiateCallback(receiver) ElseIf line.Equals("s") Then - twoway.shutdown() + sender.shutdown() ElseIf line.Equals("x") Then ' Nothing to do ElseIf line.Equals("?") Then @@ -130,8 +71,6 @@ Module CallbackC Return 0 End Function - Private Shared _haveSSL As Boolean = False - End Class Public Sub Main(ByVal args() As String) diff --git a/vb/demo/Ice/callback/Server.vb b/vb/demo/Ice/callback/Server.vb index 46ee16671d1..4a2703f6065 100644 --- a/vb/demo/Ice/callback/Server.vb +++ b/vb/demo/Ice/callback/Server.vb @@ -19,7 +19,7 @@ Module CallbackS End If Dim adapter As Ice.ObjectAdapter = communicator().createObjectAdapter("Callback.Server") - adapter.add(New CallbackSenderI, communicator().stringToIdentity("callback")) + adapter.add(New CallbackSenderI, communicator().stringToIdentity("callbackSender")) adapter.activate() communicator().waitForShutdown() Return 0 diff --git a/vb/demo/Ice/callback/config.client b/vb/demo/Ice/callback/config.client index ccb455e7822..63ae7fbc4e7 100644 --- a/vb/demo/Ice/callback/config.client +++ b/vb/demo/Ice/callback/config.client @@ -2,8 +2,14 @@ # The client contacts the server using the proxy specified by the CallbackServer # property, and provides the endpoints specified by the Endpoints property. # -Callback.CallbackServer=callback:tcp -p 10000:udp -p 10000:ssl -p 10001 -Callback.Client.Endpoints=tcp:udp:ssl +Callback.CallbackServer=callbackSender:default -p 10000 + +# +# The client creates one single object adapter with the name +# "Callback.Client". The following line sets the endpoints for this +# adapter. +# +Callback.Client.Endpoints=default # # Warn about connection exceptions diff --git a/vb/demo/Ice/callback/config.server b/vb/demo/Ice/callback/config.server index fbb6784909e..6f6d746c369 100644 --- a/vb/demo/Ice/callback/config.server +++ b/vb/demo/Ice/callback/config.server @@ -1,7 +1,7 @@ # # The server listens at the following endpoints. # -Callback.Server.Endpoints=tcp -p 10000:udp -p 10000:ssl -p 10001 +Callback.Server.Endpoints=default -p 10000 # # Warn about connection exceptions |