note description: "Base class for interface classes." author: "Patrick Ruckstuhl " date: "$Date$" revision: "$Revision$" deferred class BASE_INTERFACE inherit A_SHARED_LOGGERS EXCEPTIONS O_ERRORS feature {NONE} -- Initialization make (a_node: like node; a_db_handler: like db_handler; a_policy_cache: like policy_cache) -- Create. require a_node_ok: a_node /= Void a_db_handler_ok: a_db_handler /= Void a_policy_cache_ok: a_policy_cache /= Void do node := a_node db_handler := a_db_handler policy_cache := a_policy_cache -- setup DB access create comment_access.make (a_db_handler, Current) create community_access.make (a_db_handler, Current) create issue_access.make (a_db_handler, Current) create project_access.make (a_db_handler, Current) create release_access.make (a_db_handler, Current) create user_access.make (a_db_handler, Current) create workitem_access.make (a_db_handler, Current) ensure node_set: node = a_node db_handler_set: db_handler = a_db_handler policy_cache_set: policy_cache = a_policy_cache end feature {NONE} -- Implementation node: A_NODE -- Our node. db_handler: DATABASE_HANDLER -- Database handler. feature -- Access comment_access: COMMENT_ACCESS -- DB comment access. community_access: COMMUNITY_ACCESS -- DB community access. issue_access: ISSUE_ACCESS -- DB issue access. project_access: PROJECT_ACCESS -- DB project access. release_access: RELEASE_ACCESS -- DB release access. user_access: USER_ACCESS -- DB user access. workitem_access: WORKITEM_ACCESS -- DB workitem access. feature -- Cache policy_cache: POLICY_CACHE -- Shared policy cache for all interface objects inheriting from BASE_INTERFACE. feature -- Utility config_parser: A_CONF_PARSER -- Parser for the origo.conf configuration file do Result := node.config_parser end use_subdomains: BOOLEAN -- `true' if the frontend uses subdomains for its projects. once result := (config_parser.get_default ("origo_use_subdomains", "0").to_integer = 1) end get_project_link (a_project_name: STRING): STRING -- Given a `a_project_name', create a string containing an URL pointing to the project. do if use_subdomains then Result := "http://" + a_project_name.as_lower + "." + config_parser.get("origo_domain") else Result := "http://" + config_parser.get("origo_domain") + "/projects/" + a_project_name.as_lower end end invariant node_not_void: node /= Void db_handler_not_void: db_handler /= Void policy_cache_not_void: policy_cache /= Void comment_access_not_void: comment_access /= Void community_access_not_void: community_access /= Void issue_access_not_void: issue_access /= Void project_access_not_void: project_access /= Void user_access_not_void: user_access /= Void release_access_not_void: release_access /= Void workitem_access_not_void: workitem_access /= Void end