First integration of the new GW_ design more centralized on connector, and does not require specific feature on GW_APPLICATION depending on the connector.

So this is really more flexible this way, and much easier to write application supporting CGI, FCGI, Nino and so on .. as demonstrated in hello_world

This is a first version, more will come later, mainly migrating from Eiffel Web Reloaded to this Eiffel Web Framework project.
This commit is contained in:
Jocelyn Fiat
2011-07-12 11:53:00 +02:00
parent 4fb42df5fb
commit f74ac66569
101 changed files with 7651 additions and 107 deletions

View File

@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-8-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-8-0 http://www.eiffel.com/developers/xml/configuration-1-8-0.xsd" name="error" uuid="C2DFF741-7091-43C7-B8B1-B075E7FF914F" library_target="error">
<target name="error">
<root all_classes="true"/>
<file_rule>
<exclude>/.git$</exclude>
<exclude>/EIFGENs$</exclude>
<exclude>/.svn$</exclude>
</file_rule>
<option warning="true" full_class_checking="true" is_attached_by_default="true" void_safety="all">
<assertions precondition="true"/>
</option>
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
<cluster name="src" location="src\" recursive="true"/>
</target>
</system>

16
library/error/error.ecf Normal file
View File

@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-8-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-8-0 http://www.eiffel.com/developers/xml/configuration-1-8-0.xsd" name="error" uuid="C2DFF741-7091-43C7-B8B1-B075E7FF914F" library_target="error">
<target name="error">
<root all_classes="true"/>
<file_rule>
<exclude>/.git$</exclude>
<exclude>/EIFGENs$</exclude>
<exclude>/.svn$</exclude>
</file_rule>
<option warning="true" full_class_checking="true">
<assertions precondition="true"/>
</option>
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf"/>
<cluster name="src" location="src\" recursive="true"/>
</target>
</system>

View File

@@ -0,0 +1 @@
reference:forum2

80
library/error/src/error.e Normal file
View File

