Compare commits

...

2 Commits

Author SHA1 Message Date
7c1d1325eb Adapt to EWF concurrent version. 2015-04-02 18:38:12 +02:00
8382edf9d7 Adapted ROC cms library and example to upcoming concurrency compliant EWF.
(SCOOP support)
2015-03-25 22:32:10 +01:00
33 changed files with 538 additions and 337 deletions

View File

@@ -8,19 +8,19 @@
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
<library name="config" location=".\library\configuration\config-safe.ecf"/>
<library name="crypto" location="$ISE_LIBRARY\unstable\library\text\encryption\crypto\crypto-safe.ecf"/>
<library name="encoder" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\text\encoder\encoder-safe.ecf" readonly="false"/>
<library name="error" location="$ISE_LIBRARY\contrib\library\utility\general\error\error-safe.ecf"/>
<library name="http" location="$ISE_LIBRARY\contrib\library\network\protocol\http\http-safe.ecf"/>
<library name="http_authorization" location="$ISE_LIBRARY\contrib\library\network\authentication\http_authorization\http_authorization-safe.ecf" readonly="false"/>
<library name="encoder" location="$EWF_LIBRARY\library\text\encoder\encoder-safe.ecf" readonly="false"/>
<library name="error" location="$EWF_LIBRARY\library\utility\general\error\error-safe.ecf"/>
<library name="http" location="$EWF_LIBRARY\library\network\protocol\http\http-safe.ecf"/>
<library name="http_authorization" location="$EWF_LIBRARY\library\server\authentication\http_authorization\http_authorization-safe.ecf" readonly="false"/>
<library name="json" location="$ISE_LIBRARY\contrib\library\text\parser\json\library\json-safe.ecf" readonly="false"/>
<library name="layout" location=".\library\layout\layout-safe.ecf"/>
<library name="cms_model" location=".\library\model\cms_model-safe.ecf" readonly="false"/>
<library name="smarty" location="$ISE_LIBRARY\contrib\library\text\template\smarty\smarty-safe.ecf" readonly="false"/>
<library name="text_filter" location="$ISE_LIBRARY\unstable\library\text\text_filter\text_filter-safe.ecf"/>
<library name="time" location="$ISE_LIBRARY\library\time\time-safe.ecf"/>
<library name="wsf" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\wsf-safe.ecf"/>
<library name="wsf_extension" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\wsf_extension-safe.ecf" readonly="false"/>
<library name="wsf_html" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf_html\wsf_html-safe.ecf" readonly="false"/>
<library name="wsf" location="$EWF_LIBRARY\library\server\wsf\wsf-safe.ecf"/>
<library name="wsf_extension" location="$EWF_LIBRARY\library\server\wsf\wsf_extension-safe.ecf" readonly="false"/>
<library name="wsf_html" location="$EWF_LIBRARY\library\server\wsf_html\wsf_html-safe.ecf" readonly="false"/>
<cluster name="src" location=".\src\" recursive="true">
<file_rule>
<exclude>/EIFGENs$</exclude>

14
cms.ecf
View File

@@ -8,19 +8,19 @@
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf"/>
<library name="config" location=".\library\configuration\config.ecf"/>
<library name="crypto" location="$ISE_LIBRARY\unstable\library\text\encryption\crypto\crypto.ecf"/>
<library name="encoder" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\text\encoder\encoder.ecf" readonly="false"/>
<library name="error" location="$ISE_LIBRARY\contrib\library\utility\general\error\error.ecf"/>
<library name="http" location="$ISE_LIBRARY\contrib\library\network\protocol\http\http.ecf"/>
<library name="http_authorization" location="$ISE_LIBRARY\contrib\library\network\authentication\http_authorization\http_authorization.ecf" readonly="false"/>
<library name="encoder" location="$EWF_LIBRARY\library\text\encoder\encoder.ecf" readonly="false"/>
<library name="error" location="$EWF_LIBRARY\library\utility\general\error\error.ecf"/>
<library name="http" location="$EWF_LIBRARY\library\network\protocol\http\http.ecf"/>
<library name="http_authorization" location="$EWF_LIBRARY\library\network\authentication\http_authorization\http_authorization.ecf" readonly="false"/>
<library name="json" location="$ISE_LIBRARY\contrib\library\text\parser\json\library\json.ecf" readonly="false"/>
<library name="layout" location=".\library\layout\layout.ecf"/>
<library name="cms_model" location=".\library\model\cms_model.ecf" readonly="false"/>
<library name="smarty" location="$ISE_LIBRARY\contrib\library\text\template\smarty\smarty.ecf" readonly="false"/>
<library name="text_filter" location="$ISE_LIBRARY\unstable\library\text\text_filter\text_filter.ecf"/>
<library name="time" location="$ISE_LIBRARY\library\time\time.ecf"/>
<library name="wsf" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\wsf.ecf"/>
<library name="wsf_extension" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\wsf_extension.ecf" readonly="false"/>
<library name="wsf_html" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf_html\wsf_html.ecf" readonly="false"/>
<library name="wsf" location="$EWF_LIBRARY\library\server\wsf\wsf.ecf"/>
<library name="wsf_extension" location="$EWF_LIBRARY\library\server\wsf\wsf_extension.ecf" readonly="false"/>
<library name="wsf_html" location="$EWF_LIBRARY\library\server\wsf_html\wsf_html.ecf" readonly="false"/>
<cluster name="src" location=".\src\" recursive="true">
<file_rule>
<exclude>/EIFGENs$</exclude>

View File

