indexing description: "spread participant receiving events" library: "elogger" copyright: "Copyright (c) 2006, AXA Rosenberg, and others (see copyright.txt)" author: "Ulrich Weiss, and others" license: "Eiffel Forum License v2 (see forum.txt)" date: "$Date: $" revision: "$Revision: $" archive: "$Archive: $" class ELOG_SPREAD_SERVER_PARTICIPANT inherit GS_SHARED_SECURITY_REALM GS_SPREAD_PARTICIPANT redefine make end create make feature {NONE} -- Initialization make is -- creation procedure do Precursor realm_name := Default_realm_name channel_name := Default_channel_name end feature -- Basic Operations do_start is -- start connection to the spread server do set_realm (create {GS_SECURITY_REALM}.make (realm_name)) create session_channel.make (current,create {GS_GROUP}.make (realm, channel_name)) create callback.make (session_channel, agent message_received) register (callback) end do_stop is -- unregister callbacks (if any) do unregister (callback) end set_realm_name (a_name: STRING) is -- sets 'realm_name' require a_realm_name_valid: a_name /= Void and then (a_name.count > 0 and not a_name.has (' ')) do realm_name := a_name end set_channel_name (a_name: STRING) is -- sets 'channel_name' require a_channel_name_valid: a_name /= Void and then (a_name.count > 0 and not a_name.has (' ')) do channel_name := a_name end feature -- Access callback: GS_CALLBACK -- callback session_channel: GS_CHANNEL -- session channel Default_channel_name: STRING is "eloggerchannel" -- default channel name realm_name: STRING -- realm name channel_name: STRING -- channel name feature {NONE} -- Implementation message_received (event: ANY) is -- received a message from spread local e: ELOG_EVENT do io.put_string ("received message from spread%N") e ?= event if e = Void then io.put_string ("The object does not conform to ELOG_EVENT%N") else io.put_string (e.message+"%N") end if e.logger /= Void then io.put_string (e.logger.out) end end invariant realm_name_not_void: realm_name /= Void channel_name_not_void: channel_name /= Void end