2020-11-22 20:17:57 +01:00
|
|
|
from datetime import datetime
|
|
|
|
|
2020-11-26 10:45:02 +01:00
|
|
|
from sh_edraft.hosting.base.application_host_base import ApplicationHostBase
|
2020-11-26 11:20:21 +01:00
|
|
|
from sh_edraft.hosting.base.environment_base import EnvironmentBase
|
2020-11-25 21:41:45 +01:00
|
|
|
from sh_edraft.service.service_provider import ServiceProvider
|
2020-11-22 20:17:57 +01:00
|
|
|
|
|
|
|
|
2020-11-25 21:41:45 +01:00
|
|
|
class ApplicationHost(ApplicationHostBase):
|
2020-11-26 11:20:21 +01:00
|
|
|
|
|
|
|
def __init__(self, name: str, env: EnvironmentBase):
|
2020-11-25 21:41:45 +01:00
|
|
|
ApplicationHostBase.__init__(self)
|
2020-11-26 11:20:21 +01:00
|
|
|
self._name: str = name
|
|
|
|
self._environment: EnvironmentBase = env
|
|
|
|
|
|
|
|
self._services = ServiceProvider(self)
|
2020-11-22 20:17:57 +01:00
|
|
|
self._start_time: datetime = datetime.now()
|
2020-11-26 10:45:02 +01:00
|
|
|
self._end_time: datetime = datetime.now()
|
2020-11-22 20:17:57 +01:00
|
|
|
|
2020-11-26 11:20:21 +01:00
|
|
|
@property
|
|
|
|
def name(self) -> str:
|
|
|
|
return self._name
|
|
|
|
|
|
|
|
@property
|
|
|
|
def environment(self) -> EnvironmentBase:
|
|
|
|
return self._environment
|
|
|
|
|
2020-11-22 20:17:57 +01:00
|
|
|
@property
|
|
|
|
def services(self):
|
|
|
|
return self._services
|
|
|
|
|
|
|
|
@property
|
|
|
|
def end_time(self) -> datetime:
|
|
|
|
return self._end_time
|
|
|
|
|
|
|
|
@end_time.setter
|
2020-11-26 10:45:02 +01:00
|
|
|
def end_time(self, end_time: datetime):
|
2020-11-22 20:17:57 +01:00
|
|
|
self._end_time = end_time
|
|
|
|
|
|
|
|
@property
|
|
|
|
def start_time(self) -> datetime:
|
|
|
|
return self._start_time
|
|
|
|
|
|
|
|
@start_time.setter
|
2020-11-26 10:45:02 +01:00
|
|
|
def start_time(self, start_time: datetime):
|
2020-11-22 20:17:57 +01:00
|
|
|
self._start_time = start_time
|
|
|
|
|
|
|
|
@property
|
|
|
|
def date_time_now(self) -> datetime:
|
|
|
|
return datetime.now()
|