コード例 #1
0
ファイル: server.py プロジェクト: rumonmart/Mecagoengithub
    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
コード例 #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
コード例 #3
0
ファイル: Server.py プロジェクト: Rodrigo262/SSDD
    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
コード例 #4
0
ファイル: Server.py プロジェクト: arco-group/ice-hello
    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
コード例 #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