@@ -0,0 +1,80 @@
note
description : "Objects that represent an error"
legal: "See notice at end of class."
status: "See notice at end of class."
date: "$Date$"
revision: "$Revision$"
deferred class
ERROR
feature -- Access
code: INTEGER
deferred
ensure
result_not_zero: Result /= 0
end
name: STRING
deferred
ensure
result_attached: Result /= Void
end
message: detachable STRING_32
-- Potential error message
deferred
end
parent: detachable ERROR
-- Eventual error prior to Current
feature -- String representation
string_representation: STRING_32
-- String representation for Current
do
create Result.make_from_string (name.as_string_32)
Result.append_character (' ')
Result.append_character ('(')
Result.append_integer (code)
Result.append_character (')')
if attached message as m then
Result.append_character (':')
Result.append_character (' ')
Result.append_string (m)
end
end
feature -- Change
set_parent (a_parent: like parent)
-- Set `parent' to `a_parent'
do
parent := a_parent
end
feature -- Visitor
process (a_visitor: ERROR_VISITOR)
-- Process Current using `a_visitor'.
require
a_visitor_not_void: a_visitor /= Void
deferred
end
invariant
name_attached: name /= Void
note
copyright: "Copyright (c) 1984-2011, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
5949 Hollister Ave., Goleta, CA 93117 USA
Telephone 805-685-1006, Fax 805-685-6869
Website http://www.eiffel.com
Customer support http://support.eiffel.com
]"
end

View File

@@ -0,0 +1,57 @@
note
description : "Objects that represent a custom error"
legal: "See notice at end of class."
status: "See notice at end of class."
date: "$Date$"
revision: "$Revision$"
class
ERROR_CUSTOM
inherit
ERROR
create
make
feature {NONE} -- Initialization
make (a_code: INTEGER; a_name: STRING; a_message: detachable like message)
-- Initialize `Current'.
do
code := a_code
name := a_name
if attached a_message then
message := a_message
else
message := "Error: " + a_name + " (code=" + a_code.out + ")"
end
end
feature -- Access
code: INTEGER
name: STRING
message: STRING_32
feature -- Visitor
process (a_visitor: ERROR_VISITOR)
-- Process Current using `a_visitor'.
do
a_visitor.process_custom (Current)
end
note
copyright: "Copyright (c) 1984-2011, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
5949 Hollister Ave., Goleta, CA 93117 USA
Telephone 805-685-1006, Fax 805-685-6869
Website http://www.eiffel.com
Customer support http://support.eiffel.com
]"
end

View File

@@ -0,0 +1,75 @@
note
description : "Objects that represent a group of errors"
legal: "See notice at end of class."
status: "See notice at end of class."
date: "$Date$"
revision: "$Revision$"
class
ERROR_GROUP
inherit
ERROR
create
make
feature {NONE} -- Initialization
make (a_errors: LIST [ERROR])
-- Initialize `Current'.
do
name := a_errors.count.out + " errors"
create {ARRAYED_LIST [ERROR]} sub_errors.make (a_errors.count)
sub_errors.fill (a_errors)
end
feature -- Access
code: INTEGER = -1
name: STRING
message: detachable STRING_32
do
create Result.make_from_string (name)
from
sub_errors.start
until
sub_errors.after
loop
if
attached sub_errors.item as e and then
attached e.message as m
then
Result.append_character ('%N')
Result.append_string (m)
end
sub_errors.forth
end
end
sub_errors: LIST [ERROR]
-- Error contained by Current
feature -- Visitor
process (a_visitor: ERROR_VISITOR)
-- Process Current using `a_visitor'.
do
a_visitor.process_group (Current)
end
note
copyright: "Copyright (c) 1984-2011, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
5949 Hollister Ave., Goleta, CA 93117 USA
Telephone 805-685-1006, Fax 805-685-6869
Website http://www.eiffel.com
Customer support http://support.eiffel.com
]"
end

View File

@@ -0,0 +1,92 @@
note
description : "Objects that handle error..."
legal: "See notice at end of class."
status: "See notice at end of class."
date: "$Date$"
revision: "$Revision$"
class
ERROR_HANDLER
create
make
feature {NONE} -- Initialization
make
-- Initialize `Current'.
do
create {ARRAYED_LIST [ERROR]} errors.make (3)
end
feature -- Status
has_error: BOOLEAN
-- Has error?
do
Result := count > 0
end
count: INTEGER
do
Result := errors.count
end
errors: LIST [ERROR]
-- Errors container
feature -- Basic operation
add_error (a_error: ERROR)
-- Add `a_error' to the stack of error
do
errors.force (a_error)
end
add_error_details, add_custom_error (a_code: INTEGER; a_name: STRING; a_message: detachable STRING_32)
-- Add custom error to the stack of error
local
e: ERROR_CUSTOM
do
create e.make (a_code, a_name, a_message)
add_error (e)
end
feature -- Access
as_single_error: detachable ERROR
do
if count > 1 then
create {ERROR_GROUP} Result.make (errors)
elseif count > 0 then
Result := errors.first
end
end
feature -- Element changes
concatenate
-- Concatenate into a single error if any
do
if count > 1 and then attached as_single_error as e then
wipe_out
add_error (e)
end
end
reset, wipe_out
do
errors.wipe_out
end
note
copyright: "Copyright (c) 1984-2011, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
5949 Hollister Ave., Goleta, CA 93117 USA
Telephone 805-685-1006, Fax 805-685-6869
Website http://www.eiffel.com
Customer support http://support.eiffel.com
]"
end

View File

@@ -0,0 +1,49 @@
note
description : "Error list iterator"
legal: "See notice at end of class."
status: "See notice at end of class."
date: "$Date$"
revision: "$Revision$"
class
ERROR_ITERATOR
inherit
ERROR_VISITOR
feature -- Access
process_error (e: ERROR)
do
end
process_custom (e: ERROR_CUSTOM)
do
process_error (e)
end
process_group (g: ERROR_GROUP)
do
if attached g.sub_errors as err then
from
err.start
until
err.after
loop
process_error (err.item)
err.forth
end
end
end
note
copyright: "Copyright (c) 1984-2011, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
5949 Hollister Ave., Goleta, CA 93117 USA
Telephone 805-685-1006, Fax 805-685-6869
Website http://www.eiffel.com
Customer support http://support.eiffel.com
]"
end

View File

@@ -0,0 +1,38 @@
note
description : "Null error visitor"
legal: "See notice at end of class."
status: "See notice at end of class."
date: "$Date$"
revision: "$Revision$"
class
ERROR_NULL_VISITOR
inherit
ERROR_VISITOR
feature -- Access
process_error (e: ERROR)
do
end
process_custom (e: ERROR_CUSTOM)
do
end
process_group (g: ERROR_GROUP)
do
end
note
copyright: "Copyright (c) 1984-2011, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
5949 Hollister Ave., Goleta, CA 93117 USA
Telephone 805-685-1006, Fax 805-685-6869
Website http://www.eiffel.com
Customer support http://support.eiffel.com
]"
end

View File

@@ -0,0 +1,35 @@
note
description : "Objects to visit an ERROR"
legal: "See notice at end of class."
status: "See notice at end of class."
date: "$Date$"
revision: "$Revision$"
deferred class
ERROR_VISITOR
feature -- Access
process_error (e: ERROR)
deferred
end
process_custom (e: ERROR_CUSTOM)
deferred
end
process_group (g: ERROR_GROUP)
deferred
end
note
copyright: "Copyright (c) 1984-2011, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
5949 Hollister Ave., Goleta, CA 93117 USA
Telephone 805-685-1006, Fax 805-685-6869
Website http://www.eiffel.com
Customer support http://support.eiffel.com
]"
end

View File

@@ -0,0 +1,53 @@
note
description: "File error output visitor"
date: "$Date$"
revision: "$Revision$"
class
FILE_OUTPUT_ERROR_VISITOR
inherit
OUTPUT_ERROR_VISITOR
redefine
output_integer,
output_new_line
end
create
make
feature -- Initialization
make (f: like file)
require
f_open_write: f /= Void and then f.is_open_write
do
file := f
end
feature -- Access
file: FILE
feature -- Output
output_string (a_str: detachable STRING_GENERAL)
-- Output Unicode string
do
if a_str /= Void then
to_implement ("Convert into UTF-8 or console encoding before output")
file.put_string (a_str.as_string_8)
end
end
output_integer (i: INTEGER)
do
file.put_integer (i)
end
output_new_line
do
file.put_new_line
end
end

View File

@@ -0,0 +1,93 @@
note
description: "General error output visitor"
date: "$Date$"
revision: "$Revision$"
deferred class
OUTPUT_ERROR_VISITOR
inherit
ERROR_VISITOR
REFACTORING_HELPER
feature -- Output
output_string (a_str: detachable STRING_GENERAL)
-- Output Unicode string
deferred
end
output_any (obj: detachable ANY)
-- Output Unicode string
do
if attached {STRING_GENERAL} obj as l_str then
to_implement ("Convert into UTF-8 or console encoding before output")
output_string (l_str)
elseif obj /= Void then
output_string (obj.out)
end
end
output_integer (i: INTEGER)
do
output_string (i.out)
end
output_new_line
do
output_string ("%N")
end
feature -- Process
process_error (e: ERROR)
do
output_string ({STRING_32}"Error Name: ")
output_string (e.name)
output_string ({STRING_32}"Code: ")
output_integer (e.code)
output_new_line
output_string ({STRING_32}"%TMessage: ")
output_string (e.message)
output_new_line
end
process_custom (e: ERROR_CUSTOM)
do
output_string ({STRING_32}"Error Name: ")
output_string (e.name)
output_string ({STRING_32}"Code: ")
output_integer (e.code)
output_new_line
output_string ({STRING_32}"%TMessage: ")
output_string (e.message)
output_new_line
end
process_group (g: ERROR_GROUP)
local
l_errors: LIST [ERROR]
do
from
l_errors := g.sub_errors
l_errors.start
until
l_errors.after
loop
l_errors.item.process (Current)
l_errors.forth
end
end
note
copyright: "Copyright (c) 1984-2011, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
5949 Hollister Ave., Goleta, CA 93117 USA
Telephone 805-685-1006, Fax 805-685-6869
Website http://www.eiffel.com
Customer support http://support.eiffel.com
]"
end

View File

@@ -0,0 +1,53 @@
note
description: "Text error output visitor"
date: "$Date$"
revision: "$Revision$"
class
TEXT_OUTPUT_ERROR_VISITOR
inherit
OUTPUT_ERROR_VISITOR
redefine
output_integer,
output_new_line
end
create
make
feature -- Initialization
make (buf: like buffer)
require
buf_attached: buf /= Void
do
buffer := buf
end
feature -- Access
buffer: STRING
feature -- Output
output_string (a_str: detachable STRING_GENERAL)
-- Output Unicode string
do
if a_str /= Void then
to_implement ("Convert into UTF-8 or console encoding before output")
buffer.append_string_general (a_str)
end
end
output_integer (i: INTEGER)
do
buffer.append_integer (i)
end
output_new_line
do
buffer.append_character ('%N')
end
end