-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathfacade.py
59 lines (43 loc) · 1.39 KB
/
facade.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# ------------------------------------------------------------------------------
# Facade Implementation.
#--------------------------------------------------------------------------------
# Provide a unified interface to a set of interfaces in a subsystem.
# Façade defines a higher-level interface that makes the subsystem easier to use.
# -------------------------------------------------------------------------------
class ResourceManager:
def __init__(self):
print("Update all resources.")
def update_resources(self):
self.reportDb = ReportDb()
self.reportDb.update()
self.intranetDb = InntranetDb()
self.intranetDb.save()
self.site = Site()
self.site.update()
self.Api = Api()
self.Api.post()
class ReportDb:
def __init__(self):
print ("ReportDb called.")
def update(self):
print("ReportDb updated.")
class InntranetDb:
def __init__(self):
print("InntranetDb called.")
def save(self):
print("InntranetDb updated.")
class Site:
def __init__(self):
print("SiteDb called.")
def update(self):
print("Site updated.")
class Api:
def __init__(self):
print("Api called.")
def post(self):
print("Api post called.")
# ------------
# CLient code
# ------------
resource_manager = ResourceManager()
resource_manager.update_resources()