diff options
author | Mark Spruiell <mes@zeroc.com> | 2001-12-12 20:30:46 +0000 |
---|---|---|
committer | Mark Spruiell <mes@zeroc.com> | 2001-12-12 20:30:46 +0000 |
commit | e535e3ec7f6256d9e4e84eb7058667312c233a44 (patch) | |
tree | 8d0ef62869dee96a7c788c8a12eb87f47328c563 /java/test/Ice/objects/Client.java | |
parent | initial check-in (diff) | |
download | ice-e535e3ec7f6256d9e4e84eb7058667312c233a44.tar.bz2 ice-e535e3ec7f6256d9e4e84eb7058667312c233a44.tar.xz ice-e535e3ec7f6256d9e4e84eb7058667312c233a44.zip |
initial check-in
Diffstat (limited to 'java/test/Ice/objects/Client.java')
-rw-r--r-- | java/test/Ice/objects/Client.java | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/java/test/Ice/objects/Client.java b/java/test/Ice/objects/Client.java new file mode 100644 index 00000000000..3ebd1ff4786 --- /dev/null +++ b/java/test/Ice/objects/Client.java @@ -0,0 +1,86 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +public class Client +{ + private static class MyObjectFactory implements Ice.ObjectFactory + { + public Ice.Object + create(String type) + { + if (type.equals("::B")) + { + return new B(); + } + else if (type.equals("::C")) + { + return new C(); + } + else if (type.equals("::D")) + { + return new D(); + } + assert(false); // Should never be reached + return null; + } + + public void + destroy() + { + // Nothing to do + } + } + + private static int + run(String[] args, Ice.Communicator communicator) + { + Ice.ObjectFactory factory = new MyObjectFactory(); + communicator.addObjectFactory(factory, "::B"); + communicator.addObjectFactory(factory, "::C"); + communicator.addObjectFactory(factory, "::D"); + + InitialPrx initial = AllTests.allTests(communicator, false); + initial.shutdown(); + return 0; + } + + public static void + main(String[] args) + { + int status = 0; + Ice.Communicator communicator = null; + + try + { + communicator = Ice.Util.initialize(args); + status = run(args, communicator); + } + catch (Ice.LocalException ex) + { + ex.printStackTrace(); + status = 1; + } + + if (communicator != null) + { + try + { + communicator.destroy(); + } + catch (Ice.LocalException ex) + { + ex.printStackTrace(); + status = 1; + } + } + + System.exit(status); + } +} |