@@ -9,43 +9,50 @@
<option warning="true" full_class_checking="false" is_attached_by_default="true" void_safety="transitional" syntax="transitional">
<assertions precondition="true" postcondition="true" check="true" invariant="true" loop="true" supplier_precondition="true"/>
</option>
<setting name="concurrency" value="none"/>
<setting name="console_application" value="true"/>
<setting name="concurrency" value="scoop"/>
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
<library name="cms" location="..\..\cms-safe.ecf" readonly="false"/>
<library name="cms_demo_module" location="modules\demo\cms_demo_module-safe.ecf" readonly="false"/>
<library name="cms_model" location="..\..\library\model\cms_model-safe.ecf" readonly="false"/>
<library name="layout" location="..\..\library\layout\layout-safe.ecf" readonly="false"/>
<!--
<library name="persistence_mysql" location="..\..\library\persistence\mysql\persistence_mysql-safe.ecf" readonly="false"/>
-->
<library name="persistence_sqlite" location="..\..\library\persistence\sqlite\persistence_sqlite-safe.ecf" readonly="false"/>
<library name="wsf" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\wsf-safe.ecf"/>
<library name="wsf_extension" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\wsf_extension-safe.ecf" readonly="false"/>
<library name="wsf" location="$EWF_LIBRARY\library\server\wsf\wsf-safe.ecf"/>
<library name="wsf_extension" location="$EWF_LIBRARY\library\server\wsf\wsf_extension-safe.ecf" readonly="false"/>
</target>
<target name="demo_any" extends="common">
<root class="EWF_ROC_SERVER" feature="make_and_launch"/>
<library name="cgi" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\connector\cgi-safe.ecf"/>
<library name="libfcgi" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\connector\libfcgi-safe.ecf"/>
<library name="nino" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\connector\nino-safe.ecf"/>
<setting name="concurrency" value="scoop"/>
<library name="cgi" location="$EWF_LIBRARY\library\server\wsf\connector\cgi-safe.ecf"/>
<library name="libfcgi" location="$EWF_LIBRARY\library\server\wsf\connector\libfcgi-safe.ecf"/>
<library name="nino" location="$EWF_LIBRARY\library\server\wsf\connector\nino-safe.ecf"/>
<library name="standalone" location="$EWF_LIBRARY\library\server\wsf\connector\standalone-safe.ecf"/>
<cluster name="launcher" location=".\launcher\any\" recursive="true"/>
<cluster name="src" location=".\src\" recursive="true"/>
</target>
<target name="demo_standalone" extends="common">
<root class="EWF_ROC_SERVER" feature="make_and_launch"/>
<setting name="concurrency" value="scoop"/>
<library name="default_standalone" location="$EWF_LIBRARY\library\server\wsf\default\standalone-safe.ecf"/>
<cluster name="launcher" location=".\launcher\default\" recursive="true"/>
<cluster name="src" location=".\src\" recursive="true"/>
</target>
<target name="demo_nino" extends="common">
<root class="EWF_ROC_SERVER" feature="make_and_launch"/>
<setting name="concurrency" value="none"/>
<library name="default_nino" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\default\nino-safe.ecf"/>
<library name="default_nino" location="$EWF_LIBRARY\library\server\wsf\default\nino-safe.ecf"/>
<cluster name="launcher" location=".\launcher\default\" recursive="true"/>
<cluster name="src" location=".\src\" recursive="true"/>
</target>
<target name="demo_cgi" extends="common">
<root class="EWF_ROC_SERVER" feature="make_and_launch"/>
<library name="default_cgi" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\default\cgi-safe.ecf"/>
<library name="default_cgi" location="$EWF_LIBRARY\library\server\wsf\default\cgi-safe.ecf"/>
<cluster name="launcher" location=".\launcher\default\" recursive="true"/>
<cluster name="src" location=".\src\" recursive="true"/>
</target>
<target name="demo_libfcgi" extends="common">
<root class="EWF_ROC_SERVER" feature="make_and_launch"/>
<library name="default_libfcgi" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\default\libfcgi-safe.ecf"/>
<library name="default_libfcgi" location="$EWF_LIBRARY\library\server\wsf\default\libfcgi-safe.ecf"/>
<cluster name="launcher" location=".\launcher\default\" recursive="true"/>
<cluster name="src" location=".\src\" recursive="true"/>
</target>

View File

@@ -1,2 +1,2 @@
port=8099
port=9090
#verbose=true

View File

@@ -8,10 +8,10 @@ note
revision: "$Revision: 36 $"
class
APPLICATION_LAUNCHER
APPLICATION_LAUNCHER [G -> WSF_EXECUTION create make end]
inherit
APPLICATION_LAUNCHER_I
APPLICATION_LAUNCHER_I [G]
feature -- Custom

View File

@@ -10,24 +10,28 @@ note
revision: "$Revision: 36 $"
deferred class
APPLICATION_LAUNCHER_I
APPLICATION_LAUNCHER_I [G -> WSF_EXECUTION create make end]
inherit
SHARED_EXECUTION_ENVIRONMENT
feature -- Execution
launch (a_service: WSF_SERVICE; opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS)
launch (opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS)
local
nature: like launcher_nature
do
nature := launcher_nature
if nature = Void or else nature = nature_nino then
launch_nino (a_service, opts)
if nature = Void then
launch_standalone (opts)
elseif nature = nature_standalone then
launch_standalone (opts)
elseif nature = nature_nino then
launch_nino (opts)
elseif nature = nature_cgi then
launch_cgi (a_service, opts)
launch_cgi (opts)
elseif nature = nature_libfcgi then
launch_libfcgi (a_service, opts)
launch_libfcgi (opts)
else
-- bye bye
(create {EXCEPTIONS}).die (-1)
@@ -43,7 +47,6 @@ feature {NONE} -- Access
--| and we could use WSF_DEFAULT_SERVICE_LAUNCHER to configure this at compilation time.
local
p: PATH
l_entry_name: READABLE_STRING_32
ext: detachable READABLE_STRING_32
do
create p.make_from_string (execution_environment.arguments.command_name)
@@ -51,6 +54,9 @@ feature {NONE} -- Access
ext := l_entry.extension
end
if ext /= Void then
if ext.same_string (nature_standalone) then
Result := nature_standalone
end
if ext.same_string (nature_nino) then
Result := nature_nino
end
@@ -61,39 +67,58 @@ feature {NONE} -- Access
Result := nature_libfcgi
end
end
Result := default_nature
end
feature {NONE} -- standalone
nature_standalone: STRING = "standalone"
launch_standalone (opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS)
local
launcher: WSF_STANDALONE_SERVICE_LAUNCHER [G]
do
create launcher.make_and_launch (opts)
end
feature {NONE} -- nino
nature_nino: STRING = "nino"
launch_nino (a_service: WSF_SERVICE; opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS)
launch_nino (opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS)
local
launcher: WSF_NINO_SERVICE_LAUNCHER
launcher: WSF_NINO_SERVICE_LAUNCHER [G]
do
create launcher.make_and_launch (a_service, opts)
create launcher.make_and_launch (opts)
end
feature {NONE} -- cgi
nature_cgi: STRING = "cgi"
launch_cgi (a_service: WSF_SERVICE; opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS)
launch_cgi (opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS)
local
launcher: WSF_CGI_SERVICE_LAUNCHER
launcher: WSF_CGI_SERVICE_LAUNCHER [G]
do
create launcher.make_and_launch (a_service, opts)
create launcher.make_and_launch (opts)
end
feature {NONE} -- libfcgi
nature_libfcgi: STRING = "libfcgi"
launch_libfcgi (a_service: WSF_SERVICE; opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS)
launch_libfcgi (opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS)
local
launcher: WSF_LIBFCGI_SERVICE_LAUNCHER
launcher: WSF_LIBFCGI_SERVICE_LAUNCHER [G]
do
create launcher.make_and_launch (a_service, opts)
create launcher.make_and_launch (opts)
end
feature -- Default
default_nature: STRING
do
Result := nature_standalone
end

View File

@@ -8,10 +8,10 @@ note
revision: "$Revision: 36 $"
class
APPLICATION_LAUNCHER
APPLICATION_LAUNCHER [G -> WSF_EXECUTION create make end]
inherit
APPLICATION_LAUNCHER_I
APPLICATION_LAUNCHER_I [G]
feature -- Custom

View File

@@ -10,15 +10,15 @@ note
revision: "$Revision: 96596 $"
deferred class
APPLICATION_LAUNCHER_I
APPLICATION_LAUNCHER_I [G -> WSF_EXECUTION create make end]
feature -- Execution
launch (a_service: WSF_SERVICE; opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS)
launch (opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS)
local
launcher: WSF_DEFAULT_SERVICE_LAUNCHER
launcher: WSF_DEFAULT_SERVICE_LAUNCHER [G]
do
create {WSF_DEFAULT_SERVICE_LAUNCHER} launcher.make_and_launch (a_service, opts)
create launcher.make_and_launch (opts)
end
end

View File

