Compare commits
1 Commits
es_rev9839
...
storage_re
| Author | SHA1 | Date | |
|---|---|---|---|
| 4dcc1b0e04 |
@@ -15,7 +15,6 @@
|
|||||||
<library name="json" location="$ISE_LIBRARY\contrib\library\text\parser\json\library\json-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="layout" location=".\library\layout\layout-safe.ecf"/>
|
||||||
<library name="model" location=".\library\model\cms_model-safe.ecf" readonly="false"/>
|
<library name="model" location=".\library\model\cms_model-safe.ecf" readonly="false"/>
|
||||||
<library name="persistence_mysql" location=".\library\persistence\implementation\mysql\persistence_mysql-safe.ecf" readonly="false"/>
|
|
||||||
<library name="smarty" location="$ISE_LIBRARY\contrib\library\text\template\smarty\smarty-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="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="time" location="$ISE_LIBRARY\library\time\time-safe.ecf"/>
|
||||||
|
|||||||
@@ -12,6 +12,8 @@
|
|||||||
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
|
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
|
||||||
<library name="cms" location="..\..\cms-safe.ecf" readonly="false"/>
|
<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_demo_module" location="modules\demo\cms_demo_module-safe.ecf" readonly="false"/>
|
||||||
|
<library name="persistence_mysql" location="..\..\library\persistence\implementation\mysql\persistence_mysql-safe.ecf" readonly="false"/>
|
||||||
|
|
||||||
<library name="layout" location="..\..\library\layout\layout-safe.ecf" readonly="false"/>
|
<library name="layout" location="..\..\library\layout\layout-safe.ecf" readonly="false"/>
|
||||||
<library name="wsf" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\wsf-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_extension" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\wsf_extension-safe.ecf" readonly="false"/>
|
||||||
|
|||||||
@@ -1,6 +1,11 @@
|
|||||||
engine=smarty
|
[layout]
|
||||||
site.name=EWF Web CMS
|
root-dir=site/www
|
||||||
site.email=your@email.com
|
themes-dir=site/themes
|
||||||
var-dir=var
|
|
||||||
files-dir=files
|
[site]
|
||||||
|
name=Eiffel CMS
|
||||||
|
email=your@email.com
|
||||||
theme=bootstrap
|
theme=bootstrap
|
||||||
|
|
||||||
|
[misc]
|
||||||
|
smtp=localhost
|
||||||
|
|||||||
@@ -147,6 +147,8 @@ feature -- CMS setup
|
|||||||
debug ("refactor_fixme")
|
debug ("refactor_fixme")
|
||||||
to_implement ("To implement custom storage")
|
to_implement ("To implement custom storage")
|
||||||
end
|
end
|
||||||
|
a_setup.storage_drivers.force (create {CMS_STORAGE_MYSQL_BUILDER}.make, "mysql")
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
note
|
note
|
||||||
description: "Provides logger information"
|
description: "Provides logger information"
|
||||||
date: "$Date: 2014-08-20 15:21:15 -0300 (mi., 20 ago. 2014) $"
|
date: "$Date: 2015-01-15 00:00:58 +0100 (jeu., 15 janv. 2015) $"
|
||||||
revision: "$Revision: 95678 $"
|
revision: "$Revision: 96461 $"
|
||||||
|
|
||||||
class
|
class
|
||||||
SHARED_LOGGER
|
SHARED_LOGGER
|
||||||
@@ -29,7 +29,7 @@ feature -- Logger
|
|||||||
create l_environment
|
create l_environment
|
||||||
if attached separate_character_option_value ('d') as l_dir then
|
if attached separate_character_option_value ('d') as l_dir then
|
||||||
l_path := create {PATH}.make_from_string (l_dir)
|
l_path := create {PATH}.make_from_string (l_dir)
|
||||||
create l_log_writer.make_at_location (l_path.extended ("..").appended ("\api.log"))
|
create l_log_writer.make_at_location (l_path.extended ("logs").appended ("\api.log"))
|
||||||
else
|
else
|
||||||
l_path := create {PATH}.make_current
|
l_path := create {PATH}.make_current
|
||||||
create l_log_writer.make_at_location (l_path.extended("api.log"))
|
create l_log_writer.make_at_location (l_path.extended("api.log"))
|
||||||
@@ -107,6 +107,6 @@ feature {NONE} -- JSON
|
|||||||
end
|
end
|
||||||
|
|
||||||
note
|
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)"
|
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -45,14 +45,14 @@ feature -- Functionality Store Procedures
|
|||||||
execute_store_reader
|
execute_store_reader
|
||||||
-- Execute a `store' to read data.
|
-- Execute a `store' to read data.
|
||||||
require
|
require
|
||||||
store_not_void: store /= void
|
store_not_void: store /= Void
|
||||||
deferred
|
deferred
|
||||||
end
|
end
|
||||||
|
|
||||||
execute_store_writer
|
execute_store_writer
|
||||||
-- Execute a `store' to write data.
|
-- Execute a `store' to write data.
|
||||||
require
|
require
|
||||||
store_not_void: store /= void
|
store_not_void: store /= Void
|
||||||
deferred
|
deferred
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -61,14 +61,14 @@ feature -- SQL Queries
|
|||||||
execute_query
|
execute_query
|
||||||
-- Execute sql query, the read data from the database.
|
-- Execute sql query, the read data from the database.
|
||||||
require
|
require
|
||||||
query_not_void: query /= void
|
query_not_void: query /= Void
|
||||||
deferred
|
deferred
|
||||||
end
|
end
|
||||||
|
|
||||||
execute_change
|
execute_change
|
||||||
-- Execute sql query that update/add data.
|
-- Execute sql query that update/add data.
|
||||||
require
|
require
|
||||||
query_not_void: query /= void
|
query_not_void: query /= Void
|
||||||
deferred
|
deferred
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
</option>
|
</option>
|
||||||
<setting name="console_application" value="true"/>
|
<setting name="console_application" value="true"/>
|
||||||
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
|
<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="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="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="error" location="$ISE_LIBRARY\contrib\library\utility\general\error\error-safe.ecf"/>
|
||||||
@@ -23,7 +24,6 @@
|
|||||||
<exclude>/database/database_connection_odbc.e</exclude>
|
<exclude>/database/database_connection_odbc.e</exclude>
|
||||||
</file_rule>
|
</file_rule>
|
||||||
</cluster>
|
</cluster>
|
||||||
<cluster name="interface" location="..\..\interface\" recursive="true"/>
|
|
||||||
<cluster name="persistence_mysql" location=".\src\" recursive="true">
|
<cluster name="persistence_mysql" location=".\src\" recursive="true">
|
||||||
<file_rule>
|
<file_rule>
|
||||||
<exclude>/EIFGENs$</exclude>
|
<exclude>/EIFGENs$</exclude>
|
||||||
|
|||||||
@@ -0,0 +1,35 @@
|
|||||||
|
note
|
||||||
|
description: "[
|
||||||
|
Objects that ...
|
||||||
|
]"
|
||||||
|
author: "$Author$"
|
||||||
|
date: "$Date$"
|
||||||
|
revision: "$Revision$"
|
||||||
|
|
||||||
|
class
|
||||||
|
CMS_STORAGE_MYSQL_BUILDER
|
||||||
|
|
||||||
|
inherit
|
||||||
|
CMS_STORAGE_BUILDER
|
||||||
|
|
||||||
|
create
|
||||||
|
make
|
||||||
|
|
||||||
|
feature {NONE} -- Initialization
|
||||||
|
|
||||||
|
make
|
||||||
|
-- Initialize `Current'.
|
||||||
|
do
|
||||||
|
end
|
||||||
|
|
||||||
|
feature -- Factory
|
||||||
|
|
||||||
|
storage (a_setup: CMS_SETUP): detachable CMS_STORAGE_MYSQL
|
||||||
|
do
|
||||||
|
if attached (create {APPLICATION_JSON_CONFIGURATION_HELPER}).new_database_configuration (a_setup.layout.application_config_path) as l_database_config then
|
||||||
|
create Result.make (create {DATABASE_CONNECTION_MYSQL}.login_with_connection_string (l_database_config.connection_string))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
end
|
||||||
@@ -31,7 +31,10 @@ feature {NONE} -- Initialization
|
|||||||
do
|
do
|
||||||
configure
|
configure
|
||||||
create modules.make (3)
|
create modules.make (3)
|
||||||
|
create storage_drivers.make (2)
|
||||||
|
|
||||||
build_mailer
|
build_mailer
|
||||||
|
initialize_storages
|
||||||
initialize_modules
|
initialize_modules
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -72,6 +75,12 @@ feature {NONE} -- Initialization
|
|||||||
compute_theme_assets_location
|
compute_theme_assets_location
|
||||||
end
|
end
|
||||||
|
|
||||||
|
initialize_storages
|
||||||
|
-- Initialize storages
|
||||||
|
do
|
||||||
|
storage_drivers.force (create {CMS_STORAGE_NULL_BUILDER}, "null")
|
||||||
|
end
|
||||||
|
|
||||||
initialize_modules
|
initialize_modules
|
||||||
-- Intialize core modules.
|
-- Intialize core modules.
|
||||||
local
|
local
|
||||||
@@ -144,6 +153,11 @@ feature -- Access
|
|||||||
to_implement ("Not implemented mailer")
|
to_implement ("Not implemented mailer")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
feature -- Access: storage
|
||||||
|
|
||||||
|
storage_drivers: STRING_TABLE [CMS_STORAGE_BUILDER]
|
||||||
|
-- Precursor
|
||||||
|
|
||||||
feature -- Element change
|
feature -- Element change
|
||||||
|
|
||||||
register_module (m: CMS_MODULE)
|
register_module (m: CMS_MODULE)
|
||||||
|
|||||||
@@ -6,6 +6,9 @@ note
|
|||||||
deferred class
|
deferred class
|
||||||
CMS_SETUP
|
CMS_SETUP
|
||||||
|
|
||||||
|
inherit
|
||||||
|
REFACTORING_HELPER
|
||||||
|
|
||||||
feature -- Access
|
feature -- Access
|
||||||
|
|
||||||
layout: CMS_LAYOUT
|
layout: CMS_LAYOUT
|
||||||
@@ -88,7 +91,6 @@ feature -- Query
|
|||||||
deferred
|
deferred
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
feature -- Access: Theme
|
feature -- Access: Theme
|
||||||
|
|
||||||
themes_location: PATH
|
themes_location: PATH
|
||||||
@@ -109,6 +111,54 @@ feature -- Access: Theme
|
|||||||
theme_name: READABLE_STRING_32
|
theme_name: READABLE_STRING_32
|
||||||
-- theme name.
|
-- theme name.
|
||||||
|
|
||||||
|
feature -- Access: storage
|
||||||
|
|
||||||
|
storage_drivers: STRING_TABLE [CMS_STORAGE_BUILDER]
|
||||||
|
deferred
|
||||||
|
end
|
||||||
|
|
||||||
|
storage (a_error_handler: ERROR_HANDLER): detachable CMS_STORAGE
|
||||||
|
local
|
||||||
|
retried: BOOLEAN
|
||||||
|
l_message: STRING
|
||||||
|
do
|
||||||
|
if not retried then
|
||||||
|
to_implement ("Refactor database setup")
|
||||||
|
if
|
||||||
|
attached (create {APPLICATION_JSON_CONFIGURATION_HELPER}).new_database_configuration (layout.application_config_path) as l_database_config and then
|
||||||
|
attached storage_drivers.item (l_database_config.driver) as l_builder
|
||||||
|
then
|
||||||
|
Result := l_builder.storage (Current)
|
||||||
|
else
|
||||||
|
create {CMS_STORAGE_NULL} Result
|
||||||
|
end
|
||||||
|
else
|
||||||
|
to_implement ("Workaround code, persistence layer does not implement yet this kind of error handling.")
|
||||||
|
-- error hanling.
|
||||||
|
create {CMS_STORAGE_NULL} Result
|
||||||
|
create l_message.make (1024)
|
||||||
|
if attached ((create {EXCEPTION_MANAGER}).last_exception) as l_exception then
|
||||||
|
if attached l_exception.description as l_description then
|
||||||
|
l_message.append (l_description.as_string_32)
|
||||||
|
l_message.append ("%N%N")
|
||||||
|
elseif attached l_exception.trace as l_trace then
|
||||||
|
l_message.append (l_trace)
|
||||||
|
l_message.append ("%N%N")
|
||||||
|
else
|
||||||
|
l_message.append (l_exception.out)
|
||||||
|
l_message.append ("%N%N")
|
||||||
|
end
|
||||||
|
else
|
||||||
|
l_message.append ("The application crash without available information")
|
||||||
|
l_message.append ("%N%N")
|
||||||
|
end
|
||||||
|
a_error_handler.add_custom_error (0, " Database Connection ", l_message)
|
||||||
|
end
|
||||||
|
rescue
|
||||||
|
retried := True
|
||||||
|
retry
|
||||||
|
end
|
||||||
|
|
||||||
feature -- Element change
|
feature -- Element change
|
||||||
|
|
||||||
register_module (m: CMS_MODULE)
|
register_module (m: CMS_MODULE)
|
||||||
|
|||||||
18
library/src/persistence/cms_storage_builder.e
Normal file
18
library/src/persistence/cms_storage_builder.e
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
note
|
||||||
|
description: "[
|
||||||
|
Objects that ...
|
||||||
|
]"
|
||||||
|
author: "$Author$"
|
||||||
|
date: "$Date$"
|
||||||
|
revision: "$Revision$"
|
||||||
|
|
||||||
|
deferred class
|
||||||
|
CMS_STORAGE_BUILDER
|
||||||
|
|
||||||
|
feature -- Factory
|
||||||
|
|
||||||
|
storage (a_setup: CMS_SETUP): detachable CMS_STORAGE
|
||||||
|
deferred
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
22
library/src/persistence/cms_storage_null_builder.e
Normal file
22
library/src/persistence/cms_storage_null_builder.e
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
note
|
||||||
|
description: "[
|
||||||
|
Objects that ...
|
||||||
|
]"
|
||||||
|
author: "$Author$"
|
||||||
|
date: "$Date$"
|
||||||
|
revision: "$Revision$"
|
||||||
|
|
||||||
|
class
|
||||||
|
CMS_STORAGE_NULL_BUILDER
|
||||||
|
|
||||||
|
inherit
|
||||||
|
CMS_STORAGE_BUILDER
|
||||||
|
|
||||||
|
feature -- Factory
|
||||||
|
|
||||||
|
storage (a_setup: CMS_SETUP): detachable CMS_STORAGE_NULL
|
||||||
|
do
|
||||||
|
create Result
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
@@ -31,46 +31,13 @@ feature -- Initialize
|
|||||||
|
|
||||||
initialize
|
initialize
|
||||||
-- Initialize the persitent layer.
|
-- Initialize the persitent layer.
|
||||||
local
|
|
||||||
l_database: DATABASE_CONNECTION
|
|
||||||
retried: BOOLEAN
|
|
||||||
l_message: STRING
|
|
||||||
do
|
do
|
||||||
if not retried then
|
to_implement ("Refactor database setup")
|
||||||
to_implement ("Refactor database setup")
|
if attached setup.storage (error_handler) as l_storage then
|
||||||
if attached (create {APPLICATION_JSON_CONFIGURATION_HELPER}).new_database_configuration (setup.layout.application_config_path) as l_database_config then
|
storage := l_storage
|
||||||
create {DATABASE_CONNECTION_MYSQL} l_database.login_with_connection_string (l_database_config.connection_string)
|
|
||||||
create {CMS_STORAGE_MYSQL} storage.make (l_database)
|
|
||||||
else
|
|
||||||
create {DATABASE_CONNECTION_NULL} l_database.make_common
|
|
||||||
create {CMS_STORAGE_NULL} storage
|
|
||||||
end
|
|
||||||
else
|
else
|
||||||
to_implement ("Workaround code, persistence layer does not implement yet this kind of error handling.")
|
|
||||||
-- error hanling.
|
|
||||||
create {DATABASE_CONNECTION_NULL} l_database.make_common
|
|
||||||
create {CMS_STORAGE_NULL} storage
|
create {CMS_STORAGE_NULL} storage
|
||||||
create l_message.make (1024)
|
|
||||||
if attached ((create {EXCEPTION_MANAGER}).last_exception) as l_exception then
|
|
||||||
if attached l_exception.description as l_description then
|
|
||||||
l_message.append (l_description.as_string_32)
|
|
||||||
l_message.append ("%N%N")
|
|
||||||
elseif attached l_exception.trace as l_trace then
|
|
||||||
l_message.append (l_trace)
|
|
||||||
l_message.append ("%N%N")
|
|
||||||
else
|
|
||||||
l_message.append (l_exception.out)
|
|
||||||
l_message.append ("%N%N")
|
|
||||||
end
|
|
||||||
else
|
|
||||||
l_message.append ("The application crash without available information")
|
|
||||||
l_message.append ("%N%N")
|
|
||||||
end
|
|
||||||
error_handler.add_custom_error (0, " Database Connection ", l_message)
|
|
||||||
end
|
end
|
||||||
rescue
|
|
||||||
retried := True
|
|
||||||
retry
|
|
||||||
end
|
end
|
||||||
|
|
||||||
feature -- Access: Error
|
feature -- Access: Error
|
||||||
@@ -110,7 +77,7 @@ feature -- Status Report
|
|||||||
|
|
||||||
feature -- Access: Node
|
feature -- Access: Node
|
||||||
|
|
||||||
nodes: LIST[CMS_NODE]
|
nodes: LIST [CMS_NODE]
|
||||||
-- List of nodes.
|
-- List of nodes.
|
||||||
do
|
do
|
||||||
debug ("refactor_fixme")
|
debug ("refactor_fixme")
|
||||||
|
|||||||
Reference in New Issue
Block a user