+
Point of view
All features
deferred class XML_REPOSITORY_IMPL [O_ -> STORABLE]
Summary
Implementation of the XML store and retrieval
Schema:
  <!DOCTYPE repository [

  <!ELEMENT repository (layout | reference | embedded | basic)* >
  <!ATTLIST repository version CDATA #REQUIRED >

  <!ELEMENT layout (reference | embedded | basic | array)* >
  <!ATTLIST layout type CDATA #REQUIRED >
  <!ATTLIST layout ref ID #REQUIRED >

  <!ELEMENT reference (EMPTY) >
  <!ATTLIST reference name CDATA >
  <!ATTLIST reference ref IDREF #REQUIRED >
  <!ATTLIST reference transient (true|false) #REQUIRED >

  <!ELEMENT embedded (reference | embedded | basic | array)* >
  <!ATTLIST embedded name CDATA >
  <!ATTLIST embedded type CDATA #REQUIRED >

  <!ELEMENT basic (EMPTY) >
  <!ATTLIST basic name CDATA >
  <!ATTLIST basic type CDATA #REQUIRED >
  <!ATTLIST basic value CDATA #REQUIRED >

  <!ELEMENT array (reference | embedded | basic)* >
  <!ATTLIST array name CDATA >
  <!ATTLIST array type CDATA #REQUIRED >
  <!ATTLIST array capacity CDATA #REQUIRED >

  ] >
Direct parents
Inherit list: REPOSITORY_IMPL, XML_CALLBACKS
Insert list: UNICODE_CHARACTERS
Known children
Inherit list: XML_FILE_REPOSITORY, XML_STREAM_REPOSITORY
Class invariant
Overview
Features
Implementation of update
{}
{}
{XML_PARSER}
Internals
{}
Default transient objects
{}
{XML_PARSER}
Error handling on repository update
{ANY}
{}
Implementation of update
{}
Implementation of commit
{}
Internals
{}
Creation
{}
  • make
    Create a not-connected empty repository.
Getting and setting objects in the repository:
{ANY}
  • has (object_name: STRING): BOOLEAN
    Is object_name the name of some stored object.
  • at (object_name: STRING): O_
    Return the object currently associated to object_name.
  • add (object: O_, object_name: STRING)
    Add a new object in the Current repository.
  • put (object: O_, object_name: STRING) assign at
    Update or add a new object in the Current repository.
  • remove (object_name: STRING)
    Remove entry object_name from the Current repository.
Counting:
{ANY}
Iterating facilities:
{ANY}
Really storing data:
{ANY}
  • update
    Update the repository objects.
  • commit
    Commit all the repository objects to the physical store.
  • is_connected: BOOLEAN
    True if the repository is connected to a physical store.
  • is_updateable: BOOLEAN
    True if the repository can be updated from data in the physical store.
  • is_commitable: BOOLEAN
    True if the repository can be committed to the underlying physical store.
Implementation
{}
{}
{ANY}
update_name: STRING
is ""
constant attribute
{}
update_ref: STRING
is ""
constant attribute
{}
update_type: STRING
is ""
constant attribute
{}
update_value: STRING
is ""
constant attribute
{}
update_capacity: STRING
is ""
constant attribute
{}
update_version: STRING
is ""
constant attribute
{}
once function
{}
do_update (in_stream: INPUT_STREAM)
effective procedure
{}
last_line: INTEGER_32
effective function
{}
last_column: INTEGER_32
effective function
{}
open_nodes: FAST_ARRAY[STRING]
once function
{}
with_attribute (attribute_name: UNICODE_STRING, attribute_value: UNICODE_STRING, line: INTEGER_32, column: INTEGER_32)
effective procedure
Called by the parser to add an attribute of a node BEFORE calling open_node
require
  • not attribute_name.is_empty
  • attribute_value /= Void
open_node (node_name: UNICODE_STRING, line: INTEGER_32, column: INTEGER_32)
effective procedure
When the parser reads an opening node
require
  • not node_name.is_empty
ensure
  • not at_error implies current_node.is_equal(node_name)
