Esempio n. 1
0
    def run(self, args):
        broker = self.communicator()
        adapter = broker.createObjectAdapter('FactoryAdapter')

        publisher = self.get_topic(STATUS_TOPIC).getPublisher()
        progress_publisher = Downloader.ProgressEventPrx.uncheckedCast(
            publisher)
        print("ProgressTopic created")

        queue = WorkQueue(progress_publisher)
        servant = SchedulerFactoryI(queue)

        proxy = adapter.addWithUUID(servant)
        sync_topic = self.get_topic(SYNC_TOPIC)
        pub = sync_topic.subscribeAndGetPublisher({}, proxy)
        servant.sync_publisher = Downloader.SyncEventPrx.uncheckedCast(pub)
        print("SynTopic created")

        print(proxy, flush=True)

        adapter.activate()
        queue.start()

        self.shutdownOnInterrupt()
        broker.waitForShutdown()
        queue.destroy()

        return 0
Esempio n. 2
0
    def run(self, args):
        '''Crea los canales de eventos y el proxy que sera mostrado por teminal
        para que el cliente pueda conectarse a el'''
        adapter = self.communicator().createObjectAdapter("FactoryAdapter")
        Downloader.SyncEventPrx.uncheckedCast(
            self.get_topic(SYNC_TOPIC).getPublisher())
        progress = Downloader.ProgressEventPrx.uncheckedCast(
            self.get_topic(PROGRESS_TOPIC).getPublisher())
        queue = WorkQueue(progress)
        proxy = adapter.addWithUUID(SchedulerFactoryI(queue))

        print(proxy, flush=True)
        topic_mgr = self.get_topic(SYNC_TOPIC)
        servant = SyncEventI()
        subscriber = adapter.addWithUUID(servant)
        qos = {}
        topic_mgr.subscribeAndGetPublisher(qos, subscriber)

        while self.communicator().isShutdown():
            subscriber.requestSync()
            time.sleep(10)

        adapter.activate()
        queue.start()
        self.shutdownOnInterrupt()
        self.communicator().waitForShutdown()
        queue.destroy()

        return 0
Esempio n. 3
0
    def run(self, argv):
        topic_mgr = self.get_topic_manager() #proxy to topic
        if not topic_mgr:
            print(': invalid proxy')
            return 2

        topic_name = "ProgressTopic"
        try:
            topic = topic_mgr.retrieve(topic_name)
        except IceStorm.NoSuchTopic:
            topic = topic_mgr.create(topic_name)

        publisher = topic.getPublisher();
        progress_topic = Example.ProgressSubscriberPrx.unCheckedCast(publisher);
        work_queue = WorkQueue(progress_top)
        servant = DownloaderI(work_queue)

        adapter = broker.createObjectAdapter("DownloaderAdapter")
        printer(adapter.add(servant, broker.stringToIdentity("dowloader1")))

        work_queue.start();
        self.shutdownOnInterrupt()
        broker.waitForShutdown()
        work_queue.destroy()
        return 0
Esempio n. 4
0
    def run(self, args):

        topic_mgr = self.get_topic_manager()
        if not topic_mgr:
            print('invalid proxy')
            return 2

        topic_name = "ProgressTopic"
        try:
            topic = topic_mgr.retrieve(topic_name)
        except IceStorm.NoSuchTopic:
            topic = topic_mgr.create(topic_name)

        publisher = topic.getPublisher()
        progress = Downloader.ProgressEventPrx.uncheckedCast(publisher)

        if progress is None:
            print("Progress topic  not found")

        work_queue = WorkQueue(progress)

        ic = self.communicator()
        adapter = ic.createObjectAdapter("FactoryAdapter")
        servant = SchedulerFactoryI(work_queue, ic)
        proxy = adapter.add(servant, ic.stringToIdentity("Factory1"))

        work_queue.start()

        adapter.activate()
        print(proxy, flush=True)
        self.shutdownOnInterrupt()
        ic.waitForShutdown()

        return 0
Esempio n. 5
0
    def run(self, argv):
        work_queue = WorkQueue()
        servant = MathI(work_queue)

        broker = self.communicator()

        adapter = broker.createObjectAdapter("MathAdapter")
        print adapter.add(servant, broker.stringToIdentity("math1"))
        adapter.activate()

        work_queue.start()

        self.shutdownOnInterrupt()
        broker.waitForShutdown()

        work_queue.destroy()
        return 0
Esempio n. 6
0
    def run(self, argv):
        work_queue = WorkQueue()
        servant = MathI(work_queue)

        broker = self.communicator()

        adapter = broker.createObjectAdapter("MathAdapter")
        print adapter.add(servant, broker.stringToIdentity("math1"))
        adapter.activate()

        work_queue.start()

        self.shutdownOnInterrupt()
        broker.waitForShutdown()

        work_queue.destroy()
        return 0