Eiffel Media API
Overview Cluster Class Classes Index      Previous Next      Top Features

xml.resolver.catalog

Class XM_CATALOG_MANAGER


Direct ancestors

XM_FORMAL_PUBLIC_IDENTIFIER_ROUTINES, KL_SHARED_EXECUTION_ENVIRONMENT, KL_SHARED_STANDARD_FILES, KL_SHARED_FILE_SYSTEM, UT_SHARED_FILE_URI_ROUTINES, KL_IMPORTED_STRING_ROUTINES, UC_SHARED_STRING_EQUALITY_TESTER, UT_URL_ENCODING

Creation

Features

Invariants

indexing

description

Objects that manage OASIS XML Catalogs

library

Gobo Eiffel XML Library

copyright

Copyright (c) 2004, Colin Adams and others

license

Eiffel Forum License v2 (see forum.txt)

date

$Date: 2005/07/13 19:49:02 $

revision

$Revision: 1.11 $

class

XM_CATALOG_MANAGER

inherit

XM_FORMAL_PUBLIC_IDENTIFIER_ROUTINES
KL_SHARED_EXECUTION_ENVIRONMENT
UT_URL_ENCODING

create

make

-- Establish invariant.

feature -- Access

execution_environment: KL_EXECUTION_ENVIRONMENT

-- Execution environment

-- (From KL_SHARED_EXECUTION_ENVIRONMENT)

ensure
execution_environment_not_void: Result /= Void
bootstrap_resolver: XM_CATALOG_BOOTSTRAP_RESOLVER

-- Resolver used in bootstrap process, and for resolving catalog names

resolved_external_entity (a_public_id, a_system_id: STRING): STRING

-- Resolved URI reference for the external entity (a_public_id, a_system_id)

require
public_id_not_void: a_public_id /= Void
system_id_not_void: a_system_id /= Void
catalogs_not_disabled: not are_catalogs_disabled
ensure
resulting_uri_reference_not_void: Result /= Void
resolved_uri_reference (a_uri_reference: STRING): STRING

-- Resolved URI reference for a_uri_reference

require
uri_reference_not_void: a_uri_reference /= Void
catalogs_not_disabled: not are_catalogs_disabled
ensure
resulting_uri_reference_not_void: Result /= Void
unescaped_uri_characters: DS_HASH_SET [CHARACTER]

-- Default character set not to escape

feature -- Status report

are_catalogs_disabled: BOOLEAN

-- Is all usage of catalog files disabled?

are_processing_instructions_allowed: BOOLEAN

-- Are oasis-xml-catalog PIs allowed?

debug_level: INTEGER

-- Debugging level

has (a_catalog_name: STRING): BOOLEAN

-- Does Current have a parsed copy of a_catalog_name?

is_system_default_catalog_suppressed: BOOLEAN

-- Should use of System_default_catalog be suppressed?

prefer_public: BOOLEAN

-- Prefer public or system?

search_chain_truncated: BOOLEAN

-- Is this serach chain truncated due to a delegate?

feature -- Status setting

set_debug_level (a_level: INTEGER)

-- Set debugging level.

require
positive_debug_level: a_level >= 0
ensure
debug_level_set: debug_level = a_level
set_prefer_system

-- Prefer passed fsi to fpi.

ensure
prefer_system: not prefer_public
set_search_chain_truncated

-- Indicate delagate catalog truncates serach chain.

suppress_catalogs

-- Turn off catalog file access.

suppress_processing_instructions

-- Do not allow oasis-xml-catalog PIs to be used.

ensure
processing_instructions_disallowed: not are_processing_instructions_allowed

feature -- Element change

add_pi_catalog (a_catalog_name: STRING)

-- Add a_catalog_name to pi_catalog_files.

require
processing_instructions_allowed: are_processing_instructions_allowed
catalog_name_not_void: a_catalog_name /= Void
ensure
catalog_name_added: pi_catalog_files.has (a_catalog_name)
parse_catalog_file (a_base_uri: UT_URI)

-- Parse a_catalog_file.

require
base_uri_is_absolute: a_base_uri /= Void and then a_base_uri.is_absolute
reset_pi_catalogs

-- Clear pi_catalog_files.

ensure
pi_catalog_list_empty: pi_catalog_files.is_empty

feature -- Conversion

normalized_fpi (an_fpi: STRING): STRING

-- Normalized version of an_fpi.

-- (From XM_FORMAL_PUBLIC_IDENTIFIER_ROUTINES)

require
public_identifier_is_ascii: an_fpi /= Void
urn_to_fpi (a_publicid_urn: STRING) : STRING

-- Unwrapped urn:publicid: URN

-- (From XM_FORMAL_PUBLIC_IDENTIFIER_ROUTINES)

require
public_id_urn: a_publicid_urn /= Void and then a_publicid_urn.substring_index (

urn:publicid:

, 1) = 1
ensure
fpi_not_void: result /= Void

feature -- Output

debug_message (a_level: INTEGER; a_message, an_argument: STRING)

-- Send a debugging message to standard error stream.
-- TODO better to use log4e, if it ever gets incorporated into gobo

require
strictly_positive_debug_level: a_level > 0
message_not_void: a_message /= Void
argument_not_void: an_argument /= Void

feature {TS_TEST_CASE} -- initialization

reinit

-- Establish system catalogs

feature -- Valid characters

has_excluded_characters (s: STRING): BOOLEAN

