Added weight into to the CMS_LINK and provide a `sort' feature for CMS_MENU and related.

Protected cms service from registering many time the same module type.
Moved library/persistence/implementation/* under library/persistence/.
Moved site/www/themes to site/themes
For SQLite storage driver, auto create sqlite db file using associated sql script (to be completed).
Added code in demo module to reuse storage for module purpose.
Always call sql_post_execution in sql_query and sql_change, and not anymore by the callers.
Removed is_web and is_html from {CMS_SETUP}, it was not used.
Reused SHARED_*_ENCODER in CMS_ENCODERS
Added CMS_API.logger rather than using directly the SHARED_LOGGER.log ...
Centralize the implementation of current_user in CMS_REQUEST_UTIL
Removed the inheritance on WSF_FILTER for node handlers, since it is useless and unused.
Added CMS_NODE_API and CMS_USER_API
Prefix html id for block generated html items with "block-", to avoid css name conflict on "main", "content" or similar.
Code cleaning
This commit is contained in:
2015-02-16 13:01:06 +01:00
parent a810b1176c
commit 8d59d25ace
165 changed files with 1430 additions and 2206 deletions

View File

@@ -1,7 +1,7 @@
note
description: "Object that represent Database configuration settings"
date: "$Date: 2015-01-27 19:15:02 +0100 (mar., 27 janv. 2015) $"
revision: "$Revision: 96542 $"
date: "$Date: 2015-02-09 22:29:56 +0100 (lun., 09 févr. 2015) $"
revision: "$Revision: 96596 $"
class
DATABASE_CONFIGURATION
@@ -33,7 +33,7 @@ feature -- Access
connection_string: READABLE_STRING_32
-- Connection string
do
Result := "Driver={" + driver + "};" + database_string
Result := {STRING_32} "Driver={" + driver + {STRING_32} "};" + database_string
end
item (a_param: READABLE_STRING_GENERAL): detachable READABLE_STRING_32

View File

@@ -5,8 +5,8 @@
<option warning="true" void_safety="all">
<assertions precondition="true" postcondition="true" check="true" invariant="true" loop="true" supplier_precondition="true"/>
</option>
<setting name="console_application" value="true"/>
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
<library name="base_extension" location="$ISE_LIBRARY\library\base_extension\base_extension-safe.ecf"/>
<library name="time" location="$ISE_LIBRARY\library\time\time-safe.ecf"/>
<cluster name="cms_model" location=".\src\" recursive="true">
<file_rule>

View File

@@ -5,8 +5,8 @@
<option warning="true" void_safety="none">
<assertions precondition="true" postcondition="true" check="true" invariant="true" loop="true" supplier_precondition="true"/>
</option>
<setting name="console_application" value="true"/>
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf"/>
<library name="base_extension" location="$ISE_LIBRARY\library\base_extension\base_extension.ecf"/>
<library name="time" location="$ISE_LIBRARY\library\time\time.ecf"/>
<cluster name="cms_model" location=".\src\" recursive="true">
<file_rule>

View File

@@ -2,18 +2,29 @@ note
description: "[
Abstraction to represent a URI link in the CMS system.
]"
date: "$Date$"
revision: "$Revision$"
date: "$Date: 2015-02-09 22:29:56 +0100 (lun., 09 févr. 2015) $"
revision: "$Revision: 96596 $"
deferred class
CMS_LINK
inherit
REFACTORING_HELPER
undefine
is_equal
end
DEBUG_OUTPUT
undefine
is_equal
end
ITERABLE [CMS_LINK]
undefine
is_equal
end
COMPARABLE
feature -- Access
@@ -23,6 +34,21 @@ feature -- Access
location: READABLE_STRING_8
-- Associated url location.
weight: INTEGER
-- Optional weight used for order.
feature -- Comparison
is_less alias "<" (other: like Current): BOOLEAN
-- Is current object less than `other'?
do
if weight = other.weight then
Result := title < other.title
else
Result := weight < other.weight
end
end
feature -- status report
is_active: BOOLEAN
@@ -53,6 +79,16 @@ feature -- status report
deferred
end
feature -- Element change
set_weight (a_weight: INTEGER)
-- Set `weight' to `a_weight'.
do
weight := a_weight
ensure
weight_set: weight = a_weight
end
feature -- Query
parent: detachable CMS_LINK
@@ -84,9 +120,12 @@ feature -- Status report
create Result.make_from_string (title)
Result.append_string_general (" -> ")
Result.append_string_general (location)
Result.append_string_general (" [")
Result.append_integer (weight)
Result.append_string_general ("]")
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

