Extracted launcher code into cms/launcher/... libraries.

(mostly to help new project based on ROC CMS).
Renamed and simplified the roc cms server launcher, and the related cms execution.
Updated cms.ini and extract blocks related management into blocks.ini.
Added debug clauses for cms sqlite3 storage.
This commit is contained in:
2015-10-19 22:50:48 +02:00
parent a260bbc2c5
commit f51ddc9796
20 changed files with 476 additions and 105 deletions

View File

@@ -1,32 +1,33 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-13-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-13-0 http://www.eiffel.com/developers/xml/configuration-1-13-0.xsd" name="persistence_sqlite3" uuid="4E536C92-A09F-4305-8230-2EC5ABC51416" library_target="persistence_sqlite3">
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-14-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-14-0 http://www.eiffel.com/developers/xml/configuration-1-14-0.xsd" name="persistence_sqlite3" uuid="4E536C92-A09F-4305-8230-2EC5ABC51416" library_target="persistence_sqlite3">
<target name="persistence_sqlite3">
<root all_classes="true"/>
<option warning="true" void_safety="all">
<assertions precondition="true" postcondition="true" check="true" invariant="true" loop="true" supplier_precondition="true"/>
<assertions precondition="true" supplier_precondition="true"/>
</option>
<setting name="console_application" value="true"/>
<library name="app_env" location="..\..\app_env\app_env-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="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="app_env" location="..\..\app_env\app_env-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="sqlite3" location="$ISE_LIBRARY\unstable\library\persistency\database\sqlite3\sqlite-safe.ecf" readonly="false"/>
<library name="sqlite3" location="$ISE_LIBRARY\unstable\library\persistency\database\sqlite3\sqlite-safe.ecf" readonly="false">
<option msil_application_optimize="false">
<assertions precondition="true" supplier_precondition="true"/>
</option>
</library>
<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="..\implementation\store\" recursive="true"/>
-->
<cluster name="persistence_sqlite" location=".\src\" recursive="true">
<file_rule>
<exclude>/old$</exclude>
<exclude>/EIFGENs$</exclude>
<exclude>/CVS$</exclude>
<exclude>/.svn$</exclude>
<exclude>/old$</exclude>
</file_rule>
</cluster>
</target>

View File

@@ -75,6 +75,9 @@ feature -- Execution
sqlite.begin_transaction (False)
end
transaction_depth := transaction_depth + 1
debug ("roc_storage")
print ("# sql_begin_transaction (depth="+ transaction_depth.out +").%N")
end
end
sql_rollback_transaction
@@ -84,6 +87,9 @@ feature -- Execution
sqlite.rollback
end
transaction_depth := transaction_depth - 1
debug ("roc_storage")
print ("# sql_rollback_transaction (depth="+ transaction_depth.out +").%N")
end
end
sql_commit_transaction
@@ -93,12 +99,18 @@ feature -- Execution
sqlite.commit
end
transaction_depth := transaction_depth - 1
debug ("roc_storage")
print ("# sql_commit_transaction (depth="+ transaction_depth.out +").%N")
end
end
sql_post_execution
-- Post database execution.
-- note: execute after each `sql_query' and `sql_change'.
do
debug ("roc_storage")
print ("# sql_post_execution.%N")
end
-- FIXME
if sqlite.has_error then
write_critical_log (generator + ".post_execution Error occurred!")
@@ -116,6 +128,9 @@ feature -- Operation
local
st: SQLITE_QUERY_STATEMENT
do
debug ("roc_storage")
print ("> sql_query (" +a_sql_statement + ").%N")
end
last_sqlite_result_cursor := Void
create st.make (a_sql_statement, sqlite)
last_statement := st
@@ -129,16 +144,31 @@ feature -- Operation
else
error_handler.add_custom_error (1, "invalid query", "query compilation failed!")
end
debug ("roc_storage")
print ("< sql_query (" +a_sql_statement + ").%N")
end
end
sql_finalize
-- Finalize sql query (i.e destroy previous query statement.
do
if attached last_statement as st then
st.dispose
debug ("roc_storage")
print ("> sql_finalize.%N")
end
if attached last_statement as st then
st.cleanup
end
if attached last_sqlite_result_cursor as cur then
if cur.statement /= last_statement then
check should_not_occurs: False end
cur.statement.cleanup
end
last_sqlite_result_cursor := Void
end
last_sqlite_result_cursor := Void
last_statement := Void
debug ("roc_storage")
print ("< sql_finalize.%N")
end
end
sql_insert (a_sql_statement: STRING; a_params: detachable STRING_TABLE [detachable ANY])
@@ -146,6 +176,9 @@ feature -- Operation
local
st: SQLITE_INSERT_STATEMENT
do
debug ("roc_storage")
print ("> sql_insert (" +a_sql_statement + ").%N")
end
last_sqlite_result_cursor := Void
create st.make (a_sql_statement, sqlite)
last_statement := st
@@ -159,6 +192,9 @@ feature -- Operation
else
error_handler.add_custom_error (1, "invalid query", "query compilation failed!")
end
debug ("roc_storage")
print ("< sql_insert (" +a_sql_statement + ").%N")
end
end
sql_modify (a_sql_statement: STRING; a_params: detachable STRING_TABLE [detachable ANY])
@@ -166,6 +202,9 @@ feature -- Operation
local
st: SQLITE_MODIFY_STATEMENT
do
debug ("roc_storage")
print ("> sql_modify (" +a_sql_statement + ").%N")
end
last_sqlite_result_cursor := Void
create st.make (a_sql_statement, sqlite)
last_statement := st
@@ -179,6 +218,9 @@ feature -- Operation
else
error_handler.add_custom_error (1, "invalid query", "query compilation failed!")
end
debug ("roc_storage")
print ("< sql_modify (" +a_sql_statement + ").%N")
end
end
sqlite_arguments (a_params: STRING_TABLE [detachable ANY]): ARRAYED_LIST [SQLITE_BIND_ARG [ANY]]
@@ -279,32 +321,14 @@ feature -- Operation
feature -- Access
-- sql_rows_count: INTEGER
-- -- Number of rows for last sql execution.
-- do
-- if attached last_sqlite_result_cursor as l_cursor then
-- -- FIXME: find better solution!
-- from
-- Result := 1
-- until
-- not l_cursor.after
-- loop
-- Result := Result + 1
-- end
-- end
-- end
sql_start
-- Set the cursor on first element.
-- <Precursor>.
do
-- Already at first position if any ?
if attached last_sqlite_result_cursor as l_cursor then
-- l_cursor.start
end
-- sqlite cursor `last_sqlite_result_cursor', already at first position if any.
end
sql_after: BOOLEAN
-- Are there no more items to iterate over?
-- <Precursor>.
do
if attached last_sqlite_result_cursor as l_cursor then
Result := l_cursor.after
@@ -312,7 +336,7 @@ feature -- Access
end
sql_forth
-- Fetch next row from last sql execution, if any.
-- <Precursor>.
do
if attached last_sqlite_result_cursor as l_cursor then
l_cursor.forth