@@ -13,11 +13,11 @@
<library name="base_extension" location="$ISE_LIBRARY\library\base_extension\base_extension-safe.ecf"/>
<library name="cms" location="..\..\..\..\cms-safe.ecf" readonly="false"/>
<library name="cms_model" location="..\..\..\..\library\model\cms_model-safe.ecf" readonly="false"/>
<library name="http" location="$ISE_LIBRARY\contrib\library\network\protocol\http\http-safe.ecf"/>
<library name="http" location="$EWF_LIBRARY\library\network\protocol\http\http-safe.ecf"/>
<library name="json" location="$ISE_LIBRARY\contrib\library\text\parser\json\library\json-safe.ecf" readonly="false"/>
<library name="time" location="$ISE_LIBRARY\library\time\time-safe.ecf"/>
<library name="wsf" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\wsf-safe.ecf"/>
<library name="wsf_encoder" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\text\encoder\encoder-safe.ecf"/>
<library name="wsf" location="$EWF_LIBRARY\library\server\wsf\wsf-safe.ecf"/>
<library name="wsf_encoder" location="$EWF_LIBRARY\library\text\encoder\encoder-safe.ecf"/>
<cluster name="src" location=".\" recursive="true"/>
</target>
</system>

View File

@@ -16,17 +16,10 @@ inherit
initialize
end
WSF_SERVICE
redefine
execute
end
REFACTORING_HELPER
SHARED_EXECUTION_ENVIRONMENT
SHARED_LOGGER
create
make_and_launch
@@ -43,36 +36,19 @@ feature {NONE} -- Initialization
do
Precursor
create {WSF_SERVICE_LAUNCHER_OPTIONS_FROM_INI} service_options.make_from_file ("demo.ini")
initialize_cms (cms_setup)
end
feature -- Service
cms_service: CMS_SERVICE
-- cms service.
execute (req: WSF_REQUEST; res: WSF_RESPONSE)
do
cms_service.execute (req, res)
end
feature -- Layout
layout: CMS_LAYOUT
-- cms layout.
feature {NONE} -- Launch operation
launcher: APPLICATION_LAUNCHER
launcher: APPLICATION_LAUNCHER [EWF_ROC_SERVER_EXECUTION]
launch (a_service: WSF_SERVICE; opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS)
launch (opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS)
local
l_retry: BOOLEAN
l_message: STRING
do
if not l_retry then
log.write_debug (generator + ".launch")
launcher.launch (a_service, opts)
launcher.launch (opts)
else
-- error hanling.
create l_message.make (1024)
@@ -92,68 +68,11 @@ feature {NONE} -- Launch operation
l_message.append ("%N%N")
end
-- send email shutdown
log.write_debug (generator + ".launch shutdown")
end
rescue
l_retry := True
retry
end
feature -- CMS Initialization
cms_setup: CMS_DEFAULT_SETUP
local
utf: UTF_CONVERTER
do
if attached execution_environment.arguments.separate_character_option_value ('d') as l_dir then
create layout.make_with_directory_name (l_dir)
else
create layout.make_default
end
initialize_logger (layout)
log.write_debug (generator + ".cms_setup based directory %"" + utf.escaped_utf_32_string_to_utf_8_string_8 (layout.path.name) + "%"")
create Result.make (layout)
setup_storage (Result)
end
initialize_cms (a_setup: CMS_SETUP)
local
cms: CMS_SERVICE
api: CMS_API
do
log.write_debug (generator + ".initialize_cms")
setup_modules (a_setup)
create api.make (a_setup)
create cms.make (api)
cms_service := cms
end
feature -- CMS setup
setup_modules (a_setup: CMS_SETUP)
-- Setup additional modules.
local
m: CMS_MODULE
do
create {BASIC_AUTH_MODULE} m.make
if not a_setup.module_with_same_type_registered (m) then
m.enable
a_setup.register_module (m)
end
create {CMS_DEMO_MODULE} m.make
m.enable
a_setup.register_module (m)
end
setup_storage (a_setup: CMS_SETUP)
do
debug ("refactor_fixme")
to_implement ("To implement custom storage")
end
-- a_setup.storage_drivers.force (create {CMS_STORAGE_MYSQL_BUILDER}.make, "mysql")
a_setup.storage_drivers.force (create {CMS_STORAGE_SQLITE_BUILDER}.make, "sqlite")
end
end

View File

@@ -0,0 +1,57 @@
note
description: "Summary description for {EWF_ROC_SERVER_EXECUTION}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
EWF_ROC_SERVER_EXECUTION
inherit
CMS_EXECUTION
redefine
initialize
end
REFACTORING_HELPER
SHARED_LOGGER
create
make
feature {NONE} -- Initialization
initialize
do
Precursor
end
feature -- CMS setup
setup_modules (a_setup: CMS_SETUP)
-- Setup additional modules.
local
m: CMS_MODULE
do
create {BASIC_AUTH_MODULE} m.make
if not a_setup.module_with_same_type_registered (m) then
m.enable
a_setup.register_module (m)
end
create {CMS_DEMO_MODULE} m.make
m.enable
a_setup.register_module (m)
end
setup_storage (a_setup: CMS_SETUP)
do
debug ("refactor_fixme")
to_implement ("To implement custom storage")
end
-- a_setup.storage_drivers.force (create {CMS_STORAGE_MYSQL_BUILDER}.make, "mysql")
a_setup.storage_drivers.force (create {CMS_STORAGE_SQLITE_BUILDER}.make, "sqlite")
end
end

View File

@@ -56,10 +56,10 @@ feature -- Element Settings
l_message.append ("An unknown exception was raised.")
end
set_last_error (l_message, a_location)
log.write_critical (generator + ".set_last_error_from_exception " + l_message)
write_critical_log (generator + ".set_last_error_from_exception " + l_message)
else
set_last_error ("Generic error", "")
log.write_critical (generator + ".set_last_error_from_exception Generic Error")
write_critical_log (generator + ".set_last_error_from_exception Generic Error")
end
rescue
l_retried := True
@@ -75,7 +75,7 @@ feature -- Element Settings
attached_location: a_location /= Void
do
create last_error.make (a_message, a_location)
log.write_critical (generator + ".set_last_error " + a_message)
write_critical_log (generator + ".set_last_error " + a_message)
successful := False
ensure
last_error_set: attached last_error
@@ -103,6 +103,6 @@ feature -- Element Settings
successful: successful
end
note
copyright: "2011-2014, Javier Velilla, Jocelyn Fiat, Eiffel Software and others"
copyright: "2011-2015, Javier Velilla, Jocelyn Fiat, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
end

View File

