summaryrefslogtreecommitdiff
path: root/py/demo/IceStorm/clock
diff options
context:
space:
mode:
Diffstat (limited to 'py/demo/IceStorm/clock')
-rw-r--r--py/demo/IceStorm/clock/Publisher.py80
-rw-r--r--py/demo/IceStorm/clock/Subscriber.py26
2 files changed, 53 insertions, 53 deletions
diff --git a/py/demo/IceStorm/clock/Publisher.py b/py/demo/IceStorm/clock/Publisher.py
index 118aaa585e8..ab0af650156 100644
--- a/py/demo/IceStorm/clock/Publisher.py
+++ b/py/demo/IceStorm/clock/Publisher.py
@@ -15,46 +15,46 @@ import Demo
class Publisher(Ice.Application):
def run(self, args):
- properties = self.communicator().getProperties()
-
- manager = IceStorm.TopicManagerPrx.checkedCast(\
- self.communicator().propertyToProxy('IceStorm.TopicManager.Proxy'))
- if not manager:
- print args[0] + ": invalid proxy"
- return False
-
- topicName = "time"
- if len(args) != 1:
- topicName = args[1]
-
- #
- # Retrieve the topic.
- #
- try:
- topic = manager.retrieve(topicName)
- except IceStorm.NoSuchTopic, e:
- try:
- topic = manager.create(topicName)
- except IceStorm.TopicExists, ex:
- print self.appName() + ": temporay error. try again"
- return False
-
- #
- # Get the topic's publisher object, the Clock type, and create a
- # oneway Clock proxy (for efficiency reasons).
- #
- clock = Demo.ClockPrx.uncheckedCast(topic.getPublisher().ice_oneway())
-
- print "publishing tick events. Press ^C to terminate the application."
- try:
- while 1:
- clock.tick(time.strftime("%m/%d/%Y %H:%M:%S"))
- time.sleep(1)
- except Ice.CommunicatorDestroyedException, e:
- # Ignore
- pass
-
- return True
+ properties = self.communicator().getProperties()
+
+ manager = IceStorm.TopicManagerPrx.checkedCast(\
+ self.communicator().propertyToProxy('IceStorm.TopicManager.Proxy'))
+ if not manager:
+ print args[0] + ": invalid proxy"
+ return False
+
+ topicName = "time"
+ if len(args) != 1:
+ topicName = args[1]
+
+ #
+ # Retrieve the topic.
+ #
+ try:
+ topic = manager.retrieve(topicName)
+ except IceStorm.NoSuchTopic, e:
+ try:
+ topic = manager.create(topicName)
+ except IceStorm.TopicExists, ex:
+ print self.appName() + ": temporay error. try again"
+ return False
+
+ #
+ # Get the topic's publisher object, the Clock type, and create a
+ # oneway Clock proxy (for efficiency reasons).
+ #
+ clock = Demo.ClockPrx.uncheckedCast(topic.getPublisher().ice_oneway())
+
+ print "publishing tick events. Press ^C to terminate the application."
+ try:
+ while 1:
+ clock.tick(time.strftime("%m/%d/%Y %H:%M:%S"))
+ time.sleep(1)
+ except Ice.CommunicatorDestroyedException, e:
+ # Ignore
+ pass
+
+ return True
app = Publisher()
sys.exit(app.main(sys.argv, "config.pub"))
diff --git a/py/demo/IceStorm/clock/Subscriber.py b/py/demo/IceStorm/clock/Subscriber.py
index 9dcacf2b0ff..17fb94ad222 100644
--- a/py/demo/IceStorm/clock/Subscriber.py
+++ b/py/demo/IceStorm/clock/Subscriber.py
@@ -22,7 +22,7 @@ class Subscriber(Ice.Application):
properties = self.communicator().getProperties()
manager = IceStorm.TopicManagerPrx.checkedCast(\
- self.communicator().propertyToProxy('IceStorm.TopicManager.Proxy'))
+ self.communicator().propertyToProxy('IceStorm.TopicManager.Proxy'))
if not manager:
print args[0] + ": invalid proxy"
return False
@@ -43,18 +43,18 @@ class Subscriber(Ice.Application):
print self.appName() + ": temporay error. try again"
return False
- adapter = self.communicator().createObjectAdapter("Clock.Subscriber")
+ adapter = self.communicator().createObjectAdapter("Clock.Subscriber")
- #
- # Add a Servant for the Ice Object.
- #
- subscriber = adapter.addWithUUID(ClockI());
+ #
+ # Add a Servant for the Ice Object.
+ #
+ subscriber = adapter.addWithUUID(ClockI());
- #
- # This demo requires no quality of service, so it will use
- # the defaults.
- #
- qos = {}
+ #
+ # This demo requires no quality of service, so it will use
+ # the defaults.
+ #
+ qos = {}
topic.subscribe(qos, subscriber)
adapter.activate()
@@ -66,8 +66,8 @@ class Subscriber(Ice.Application):
# Unsubscribe all subscribed objects.
#
topic.unsubscribe(subscriber)
-
- return True
+
+ return True
app = Subscriber()
sys.exit(app.main(sys.argv, "config.sub"))