close_node (node_name: UNICODE_STRING, line: INTEGER_32, column: INTEGER_32)
effective procedure
When the parser reads a closing node
require
  • not node_name.is_empty
  • current_node.is_equal(node_name)
open_close_node (node_name: UNICODE_STRING, line: INTEGER_32, column: INTEGER_32)
effective procedure
When the parser reads a node that opens and closes immediately (syntax "<node/>")
require
  • not node_name.is_empty
current_node: UNICODE_STRING
effective function
The current node
xml_header (line: INTEGER_32, column: INTEGER_32)
effective procedure
Called by the parser if a "<?xml ... ?>"
header is read. Note that with_attribute may have been called first (usually with the version and encoding attributes)
processing_instruction (a_target: UNICODE_STRING, a_data: UNICODE_STRING)
effective procedure
Called by the parser if a "<?...?>"
processing instruction is read.
entity (a_entity: UNICODE_STRING, line: INTEGER_32, column: INTEGER_32): UNICODE_STRING
effective function
Called by the parser when an &entity; is found.
Note that standard XML attributes (lt, gt, amp, apos and quot) are automatically handled and not given to this feature (they cannot be bypassed). Returns Void if the entity is not recognized.
open_entity_url (a_entity: UNICODE_STRING, a_url: URL)
effective procedure
XML_REPOSITORY doesn't use entity urls
require
  • a_url /= Void
close_entity_url (a_entity: UNICODE_STRING, a_url: URL)
effective procedure
Called by the parser when the stream triggered by open_entity_url is disconnected
require
  • a_url /= Void
data (a_data: UNICODE_STRING, line: INTEGER_32, column: INTEGER_32)
effective procedure
Called by the parser when the node contains raw data
require
  • not a_data.is_empty
parse_error (line: INTEGER_32, column: INTEGER_32, message: STRING)
effective procedure
Called by the parser if there is an error
require
  • message /= Void
ensure
  • at_error
at_error: BOOLEAN
writable attribute
True if there was at least an error
version: STRING
is "1"
frozen
constant attribute
{}
clear_attributes
effective procedure
{}
once function
{}
register_transient_objects
effective procedure
{}
unregister_transient_objects
effective procedure
{}
set_validator (a_validator: XML_VALIDATOR)
effective procedure
Sets a validator for this XML file.
The parser uses it when setting a DTD, but you may use it too to implement other validators (such as an XML Schema).
require ensure
validator: XML_VALIDATOR
writable attribute
The XML validator for this file (DTD, XML Schema...)
register_update_error_handler (a_error_handler: PROCEDURE[TUPLE 3[ABSTRACT_STRING, INTEGER_32, INTEGER_32]])
effective procedure
{ANY}
writable attribute
{}
fire_update_error (message: ABSTRACT_STRING, line: INTEGER_32, column: INTEGER_32)
effective procedure
{}
solve_again: BOOLEAN
writable attribute
{}
update_layouts: STACK[REPOSITORY_LAYOUT]
once function
{}
updated_internals: AVL_DICTIONARY[INTERNALS, INTEGER_32]
once function
{}
internals_references: HASHED_DICTIONARY[INTEGER_32, POINTER]
once function
{}
once function
{}
once function
{}
solve (ref: INTEGER_32): INTERNALS
effective function
{}
require
  • ref > 0
internals_reference (internals: INTERNALS): INTEGER_32
effective function
{}
require
  • not internals.type_is_expanded
once function
{}
read_from_stream (in_stream: INPUT_STREAM)
effective procedure
{}
update_from_stream (in_stream: INPUT_STREAM)
effective procedure
{}
record_object (ref: INTEGER_32, name: STRING, line: INTEGER_32, column: INTEGER_32)
effective procedure
{}
Register the object as a high-level one, i.e.
put it in the repository.
check_non_empty_data (a_data: STRING, data_type: STRING, line: INTEGER_32, column: INTEGER_32)
effective procedure
{}
open_repository (a_repository: REPOSITORY_LAYOUT, line: INTEGER_32, column: INTEGER_32)
effective procedure
{}
require
  • a_repository.kind.is_equal("repository")
