note description: "API node." author: "Patrick Ruckstuhl " date: "$Date$" revision: "$Revision$" deferred class A_NODE_API inherit A_NODE_CLIENT redefine switches, aranea_startup select warn end GOA_FAST_CGI_SERVLET_APP rename make as make_httpd, warn as goa_warn, exceptions as goa_exceptions end GOA_SHARED_SERVICE_REGISTRY export {NONE} all end GOA_XRPC_CONSTANTS export {NONE} all end feature {NONE} -- Initialization aranea_startup -- Aranea node has ben started. local l_thread: WORKER_THREAD do -- start fastcgi handler in own thread create l_thread.make (agent do create config config.set_server_port (fastcgi_port) config.set_document_root (".") make_httpd ("localhost", fastcgi_port, 10) register_servlets init_xmlrpc run rescue -- on error, trace and restart node_logger.error (exception_trace) -- sleep for 10 seconds before retrying, retry forever (create {EXECUTION_ENVIRONMENT}).sleep (10000000000) end_listening initialize_listening retry end) l_thread.launch end feature -- Status is_internal: BOOLEAN -- Is this an internal API node? once Result := has_option (internal_switch) end feature {NONE} -- Argument handling switches: detachable ARRAYED_LIST [attached ARGUMENT_SWITCH] -- Command line switches. local l_assertion_flag: BOOLEAN once -- disable assertion-checking for precursor-assertion-check l_assertion_flag := {ISE_RUNTIME}.check_assert (False) Result := Precursor Result.extend (create {ARGUMENT_SWITCH}.make (internal_switch, "Internal api node?", True, False)) Result.extend (create {ARGUMENT_NATURAL_SWITCH}.make (port_switch, "API fastcgi port.", False, False, "PORT", "Port to use as fastcgi interface.", False)) -- restore previous value of assertion-checking l_assertion_flag := {ISE_RUNTIME}.check_assert (l_assertion_flag) end internal_switch: STRING = "internal" port_switch: STRING = "p" feature {NONE} -- Implementation name: STRING = "Aranea API" version: STRING = "$Revision$" field_exception: BOOLEAN = False -- Don't let goanna retry on an exception, we restart the goanna server ourselves. fastcgi_port: INTEGER -- Port to use for fastcgi communication. once Result := option_of_name (port_switch).value.to_integer end peer_description: STRING = "xmlrpc interface to aranea services." -- Description of this aranea node. config: GOA_SERVLET_CONFIG; -- Configuration for servlets register_servlets -- Initialise servlets local servlet: GOA_XMLRPC_SERVLET; log_file: STRING do servlet_manager.set_servlet_mapping_prefix ("servlet") servlet_manager.set_config (config) create {GOA_XMLRPC_SERVLET} servlet.init (config) -- we want our goanna log to be in the working dir of the node -- (which is the directory where the other logs are stored) log_file := working_directory + operating_environment.directory_separator.out + node_name + ".log" servlet.set_custom_log_file (log_file) servlet_manager.register_servlet (servlet, "xmlrpc") servlet_manager.register_default_servlet (servlet) end init_xmlrpc -- Initialise XML RPC calls do registry.register (create {GOA_XRPC_SYSTEM}.make, "system") end end