summaryrefslogtreecommitdiff
path: root/java/demo/IceGrid/simple/Client.java
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2005-09-23 08:07:35 +0000
committerBenoit Foucher <benoit@zeroc.com>2005-09-23 08:07:35 +0000
commit0cf0aeac80a0411aaa73abc38af14387a720bd44 (patch)
treeec2d932db97b3c58a70057f1b539f30a3afa5fce /java/demo/IceGrid/simple/Client.java
parentFix (diff)
downloadice-0cf0aeac80a0411aaa73abc38af14387a720bd44.tar.bz2
ice-0cf0aeac80a0411aaa73abc38af14387a720bd44.tar.xz
ice-0cf0aeac80a0411aaa73abc38af14387a720bd44.zip
Fixes
Diffstat (limited to 'java/demo/IceGrid/simple/Client.java')
-rw-r--r--java/demo/IceGrid/simple/Client.java25
1 files changed, 23 insertions, 2 deletions
diff --git a/java/demo/IceGrid/simple/Client.java b/java/demo/IceGrid/simple/Client.java
index 1637604185b..834b4569c04 100644
--- a/java/demo/IceGrid/simple/Client.java
+++ b/java/demo/IceGrid/simple/Client.java
@@ -29,11 +29,32 @@ public class Client extends Ice.Application
properties.parseCommandLineOptions("", args);
+ //
+ // First we try to connect to the object with the `hello'
+ // identity. If it's not registered with the registry, we
+ // search for an object with the ::Demo::Hello type.
+ //
Ice.ObjectPrx base = communicator().stringToProxy(properties.getPropertyWithDefault("Identity", "hello"));
- HelloPrx twoway = HelloPrxHelper.checkedCast(base);
+ HelloPrx twoway = null;
+ try
+ {
+ twoway = HelloPrxHelper.checkedCast(base);
+ }
+ catch(Ice.NotRegisteredException ex)
+ {
+ IceGrid.QueryPrx query =
+ IceGrid.QueryPrxHelper.uncheckedCast(communicator().stringToProxy("IceGrid/Query"));
+ try
+ {
+ twoway = HelloPrxHelper.checkedCast(query.findObjectByType("::Demo::Hello"));
+ }
+ catch(IceGrid.ObjectNotExistException ex1)
+ {
+ }
+ }
if(twoway == null)
{
- System.err.println("invalid proxy");
+ System.err.println(": couldn't find a `::Demo::Hello' object.");
return 1;
}