open_layout (a_type: STRING, a_ref: INTEGER_32, a_layout: REPOSITORY_LAYOUT, line: INTEGER_32, column: INTEGER_32)
effective procedure
{}
require
  • a_layout.kind.is_equal("layout")
  • a_ref > 0
open_reference (a_name: STRING, a_ref: INTEGER_32, a_reference: REPOSITORY_LAYOUT, line: INTEGER_32, column: INTEGER_32)
effective procedure
{}
require
  • a_reference.kind.is_equal("reference")
  • a_ref >= 0
    0 is Void

open_embedded (a_name: STRING, a_type: STRING, a_embedded: REPOSITORY_LAYOUT, line: INTEGER_32, column: INTEGER_32)
effective procedure
{}
require
  • a_embedded.kind.is_equal("embedded")
open_basic (a_name: STRING, a_type: STRING, a_value: STRING, a_basic: REPOSITORY_LAYOUT, line: INTEGER_32, column: INTEGER_32)
effective procedure
{}
require
  • a_basic.kind.is_equal("basic")
open_array (a_name: STRING, a_type: STRING, a_capacity: INTEGER_32, a_array: REPOSITORY_LAYOUT, line: INTEGER_32, column: INTEGER_32)
effective procedure
{}
require
  • a_array.kind.is_equal("array")
close_repository (line: INTEGER_32, column: INTEGER_32)
effective procedure
{}
require
close_layout (line: INTEGER_32, column: INTEGER_32)
effective procedure
{}
require
close_reference (line: INTEGER_32, column: INTEGER_32)
effective procedure
{}
require
close_embedded (line: INTEGER_32, column: INTEGER_32)
effective procedure
{}
require
close_basic (line: INTEGER_32, column: INTEGER_32)
effective procedure
{}
require
close_array (line: INTEGER_32, column: INTEGER_32)
effective procedure
{}
require
commit_map: SET[POINTER]
once function
{}
Used when committing object not to commit them twice
write_to_stream (out_stream: REPOSITORY_OUTPUT)
effective procedure
{}
require
  • out_stream.is_connected
write_object (name: STRING, object: STORABLE, out_stream: REPOSITORY_OUTPUT)
effective procedure
{}
write_internals (int: INTERNALS, name: STRING, out_stream: REPOSITORY_OUTPUT)
effective procedure
{}
write_reference_layout (reference: INTERNALS, name: STRING, out_stream: REPOSITORY_OUTPUT)
effective procedure
{}
require
  • reference /= Void implies not reference.type_is_expanded
write_layout (layout: INTERNALS, out_stream: REPOSITORY_OUTPUT)
effective procedure
{}
require
  • not commit_map.has(layout.object_as_pointer)
  • not layout.type_is_expanded
ensure
write_contents (layout: INTERNALS, out_stream: REPOSITORY_OUTPUT)
effective procedure
{}
require
  • layout.type_is_expanded or else transient.reference(layout) = Void
  • not layout.type_is_native_array
write_array_contents (layout: INTERNALS, out_stream: REPOSITORY_OUTPUT)
effective procedure
{}
require
  • layout.type_is_native_array
write_array_fields_layouts (array: INTERNALS, out_stream: REPOSITORY_OUTPUT)
effective procedure
{}
require
  • array.type_is_expanded and then array.type_is_native_array
write_expanded (internals: INTERNALS, name: STRING, out_stream: REPOSITORY_OUTPUT)
effective procedure
{}
require
  • internals.type_is_expanded
write_array_layout_object (internals: INTERNALS, name: STRING, out_stream: REPOSITORY_OUTPUT)
effective procedure
{}
require
  • internals.type_is_native_array
write_embedded_layout_object (internals: INTERNALS, name: STRING, out_stream: REPOSITORY_OUTPUT)
effective procedure
{}
once function
{}
new_layout (a_kind: STRING): REPOSITORY_LAYOUT
effective function
{}
ensure
  • Result.kind.is_equal(a_kind)
release_layout (a_layout: REPOSITORY_LAYOUT)
effective procedure
{}
writable attribute
{}
make
effective procedure
{}
Create a not-connected empty repository.
has (object_name: STRING): BOOLEAN
frozen
effective function
{ANY}
Is object_name the name of some stored object.
require
  • not object_name.is_empty
