Пример #1
0
    def load(self, dependencies):
        api = dependencies['api']
        config = dependencies['config']
        token_changed_subscribe = dependencies['token_changed_subscribe']

        provd_client = ProvdClient(**config['provd'])
        token_changed_subscribe(provd_client.set_token)

        device_dao = build_device_dao(provd_client)
        device_updater = build_device_updater(provd_client)
        service = build_service(provd_client, device_updater)

        api.add_resource(
            LineDeviceAssociation,
            '/lines/<int:line_id>/devices/<device_id>',
            endpoint='line_devices',
            resource_class_args=(line_dao, device_dao, service),
        )

        api.add_resource(
            LineDeviceGet,
            '/lines/<int:line_id>/devices',
            resource_class_args=(line_dao, device_dao, service),
        )

        api.add_resource(
            DeviceLineGet,
            '/devices/<device_id>/lines',
            resource_class_args=(line_dao, device_dao, service),
        )
Пример #2
0
def build_user_funckey_template_service(provd_client):
    device_updater = device_builder.build_device_updater(provd_client)

    return UserFuncKeyTemplateService(
        user_dao_module,
        build_user_template_validator(),
        build_notifier(),
        device_updater,
    )
Пример #3
0
def build_service(registrar_dao, provd_client):
    validator = build_validator()
    notifier = RegistrarNotifier(bus)
    line_service = build_line_service(provd_client)
    device_updater = build_device_updater(provd_client)

    registrar_service = RegistrarService(registrar_dao, validator, notifier,
                                         line_service, device_updater,
                                         provd_client)
    return registrar_service
Пример #4
0
def build_template_service(provd_client, pjsip_doc):
    device_updater = device_builder.build_device_updater(provd_client)

    return SipEndpointService(
        endpoint_sip_dao_module,
        build_validator(pjsip_doc),
        build_template_notifier(),
        device_updater,
        template=True,
    )
Пример #5
0
def build_service(provd_client):
    device_updater = device_builder.build_device_updater(provd_client)

    return TemplateService(
        template_dao_module,
        user_dao_module,
        build_validator(),
        build_validator_bsfilter(),
        build_notifier(),
        device_updater,
    )
Пример #6
0
def build_service(provd_client):
    device_dao = device_builder.build_dao(provd_client)
    device_updater = device_builder.build_device_updater(provd_client)
    registrar_dao = RegistrarDao(provd_client)

    return LineService(
        line_dao_module,
        build_validator(registrar_dao),
        build_notifier(),
        device_updater,
        device_dao,
        user_line_build_service(),
        line_device_build_service(provd_client, device_updater),
    )
Пример #7
0
def build_service(provd_client):
    device_updater = device_builder.build_device_updater(provd_client)

    return SipEndpointService(endpoint_sip_dao_module, build_validator(),
                              build_notifier(), device_updater)
Пример #8
0
def build_service(provd_client):
    updater = build_device_updater(provd_client)
    return UserService(user_dao, build_validator(), build_notifier(), updater,
                       func_key_dao)
Пример #9
0
def build_service(provd_client):
    device_updater = device_builder.build_device_updater(provd_client)
    return ExtensionService(extension_dao_module, build_validator(),
                            build_notifier(), device_updater)