indexing description: "Release delete use case" author: "Marco Zietzling " date: "$Date$" revision: "$Revision$" class RELEASE_DELETE inherit AUTH_USE_CASE O_RELEASE_CONSTANTS O_CONFIG_CONSTANTS create make feature -- Access namespace: STRING is -- Namespace of this use case. once Result := release_namespace end type: STRING is -- Message type of this use case. once Result := release_delete_type end feature -- Basic operation start (a_msg: O_MESSAGE) is -- Start the use case by a_msg. local l_msg: O_RELEASE_DELETE_MESSAGE do l_msg ?= a_msg check valid_message: l_msg /= Void end -- check if the user is authorized and act accordingly is_authorized_for_project (l_msg, "release_delete", l_msg.project_id, auth_node) end feature {NONE} -- Callbacks handle_auth_success (a_msg: O_MESSAGE) is -- a_msg has been authorized, execute it. local -- incoming l_release_delete_message: O_RELEASE_DELETE_MESSAGE -- outgoing l_project_retrieve_message: O_PROJECT_MESSAGE do l_release_delete_message ?= a_msg check valid_message: l_release_delete_message /= Void end -- send message to storage node to get the corresponding project create l_project_retrieve_message.make (l_release_delete_message.session, l_release_delete_message.project_id) l_project_retrieve_message.set_reply_handler (agent process_storage_project_reply (?, a_msg)) node.send_message_node (l_project_retrieve_message, "storage1") end process_storage_project_reply (a_msg, a_orig_msg: O_MESSAGE) is -- Process project reply from storage node. -- Reply is project_retrieve_reply message with project name included. require a_msg_not_void: a_msg /= Void a_orig_msg_not_void: a_orig_msg /= Void local -- incoming l_release_delete_message: O_RELEASE_DELETE_MESSAGE l_project_retrieve_reply_message: O_PROJECT_REPLY_MESSAGE -- outgoing l_config_command_message: O_GENERIC_MESSAGE l_project_name: STRING do l_release_delete_message ?= a_orig_msg check valid_message: l_release_delete_message /= Void end l_project_retrieve_reply_message ?= a_msg check valid_reply: l_project_retrieve_reply_message /= Void end l_project_name := l_project_retrieve_reply_message.arguments.item("name").out create l_config_command_message.make (config_namespace, config_release_delete_file_type) l_config_command_message.add_argument ("release_remove", "/usr/local/lib/origo/origo-release-delete.sh " + l_project_name + " " + l_release_delete_message.release_id.out) -- send message to config node to delete files node.send_message_node (l_config_command_message, "config1") -- send message to storage node to delete files forward_to_node (l_release_delete_message, "storage1") end end