diff options
author | Matthew Newhook <matthew@zeroc.com> | 2015-03-18 12:58:16 -0230 |
---|---|---|
committer | Matthew Newhook <matthew@zeroc.com> | 2015-03-18 12:58:16 -0230 |
commit | 9b7668c7c92cf9cb311fe444cdddb489cd2a219d (patch) | |
tree | 5016567c58c81f5654e9d01935e199c6bf4761d2 /java/demo/IceStorm/clock/Publisher.java | |
parent | VS add-in & build updates: (diff) | |
download | ice-9b7668c7c92cf9cb311fe444cdddb489cd2a219d.tar.bz2 ice-9b7668c7c92cf9cb311fe444cdddb489cd2a219d.tar.xz ice-9b7668c7c92cf9cb311fe444cdddb489cd2a219d.zip |
Removed demos.
Moved demoscript to distribution.
Diffstat (limited to 'java/demo/IceStorm/clock/Publisher.java')
-rw-r--r-- | java/demo/IceStorm/clock/Publisher.java | 149 |
1 files changed, 0 insertions, 149 deletions
diff --git a/java/demo/IceStorm/clock/Publisher.java b/java/demo/IceStorm/clock/Publisher.java deleted file mode 100644 index cacf84ff840..00000000000 --- a/java/demo/IceStorm/clock/Publisher.java +++ /dev/null @@ -1,149 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2015 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 Publisher extends Ice.Application -{ - public void - usage() - { - System.out.println("Usage: " + appName() + " [--datagram|--twoway|--oneway] [topic]"); - } - - @Override - public int - run(String[] args) - { - String option = "None"; - String topicName = "time"; - int i; - - for(i = 0; i < args.length; ++i) - { - String oldoption = option; - if(args[i].equals("--datagram")) - { - option = "Datagram"; - } - else if(args[i].equals("--twoway")) - { - option = "Twoway"; - } - else if(args[i].equals("--oneway")) - { - option = "Oneway"; - } - else if(args[i].startsWith("--")) - { - usage(); - return 1; - } - else - { - topicName = args[i++]; - break; - } - - if(!oldoption.equals(option) && !oldoption.equals("None")) - { - usage(); - return 1; - } - } - - if(i != args.length) - { - usage(); - return 1; - } - - IceStorm.TopicManagerPrx manager = IceStorm.TopicManagerPrxHelper.checkedCast( - communicator().propertyToProxy("TopicManager.Proxy")); - if(manager == null) - { - System.err.println("invalid proxy"); - return 1; - } - - // - // Retrieve the topic. - // - IceStorm.TopicPrx topic; - try - { - topic = manager.retrieve(topicName); - } - catch(IceStorm.NoSuchTopic e) - { - try - { - topic = manager.create(topicName); - } - catch(IceStorm.TopicExists ex) - { - System.err.println(appName() + ": temporary failure, try again."); - return 1; - } - } - - // - // Get the topic's publisher object, and create a Clock proxy with - // the mode specified as an argument of this application. - // - Ice.ObjectPrx publisher = topic.getPublisher(); - if(option.equals("Datagram")) - { - publisher = publisher.ice_datagram(); - } - else if(option.equals("Twoway")) - { - // Do nothing. - } - else // if(oneway) - { - publisher = publisher.ice_oneway(); - } - ClockPrx clock = ClockPrxHelper.uncheckedCast(publisher); - - System.out.println("publishing tick events. Press ^C to terminate the application."); - try - { - java.text.SimpleDateFormat date = new java.text.SimpleDateFormat("MM/dd/yy HH:mm:ss:SSS"); - while(true) - { - - clock.tick(date.format(new java.util.Date())); - - try - { - Thread.currentThread(); - Thread.sleep(1000); - } - catch(java.lang.InterruptedException e) - { - } - } - } - catch(Ice.CommunicatorDestroyedException ex) - { - // Ignore - } - - return 0; - } - - public static void - main(String[] args) - { - Publisher app = new Publisher(); - int status = app.main("Publisher", args, "config.pub"); - System.exit(status); - } -} |