@@ -0,0 +1,172 @@
note
description: "Summary description for {LOGGER}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
LOGGER
inherit
ANY
LOG_PRIORITY_CONSTANTS
export
{NONE} all
end
SHARED_EXECUTION_ENVIRONMENT
export
{NONE} all
end
create
make,
make_with_layout
feature {NONE} -- Initialization
make
do
create log.make
end
make_with_layout (app: APPLICATION_LAYOUT)
do
make
apply_layout (app)
end
feature -- Change
apply_layout (app: APPLICATION_LAYOUT)
do
initialize_logger (app, log)
end
feature {NONE} -- Internal
log: LOGGING_FACILITY
feature -- Logging
put_information (a_message: separate READABLE_STRING_8)
do
log.write_information (create {STRING}.make_from_separate (a_message))
end
put_error (a_message: separate READABLE_STRING_8)
do
log.write_error (create {STRING}.make_from_separate (a_message))
end
put_warning (a_message: separate READABLE_STRING_8)
do
log.write_warning (create {STRING}.make_from_separate (a_message))
end
put_critical (a_message: separate READABLE_STRING_8)
do
log.write_critical (create {STRING}.make_from_separate (a_message))
end
put_alert (a_message: separate READABLE_STRING_8)
do
log.write_alert (create {STRING}.make_from_separate (a_message))
end
put_debug (a_message: separate READABLE_STRING_8)
do
log.write_debug (create {STRING}.make_from_separate (a_message))
end
feature {NONE} -- Implementation
initialize_logger (app: APPLICATION_LAYOUT; a_log: like log)
local
l_log_writer_file: LOG_ROLLING_WRITER_FILE
l_log_writer: LOG_WRITER
l_logs_path: detachable PATH
l_logger_config: LOGGER_CONFIGURATION
ut: FILE_UTILITIES
do
l_logger_config := new_logger_level_configuration (app.application_config_path)
l_logs_path := l_logger_config.location
if l_logs_path = Void then
l_logs_path := app.logs_path
end
if ut.directory_path_exists (l_logs_path) then
create l_log_writer_file.make_at_location (l_logs_path.extended (app.name).appended_with_extension ("log"))
l_log_writer_file.set_max_file_size ({NATURAL_64} 1024 * 1204)
l_log_writer_file.set_max_backup_count (l_logger_config.backup_count)
l_log_writer := l_log_writer_file
else
-- Should we create the directory anyway ?
create {LOG_WRITER_NULL} l_log_writer
end
set_logger_level (l_log_writer, l_logger_config.level)
a_log.register_log_writer (l_log_writer)
end
set_logger_level (a_log_writer: LOG_WRITER; a_priority: INTEGER)
-- Setup the logger level based on `a_priority'
do
if a_priority = log_debug then
a_log_writer.enable_debug_log_level
elseif a_priority = Log_emergency then
a_log_writer.enable_emergency_log_level
elseif a_priority = Log_alert then
a_log_writer.enable_alert_log_level
elseif a_priority = Log_critical then
a_log_writer.enable_critical_log_level
elseif a_priority = Log_error then
a_log_writer.enable_error_log_level
elseif a_priority = Log_warning then
a_log_writer.enable_warning_log_level
elseif a_priority = Log_notice then
a_log_writer.enable_notice_log_level
elseif a_priority = Log_information then
a_log_writer.enable_information_log_level
else
a_log_writer.enable_unkno_log_level
end
end
new_logger_level_configuration (a_path: PATH): LOGGER_CONFIGURATION
-- Retrieve a new logger level configuration.
-- By default, level is set to `DEBUG'.
local
l_parser: JSON_PARSER
ut: FILE_UTILITIES
do
create Result
if
ut.file_path_exists (a_path) and then
attached (create {JSON_FILE_READER}).read_json_from (a_path.name) as json_file
then
create l_parser.make_with_string (json_file)
l_parser.parse_content
if
l_parser.is_valid and then
attached l_parser.parsed_json_object as jv and then
attached {JSON_OBJECT} jv.item ("logger") as l_logger
then
if attached {JSON_STRING} l_logger.item ("location") as l_location then
Result.set_location_with_string (l_location.item)
end
if attached {JSON_STRING} l_logger.item ("backup_count") as l_count then
if l_count.item.is_natural then
Result.set_backup_count (l_count.item.to_natural)
end
end
if attached {JSON_STRING} l_logger.item ("level") as l_level then
Result.set_level (l_level.item)
end
end
end
end
note
copyright: "2011-2015, Javier Velilla, Jocelyn Fiat, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
end

View File

@@ -67,7 +67,6 @@ feature -- Output
rescue
l_retry := True
retry
end
write_emergency (msg: STRING)
@@ -135,6 +134,6 @@ feature -- Output
retry
end
note
copyright: "2011-2014, Javier Velilla, Jocelyn Fiat, Eiffel Software and others"
copyright: "2011-2015, Javier Velilla, Jocelyn Fiat, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
end

View File

