indexing description: "Represents an advertisement of unknown type. Not used for generating documents." author: "Beat Strasser " date: "$Date$" revision: "$Revision$" class P2P_UNKNOWN_ADVERTISEMENT inherit P2P_ADVERTISEMENT redefine parse_from_string, make_from_element end create parse_from_string, make_from_element feature {NONE} -- Initialization parse_from_string (source: STRING) is -- Parse advertisement from given string do Precursor (source) if is_valid then root_element_name := cached_document.document.root_element.name end end make_from_element (root: XM_ELEMENT) is -- Create advertisement from given root element do Precursor (root) root_element_name := cached_document.document.root_element.name end feature -- Basic operations create_specific_type: P2P_ADVERTISEMENT is -- Detect type and try to create such an advertisement. Current, if unrecognized do if Rootname_peer.is_equal (root_element_name) then create {P2P_PEER_ADVERTISEMENT} Result.make_from_element (cached_document.document.root_element.deep_twin) elseif Rootname_group.is_equal (root_element_name) then create {P2P_PEERGROUP_ADVERTISEMENT} Result.make_from_element (cached_document.document.root_element.deep_twin) elseif Rootname_module_class.is_equal (root_element_name) then create {P2P_MODULE_CLASS_ADVERTISEMENT} Result.make_from_element (cached_document.document.root_element.deep_twin) elseif Rootname_module_specification.is_equal (root_element_name) then create {P2P_MODULE_SPECIFICATION_ADVERTISEMENT} Result.make_from_element (cached_document.document.root_element.deep_twin) elseif Rootname_module_implementation.is_equal (root_element_name) then create {P2P_MODULE_IMPLEMENTATION_ADVERTISEMENT} Result.make_from_element (cached_document.document.root_element.deep_twin) elseif Rootname_pipe.is_equal (root_element_name) then create {P2P_PIPE_ADVERTISEMENT} Result.make_from_element (cached_document.document.root_element.deep_twin) elseif Rootname_transport_tcp.is_equal (root_element_name) then create {P2P_TCP_ADVERTISEMENT} Result.make_from_element (cached_document.document.root_element.deep_twin) elseif Rootname_platform_config.is_equal (root_element_name) then create {P2P_CONFIGURATION_ADVERTISEMENT} Result.make_from_element (cached_document.document.root_element.deep_twin) else Result := Current end end feature {NONE} -- Implementation root_element_name: STRING element_handler (element: XM_ELEMENT) is -- Don't handle anything, because we know nothing about the advertisement do end Rootname_peer: STRING is "PA" Rootname_group: STRING is "PGA" Rootname_module_class: STRING is "MCA" Rootname_module_specification: STRING is "MSA" Rootname_module_implementation: STRING is "MIA" Rootname_pipe: STRING is "PipeAdvertisement" Rootname_transport_tcp: STRING is "TCPTransportAdvertisement" Rootname_platform_config: STRING is "CP" end