-- Does s contain excluded characters?
-- Note that the escape character '%' is not considered excluded.

-- (From UT_URL_ENCODING)

require
s_not_void: s /= Void
is_valid_scheme (a_scheme: STRING): BOOLEAN

-- Is a_scheme a valid scheme?

-- (From UT_URL_ENCODING)

feature -- Character sets

default_unescaped: DS_HASH_SET [CHARACTER]

-- Default character set not to escape

-- (From UT_URL_ENCODING)

rfc_digit_characters: STRING

-- RFC 2396 'digit' characters

-- (From UT_URL_ENCODING)

rfc_extra_reserved_characters: STRING

-- RFC 2732 addition to 'reserved' characters

-- (From UT_URL_ENCODING)

rfc_lowalpha_characters: STRING

-- RFC 2396 'lowalpha' characters

-- (From UT_URL_ENCODING)

rfc_mark_characters: STRING

-- RFC 2396 'mark' characters

-- (From UT_URL_ENCODING)

rfc_reserved_characters: STRING

-- RFC 2396 'reserved' characters

-- (From UT_URL_ENCODING)

rfc_upalpha_characters: STRING

-- RFC 2396 'lowalpha' characters

-- (From UT_URL_ENCODING)

maximum_character_code_in_string (a_string: STRING): INTEGER

-- Maximum character code used in string

-- (From UT_URL_ENCODING)

require
a_string_not_void: a_string /= Void
ensure
positive_result: Result >= 0
empty_zero: a_string.is_empty implies Result = 0
new_character_set (some_characters: STRING): DS_HASH_SET [CHARACTER]

-- New set of characters for use with escape_custom

-- (From UT_URL_ENCODING)

require
some_characters_not_void: some_characters /= Void
ensure
set_not_void: Result /= Void
count_set: Result.count = some_characters.count

feature -- Escape/unescape data characters

escape_custom (a_string: STRING; unescaped_chars: DS_SET [CHARACTER]; escape_space_as_plus: BOOLEAN): STRING

-- Escape all characters except those in unescaped_chars in
-- a_string and return a new string.

-- (From UT_URL_ENCODING)

require
a_string_not_void: a_string /= Void
unescaped_chars_not_void: unescaped_chars /= Void
no_high_characters: maximum_character_code_in_string (a_string) < 256
ensure
escape_custom_not_void: Result /= Void
space_as_plus: escape_space_as_plus implies (not Result.has (' ') and (a_string.has (' ') implies Result.has ('+')))
escape_custom_cannot_be_smaller: Result.count >= a_string.count
escape_string (a_string: STRING): STRING

-- Escape reserved characters in a_string and return a new string.

-- (From UT_URL_ENCODING)

require
a_string_not_void: a_string /= Void
no_high_characters: maximum_character_code_in_string (a_string) < 256
ensure
escape_string_not_void: Result /= Void
no_spaces: not Result.has (' ')
escape_string_cannot_be_smaller: Result.count >= a_string.count
escape_utf8 (a_string: STRING): STRING

-- Escape reserved characters in a_string and return a new
-- string. Characters above 128 are converted to UTF8
-- representation before being encoded.

-- (From UT_URL_ENCODING)

require
a_string_not_void: a_string /= Void
ensure
escape_utf8_not_void: Result /= Void
no_spaces: not Result.has (' ')
escape_utf8_cannot_be_smaller: Result.count >= a_string.count
unescape_string (a_string: STRING): STRING

-- Replace the URI hexadecimal escape sequences in a_string
-- with the corresponding characters.

-- (From UT_URL_ENCODING)

require
a_string_not_void: a_string /= Void
ensure
unescaped_string_not_void: Result /= Void
unescaped_string_cannot_be_larger: Result.count <= a_string.count
unescape_utf8 (a_string: STRING): STRING

-- Unescape a_string, and convert UTF8 encoded result to string.

-- (From UT_URL_ENCODING)

require
a_string_not_void: a_string /= Void
ensure
unescape_utf8_not_void: Result /= Void
unescape_utf8_cannot_be_larger: Result.count <= a_string.count

feature {XM_CATALOG, TS_TEST_CASE} -- Implementation

resolved_fpi (a_public_id: STRING; prefer_public_required: BOOLEAN): STRING

-- Resolved URI reference for a_public_id

require
public_id_not_void: a_public_id /= Void
ensure
result_may_be_void_if_not_match: True
resolved_fsi (a_system_id: STRING): STRING

-- Resolved URI reference for a_system_id

require
system_id_not_void: a_system_id /= Void
ensure
result_may_be_void_if_not_match: True
resolved_uri (a_uri_reference: STRING): STRING

-- Resolved URI reference for a_uri_reference

require
system_id_not_void: a_uri_reference /= Void
ensure
result_may_be_void_if_not_match: True
retrieved_catalog (a_catalog_name: STRING): XM_CATALOG

-- Parsed catalog named a_catalog_name

require
catalog_name_not_void: a_catalog_name /= Void
ensure
retrieved_catalog_may_be_void: True

invariant

system_catalog_files_not_void: system_catalog_files /= Void
pi_catalog_files_not_void: pi_catalog_files /= Void
all_known_catalogs_not_void: all_known_catalogs /= Void
positive_debug_level: debug_level >= 0

-- From ANY
reflexive_equality: standard_is_equal (Current)
reflexive_conformance: conforms_to (Current)

end