indexing
	description: "File URL"
	status: "See note at end of class"
	date: "$Date$"
	revision: "$Revision$"

class interface
	FILE_URL

create 

	make (a: STRING)
			-- Create URL with address a.
			-- (from URL)
		require -- from URL
			address_specified: a /= void and then not a.is_empty
		ensure -- from URL
			address_set: address = a
			default_port_set: port = default_port
			no_proxy_set: proxy_information = void

feature -- Access

	Hash_code: INTEGER is 0
			-- Hash function
			-- (Objects of the current type cannot be hashed, therefore the
			-- hash function is a constant.)

	location: STRING
			-- Full URL of resource

	name: FILE_NAME

	port: INTEGER
			-- Port used by service
			-- (from URL)

	proxy_host: STRING
			-- Name or address of proxy host
			-- (from URL)
		require -- from URL
			proxy_supported: is_proxy_supported
			has_proxy: is_proxy_used
		ensure -- from URL
			result_not_empty: Result /= void and then not Result.is_empty

	proxy_port: INTEGER
			-- Port of proxy
			-- (from URL)
		require -- from URL
			proxy_supported: is_proxy_supported
			has_proxy: is_proxy_used
		ensure -- from URL
			result_non_negative: Result >= 0

	Service: STRING is "file"
			-- Name of service
	
feature -- Status report

	Default_port: INTEGER is 0
			-- Default port number for service (Answer: 0)
			-- (The 'file' service does not use a port.)

	Has_username: BOOLEAN is False
			-- Can address contain a username? (Answer: no)

	is_correct: BOOLEAN
			-- Is URL correct?

	Is_hashable: BOOLEAN is False
			-- Are objects of this type hashable? (Answer: no)

	Is_password_accepted: BOOLEAN is False
			-- Can a password be set? (Answer: no)

	Is_proxy_supported: BOOLEAN is False
			-- Are proxy connections supported? (Answer: no)

	is_proxy_used: BOOLEAN
			-- Is a proxy used?
			-- (from URL)

	proxy_host_ok (host: STRING): BOOLEAN
			-- Is host name of proxy correct?
		require -- from URL
			proxy_supported: is_proxy_supported
	
feature -- Status setting

	reset_proxy
			-- Reset proxy information.
			-- (from URL)
		require -- from URL
			proxy_supported: is_proxy_supported
		ensure -- from URL
			no_proxy_set: not is_proxy_used
			port_reset: proxy_port = 0

	set_password (pw: STRING)
			-- Set password.
		require -- from URL
			password_accepted: is_password_accepted
			non_empty_password: pw /= void and then not pw.is_empty

	set_port (port_no: INTEGER)
			-- Set port to port_no.
			-- (from URL)
		require -- from URL
			port_non_negative: port_no >= 0
		ensure -- from URL
			port_set: port = port_no

	set_proxy (host: STRING; port_no: INTEGER)
			-- Set proxy host to host and proxy port to port_no.
			-- (from URL)
		require -- from URL
			proxy_supported: is_proxy_supported
			non_empty_host: host /= void and then not host.is_empty
			host_valid: proxy_host_ok (host)
			non_negative_port: port_no >= 0
		ensure -- from URL
			host_set: proxy_host = host
			port_set: proxy_port = port_no

	set_proxy_information (pi: PROXY_INFORMATION)
			-- Set proxy information to pi.
			-- (from URL)
		require -- from URL
			proxy_supported: is_proxy_supported
		ensure -- from URL
			proxy_information_set: proxy_information = pi

	set_username (un: STRING)
			-- Set username.
		require -- from URL
			username_ok: has_username
			non_empty_username: un /= void and then not un.is_empty
	
invariant

		-- from ANY
	reflexive_equality: standard_is_equal (Current)
	reflexive_conformance: conforms_to (Current)
		-- from URL
	proxy_used_definition: is_proxy_used = (proxy_information /= void)
	proxy_usage_constraint: is_proxy_used implies is_proxy_supported

end -- class FILE_URL