Documente Academic
Documente Profesional
Documente Cultură
//
// Copyright (c) 2003-2013 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 java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import Demo.*;
if (i != args.length) {
usage();
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);