Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1014)

Unified Diff: appengine/monorail/services/service_manager.py

Issue 1868553004: Open Source Monorail (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Rebase Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « appengine/monorail/services/secrets_svc.py ('k') | appengine/monorail/services/spam_svc.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: appengine/monorail/services/service_manager.py
diff --git a/appengine/monorail/services/service_manager.py b/appengine/monorail/services/service_manager.py
new file mode 100644
index 0000000000000000000000000000000000000000..7ab96bc64679a732baacf30a7236fb583cfe60e4
--- /dev/null
+++ b/appengine/monorail/services/service_manager.py
@@ -0,0 +1,68 @@
+# Copyright 2016 The Chromium Authors. All rights reserved.
+# Use of this source code is govered by a BSD-style
+# license that can be found in the LICENSE file or at
+# https://developers.google.com/open-source/licenses/bsd
+
+"""Service manager to initialize all services."""
+
+from features import autolink
+from services import cachemanager_svc
+from services import config_svc
+from services import features_svc
+from services import issue_svc
+from services import project_svc
+from services import spam_svc
+from services import star_svc
+from services import user_svc
+from services import usergroup_svc
+
+
+svcs = None
+
+
+class Services(object):
+ """A simple container for widely-used service objects."""
+
+ def __init__(
+ self, project=None, user=None, issue=None, config=None,
+ inboundemail=None, usergroup=None, cache_manager=None, autolink_obj=None,
+ user_star=None, project_star=None, issue_star=None, features=None,
+ spam=None):
+ # Persistence services
+ self.project = project
+ self.user = user
+ self.usergroup = usergroup
+ self.issue = issue
+ self.config = config
+ self.user_star = user_star
+ self.project_star = project_star
+ self.issue_star = issue_star
+ self.features = features
+ self.spam = spam
+
+ # Misc. services
+ self.cache_manager = cache_manager
+ self.inboundemail = inboundemail
+ self.autolink = autolink_obj
+
+
+def set_up_services():
+ """Set up all services."""
+
+ global svcs
+ if svcs is None:
+ svcs = Services()
+ svcs.autolink = autolink.Autolink()
+ svcs.cache_manager = cachemanager_svc.CacheManager()
+ svcs.user = user_svc.UserService(svcs.cache_manager)
+ svcs.user_star = star_svc.UserStarService(svcs.cache_manager)
+ svcs.project_star = star_svc.ProjectStarService(svcs.cache_manager)
+ svcs.issue_star = star_svc.IssueStarService(svcs.cache_manager)
+ svcs.project = project_svc.ProjectService(svcs.cache_manager)
+ svcs.usergroup = usergroup_svc.UserGroupService(svcs.cache_manager)
+ svcs.config = config_svc.ConfigService(svcs.cache_manager)
+ svcs.issue = issue_svc.IssueService(
+ svcs.project, svcs.config, svcs.cache_manager)
+ svcs.features = features_svc.FeaturesService(svcs.cache_manager)
+ svcs.spam = spam_svc.SpamService()
+ return svcs
« no previous file with comments | « appengine/monorail/services/secrets_svc.py ('k') | appengine/monorail/services/spam_svc.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698