Added logic to create application

This commit is contained in:
2020-11-26 11:55:55 +01:00
parent c815e75282
commit 1c753aaaea
9 changed files with 66 additions and 14 deletions

View File

@@ -1,17 +1,20 @@
from datetime import datetime
from sh_edraft.hosting.hosting_environment import HostingEnvironment
from sh_edraft.hosting.base.application_host_base import ApplicationHostBase
from sh_edraft.hosting.base.environment_base import EnvironmentBase
from sh_edraft.service.base import ServiceProviderBase
from sh_edraft.service.service_provider import ServiceProvider
class ApplicationHost(ApplicationHostBase):
def __init__(self, name: str, env: EnvironmentBase):
def __init__(self, name: str, args: list[str]):
ApplicationHostBase.__init__(self)
self._name: str = name
self._environment: EnvironmentBase = env
self._environment = HostingEnvironment()
self._args: list[str] = args
self._services = ServiceProvider(self)
self._start_time: datetime = datetime.now()
self._end_time: datetime = datetime.now()
@@ -24,10 +27,6 @@ class ApplicationHost(ApplicationHostBase):
def environment(self) -> EnvironmentBase:
return self._environment
@property
def services(self):
return self._services
@property
def end_time(self) -> datetime:
return self._end_time
@@ -47,3 +46,7 @@ class ApplicationHost(ApplicationHostBase):
@property
def date_time_now(self) -> datetime:
return datetime.now()
@property
def services(self) -> ServiceProviderBase:
return self._services

View File

@@ -0,0 +1,16 @@
from abc import ABC, abstractmethod
class ApplicationBase(ABC):
@abstractmethod
def __init__(self): pass
@abstractmethod
def create_configuration(self): pass
@abstractmethod
def create_services(self): pass
@abstractmethod
def main(self): pass

View File

@@ -1,14 +1,16 @@
from typing import Optional
from sh_edraft.hosting.base.environment_base import EnvironmentBase
from sh_edraft.hosting.model.environment_name import EnvironmentName
class HostingEnvironment(EnvironmentBase):
def __init__(self, name: EnvironmentName, crp: str):
def __init__(self, name: EnvironmentName = None, crp: str = None):
EnvironmentBase.__init__(self)
self._name = name
self._content_root_path = crp
self._name: Optional[EnvironmentName] = name
self._content_root_path: Optional[str] = crp
@property
def name(self) -> EnvironmentName:
@@ -17,4 +19,3 @@ class HostingEnvironment(EnvironmentBase):
@property
def content_root_path(self) -> str:
return self._content_root_path