@@ -13,100 +13,103 @@ inherit
feature -- Logger
log: LOGGING_FACILITY
logger: separate LOGGER
-- `log' facility (once per process)
-- that could be shared between threads
-- without reinitializing it.
once ("PROCESS")
create Result.make
do
Result := logger_cell_item (logger_cell)
end
logger_cell: separate CELL [separate LOGGER]
once ("PROCESS")
create Result.put (create {separate LOGGER}.make)
end
logger_cell_item (a_cell: like logger_cell): separate LOGGER
do
Result := a_cell.item
end
feature -- Logging
write_debug_log (m: READABLE_STRING_8)
do
write_debug_log_to (m, logger)
end
write_information_log (m: READABLE_STRING_8)
do
write_information_log_to (m, logger)
end
write_warning_log (m: READABLE_STRING_8)
do
write_warning_log_to (m, logger)
end
write_error_log (m: READABLE_STRING_8)
do
write_error_log_to (m, logger)
end
write_critical_log (m: READABLE_STRING_8)
do
write_critical_log_to (m, logger)
end
write_alert_log (m: READABLE_STRING_8)
do
write_alert_log_to (m, logger)
end
feature {NONE} -- Logger: separate implementation
write_debug_log_to (m: READABLE_STRING_8; a_log: like logger)
do
a_log.put_debug (m)
end
write_information_log_to (m: READABLE_STRING_8; a_log: like logger)
do
a_log.put_information (m)
end
write_warning_log_to (m: READABLE_STRING_8; a_log: like logger)
do
a_log.put_warning (m)
end
write_error_log_to (m: READABLE_STRING_8; a_log: like logger)
do
a_log.put_error (m)
end
write_critical_log_to (m: READABLE_STRING_8; a_log: like logger)
do
a_log.put_critical (m)
end
write_alert_log_to (m: READABLE_STRING_8; a_log: like logger)
do
a_log.put_alert (m)
end
feature {NONE} -- Implementation
initialize_logger (app: APPLICATION_LAYOUT)
local
l_log_writer_file: LOG_ROLLING_WRITER_FILE
l_log_writer: LOG_WRITER
l_logs_path: detachable PATH
l_logger_config: LOGGER_CONFIGURATION
ut: FILE_UTILITIES
l_logger: LOGGER
do
l_logger_config := new_logger_level_configuration (app.application_config_path)
l_logs_path := l_logger_config.location
if l_logs_path = Void then
l_logs_path := app.logs_path
end
if ut.directory_path_exists (l_logs_path) then
create l_log_writer_file.make_at_location (l_logs_path.extended (app.name).appended_with_extension ("log"))
l_log_writer_file.set_max_file_size ({NATURAL_64} 1024 * 1204)
l_log_writer_file.set_max_backup_count (l_logger_config.backup_count)
l_log_writer := l_log_writer_file
else
-- Should we create the directory anyway ?
create {LOG_WRITER_NULL} l_log_writer
end
set_logger_level (l_log_writer, l_logger_config.level)
log.register_log_writer (l_log_writer)
create l_logger.make_with_layout (app)
set_logger_to (l_logger, logger_cell)
end
set_logger_level (a_log_writer: LOG_WRITER; a_priority: INTEGER)
-- Setup the logger level based on `a_priority'
set_logger_to (a_logger: separate LOGGER; a_cell: like logger_cell)
do
if a_priority = log_debug then
a_log_writer.enable_debug_log_level
elseif a_priority = Log_emergency then
a_log_writer.enable_emergency_log_level
elseif a_priority = Log_alert then
a_log_writer.enable_alert_log_level
elseif a_priority = Log_critical then
a_log_writer.enable_critical_log_level
elseif a_priority = Log_error then
a_log_writer.enable_error_log_level
elseif a_priority = Log_warning then
a_log_writer.enable_warning_log_level
elseif a_priority = Log_notice then
a_log_writer.enable_notice_log_level
elseif a_priority = Log_information then
a_log_writer.enable_information_log_level
else
a_log_writer.enable_unkno_log_level
end
a_cell.replace (a_logger)
end
new_logger_level_configuration (a_path: PATH): LOGGER_CONFIGURATION
-- Retrieve a new logger level configuration.
-- By default, level is set to `DEBUG'.
local
l_parser: JSON_PARSER
ut: FILE_UTILITIES
do
create Result
if
ut.file_path_exists (a_path) and then
attached (create {JSON_FILE_READER}).read_json_from (a_path.name) as json_file
then
create l_parser.make_with_string (json_file)
l_parser.parse_content
if
l_parser.is_valid and then
attached l_parser.parsed_json_object as jv and then
attached {JSON_OBJECT} jv.item ("logger") as l_logger
then
if attached {JSON_STRING} l_logger.item ("location") as l_location then
Result.set_location_with_string (l_location.item)
end
if attached {JSON_STRING} l_logger.item ("backup_count") as l_count then
if l_count.item.is_natural then
Result.set_backup_count (l_count.item.to_natural)
end
end
if attached {JSON_STRING} l_logger.item ("level") as l_level then
Result.set_level (l_level.item)
end
end
end
end
note
copyright: "2011-2015, Javier Velilla, Jocelyn Fiat, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"

View File

@@ -20,7 +20,7 @@ feature {NONE} -- Initialization
is_connected: a_connection.is_connected
do
connection := a_connection
log.write_information (generator + ".make - is database connected? "+ a_connection.is_connected.out )
write_information_log (generator + ".make - is database connected? "+ a_connection.is_connected.out )
create {DATABASE_HANDLER_IMPL} db_handler.make (a_connection)
@@ -50,7 +50,7 @@ feature -- Query
do
error_handler.append (db_handler.database_error_handler)
if error_handler.has_error then
log.write_critical (generator + ".post_execution " + error_handler.as_string_representation)
write_critical_log (generator + ".post_execution " + error_handler.as_string_representation)
end
end

View File

@@ -42,7 +42,7 @@ feature -- Initialization
rescue
create db_control.make
-- set_last_error_from_exception ("Connection execution")
-- log.write_critical (generator + ".make_common:" + last_error_message)
-- write_critical_log (generator + ".make_common:" + last_error_message)
if is_connected then
disconnect
end
@@ -73,7 +73,7 @@ feature -- Initialization
rescue
create db_control.make
-- set_last_error_from_exception ("Connection execution")
-- log.write_critical (generator + ".make_common:" + last_error_message)
-- write_critical_log (generator + ".make_common:" + last_error_message)
if is_connected then
disconnect
end
@@ -103,20 +103,20 @@ feature -- Initialization
login_with_connection_string (a_string: STRING)
-- Login with `a_connection_string'and immediately connect to database.
do
log.write_debug (generator +".login_with_connection_string")
write_debug_log (generator +".login_with_connection_string")
create db_application.login_with_connection_string (a_string)
create database_error_handler.make
db_application.set_base
create db_control.make
log.write_debug (generator +".login_with_connection_string, is_keep_connection? "+ is_keep_connection.out )
write_debug_log (generator +".login_with_connection_string, is_keep_connection? "+ is_keep_connection.out )
keep_connection := is_keep_connection
if keep_connection then
connect
if not db_control.is_ok then
log.write_critical (generator +".login_with_connection_string:"+ db_control.error_code.out )
log.write_critical (generator +".login_with_connection_string:"+ db_control.error_message_32 )
write_critical_log (generator +".login_with_connection_string:"+ db_control.error_code.out )
write_critical_log (generator +".login_with_connection_string:"+ db_control.error_message_32 )
end
log.write_debug (generator +".login_with_connection_string, After connect, is_connected? "+ is_connected.out)
write_debug_log (generator +".login_with_connection_string, After connect, is_connected? "+ is_connected.out)
end
end

View File

@@ -177,7 +177,7 @@ feature -- Error handling
do
if attached db_change as l_change and then not l_change.is_ok then
database_error_handler.add_database_error (l_change.error_message_32, l_change.error_code)
log.write_error (generator + ".check_database_change_error: " + l_change.error_message_32)
write_error_log (generator + ".check_database_change_error: " + l_change.error_message_32)
l_change.reset
end
end
@@ -187,7 +187,7 @@ feature -- Error handling
do
if attached db_selection as l_selection and then not l_selection.is_ok then
database_error_handler.add_database_error (l_selection.error_message_32, l_selection.error_code)
log.write_error (generator + ".check_database_selection_error: " + l_selection.error_message_32)
write_error_log (generator + ".check_database_selection_error: " + l_selection.error_message_32)
l_selection.reset
end
end

View File

@@ -44,7 +44,7 @@ feature -- Functionality
items := l_store.execute_reader (l_db_selection)
check_database_selection_error
end
log.write_debug ( generator+".execute_reader Successful")
write_debug_log ( generator+".execute_reader Successful")
end
rescue
l_retried := True
@@ -69,7 +69,7 @@ feature -- Functionality
l_store.execute_writer (l_db_change)
check_database_change_error
end
log.write_debug ( generator+".execute_writer Successful")
write_debug_log ( generator+".execute_writer Successful")
end
rescue
l_retried := True

View File

@@ -19,8 +19,8 @@ feature {NONE} -- Intialization
data_reader (a_query: STRING; a_parameters: like parameters)
-- SQL data reader for the query `a_query' with arguments `a_parameters'
do
log.write_information (generator + ".data_reader" + " execute query: " + a_query)
log.write_debug (generator + ".data_reader" + " arguments:" + log_parameters (a_parameters))
write_information_log (generator + ".data_reader" + " execute query: " + a_query)
write_debug_log (generator + ".data_reader" + " arguments:" + log_parameters (a_parameters))
query := a_query
parameters := a_parameters
ensure
@@ -43,7 +43,7 @@ feature -- Execution
a_base_selection.load_result
Result := a_base_selection.container
else
log.write_error (generator + "." + a_base_selection.error_message_32)
write_error_log (generator + "." + a_base_selection.error_message_32)
end
unset_map_name (a_base_selection)
a_base_selection.terminate

View File

