Пример #1
0
def createserver(config, jobqueue, db):
    channel_set = TornadoChannelSet()
    polling_channel = TornadoChannel('amf')
    channel_set.mapChannel(polling_channel)
    class_mapper = ClassDefMapper()
    encoder = Encoder(amf3=True, use_collections=True, use_proxies=True, use_references=True, class_def_mapper=class_mapper)
    decoder = Decoder(amf3=True, class_def_mapper=class_mapper)
    for channel in channel_set:
        channel.endpoint.encoder = encoder
        channel.endpoint.decoder = decoder

    srcpath = os.path.join(os.environ["CUREGAME_ROOT"], "../flex/lib/")
    if not os.path.exists(srcpath):
        srcpath = None

    for klass in EXPOSE_SERVICES:
        as3rpc.bind_amfast_service(klass, channel_set, class_mapper, args=(config, jobqueue, db), srcpath=srcpath)

    bin_path = os.path.join(os.environ["CUREGAME_ROOT"], "../flex/Dashboard/bin")
    static_path = os.path.join(os.environ["CUREGAME_ROOT"], "media")
    template_path = os.path.join(os.environ["CUREGAME_ROOT"], "media/html")
    return tornado.web.Application([
            (r"/dashboard/amf/", polling_channel.request_handler),
            (r"/(.*)", tornado.web.StaticFileHandler, {"path": bin_path}),
            ], static_path=static_path, template_path=template_path)
Пример #2
0
        dest="log_debug", help="log debugging output")
    (options, args) = parser.parse_args()

    amfast.log_debug = options.log_debug
    handler = logging.StreamHandler(sys.stdout)
    handler.setLevel(logging.DEBUG)
    amfast.logger.addHandler(handler)

    # If the code is completely asynchronous,
    # you can use the dummy_threading module
    # to avoid RLock overhead.
    import dummy_threading
    amfast.mutex_cls = dummy_threading.RLock

    # Setup ChannelSet
    channel_set = TornadoChannelSet(notify_connections=True)

    # Clients connect every x seconds
    # to polling channels to check for messages.
    # If messages are available, they are
    # returned to the client.
    streaming_channel = StreamingTornadoChannel('amf')
    channel_set.mapChannel(streaming_channel)

    static_path = os.path.join(os.path.dirname(__file__), '..', 'flex', 'deploy')

    application = tornado.web.Application([
        (r"/amf", streaming_channel.request_handler),
    ], static_path=static_path)

    http_server = tornado.httpserver.HTTPServer(application)
Пример #3
0
        dest="log_debug", help="log debugging output")
    (options, args) = parser.parse_args()

    amfast.log_debug = options.log_debug
    handler = logging.StreamHandler(sys.stdout)
    handler.setLevel(logging.DEBUG)
    amfast.logger.addHandler(handler)

    # If the code is completely asynchronous,
    # you can use the dummy_threading module
    # to avoid RLock overhead.
    import dummy_threading
    amfast.mutex_cls = dummy_threading.RLock

    # Setup ChannelSet
    channel_set = TornadoChannelSet(notify_connections=True)

    # Clients connect every x seconds
    # to polling channels to check for messages.
    # If messages are available, they are
    # returned to the client.
    polling_channel = TornadoChannel('amf')
    channel_set.mapChannel(polling_channel)

    # Long-poll channels do not return
    # a response to the client until
    # a message is available, or channel.max_interval
    # is reached.
    long_poll_channel = TornadoChannel('longPoll', wait_interval=90000)
    channel_set.mapChannel(long_poll_channel)
