示例#1
0
    def __init__(self, name=None, application_settings=None, global_settings=None):
        RootService.__init__(self, settings=global_settings)

        # Compute name for Twisted service
        self.name = u'app-{name}'.format(name=name)

        # Make channel object from application settings configuration object
        self.setupChannel(channel=application_settings, name=name)

        # Create application service object composed of subsystem components
        service = ProtocolForwarderService(
            channel = self.channel
        )

        # Register service component with its container
        self.registerService(service)
示例#2
0
    def __init__(self,
                 name=None,
                 application_settings=None,
                 global_settings=None):
        RootService.__init__(self, settings=global_settings)

        # Compute name for Twisted service
        self.name = u'app-{name}'.format(name=name)

        # Make channel object from application settings configuration object
        self.channel = Bunch(**application_settings)

        # Main application components
        for service_reference in read_list(application_settings.services):

            # Load service component
            try:
                service_factory = KotoriBootloader.load_entrypoint(
                    service_reference)
            except Exception as ex:
                log.failure(
                    'Error loading composite service component "{service_name}" into "{app_name}":\n{log_failure}"',
                    service_name=service_reference,
                    app_name=name)
                continue

            # Load data processing strategy and graphing components
            # TODO: Review whether this should be per-service or not
            # TODO: Introduce strict/non-strict handling
            strategy_factory = KotoriBootloader.load_entrypoint(
                application_settings.strategy, onerror='ignore')
            graphing_factory = KotoriBootloader.load_entrypoint(
                application_settings.graphing, onerror='ignore')

            # Create application service object composed of subsystem components
            # TODO: Bundle all arguments into yet another wrapper object for an universal object factory

            service = service_factory(
                channel=self.channel,
                strategy=strategy_factory(settings=global_settings),
                graphing=graphing_factory(settings=global_settings,
                                          channel=self.channel))

            # Register service component with its container
            self.registerService(service)
示例#3
0
    def __init__(self, name=None, application_settings=None, global_settings=None):
        RootService.__init__(self, settings=global_settings)

        # Compute name for Twisted service
        self.name = u'app-{name}'.format(name=name)

        # Make channel object from application settings configuration object
        application_settings = deepcopy(application_settings)
        application_settings.update(name=name)
        self.channel = Bunch(**application_settings)

        # Create application service object composed of subsystem components
        service = FirmwareBuilderService(
            channel = self.channel
        )

        # Register service component with its container
        self.registerService(service)
示例#4
0
    def __init__(self, name=None, application_settings=None, global_settings=None):
        RootService.__init__(self, settings=global_settings)

        # Compute name for Twisted service
        self.name = u'app-{name}'.format(name=name)

        # Make channel object from application settings configuration object
        self.channel = Bunch(**application_settings)

        # Create application service object composed of subsystem components
        service = MqttInfluxGrafanaService(
            channel  = self.channel,
            # Data processing strategy and graphing components
            strategy = WanBusStrategy(),
            graphing = GrafanaManager(settings=global_settings, channel=self.channel)
            )

        # Register service component with its container
        self.registerService(service)
示例#5
0
文件: mqttkit.py 项目: thiasB/kotori
    def __init__(self, name=None, application_settings=None, global_settings=None):
        RootService.__init__(self, settings=global_settings)

        # Compute name for Twisted service
        self.name = u'app-{name}'.format(name=name)

        # Make channel object from application settings configuration object
        self.channel = Bunch(**application_settings)

        # Create application service object composed of subsystem components
        service = MqttInfluxGrafanaService(
            channel  = self.channel,
            # Data processing strategy and graphing components
            strategy=WanBusStrategy(),
            graphing=GrafanaManager(settings=global_settings, channel=self.channel)
            )

        # Register service component with its container
        self.registerService(service)
示例#6
0
def hiveeyes_boot(settings, debug=False):

    # Service container root
    rootService = RootService(settings=settings)

    # Channel realm
    channel = Bunch(**settings.hiveeyes)

    # Main application service
    service = MqttInfluxGrafanaService(
        channel  = channel,
        graphing = [
            HiveeyesGenericGrafanaManager(settings=settings, channel=channel),
            HiveeyesBeehiveGrafanaManager(settings=settings, channel=channel),
        ],
        strategy = WanBusStrategy()
    )

    rootService.registerService(service)
    rootService.startService()
示例#7
0
    def __init__(self, name=None, application_settings=None, global_settings=None):
        RootService.__init__(self, settings=global_settings)

        # Compute name for Twisted service
        self.name = u'app-{name}'.format(name=name)

        # Make channel object from application settings configuration object
        self.channel = Bunch(**application_settings)

        # Main application components
        for service_reference in read_list(application_settings.services):

            # Load service component
            try:
                service_factory = KotoriBootloader.load_entrypoint(service_reference)
            except Exception as ex:
                log.failure('Error loading composite service component "{service_name}" into "{app_name}":\n{log_failure}"',
                            service_name=service_reference, app_name=name)
                continue

            # Load data processing strategy and graphing components
            # TODO: Review whether this should be per-service or not
            # TODO: Introduce strict/non-strict handling
            strategy_factory = KotoriBootloader.load_entrypoint(application_settings.strategy, onerror='ignore')
            graphing_factory = KotoriBootloader.load_entrypoint(application_settings.graphing, onerror='ignore')

            # Create application service object composed of subsystem components
            # TODO: Bundle all arguments into yet another wrapper object for an universal object factory

            service = service_factory(
                channel  = self.channel,
                strategy = strategy_factory(settings=global_settings),
                graphing = graphing_factory(settings=global_settings, channel=self.channel)
                )

            # Register service component with its container
            self.registerService(service)
示例#8
0
def hiveeyes_boot(settings, debug=False):

    # Service container root
    rootService = RootService(settings=settings)

    # Channel realm
    channel = Bunch(**settings.hiveeyes)

    # Main application service
    service = MqttInfluxGrafanaService(
        channel=channel,
        graphing=[
            HiveeyesGenericGrafanaManager(settings=settings, channel=channel),
            HiveeyesBeehiveGrafanaManager(settings=settings, channel=channel),
        ],
        strategy=WanBusStrategy())

    rootService.registerService(service)
    rootService.startService()