note description: "[ Provides facilities to propagate backend changes to the frontend to ensure system consistency. Currently it is just an xml-rpc client for the internal drupal xml-rpc interface which encapsulates xml-rpc specific functionality. ]" author: "Dennis Rietmann " date: "$Date$" revision: "$Revision$" class O_FRONTEND_INTERACTOR inherit A_CONSTANTS create make feature {NONE} -- Initialization make (a_project_name: STRING; a_config_parser: A_CONF_PARSER) -- Create a frontend synchronizer for the given project (frontend calls are project-centric) require project_name_not_void: a_project_name /= Void config_parser_not_void: a_config_parser /= Void local l_use_subdomains: INTEGER do create xrpc_factory.make xrpc_port := a_config_parser.get_default ("drupal_xrpc_port", "80").to_integer l_use_subdomains := a_config_parser.get_default ("origo_use_subdomains", "0").to_integer if l_use_subdomains = 1 then xrpc_host := a_project_name + "." + a_config_parser.get_default ("drupal_xrpc_host", "127.0.0.1") xrpc_path := a_config_parser.get_default ("drupal_xrpc_path", "/xmlrpc.php") else xrpc_host := a_config_parser.get_default ("drupal_xrpc_host", "127.0.0.1") xrpc_path := "/projects/" + a_project_name + a_config_parser.get_default ("drupal_xrpc_path", "/xmlrpc.php") end end feature -- Access invoke (a_method: STRING; a_parameters: DS_ARRAYED_LIST[ANY]) -- Executes an xml-rpc call on the drupal xml-rpc interface -- Returns the client used to make the call which can be used to retrieve the status and in case of -- an error the fault object. local l_xrpc_call: GOA_XRPC_CALL l_xrpc_param: GOA_XRPC_PARAM do create xrpc_client.make (xrpc_host, xrpc_port, xrpc_path) -- we use a fresh client instance for each call create l_xrpc_call.make (a_method) -- add parameters to the call from a_parameters.start until a_parameters.after loop create l_xrpc_param.make (xrpc_factory.build (a_parameters.item_for_iteration)) l_xrpc_call.add_param (l_xrpc_param) a_parameters.forth end xrpc_client.invoke (l_xrpc_call) last_error := Void invocation_ok := xrpc_client.invocation_ok if invocation_ok then last_result := xrpc_client.response.value.value.as_object else last_error := xrpc_client.fault.string end end invocation_ok: BOOLEAN -- Was the last call successful? last_result: ANY -- Last call response. Only available if 'invocation_ok'. last_error: STRING -- Last error message. Only available if not 'invocation_ok'. feature {NONE} -- Implementation xrpc_factory: GOA_XRPC_VALUE_FACTORY -- XML-RPC factory used to marshall arguments for the drupal xml-rpc callbacks xrpc_client: GOA_XRPC_LITE_CLIENT xrpc_host: STRING xrpc_port: INTEGER xrpc_path: STRING end