@@ -20,8 +20,8 @@ feature -- Intialization
local
l_retried: BOOLEAN
do
log.write_information (generator + ".data_reader" + " execute store procedure: " + a_sp)
log.write_debug (generator + ".data_reader" + " arguments:" + log_parameters (a_parameters))
write_information_log (generator + ".data_reader" + " execute store procedure: " + a_sp)
write_debug_log (generator + ".data_reader" + " arguments:" + log_parameters (a_parameters))
if not l_retried then
stored_procedure := a_sp
parameters := a_parameters
@@ -33,14 +33,14 @@ feature -- Intialization
if proc.exists then
if proc.text_32 /= Void then
debug
log.write_debug ( generator + ".data_reader: " + proc.text_32)
write_debug_log ( generator + ".data_reader: " + proc.text_32)
end
end
else
has_error := True
error_message := proc.error_message_32
error_code := proc.error_code
log.write_error (generator + ".data_witer message:" + proc.error_message_32 + " code:" + proc.error_code.out)
write_error_log (generator + ".data_witer message:" + proc.error_message_32 + " code:" + proc.error_code.out)
end
else
stored_procedure := a_sp
@@ -49,7 +49,7 @@ feature -- Intialization
end
rescue
set_last_error_from_exception ("SQL execution")
log.write_critical (generator+ ".data_reader " + last_error_message)
write_critical_log (generator+ ".data_reader " + last_error_message)
l_retried := True
retry
end
@@ -59,8 +59,8 @@ feature -- Intialization
local
l_retried: BOOLEAN
do
log.write_information (generator + ".data_reader" + " execute store procedure: " + a_sp)
log.write_debug (generator + ".data_reader" + " arguments:" + log_parameters (a_parameters))
write_information_log (generator + ".data_reader" + " execute store procedure: " + a_sp)
write_debug_log (generator + ".data_reader" + " arguments:" + log_parameters (a_parameters))
if not l_retried then
stored_procedure := a_sp
parameters := a_parameters
@@ -70,14 +70,14 @@ feature -- Intialization
if proc.exists then
if proc.text_32 /= Void then
debug
log.write_debug ( generator + ".data_writer: " + proc.text_32)
write_debug_log ( generator + ".data_writer: " + proc.text_32)
end
end
else
has_error := True
error_message := proc.error_message_32
error_code := proc.error_code
log.write_error (generator + ".data_witer message:" + proc.error_message_32 + " code:" + proc.error_code.out)
write_error_log (generator + ".data_witer message:" + proc.error_message_32 + " code:" + proc.error_code.out)
end
else
stored_procedure := a_sp
@@ -86,12 +86,11 @@ feature -- Intialization
end
rescue
set_last_error_from_exception ("SQL execution")
log.write_critical (generator+ ".data_reader " + last_error_message)
write_critical_log (generator+ ".data_reader " + last_error_message)
l_retried := True
retry
end
execute_reader (a_base_selection: DB_SELECTION): detachable LIST [DB_RESULT]
-- Execute the Current store procedure.
do

View File

@@ -9,8 +9,8 @@
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
<library name="cms" location="..\..\..\cms-safe.ecf" readonly="false"/>
<library name="crypto" location="$ISE_LIBRARY\unstable\library\text\encryption\crypto\crypto-safe.ecf"/>
<library name="encoder" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\text\encoder\encoder-safe.ecf"/>
<library name="error" location="$ISE_LIBRARY\contrib\library\utility\general\error\error-safe.ecf"/>
<library name="encoder" location="$EWF_LIBRARY\library\text\encoder\encoder-safe.ecf"/>
<library name="error" location="$EWF_LIBRARY\library\utility\general\error\error-safe.ecf"/>
<library name="json" location="$ISE_LIBRARY\contrib\library\text\parser\json\library\json-safe.ecf" readonly="false"/>
<library name="layout" location="..\..\layout\layout-safe.ecf"/>
<library name="logging" location="$ISE_LIBRARY\library\runtime\logging\logging-safe.ecf"/>

View File

@@ -9,8 +9,8 @@
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf"/>
<library name="cms" location="..\..\..\cms.ecf" readonly="false"/>
<library name="crypto" location="$ISE_LIBRARY\unstable\library\text\encryption\crypto\crypto.ecf"/>
<library name="encoder" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\text\encoder\encoder.ecf"/>
<library name="error" location="$ISE_LIBRARY\contrib\library\utility\general\error\error.ecf"/>
<library name="encoder" location="$EWF_LIBRARY\library\text\encoder\encoder.ecf"/>
<library name="error" location="$EWF_LIBRARY\library\utility\general\error\error.ecf"/>
<library name="json" location="$ISE_LIBRARY\contrib\library\text\parser\json\library\json.ecf" readonly="false"/>
<library name="layout" location="..\..\layout\layout.ecf"/>
<library name="logging" location="$ISE_LIBRARY\library\runtime\logging\logging.ecf"/>

View File

@@ -9,8 +9,8 @@
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
<library name="cms" location="..\..\..\cms-safe.ecf"/>
<library name="crypto" location="$ISE_LIBRARY\unstable\library\text\encryption\crypto\crypto-safe.ecf"/>
<library name="encoder" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\text\encoder\encoder-safe.ecf"/>
<library name="error" location="$ISE_LIBRARY\contrib\library\utility\general\error\error-safe.ecf"/>
<library name="encoder" location="$EWF_LIBRARY\library\text\encoder\encoder-safe.ecf"/>
<library name="error" location="$EWF_LIBRARY\library\utility\general\error\error-safe.ecf"/>
<library name="json" location="$ISE_LIBRARY\contrib\library\text\parser\json\library\json-safe.ecf" readonly="false"/>
<library name="layout" location="..\..\layout\layout-safe.ecf"/>
<library name="logging" location="$ISE_LIBRARY\library\runtime\logging\logging-safe.ecf"/>

View File

@@ -9,8 +9,8 @@
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf"/>
<library name="cms" location="..\..\..\cms.ecf"/>
<library name="crypto" location="$ISE_LIBRARY\unstable\library\text\encryption\crypto\crypto.ecf"/>
<library name="encoder" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\text\encoder\encoder.ecf"/>
<library name="error" location="$ISE_LIBRARY\contrib\library\utility\general\error\error.ecf"/>
<library name="encoder" location="$EWF_LIBRARY\library\text\encoder\encoder.ecf"/>
<library name="error" location="$EWF_LIBRARY\library\utility\general\error\error.ecf"/>
<library name="json" location="$ISE_LIBRARY\contrib\library\text\parser\json\library\json.ecf" readonly="false"/>
<library name="layout" location="..\..\layout\layout.ecf"/>
<library name="logging" location="$ISE_LIBRARY\library\runtime\logging\logging.ecf"/>

View File

@@ -47,7 +47,7 @@ feature -- Access: iterator
l_parameters: STRING_TABLE [ANY]
do
error_handler.reset
log.write_information (generator + ".nodes_iterator")
write_information_log (generator + ".nodes_iterator")
create l_parameters.make (0)
sql_query (select_nodes, l_parameters)
create Result.make (db_handler, agent fetch_node)
@@ -61,7 +61,7 @@ feature -- Access: iterator
do
-- FIXME: check implementation...
error_handler.reset
log.write_information (generator + ".recent_nodes_iterator")
write_information_log (generator + ".recent_nodes_iterator")
create l_parameters.make (2)
l_parameters.put (a_rows, "rows")
l_parameters.put (a_lower, "offset")

View File

@@ -50,7 +50,7 @@ feature -- Basic operations
execute_next (req, res)
end
else
api.logger.put_error (generator + ".execute Not valid", Void)
api.logger.put_debug (generator + ".execute without authentication", Void)
execute_next (req, res)
end
end

View File

@@ -176,9 +176,11 @@ feature -- Handler
a_api.user_api.new_user (l_user)
end
if a_node_api.nodes_count = 0 then
create l_node.make ({STRING_32} "This is a content", {STRING_32} "And a summary", {STRING_32} "Nice title")
l_node.set_author (l_user)
a_node_api.new_node (l_node)
if l_user /= Void then
create l_node.make ({STRING_32} "This is a content", {STRING_32} "And a summary", {STRING_32} "Nice title")
l_node.set_author (l_user)
a_node_api.new_node (l_node)
end
end
create s.make_from_string ("<p>Nodes:</p>")

View File