at (object_name: STRING): O_
frozen
effective function
{ANY}
Return the object currently associated to object_name.
require
  • has(object_name)
ensure
  • Result /= Void
add (object: O_, object_name: STRING)
frozen
effective procedure
{ANY}
Add a new object in the Current repository.
require
  • object /= Void
  • new_reference: not has(object_name)
ensure
  • reference_stored: object = at(object_name)
put (object: O_, object_name: STRING) assign at
frozen
effective procedure
{ANY}
Update or add a new object in the Current repository.
require
  • object /= Void
ensure
  • reference_stored: object = at(object_name)
remove (object_name: STRING)
effective procedure
{ANY}
Remove entry object_name from the Current repository.
require
  • has(object_name)
ensure
  • not has(object_name)
count: INTEGER_32
effective function
{ANY}
Actual count of stored elements.
is_empty: BOOLEAN
effective function
{ANY}
Is it empty ?
ensure
lower: INTEGER_32
is 1
constant attribute
{ANY}
upper: INTEGER_32
effective function
{ANY}
ensure
valid_index (index: INTEGER_32): BOOLEAN
effective function
{ANY}
ensure
item (index: INTEGER_32): O_
effective function
{ANY}
require ensure
key (index: INTEGER_32): STRING
effective function
{ANY}
require ensure
new_iterator_on_items: ITERATOR[O_]
effective function
{ANY}
ensure
  • Result /= Void
new_iterator_on_keys: ITERATOR[STRING]
effective function
{ANY}
ensure
  • Result /= Void
key_map_in (buffer: COLLECTION[STRING])
effective procedure
{ANY}
Append in buffer, all available keys (this may be useful to speed up the traversal).
require
  • buffer /= Void
ensure
  • buffer.count = count + old buffer.count
item_map_in (buffer: COLLECTION[O_])
effective procedure
{ANY}
Append in buffer, all available items (this may be useful to speed up the traversal).
require
  • buffer /= Void
ensure
  • buffer.count = count + old buffer.count
update
deferred procedure
{ANY}
Update the repository objects.
Get all objects from the physical store.
require
commit
deferred procedure
{ANY}
Commit all the repository objects to the physical store.
require
is_connected: BOOLEAN
deferred function
{ANY}
True if the repository is connected to a physical store.
is_updateable: BOOLEAN
deferred function
{ANY}
True if the repository can be updated from data in the physical store.
ensure
is_commitable: BOOLEAN
deferred function
{ANY}
True if the repository can be committed to the underlying physical store.
ensure
repository: DICTIONARY[O_, STRING]
writable attribute
{}
objects_are_expanded: BOOLEAN
effective function
{}
valid_generating_type_for_internals (type: STRING): BOOLEAN
frozen
{}
require
  • type /= Void
ensure
  • Result implies not type.has_prefix("NATIVE_ARRAY")
internals_from_generating_type (type: STRING): INTERNALS
frozen
{}
require ensure
  • Result /= Void
  • Result.object_can_be_modified
valid_generating_type_for_native_array_internals (type: STRING): BOOLEAN
frozen
{}
require
  • type /= Void
ensure
  • Result implies type.has_prefix("NATIVE_ARRAY")
native_array_internals_from_generating_type (type: STRING, capacity: INTEGER_32): INTERNALS
frozen
{}
require ensure
  • Result /= Void
  • Result.object_can_be_modified
is_separator (unicode: INTEGER_32): BOOLEAN
effective function
{ANY}
is_base_char (unicode: INTEGER_32): BOOLEAN
effective function
{ANY}
is_ideographic (unicode: INTEGER_32): BOOLEAN
effective function
{ANY}
is_combining_char (unicode: INTEGER_32): BOOLEAN
effective function
{ANY}
is_extender (unicode: INTEGER_32): BOOLEAN
effective function
{ANY}
is_letter (unicode: INTEGER_32): BOOLEAN
effective function
{ANY}
is_digit (unicode: INTEGER_32): BOOLEAN
effective function
{ANY}