summaryrefslogtreecommitdiff
path: root/java/demo/IcePack/hello/Client.java
diff options
context:
space:
mode:
authorMark Spruiell <mes@zeroc.com>2005-10-10 20:51:09 +0000
committerMark Spruiell <mes@zeroc.com>2005-10-10 20:51:09 +0000
commit5c820414d32245f8f23ad323787b72fb94f2782b (patch)
tree7b00c76b0c76606ed30740849b83e65921b8be84 /java/demo/IcePack/hello/Client.java
parentadding IceGrid (diff)
downloadice-5c820414d32245f8f23ad323787b72fb94f2782b.tar.bz2
ice-5c820414d32245f8f23ad323787b72fb94f2782b.tar.xz
ice-5c820414d32245f8f23ad323787b72fb94f2782b.zip
bug 475: remove IcePack
Diffstat (limited to 'java/demo/IcePack/hello/Client.java')
-rw-r--r--java/demo/IcePack/hello/Client.java190
1 files changed, 0 insertions, 190 deletions
diff --git a/java/demo/IcePack/hello/Client.java b/java/demo/IcePack/hello/Client.java
deleted file mode 100644
index 3f308bf8868..00000000000
--- a/java/demo/IcePack/hello/Client.java
+++ /dev/null
@@ -1,190 +0,0 @@
-// **********************************************************************
-//
-// Copyright (c) 2003-2005 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.
-//
-// **********************************************************************
-
-import Demo.*;
-
-public class Client extends Ice.Application
-{
- private void
- menu()
- {
- System.out.println(
- "usage:\n" +
- "c: create a hello object\n" +
- "d: destroy the current hello object\n" +
- "s: set the current hello object\n" +
- "r: set the current hello object to a random hello object\n" +
- "S: show the name of the current hello object\n" +
- "t: send greeting\n" +
- "x: exit\n" +
- "?: help\n");
- }
-
- public int
- run(String[] args)
- {
- try
- {
- IcePack.QueryPrx query = IcePack.QueryPrxHelper.checkedCast(communicator().stringToProxy("IcePack/Query"));
- //
- // Get an object implementing the HelloFactory interface.
- //
- HelloFactoryPrx factory = HelloFactoryPrxHelper.checkedCast(query.findObjectByType("::Demo::HelloFactory"));
-
- //
- // By default we create a Hello object named 'Foo'.
- //
- HelloPrx hello;
- try
- {
- hello = factory.find("Foo");
- }
- catch(NameNotExistException ex)
- {
- hello = factory.create("Foo");
- }
-
- menu();
-
- java.io.BufferedReader in = new java.io.BufferedReader(new java.io.InputStreamReader(System.in));
-
- String line = null;
- do
- {
- try
- {
- System.out.print("==> ");
- System.out.flush();
- line = in.readLine();
- if(line == null)
- {
- break;
- }
- if(line.equals("t"))
- {
- hello.sayHello();
- }
- else if(line.equals("c"))
- {
- System.out.print("name: ");
- System.out.flush();
- String name = in.readLine();
- if(name != null && name.length() > 0)
- {
- try
- {
- hello = factory.find(name);
- System.out.println("Hello object named '" + name + "' already exists");
- }
- catch(NameNotExistException ex)
- {
- try
- {
- factory = HelloFactoryPrxHelper.checkedCast(
- query.findObjectByType("::Demo::HelloFactory"));
- hello = factory.create(name);
- }
- catch(IcePack.ObjectNotExistException e)
- {
- }
- }
- }
- }
- else if(line.equals("d"))
- {
- if(Ice.Util.identityToString(hello.ice_getIdentity()).equals("Foo"))
- {
- System.out.println("Can't delete the default Hello object named 'Foo'");
- }
- else
- {
- hello.destroy();
-
- try
- {
- hello = factory.find("Foo");
- }
- catch(NameNotExistException ex)
- {
- hello = factory.create("Foo");
- }
- }
- }
- else if(line.equals("s"))
- {
- System.out.print("name: ");
- System.out.flush();
- String name = in.readLine();
- if(name != null && name.length() > 0)
- {
- try
- {
- hello = HelloPrxHelper.checkedCast(factory.find(name));
- }
- catch(NameNotExistException ex)
- {
- System.out.println("This name doesn't exist");
- }
- }
- }
- else if(line.equals("r"))
- {
- hello = HelloPrxHelper.checkedCast(query.findObjectByType("::Demo::Hello"));
- }
- else if(line.equals("S"))
- {
- System.out.println(Ice.Util.identityToString(hello.ice_getIdentity()));
- }
- else if(line.equals("x"))
- {
- // Nothing to do
- }
- else if(line.equals("?"))
- {
- menu();
- }
- else
- {
- System.out.println("unknown command `" + line + "'");
- menu();
- }
- }
- catch(java.io.IOException ex)
- {
- ex.printStackTrace();
- }
- catch(Ice.LocalException ex)
- {
- ex.printStackTrace();
- }
- }
- while(!line.equals("x"));
- }
- catch(NameExistsException e)
- {
- e.printStackTrace();
- return 1;
- }
- catch(IcePack.ObjectNotExistException e)
- {
- e.printStackTrace();
- return 1;
- }
-
- return 0;
- }
-
- public static void
- main(String[] args)
- {
- Client app = new Client();
- int status = app.main("Client", args, "config");
- System.exit(status);
- }
-}