@@ -49,7 +49,7 @@ feature -- Access: user
users: LIST [CMS_USER]
do
create {ARRAYED_LIST[CMS_USER]} Result.make (0)
create {ARRAYED_LIST [CMS_USER]} Result.make (0)
end
user_by_id (a_id: like {CMS_USER}.id): detachable CMS_USER
@@ -70,16 +70,16 @@ feature -- Access: user
feature -- User Nodes
user_collaborator_nodes (a_id: like {CMS_USER}.id): LIST[CMS_NODE]
user_collaborator_nodes (a_id: like {CMS_USER}.id): LIST [CMS_NODE]
-- Possible list of nodes where the user identified by `a_id', is a collaborator.
do
create {ARRAYED_LIST[CMS_NODE]} Result.make (0)
create {ARRAYED_LIST [CMS_NODE]} Result.make (0)
end
user_author_nodes (a_id: like {CMS_USER}.id): LIST[CMS_NODE]
user_author_nodes (a_id: like {CMS_USER}.id): LIST [CMS_NODE]
-- Possible list of nodes where the user identified by `a_id', is the author.
do
create {ARRAYED_LIST[CMS_NODE]} Result.make (0)
create {ARRAYED_LIST [CMS_NODE]} Result.make (0)
end
feature -- Change: user
@@ -87,6 +87,7 @@ feature -- Change: user
new_user (a_user: CMS_USER)
-- Add a new user `a_user'.
do
a_user.set_id (1)
end
update_user (a_user: CMS_USER)
@@ -102,10 +103,9 @@ feature -- Access: roles and permissions
user_roles: LIST [CMS_USER_ROLE]
do
create {ARRAYED_LIST[CMS_USER_ROLE]} Result.make (0)
create {ARRAYED_LIST [CMS_USER_ROLE]} Result.make (0)
end
feature -- Change: roles and permissions
save_user_role (a_user_role: CMS_USER_ROLE)
@@ -122,13 +122,13 @@ feature -- Access: node
nodes: LIST[CMS_NODE]
-- List of nodes.
do
create {ARRAYED_LIST[CMS_NODE]} Result.make (0)
create {ARRAYED_LIST [CMS_NODE]} Result.make (0)
end
recent_nodes (a_lower: INTEGER; a_count: INTEGER): LIST [CMS_NODE]
-- List of the `a_count' most recent nodes, starting from `a_lower'.
do
create {ARRAYED_LIST[CMS_NODE]} Result.make (0)
create {ARRAYED_LIST [CMS_NODE]} Result.make (0)
end
node_by_id (a_id: INTEGER_64): detachable CMS_NODE
@@ -144,7 +144,7 @@ feature -- Access: node
node_collaborators (a_id: like {CMS_NODE}.id): LIST [CMS_USER]
-- Possible list of node's collaborator.
do
create {ARRAYED_LIST[CMS_USER]} Result.make (0)
create {ARRAYED_LIST [CMS_USER]} Result.make (0)
end
feature -- Node

View File

@@ -22,7 +22,7 @@ feature -- Access
-- Number of items nodes.
do
error_handler.reset
log.write_information (generator + ".nodes_count")
write_information_log (generator + ".nodes_count")
sql_query (select_nodes_count, Void)
if sql_rows_count = 1 then
Result := sql_read_integer_64 (1)
@@ -35,7 +35,7 @@ feature -- Access
create {ARRAYED_LIST [CMS_NODE]} Result.make (0)
error_handler.reset
log.write_information (generator + ".nodes")
write_information_log (generator + ".nodes")
from
sql_query (select_nodes, Void)
@@ -58,7 +58,7 @@ feature -- Access
create {ARRAYED_LIST [CMS_NODE]} Result.make (0)
error_handler.reset
log.write_information (generator + ".nodes")
write_information_log (generator + ".nodes")
from
create l_parameters.make (2)
@@ -82,7 +82,7 @@ feature -- Access
l_parameters: STRING_TABLE [ANY]
do
error_handler.reset
log.write_information (generator + ".node")
write_information_log (generator + ".node")
create l_parameters.make (1)
l_parameters.put (a_id,"id")
sql_query (select_node_by_id, l_parameters)
@@ -97,7 +97,7 @@ feature -- Access
l_parameters: STRING_TABLE [ANY]
do
error_handler.reset
log.write_information (generator + ".node_author")
write_information_log (generator + ".node_author")
create l_parameters.make (1)
l_parameters.put (a_id, "node_id")
sql_query (select_node_author, l_parameters)
@@ -110,7 +110,7 @@ feature -- Access
-- Last insert node id.
do
error_handler.reset
log.write_information (generator + ".last_inserted_node_id")
write_information_log (generator + ".last_inserted_node_id")
sql_query (Sql_last_insert_node_id, Void)
if sql_rows_count = 1 then
Result := sql_read_integer_64 (1)
@@ -126,7 +126,7 @@ feature -- Change: Node
do
-- New node
error_handler.reset
log.write_information (generator + ".new_node")
write_information_log (generator + ".new_node")
create l_parameters.make (7)
l_parameters.put (a_node.title, "title")
l_parameters.put (a_node.summary, "summary")
@@ -153,7 +153,7 @@ feature -- Change: Node
local
l_parameters: STRING_TABLE [ANY]
do
log.write_information (generator + ".delete_node")
write_information_log (generator + ".delete_node")
error_handler.reset
create l_parameters.make (1)
@@ -169,7 +169,7 @@ feature -- Change: Node
do
create now.make_now_utc
error_handler.reset
log.write_information (generator + ".update_node")
write_information_log (generator + ".update_node")
create l_parameters.make (7)
l_parameters.put (a_node.title, "title")
l_parameters.put (a_node.summary, "summary")
@@ -195,7 +195,7 @@ feature -- Change: Node
do
-- FIXME: unused a_user_id !
error_handler.reset
log.write_information (generator + ".update_node_title")
write_information_log (generator + ".update_node_title")
create l_parameters.make (3)
l_parameters.put (a_title, "title")
l_parameters.put (create {DATE_TIME}.make_now_utc, "changed")
@@ -210,7 +210,7 @@ feature -- Change: Node
do
-- FIXME: unused a_user_id !
error_handler.reset
log.write_information (generator + ".update_node_summary")
write_information_log (generator + ".update_node_summary")
create l_parameters.make (3)
l_parameters.put (a_summary, "summary")
l_parameters.put (create {DATE_TIME}.make_now_utc, "changed")
@@ -225,7 +225,7 @@ feature -- Change: Node
do
-- FIXME: unused a_user_id !
error_handler.reset
log.write_information (generator + ".update_node_content")
write_information_log (generator + ".update_node_content")
create l_parameters.make (3)
l_parameters.put (a_content, "content")
l_parameters.put (create {DATE_TIME}.make_now_utc, "changed")

View File