@@ -2,8 +2,8 @@ note
description: "[
Abstraction to represent a links container in the CMS system.
]"
date: "$Date$"
revision: "$Revision$"
date: "$Date: 2015-02-09 22:29:56 +0100 (lun., 09 févr. 2015) $"
revision: "$Revision: 96596 $"
deferred class
CMS_LINK_COMPOSITE
@@ -30,6 +30,27 @@ feature -- Element change
deferred
end
sort
-- Sort `items' and also recursively in sub items.
local
l_sorter: QUICK_SORTER [CMS_LINK]
do
create l_sorter.make (create {COMPARABLE_COMPARATOR [CMS_LINK]})
if attached items as lst then
l_sorter.sort (lst)
across
lst as ic
loop
if
attached {CMS_LINK_COMPOSITE} ic.item as l_composite and then
not l_composite.is_empty
then
l_composite.sort
end
end
end
end
feature -- status report
is_empty: BOOLEAN
@@ -47,6 +68,6 @@ feature -- status report
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

@@ -2,8 +2,8 @@ note
description: "[
Abstraction to represent a link to a CMS resource.
]"
date: "$Date$"
revision: "$Revision$"
date: "$Date: 2015-02-09 22:29:56 +0100 (lun., 09 févr. 2015) $"
revision: "$Revision: 96596 $"
class
CMS_LOCAL_LINK
@@ -16,6 +16,8 @@ inherit
items as children,
extend as add_link,
remove as remove_link
undefine
is_equal
end
create
@@ -168,6 +170,6 @@ feature {NONE} -- Implementation
invariant
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

@@ -3,8 +3,8 @@ note
Abstraction to represent a MENU in the CMS system.
It has items as sub menu/link.
]"
date: "$Date$"
revision: "$Revision$"
date: "$Date: 2015-02-09 22:29:56 +0100 (lun., 09 févr. 2015) $"
revision: "$Revision: 96596 $"
class
CMS_MENU
@@ -61,6 +61,17 @@ feature -- Status report
Result := items.is_empty
end
has (lnk: CMS_LINK): BOOLEAN
do
across
items as ic
until
Result
loop
Result := ic.item.location.same_string (lnk.location)
end
end
feature -- Element change
extend (lnk: CMS_LINK)
@@ -91,6 +102,6 @@ feature -- Access
invariant
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

@@ -1,112 +0,0 @@
note
description: "Summary description for {CMS_STORAGE_MYSQL}."
date: "$Date: 2015-01-27 19:15:02 +0100 (mar., 27 janv. 2015) $"
revision: "$Revision: 96542 $"
class
CMS_STORAGE_MYSQL
inherit
CMS_STORAGE
CMS_STORAGE_STORE_SQL
CMS_USER_STORAGE_MYSQL
CMS_NODE_STORAGE_MYSQL
REFACTORING_HELPER
create
make
--feature {NONE} -- Initialization
-- make (a_connection: DATABASE_CONNECTION)
-- --
-- require
-- is_connected: a_connection.is_connected
-- do
-- connection := a_connection
-- log.write_information (generator + ".make - is database connected? "+ a_connection.is_connected.out )
-- create {DATABASE_HANDLER_IMPL} db_handler.make (a_connection)
-- create error_handler.make
---- error_handler.add_synchronization (db_handler.database_error_handler)
-- end
-- db_handler: DATABASE_HANDLER
-- connection: DATABASE_CONNECTION
-- -- Current database connection.
--feature -- Query
-- sql_post_execution
-- -- Post database execution.
-- 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)
-- end
-- end
-- sql_begin_transaction
-- do
-- connection.begin_transaction
-- end
-- sql_commit_transaction
-- do
-- connection.commit
-- end
-- sql_query (a_sql_statement: STRING; a_params: detachable STRING_TABLE [detachable ANY])
-- do
-- check_sql_query_validity (a_sql_statement, a_params)
-- db_handler.set_query (create {DATABASE_QUERY}.data_reader (a_sql_statement, a_params))
-- db_handler.execute_query
-- end
-- sql_change (a_sql_statement: STRING; a_params: detachable STRING_TABLE [detachable ANY])
-- do
-- check_sql_query_validity (a_sql_statement, a_params)
-- db_handler.set_query (create {DATABASE_QUERY}.data_reader (a_sql_statement, a_params))
-- db_handler.execute_change
-- end
-- sql_rows_count: INTEGER
-- -- Number of rows for last sql execution.
-- do
-- Result := db_handler.count
-- end
-- sql_start
-- -- Set the cursor on first element.
-- do
-- db_handler.start
-- end
-- sql_after: BOOLEAN
-- -- Are there no more items to iterate over?
-- do
-- Result := db_handler.after
-- end
-- sql_forth
-- -- Fetch next row from last sql execution, if any.
-- do
-- db_handler.forth
-- end
-- sql_item (a_index: INTEGER): detachable ANY
-- do
-- if attached {DB_TUPLE} db_handler.item as l_item and then l_item.count >= a_index then
-- Result := l_item.item (a_index)
-- else
-- check has_item_at_index: False end
-- end
-- end
end

View File

@@ -1,112 +0,0 @@
note
description: "Summary description for {CMS_STORAGE_MYSQL}."
date: "$Date: 2015-01-27 19:15:02 +0100 (mar., 27 janv. 2015) $"
revision: "$Revision: 96542 $"
class
CMS_STORAGE_SQLITE
inherit
CMS_STORAGE
CMS_STORAGE_STORE_SQL
CMS_USER_STORAGE_SQLITE
CMS_NODE_STORAGE_SQLITE
REFACTORING_HELPER
create
make
--feature {NONE} -- Initialization
-- make (a_connection: DATABASE_CONNECTION)
-- --
-- require
-- is_connected: a_connection.is_connected
-- do
-- connection := a_connection
-- log.write_information (generator + ".make_with_database is database connected? "+ a_connection.is_connected.out )
-- create {DATABASE_HANDLER_IMPL} db_handler.make (a_connection)
-- create error_handler.make
---- error_handler.add_synchronization (db_handler.database_error_handler)
-- end
-- db_handler: DATABASE_HANDLER
-- connection: DATABASE_CONNECTION
-- -- Current database connection.
--feature -- Access: user
-- sql_post_execution
-- -- Post database execution.
-- 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)
-- end
-- end
-- sql_begin_transaction
-- do
-- connection.begin_transaction
-- end
-- sql_commit_transaction
-- do
-- connection.commit
-- end
-- sql_query (a_sql_statement: STRING; a_params: detachable STRING_TABLE [detachable ANY])
-- do
-- check_sql_query_validity (a_sql_statement, a_params)
-- db_handler.set_query (create {DATABASE_QUERY}.data_reader (a_sql_statement, a_params))
-- db_handler.execute_query
-- end
-- sql_change (a_sql_statement: STRING; a_params: detachable STRING_TABLE [detachable ANY])
-- do
-- check_sql_query_validity (a_sql_statement, a_params)
-- db_handler.set_query (create {DATABASE_QUERY}.data_reader (a_sql_statement, a_params))
-- db_handler.execute_change
-- end
-- sql_rows_count: INTEGER
-- -- Number of rows for last sql execution.
-- do
-- Result := db_handler.count
-- end
-- sql_start
-- -- Set the cursor on first element.
-- do
-- db_handler.start
-- end
-- sql_after: BOOLEAN
-- -- Are there no more items to iterate over?
-- do
-- Result := db_handler.after
-- end
-- sql_forth
-- -- Fetch next row from last sql execution, if any.
-- do
-- db_handler.forth
-- end
-- sql_item (a_index: INTEGER): detachable ANY
-- do
-- if attached {DB_TUPLE} db_handler.item as l_item and then l_item.count >= a_index then
-- Result := l_item.item (a_index)
-- else
-- check has_item_at_index: False end
-- end
-- end
end

View File

@@ -1,43 +0,0 @@
note
description: "[
Objects that ...
]"
author: "$Author: jfiat $"
date: "$Date: 2015-01-27 19:15:02 +0100 (mar., 27 janv. 2015) $"
revision: "$Revision: 96542 $"
class
CMS_STORAGE_SQLITE_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_SQLITE
local
s: STRING
do
if attached (create {APPLICATION_JSON_CONFIGURATION_HELPER}).new_database_configuration (a_setup.layout.application_config_path) as l_database_config then
s := "Driver=SQLite3 ODBC Driver;Database="
if attached l_database_config.database_name as db_name then
s.append (db_name)
end
s.append (";LongNames=0;Timeout=1000;NoTXN=0;SyncPragma=NORMAL;StepAPI=0;")
create Result.make (create {DATABASE_CONNECTION_ODBC}.login_with_connection_string (s))
--create Result.make (create {DATABASE_CONNECTION_ODBC}.login_with_connection_string (l_database_config.connection_string))
end
end
end

View File

@@ -1,8 +1,8 @@
note
description: "Summary description for {CMS_STORAGE_STORE_SQL}."
author: ""
date: "$Date: 2015-01-27 19:15:02 +0100 (mar., 27 janv. 2015) $"
revision: "$Revision: 96542 $"
date: "$Date: 2015-02-13 13:08:13 +0100 (ven., 13 févr. 2015) $"
revision: "$Revision: 96616 $"
deferred class
CMS_STORAGE_STORE_SQL
@@ -28,6 +28,14 @@ feature {NONE} -- Initialization
-- error_handler.add_synchronization (db_handler.database_error_handler)
end
feature -- Status report
is_available: BOOLEAN
-- Is storage available?
do
Result := connection.is_connected
end
feature {NONE} -- Implementation
db_handler: DATABASE_HANDLER
@@ -66,6 +74,7 @@ feature -- Query
check_sql_query_validity (a_sql_statement, a_params)
db_handler.set_query (create {DATABASE_QUERY}.data_reader (a_sql_statement, a_params))
db_handler.execute_query
sql_post_execution
end
sql_change (a_sql_statement: STRING; a_params: detachable STRING_TABLE [detachable ANY])
@@ -73,6 +82,7 @@ feature -- Query
check_sql_query_validity (a_sql_statement, a_params)
db_handler.set_query (create {DATABASE_QUERY}.data_reader (a_sql_statement, a_params))
db_handler.execute_change
sql_post_execution
end
sql_rows_count: INTEGER

View File

@@ -7,19 +7,19 @@
</option>
<setting name="console_application" value="true"/>
<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="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="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="layout" location="..\..\layout\layout-safe.ecf"/>
<library name="logging" location="$ISE_LIBRARY\library\runtime\logging\logging-safe.ecf"/>
<library name="model" location="..\..\..\model\cms_model-safe.ecf"/>
<library name="model" location="..\..\model\cms_model-safe.ecf"/>
<library name="mysql" location="$ISE_LIBRARY\library\store\dbms\rdbms\mysql\mysql-safe.ecf"/>
<library name="store" location="$ISE_LIBRARY\library\store\store-safe.ecf" readonly="false"/>
<library name="thread" location="$ISE_LIBRARY\library\thread\thread-safe.ecf"/>
<library name="time" location="$ISE_LIBRARY\library\time\time-safe.ecf"/>
<cluster name="common" location="..\common\" recursive="true">
<cluster name="common" location="..\implementation\store\" recursive="true">
<file_rule>
<exclude>/database/database_connection_odbc.e</exclude>
</file_rule>

View File

@@ -7,19 +7,19 @@
</option>
<setting name="console_application" value="true"/>
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf"/>
<library name="cms" location="..\..\..\..\cms.ecf" readonly="false"/>
<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="json" location="$ISE_LIBRARY\contrib\library\text\parser\json\library\json.ecf" readonly="false"/>
<library name="layout" location="..\..\..\layout\layout.ecf"/>
<library name="layout" location="..\..\layout\layout.ecf"/>
<library name="logging" location="$ISE_LIBRARY\library\runtime\logging\logging.ecf"/>
<library name="model" location="..\..\..\model\cms_model.ecf"/>
<library name="model" location="..\..\model\cms_model.ecf"/>
<library name="mysql" location="$ISE_LIBRARY\library\store\dbms\rdbms\mysql\mysql.ecf"/>
<library name="store" location="$ISE_LIBRARY\library\store\store.ecf" readonly="false"/>
<library name="thread" location="$ISE_LIBRARY\library\thread\thread.ecf"/>
<library name="time" location="$ISE_LIBRARY\library\time\time.ecf"/>
<cluster name="common" location="..\common\" recursive="true">
<cluster name="common" location="..\implementation\store\" recursive="true">
<file_rule>
<exclude>/database/database_connection_odbc.e</exclude>
</file_rule>

View File

@@ -0,0 +1,31 @@
note
description: "Summary description for {CMS_STORAGE_MYSQL}."
date: "$Date: 2015-02-09 22:29:56 +0100 (lun., 09 févr. 2015) $"
revision: "$Revision: 96596 $"
class
CMS_STORAGE_MYSQL
inherit
CMS_STORAGE
CMS_STORAGE_STORE_SQL
CMS_USER_STORAGE_MYSQL
CMS_NODE_STORAGE_MYSQL
REFACTORING_HELPER
create
make
feature -- Status report
is_initialized: BOOLEAN
-- Is storage initialized?
do
Result := has_user
end
end

View File

@@ -0,0 +1,100 @@
note
description: "Summary description for {ROLE_TEST_SET}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
ROLE_TEST_SET
inherit
EQA_TEST_SET
redefine
on_prepare,
on_clean
select
default_create
end
ABSTRACT_DB_TEST
rename
default_create as default_db_test
end
feature {NONE} -- Events
on_prepare
-- <Precursor>
do
(create {CLEAN_DB}).clean_db(connection)
end
on_clean
-- <Precursor>
do
end
feature -- Test routines
test_roles_empty
do
assert ("Not elements",role_provider.roles.after)
assert ("Count = 0", role_provider.count = 0)
end
test_roles_by_id_not_exist
do
assert ("Void", role_provider.role (1) = Void)
end
test_roles_by_name_not_exist
do
assert ("Void", role_provider.role_by_name ("admin") = Void)
end
test_new_role
do
assert ("Count = 0", role_provider.count = 0)
role_provider.new_role ("admin")
assert ("Count = 1", role_provider.count = 1)
assert ("Expected role", attached role_provider.role (1) as l_role and then l_role.name ~ "admin")
assert ("Expected role", attached role_provider.role_by_name ("admin") as l_role and then l_role.id = 1)
end
test_permissions_empty_not_exist_role
do
assert ("Not elements",role_provider.permission_by_role (1).after)
end
test_permissions_empty_exist_role
do
assert ("Count = 0", role_provider.count = 0)
role_provider.new_role ("admin")
assert ("Count = 1", role_provider.count = 1)
assert ("Exist role",not role_provider.roles.after)
assert ("Not permission by role 1 elements",role_provider.permission_by_role (1).after)
end
test_new_role_with_permissions
do
assert ("Count = 0", role_provider.count = 0)
role_provider.new_role ("admin")
role_provider.save_role_permission (1, "Create Page")
role_provider.save_role_permission (1, "Edit Page")
role_provider.save_role_permission (1, "Delete Page")
assert ("Count = 1", role_provider.count = 1)
assert ("Exist role",not role_provider.roles.after)
assert ("Exist role permissions",not role_provider.permission_by_role (1).after)
assert ("Not Exist role permissions, for id 2",role_provider.permission_by_role (2).after)
end
feature {NONE} -- Implementation
role_provider: ROLE_DATA_PROVIDER
-- role provider.
once
create Result.make (connection)
end
end

View File

@@ -7,9 +7,9 @@
</option>
<setting name="concurrency" value="thread"/>
<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="crypto" location="$ISE_LIBRARY\unstable\library\text\encryption\crypto\crypto-safe.ecf"/>
<library name="model" location="..\..\..\..\model\cms_model-safe.ecf"/>
<library name="model" location="..\..\..\model\cms_model-safe.ecf"/>
<library name="persitence_mysql" location="..\persistence_mysql-safe.ecf" readonly="false"/>
<library name="process" location="$ISE_LIBRARY\library\process\process-safe.ecf"/>
<library name="testing" location="$ISE_LIBRARY\library\testing\testing-safe.ecf"/>

View File

@@ -7,19 +7,19 @@
</option>
<setting name="console_application" value="true"/>
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
<library name="cms" location="..\..\..\..\cms-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="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="layout" location="..\..\layout\layout-safe.ecf"/>
<library name="logging" location="$ISE_LIBRARY\library\runtime\logging\logging-safe.ecf"/>
<library name="model" location="..\..\..\model\cms_model-safe.ecf"/>
<library name="model" location="..\..\model\cms_model-safe.ecf"/>
<library name="odbc" location="$ISE_LIBRARY\library\store\dbms\rdbms\odbc\odbc-safe.ecf"/>
<library name="store" location="$ISE_LIBRARY\library\store\store-safe.ecf" readonly="false"/>
<library name="thread" location="$ISE_LIBRARY\library\thread\thread-safe.ecf"/>
<library name="time" location="$ISE_LIBRARY\library\time\time-safe.ecf"/>
<cluster name="common" location="..\common\" recursive="true"/>
<cluster name="common" location="..\implementation\store\" recursive="true"/>
<cluster name="persistence_sqlite" location=".\src\" recursive="true">
<file_rule>
<exclude>/EIFGENs$</exclude>

View File

@@ -7,19 +7,19 @@
</option>
<setting name="console_application" value="true"/>
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf"/>
<library name="cms" location="..\..\..\..\cms.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="json" location="$ISE_LIBRARY\contrib\library\text\parser\json\library\json.ecf" readonly="false"/>
<library name="layout" location="..\..\..\layout\layout.ecf"/>
<library name="layout" location="..\..\layout\layout.ecf"/>
<library name="logging" location="$ISE_LIBRARY\library\runtime\logging\logging.ecf"/>
<library name="model" location="..\..\..\model\cms_model.ecf"/>
<library name="model" location="..\..\model\cms_model.ecf"/>
<library name="odbc" location="$ISE_LIBRARY\library\store\dbms\rdbms\odbc\odbc.ecf"/>
<library name="store" location="$ISE_LIBRARY\library\store\store.ecf" readonly="false"/>
<library name="thread" location="$ISE_LIBRARY\library\thread\thread.ecf"/>
<library name="time" location="$ISE_LIBRARY\library\time\time.ecf"/>
<cluster name="common" location="..\common\" recursive="true"/>
<cluster name="common" location="..\implementation\store\" recursive="true"/>
<cluster name="persistence_sqlite" location=".\src\" recursive="true">
<file_rule>
<exclude>/EIFGENs$</exclude>

View File

@@ -1,8 +1,8 @@
note
description: "Summary description for {CMS_NODE_STORAGE_SQLITE}."
author: ""
date: "$Date: 2015-01-27 19:15:02 +0100 (mar., 27 janv. 2015) $"
revision: "$Revision: 96542 $"
date: "$Date: 2015-02-13 13:08:13 +0100 (ven., 13 févr. 2015) $"
revision: "$Revision: 96616 $"
deferred class
CMS_NODE_STORAGE_SQLITE
@@ -50,7 +50,6 @@ feature -- Access: iterator
log.write_information (generator + ".nodes_iterator")
create l_parameters.make (0)
sql_query (select_nodes, l_parameters)
sql_post_execution
create Result.make (db_handler, agent fetch_node)
end
@@ -69,7 +68,6 @@ feature -- Access: iterator
create l_query.make_from_string (select_recent_nodes)
sql_query (l_query, l_parameters)
create Result.make (db_handler, agent fetch_node)
sql_post_execution
end
end

View File

@@ -0,0 +1,31 @@
note
description: "Summary description for {CMS_STORAGE_MYSQL}."
date: "$Date: 2015-02-09 22:29:56 +0100 (lun., 09 févr. 2015) $"
revision: "$Revision: 96596 $"
class
CMS_STORAGE_SQLITE
inherit
CMS_STORAGE
CMS_STORAGE_STORE_SQL
CMS_USER_STORAGE_SQLITE
CMS_NODE_STORAGE_SQLITE
REFACTORING_HELPER
create
make
feature -- Status report
is_initialized: BOOLEAN
-- Is storage initialized?
do
Result := has_user
end
end

View File

@@ -0,0 +1,91 @@
note
description: "[
Objects that ...
]"
author: "$Author: jfiat $"
date: "$Date: 2015-02-13 13:08:13 +0100 (ven., 13 févr. 2015) $"
revision: "$Revision: 96616 $"
class
CMS_STORAGE_SQLITE_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_SQLITE
local
s: STRING
do
if attached (create {APPLICATION_JSON_CONFIGURATION_HELPER}).new_database_configuration (a_setup.layout.application_config_path) as l_database_config then
s := "Driver=SQLite3 ODBC Driver;Database="
if attached l_database_config.database_name as db_name then
s.append (db_name)
end
s.append (";LongNames=0;Timeout=1000;NoTXN=0;SyncPragma=NORMAL;StepAPI=0;")
create Result.make (create {DATABASE_CONNECTION_ODBC}.login_with_connection_string (s))
--create Result.make (create {DATABASE_CONNECTION_ODBC}.login_with_connection_string (l_database_config.connection_string))
if Result.is_available then
if not Result.is_initialized then
initialize (a_setup, Result)
end
end
end
end
initialize (a_setup: CMS_SETUP; a_storage: CMS_STORAGE_STORE_SQL)
do
initialize_schema (a_setup, a_storage)
initialize_data (a_setup, a_storage)
end
initialize_schema (a_setup: CMS_SETUP; a_storage: CMS_STORAGE_STORE_SQL)
local
p: PATH
f: PLAIN_TEXT_FILE
sql: STRING
do
p := a_setup.layout.path.extended ("scripts").extended ("sqlite.sql")
create f.make_with_path (p)
if f.exists and then f.is_access_readable then
create sql.make (f.count)
f.open_read
from
f.start
until
f.exhausted or f.end_of_file
loop
f.read_stream_thread_aware (1_024)
sql.append (f.last_string)
end
f.close
a_storage.error_handler.reset
-- a_storage.sql_begin_transaction
a_storage.sql_change (sql, Void)
-- a_storage.sql_commit_transaction
end
end
initialize_data (a_setup: CMS_SETUP; a_storage: CMS_STORAGE_STORE_SQL)
local
u: CMS_USER
do
create u.make ("admin")
u.set_password ("#admin#")
u.set_email (a_setup.site_email)
a_storage.new_user (u)
end
end

View File

@@ -7,9 +7,9 @@
</option>
<setting name="concurrency" value="thread"/>
<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="crypto" location="$ISE_LIBRARY\unstable\library\text\encryption\crypto\crypto-safe.ecf"/>
<library name="model" location="..\..\..\..\model\cms_model-safe.ecf"/>
<library name="model" location="..\..\..\model\cms_model-safe.ecf"/>
<library name="persitence_sqlite" location="..\persistence_sqlite-safe.ecf" readonly="false"/>
<library name="process" location="$ISE_LIBRARY\library\process\process-safe.ecf"/>
<library name="testing" location="$ISE_LIBRARY\library\testing\testing-safe.ecf"/>