Improved application host
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
import atexit
|
||||
from abc import ABC, abstractmethod
|
||||
from typing import Type, Optional
|
||||
|
||||
@@ -21,10 +20,6 @@ class ApplicationABC(ABC):
|
||||
def use_startup(self, startup: Type[StartupABC]):
|
||||
self._startup = startup()
|
||||
|
||||
@staticmethod
|
||||
def output_at_exit():
|
||||
atexit.register(Console.close)
|
||||
|
||||
def build(self):
|
||||
if self._startup is not None:
|
||||
self._app_host = self._startup.create_application_host()
|
||||
|
@@ -1,3 +1,5 @@
|
||||
import atexit
|
||||
from collections import Callable
|
||||
from datetime import datetime
|
||||
|
||||
from cpl.application.application_host_abc import ApplicationHostABC
|
||||
@@ -5,6 +7,7 @@ from cpl.application.application_runtime import ApplicationRuntime
|
||||
from cpl.application.application_runtime_abc import ApplicationRuntimeABC
|
||||
from cpl.configuration.configuration import Configuration
|
||||
from cpl.configuration.configuration_abc import ConfigurationABC
|
||||
from cpl.console.console import Console
|
||||
from cpl.dependency_injection.service_provider import ServiceProvider
|
||||
from cpl.dependency_injection.service_provider_base import ServiceProviderABC
|
||||
|
||||
@@ -35,4 +38,9 @@ class ApplicationHost(ApplicationHostABC):
|
||||
def services(self) -> ServiceProviderABC:
|
||||
return self._services
|
||||
|
||||
def create(self): pass
|
||||
@staticmethod
|
||||
def output_at_exit():
|
||||
atexit.register(Console.close)
|
||||
|
||||
def console_argument_error_function(self, function: Callable):
|
||||
self._config.argument_error_function = function
|
||||
|
@@ -1,4 +1,5 @@
|
||||
from abc import ABC, abstractmethod
|
||||
from collections import Callable
|
||||
|
||||
from cpl.application.application_runtime_abc import ApplicationRuntimeABC
|
||||
from cpl.configuration.configuration_abc import ConfigurationABC
|
||||
@@ -21,3 +22,10 @@ class ApplicationHostABC(ABC):
|
||||
@property
|
||||
@abstractmethod
|
||||
def services(self) -> ServiceProviderABC: pass
|
||||
|
||||
@staticmethod
|
||||
@abstractmethod
|
||||
def output_at_exit(): pass
|
||||
|
||||
@abstractmethod
|
||||
def console_argument_error_function(self, function: Callable): pass
|
||||
|
Reference in New Issue
Block a user