@@ -28,7 +28,7 @@ feature -- Access: user
-- Number of items users.
do
error_handler.reset
log.write_information (generator + ".user_count")
write_information_log (generator + ".user_count")
sql_query (select_users_count, Void)
if sql_rows_count = 1 then
@@ -41,7 +41,7 @@ feature -- Access: user
create {ARRAYED_LIST [CMS_USER]} Result.make (0)
error_handler.reset
log.write_information (generator + ".all_users")
write_information_log (generator + ".all_users")
from
sql_query (select_users, Void)
@@ -62,7 +62,7 @@ feature -- Access: user
l_parameters: STRING_TABLE [detachable ANY]
do
error_handler.reset
log.write_information (generator + ".user")
write_information_log (generator + ".user")
create l_parameters.make (1)
l_parameters.put (a_id, "uid")
sql_query (select_user_by_id, l_parameters)
@@ -79,7 +79,7 @@ feature -- Access: user
l_parameters: STRING_TABLE [detachable ANY]
do
error_handler.reset
log.write_information (generator + ".user_by_name")
write_information_log (generator + ".user_by_name")
create l_parameters.make (1)
l_parameters.put (a_name, "name")
sql_query (select_user_by_name, l_parameters)
@@ -96,7 +96,7 @@ feature -- Access: user
l_parameters: STRING_TABLE [detachable ANY]
do
error_handler.reset
log.write_information (generator + ".user_by_email")
write_information_log (generator + ".user_by_email")
create l_parameters.make (1)
l_parameters.put (a_email, "email")
sql_query (select_user_by_email, l_parameters)
@@ -120,10 +120,10 @@ feature -- Access: user
then
Result := True
else
log.write_information (generator + ".is_valid_credential User: wrong username or password" )
write_information_log (generator + ".is_valid_credential User: wrong username or password" )
end
else
log.write_information (generator + ".is_valid_credential User:" + l_auth_login + "does not exist" )
write_information_log (generator + ".is_valid_credential User:" + l_auth_login + "does not exist" )
end
end
@@ -148,7 +148,7 @@ feature -- Change: user
l_password_salt := l_security.salt
l_password_hash := l_security.password_hash (l_password, l_password_salt)
log.write_information (generator + ".new_user")
write_information_log (generator + ".new_user")
create l_parameters.make (4)
l_parameters.put (a_user.name, "name")
l_parameters.put (l_password_hash, "password")
@@ -189,7 +189,7 @@ feature -- Change: user
l_password_hash /= Void and l_password_salt /= Void and
attached a_user.email as l_email
then
log.write_information (generator + ".update_user")
write_information_log (generator + ".update_user")
create l_parameters.make (6)
l_parameters.put (a_user.id, "uid")
l_parameters.put (a_user.name, "name")
@@ -233,7 +233,7 @@ feature {NONE} -- Implementation
l_parameters: STRING_TABLE [detachable ANY]
do
error_handler.reset
log.write_information (generator + ".user_salt")
write_information_log (generator + ".user_salt")
create l_parameters.make (1)
l_parameters.put (a_username, "name")
sql_query (select_salt_by_username, l_parameters)
@@ -282,7 +282,7 @@ feature {NONE} -- Implementation
-- Last insert user id.
do
error_handler.reset
log.write_information (generator + ".last_inserted_user_id")
write_information_log (generator + ".last_inserted_user_id")
sql_query (Sql_last_insert_user_id, Void)
if sql_rows_count = 1 then
Result := sql_read_integer_64 (1)

View File

@@ -6,53 +6,49 @@ note
even for a specific handler.
]"
class
CMS_SERVICE
deferred class
CMS_EXECUTION
inherit
WSF_ROUTED_SKELETON_SERVICE
rename
execute as execute_service
WSF_FILTERED_ROUTED_SKELETON_EXECUTION
undefine
requires_proxy
redefine
execute_default
end
WSF_FILTERED_SERVICE
WSF_FILTER
rename
execute as execute_filter
execute_default,
filter_execute,
initialize
end
WSF_NO_PROXY_POLICY
WSF_URI_HELPER_FOR_ROUTED_SERVICE
WSF_URI_HELPER_FOR_ROUTED_EXECUTION
WSF_URI_TEMPLATE_HELPER_FOR_ROUTED_SERVICE
WSF_URI_TEMPLATE_HELPER_FOR_ROUTED_EXECUTION
REFACTORING_HELPER
SHARED_LOGGER
create
make
--create
-- make
feature {NONE} -- Initialization
make (a_api: CMS_API)
initialize
-- Build a CMS service with `a_api'
do
api := a_api
initialize
ensure
api_set: api = a_api
initialize_cms (cms_setup)
Precursor
end
initialize
-- Initialize various parts of the CMS service.
initialize_cms (a_setup: CMS_SETUP)
do
setup := a_setup
write_debug_log (generator + ".initialize_cms")
setup_modules (a_setup)
create api.make (a_setup)
-- CMS Initialization
initialize_modules
initialize_users
initialize_auth_engine
@@ -88,6 +84,17 @@ feature {NONE} -- Initialization
to_implement ("To Implement authentication engine")
end
feature -- CMS setup
setup_modules (a_setup: CMS_SETUP)
-- Setup additional modules.
deferred
end
setup_storage (a_setup: CMS_SETUP)
deferred
end
feature -- Settings: router
setup_router
@@ -155,12 +162,12 @@ feature -- Settings: router
feature -- Execute Filter
execute_filter (req: WSF_REQUEST; res: WSF_RESPONSE)
filter_execute (req: WSF_REQUEST; res: WSF_RESPONSE)
-- Execute the filter.
do
res.put_header_line ("Date: " + (create {HTTP_DATE}.make_now_utc).string)
res.put_header_line ("X-EWF-Server: CMS_v1.0")
execute_service (req, res)
Precursor (req, res)
end
feature -- Filters
@@ -225,13 +232,27 @@ feature -- Filters
feature -- Access
layout: CMS_LAYOUT
api: CMS_API
-- API service.
setup: CMS_SETUP
setup: CMS_SETUP
cms_setup: CMS_DEFAULT_SETUP
-- CMS setup.
local
utf: UTF_CONVERTER
do
Result := api.setup
if attached execution_environment.arguments.separate_character_option_value ('d') as l_dir then
create layout.make_with_directory_name (l_dir)
else
create layout.make_default
end
initialize_logger (layout)
write_debug_log (generator + ".cms_setup based directory %"" + utf.escaped_utf_32_string_to_utf_8_string_8 (layout.path.name) + "%"")
create Result.make (layout)
setup_storage (Result)
end
modules: CMS_MODULE_COLLECTION

View File

@@ -11,9 +11,6 @@ inherit
CMS_LOGGER
SHARED_LOGGER
rename
log as log_facility
end
create
make
@@ -29,32 +26,32 @@ feature -- Logging
put_information (a_message: READABLE_STRING_8; a_data: detachable ANY)
do
log_facility.write_information (log_message (a_message, a_data))
write_information_log (log_message (a_message, a_data))
end
put_error (a_message: READABLE_STRING_8; a_data: detachable ANY)
do
log_facility.write_error (log_message (a_message, a_data))
write_error_log (log_message (a_message, a_data))
end
put_warning (a_message: READABLE_STRING_8; a_data: detachable ANY)
do
log_facility.write_warning (log_message (a_message, a_data))
write_warning_log (log_message (a_message, a_data))
end
put_critical (a_message: READABLE_STRING_8; a_data: detachable ANY)
do
log_facility.write_critical (log_message (a_message, a_data))
write_critical_log (log_message (a_message, a_data))
end
put_alert (a_message: READABLE_STRING_8; a_data: detachable ANY)
do
log_facility.write_alert (log_message (a_message, a_data))
write_alert_log (log_message (a_message, a_data))
end
put_debug (a_message: READABLE_STRING_8; a_data: detachable ANY)
do
log_facility.write_debug (log_message (a_message, a_data))
write_debug_log (log_message (a_message, a_data))
end
end