Пример #4
0
                      help="log debugging output")
    (options, args) = parser.parse_args()

    amfast.log_debug = options.log_debug
    handler = logging.StreamHandler(sys.stdout)
    handler.setLevel(logging.DEBUG)
    amfast.logger.addHandler(handler)

    # If the code is completely asynchronous,
    # you can use the dummy_threading module
    # to avoid RLock overhead.
    import dummy_threading
    amfast.mutex_cls = dummy_threading.RLock

    # Setup ChannelSet
    channel_set = TornadoChannelSet(notify_connections=True)

    # Clients connect every x seconds
    # to polling channels to check for messages.
    # If messages are available, they are
    # returned to the client.
    polling_channel = TornadoChannel('amf')
    channel_set.mapChannel(polling_channel)

    # Long-poll channels do not return
    # a response to the client until
    # a message is available, or channel.max_interval
    # is reached.
    long_poll_channel = TornadoChannel('longPoll', wait_interval=90000)
    channel_set.mapChannel(long_poll_channel)
Пример #5
0
def createserver(config, rootdir, db):
    channel_set = TornadoChannelSet()
    polling_channel = TornadoChannel('amf')
    channel_set.mapChannel(polling_channel)
    class_mapper = ClassDefMapper()
    encoder = Encoder(amf3=True,
                      use_collections=True,
                      use_proxies=True,
                      use_references=True,
                      class_def_mapper=class_mapper)
    decoder = Decoder(amf3=True, class_def_mapper=class_mapper)
    for channel in channel_set:
        channel.endpoint.encoder = encoder
        channel.endpoint.decoder = decoder

    srcpath = os.path.join(rootdir, "../flex/lib/")
    if not os.path.exists(srcpath):
        srcpath = None

    for klass in EXPOSE_SERVICES:
        as3rpc.bind_amfast_service(klass,
                                   channel_set,
                                   class_mapper,
                                   args=(config, db),
                                   srcpath=srcpath)

    swf_path = os.path.join(rootdir, "media/swf")
    static_path = os.path.join(rootdir, "media")
    template_path = os.path.join(rootdir, "media/html")
    pcms_md5 = hashlib.md5(
        open(os.path.join(swf_path, "pcms.swf"), "rb").read()).hexdigest()

    return tornado.web.Application(
        [
            (r"/remotepy/rpc/", remotepy.RemotePyHandler),
            (r"/pcms/amf/", polling_channel.request_handler),
            (r"/pcms/excel/", GeneratePatientExcelHandler, {
                "db": db
            }),
            (r"/admin/login/", AdminLoginHandler),
            (r"/admin/logout/", AdminLogoutHandler),
            (r"/admin/list/", AdminListStationsHandler, {
                "db": db
            }),
            (r"/admin/reset/sync/", AdminResetClientSyncHandler, {
                "db": db
            }),
            (r"/admin/status/", AdminStatusCheckHandler, {
                "db": db
            }),
            (r"/", FlashAppHandler, {
                "config": config,
                "title": _("VRS Analytics"),
                "flash_id": "pcms",
                "flash_version": "10.1.0",
                "flash_movie": "pcms.swf",
                "movie_md5": pcms_md5
            }),
            (r"/(.*)", tornado.web.StaticFileHandler, {
                "path": swf_path
            }),
        ],
        login_url="/admin/login/",
        cookie_secret="529397d22d7bd16a1f4616726f3312fe4d4b48c1",
        static_path=static_path,
        template_path=template_path)
Пример #6
0
                      help="log debugging output")
    (options, args) = parser.parse_args()

    amfast.log_debug = options.log_debug
    handler = logging.StreamHandler(sys.stdout)
    handler.setLevel(logging.DEBUG)
    amfast.logger.addHandler(handler)

    # If the code is completely asynchronous,
    # you can use the dummy_threading module
    # to avoid RLock overhead.
    import dummy_threading
    amfast.mutex_cls = dummy_threading.RLock

    # Setup ChannelSet
    channel_set = TornadoChannelSet(notify_connections=True)

    # Clients connect every x seconds
    # to polling channels to check for messages.
    # If messages are available, they are
    # returned to the client.
    streaming_channel = StreamingTornadoChannel('amf')
    channel_set.mapChannel(streaming_channel)

    static_path = os.path.join(os.path.dirname(__file__), '..', 'flex',
                               'deploy')

    application = tornado.web.Application([
        (r"/amf", streaming_channel.request_handler),
    ],
                                          static_path=static_path)