Source code for AutoArchive._services.external_command_executor._external_command_executor_service_component
# _external_command_executor_service_component.py
#
# Project: AutoArchive
# License: GNU GPLv3
#
# Copyright (C) 2003 - 2023 Róbert Čerňanský
""":class:`ExternalCommandExecutorServiceComponent` class."""
__all__ = ["ExternalCommandExecutorServiceComponent"]
from AutoArchive._infrastructure.service import IServiceComponent
from AutoArchive._infrastructure.service._service_accessor import ServiceAccessor
from . import ExternalCommandExecutorServiceIdentification
from ._external_command_executor import ExternalCommandExecutor
[docs]
class ExternalCommandExecutorServiceComponent(IServiceComponent):
"""Service component for external command executor.
Registers service identified as :class:`.ExternalCommandExecutorServiceIdentification`."""
def __init__(self, applicationContext, serviceAccessor: ServiceAccessor):
self.__serviceAccessor = serviceAccessor
serviceAccessor.registerService(ExternalCommandExecutorServiceIdentification, ExternalCommandExecutor)
[docs]
def destroyServices(self):
"See: :meth:`IServiceComponent.destroyServices()`"
self.__serviceAccessor.unregisterService(ExternalCommandExecutorServiceIdentification)