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,7 +1,8 @@
<?xml version="1.0" encoding="ISO-8859-1"?> <?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="demo" uuid="3643E657-BCBE-46AA-931B-71EAEA877A18" library_target="demo"> <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="demo" uuid="3643E657-BCBE-46AA-931B-71EAEA877A18" library_target="demo">
<description>Example/demo for Eiffel ROC CMS library</description> <description>Example/demo for Eiffel ROC CMS library</description>
<target name="common" abstract="true"> <target name="common" abstract="true">
<root class="DEMO_CMS_SERVER" feature="make_and_launch"/>
<file_rule> <file_rule>
<exclude>/EIFGENs$</exclude> <exclude>/EIFGENs$</exclude>
<exclude>/CVS$</exclude> <exclude>/CVS$</exclude>
@@ -12,7 +13,12 @@
</option> </option>
<setting name="concurrency" value="thread"/> <setting name="concurrency" value="thread"/>
<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">
<option>
<assertions precondition="true" postcondition="true" supplier_precondition="true"/>
</option>
</library>
<library name="cms_admin_module" location="..\..\modules\admin\admin-safe.ecf" readonly="false"/>
<library name="cms_app_env" location="..\..\library\app_env\app_env-safe.ecf" readonly="false"/> <library name="cms_app_env" location="..\..\library\app_env\app_env-safe.ecf" readonly="false"/>
<library name="cms_auth_module" location="..\..\modules\auth\auth-safe.ecf" readonly="false"/> <library name="cms_auth_module" location="..\..\modules\auth\auth-safe.ecf" readonly="false"/>
<library name="cms_basic_auth_module" location="..\..\modules\basic_auth\basic_auth-safe.ecf" readonly="false"/> <library name="cms_basic_auth_module" location="..\..\modules\basic_auth\basic_auth-safe.ecf" readonly="false"/>
@@ -24,35 +30,31 @@
<library name="cms_node_module" location="..\..\modules\node\node-safe.ecf" readonly="false"/> <library name="cms_node_module" location="..\..\modules\node\node-safe.ecf" readonly="false"/>
<library name="cms_oauth_20_module" location="..\..\modules\oauth20\oauth20-safe.ecf" readonly="false"/> <library name="cms_oauth_20_module" location="..\..\modules\oauth20\oauth20-safe.ecf" readonly="false"/>
<library name="cms_openid_module" location="..\..\modules\openid\openid-safe.ecf" readonly="false"/> <library name="cms_openid_module" location="..\..\modules\openid\openid-safe.ecf" readonly="false"/>
<library name="cms_admin_module" location="..\..\modules\admin\admin-safe.ecf" readonly="false"/>
<library name="cms_recent_changes_module" location="..\..\modules\recent_changes\recent_changes-safe.ecf" readonly="false"/> <library name="cms_recent_changes_module" location="..\..\modules\recent_changes\recent_changes-safe.ecf" readonly="false"/>
<library name="persistence_sqlite3" location="..\..\library\persistence\sqlite3\sqlite3-safe.ecf" readonly="false"/> <library name="persistence_sqlite3" location="..\..\library\persistence\sqlite3\sqlite3-safe.ecf" readonly="false">
<library name="persistence_store_odbc" location="..\..\library\persistence\store_odbc\store_odbc-safe.ecf" readonly="false"/> <option>
<assertions/>
</option>
</library>
<!-- <!--
<library name="persistence_store_mysql" location="..\..\library\persistence\store_mysql\store_mysql-safe.ecf" readonly="false"/> <library name="persistence_store_odbc" location="..\..\library\persistence\store_odbc\store_odbc-safe.ecf" />
<library name="persistence_store_mysql" location="..\..\library\persistence\store_mysql\store_mysql-safe.ecf" />
--> -->
<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"/>
</target> </target>
<target name="demo_any" extends="common"> <target name="demo_any" extends="common">
<root class="EWF_ROC_SERVER" feature="make_and_launch"/>
<setting name="concurrency" value="thread"/> <setting name="concurrency" value="thread"/>
<library name="cgi" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\connector\cgi-safe.ecf"/> <library name="any_launcher" location="..\..\launcher\any-safe.ecf" readonly="false"/>
<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"/>
<library name="standalone" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\connector\standalone-safe.ecf"/>
<cluster name="launcher" location=".\launcher\any\" recursive="true"/>
<cluster name="src" location=".\src\" recursive="true"/> <cluster name="src" location=".\src\" recursive="true"/>
</target> </target>
<target name="demo_standalone" extends="common"> <target name="demo_standalone" extends="common">
<root class="EWF_ROC_SERVER" feature="make_and_launch"/>
<option debug="true"> <option debug="true">
<debug name="dbglog" enabled="true"/> <debug name="dbglog" enabled="true"/>
</option> </option>
<setting name="concurrency" value="thread"/> <setting name="concurrency" value="thread"/>
<variable name="httpd_ssl_disabled" value="true"/> <variable name="httpd_ssl_disabled" value="true"/>
<library name="default_standalone" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\default\standalone-safe.ecf"/> <library name="standalone_launcher" location="..\..\launcher\standalone-safe.ecf" readonly="false"/>
<cluster name="launcher" location=".\launcher\default\" recursive="true"/>
<cluster name="src" location=".\src\" recursive="true"/> <cluster name="src" location=".\src\" recursive="true"/>
</target> </target>
<target name="demo_standalone_none" extends="demo_standalone"> <target name="demo_standalone_none" extends="demo_standalone">
@@ -64,25 +66,14 @@
<target name="demo_standalone_scoop" extends="demo_standalone"> <target name="demo_standalone_scoop" extends="demo_standalone">
<setting name="concurrency" value="scoop"/> <setting name="concurrency" value="scoop"/>
</target> </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"/>
<cluster name="launcher" location=".\launcher\default\" recursive="true"/>
<cluster name="src" location=".\src\" recursive="true"/>
</target>
<target name="demo_cgi" extends="common"> <target name="demo_cgi" extends="common">
<root class="EWF_ROC_SERVER" feature="make_and_launch"/>
<setting name="concurrency" value="none"/> <setting name="concurrency" value="none"/>
<library name="default_cgi" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\default\cgi-safe.ecf"/> <library name="cgi_launcher" location="..\..\launcher\cgi-safe.ecf" readonly="false"/>
<cluster name="launcher" location=".\launcher\default\" recursive="true"/>
<cluster name="src" location=".\src\" recursive="true"/> <cluster name="src" location=".\src\" recursive="true"/>
</target> </target>
<target name="demo_libfcgi" extends="common"> <target name="demo_libfcgi" extends="common">
<root class="EWF_ROC_SERVER" feature="make_and_launch"/>
<setting name="concurrency" value="none"/> <setting name="concurrency" value="none"/>
<library name="default_libfcgi" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\default\libfcgi-safe.ecf"/> <library name="libfcgi_launcher" location="..\..\launcher\libfcgi-safe.ecf" readonly="false"/>
<cluster name="launcher" location=".\launcher\default\" recursive="true"/>
<cluster name="src" location=".\src\" recursive="true"/> <cluster name="src" location=".\src\" recursive="true"/>
</target> </target>
<target name="demo" extends="demo_standalone"> <target name="demo" extends="demo_standalone">

View File

@@ -0,0 +1,38 @@
### Blocks settings
#navigation.region=sidebar_first
#navigation.condition=is_front
management.conditions[]=path:admin*
management.conditions[]=is_front
#Feeds
feed.news.weight=3
feed.news.region=feed_news
feed.news.region=content
feed.news.condition=<none>
feed.forum.weight=2
feed.forum.region=feed_forum
feed.forum.region=<none>
feed.forum.condition=<none>
feed.forum.options[size]=15
#Updates
recent_changes.region=content
recent_changes.condition=is_front
recent_changes.title=Updates
recent_changes.options[size]=3
#Aliases
&aliases[foo]=management
&aliases[bar]=feed.forum
foo.region=content
foo.condition=is_front
foo.weight=-10
bar.region=content
bar.condition=is_front
bar.title=Bar

View File

@@ -21,28 +21,10 @@ output=@stderr
# for each module, this can be overwritten with # for each module, this can be overwritten with
# module_name= on or off # module_name= on or off
*=all *=all
admin=on
auth=on
basic_auth=on
blog=on
debug=on
demo=on
node=on
oauth20=on
openid=on
[blocks] [blocks]
#navigation.region=sidebar_first @include=blocks.ini
feed.news.region=feed_news
feed.news.condition=is_front
feed.forum.region=feed_forum
feed.forum.condition=is_front
#management.condition=is_front
#navigation.condition=is_front
[admin] [admin]
# CMS Installation, are accessible by "all", "none" or uppon "permission". (default is none) # CMS Installation, are accessible by "all", "none" or uppon "permission". (default is none)
installation_access=permission
installation_access=all installation_access=all

View File

@@ -1,31 +1,21 @@
note note
description: "Summary description for {EWF_ROC_SERVER_EXECUTION}." description: "[
CMS Execution for the demo server.
]"
date: "$Date$" date: "$Date$"
revision: "$Revision$" revision: "$Revision$"
class class
EWF_ROC_SERVER_EXECUTION DEMO_CMS_EXECUTION
inherit inherit
CMS_EXECUTION CMS_EXECUTION
redefine
initialize
end
REFACTORING_HELPER
SHARED_LOGGER
create create
make make
feature {NONE} -- Initialization feature {NONE} -- Initialization
initialize
do
Precursor
end
initial_cms_setup: CMS_DEFAULT_SETUP initial_cms_setup: CMS_DEFAULT_SETUP
-- CMS setup. -- CMS setup.
local local
@@ -39,18 +29,17 @@ feature {NONE} -- Initialization
create Result.make (l_env) create Result.make (l_env)
end end
feature -- CMS setup feature -- CMS storage
setup_storage (a_setup: CMS_SETUP) setup_storage (a_setup: CMS_SETUP)
do do
debug ("refactor_fixme")
to_implement ("To implement custom storage")
end
-- a_setup.storage_drivers.force (create {CMS_STORAGE_STORE_MYSQL_BUILDER}.make, "mysql")
a_setup.storage_drivers.force (create {CMS_STORAGE_SQLITE3_BUILDER}.make, "sqlite3") a_setup.storage_drivers.force (create {CMS_STORAGE_SQLITE3_BUILDER}.make, "sqlite3")
a_setup.storage_drivers.force (create {CMS_STORAGE_STORE_ODBC_BUILDER}.make, "odbc") -- a_setup.storage_drivers.force (create {CMS_STORAGE_STORE_MYSQL_BUILDER}.make, "mysql")
-- a_setup.storage_drivers.force (create {CMS_STORAGE_STORE_ODBC_BUILDER}.make, "odbc")
end end
feature -- CMS modules
setup_modules (a_setup: CMS_SETUP) setup_modules (a_setup: CMS_SETUP)
-- Setup additional modules. -- Setup additional modules.
local local

View File

@@ -0,0 +1,18 @@
note
description: "[
DEMO application server.
]"
date: "$Date: 2015-02-09 22:29:56 +0100 (lun., 09 févr. 2015) $"
revision: "$Revision: 96596 $"
class
DEMO_CMS_SERVER
inherit
ROC_CMS_LAUNCHER [DEMO_CMS_EXECUTION]
create
make_and_launch
end

10
launcher/README.txt Normal file
View File

@@ -0,0 +1,10 @@
Collection of ROC CMS launcher ready to use.
- Include any-safe.ecf to use any of cgi, libfcgi or standalone connector.
- Include standalone-safe.ecf to use standalone connector.
- Include libfcgi-safe.ecf to use libfcgi connector.
- Include cgi-safe.ecf to use cgi connector.
In application, the root class need to inherit from ROC_CMS_LAUNCHER with adapted CMS_EXECUTION
descendant.

18
launcher/any-safe.ecf Normal file
View File

@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<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="launcher" uuid="6FDCA393-AFC3-436B-A58A-870923967C86" library_target="launcher">
<target name="common" abstract="true">
<root all_classes="true"/>
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
<library name="cms" location="..\cms-safe.ecf"/>
<library name="cms_app_env" location="..\library\app_env\app_env-safe.ecf" readonly="false"/>
<library name="wsf" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\wsf-safe.ecf"/>
</target>
<target name="launcher" extends="common">
<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"/>
<library name="standalone" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\connector\standalone-safe.ecf"/>
<cluster name="src" location=".\" recursive="false"/>
<cluster name="launcher" location=".\any\" recursive="true"/>
</target>
</system>

19
launcher/any.ecf Normal file
View File

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<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="launcher" uuid="6FDCA393-AFC3-436B-A58A-870923967C86" library_target="launcher">
<target name="common" abstract="true">
<root all_classes="true"/>
<option void_safety="none" />
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf"/>
<library name="cms" location="..\cms.ecf"/>
<library name="cms_app_env" location="..\library\app_env\app_env.ecf" readonly="false"/>
<library name="wsf" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\wsf.ecf"/>
</target>
<target name="launcher" extends="common">
<library name="cgi" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\connector\cgi.ecf"/>
<library name="libfcgi" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\connector\libfcgi.ecf"/>
<library name="nino" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\connector\nino.ecf"/>
<library name="standalone" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\connector\standalone.ecf"/>
<cluster name="src" location=".\" recursive="false"/>
<cluster name="launcher" location=".\any\" recursive="true"/>
</target>
</system>

View File

@@ -0,0 +1,19 @@
note
description: "[
Effective class for APPLICATION_LAUNCHER_I
You can put modification in this class
]"
date: "$Date: 2013-06-12 13:55:42 +0200 (mer., 12 juin 2013) $"
revision: "$Revision: 36 $"
class
APPLICATION_LAUNCHER [G -> WSF_EXECUTION create make end]
inherit
APPLICATION_LAUNCHER_I [G]
feature -- Custom
end

View File

@@ -0,0 +1,127 @@
note
description: "[
Specific application launcher
DO NOT EDIT THIS CLASS
you can customize APPLICATION_LAUNCHER
]"
date: "$Date: 2013-06-12 13:55:42 +0200 (mer., 12 juin 2013) $"
revision: "$Revision: 36 $"
deferred class
APPLICATION_LAUNCHER_I [G -> WSF_EXECUTION create make end]
inherit
SHARED_EXECUTION_ENVIRONMENT
feature -- Execution
launch (opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS)
local
nature: like launcher_nature
do
nature := launcher_nature
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 (opts)
elseif nature = nature_libfcgi then
launch_libfcgi (opts)
else
-- bye bye
(create {EXCEPTIONS}).die (-1)
end
end
feature {NONE} -- Access
launcher_nature: detachable READABLE_STRING_8
-- Initialize the launcher nature
-- either cgi, libfcgi, or nino.
--| We could extend with more connector if needed.
--| and we could use WSF_DEFAULT_SERVICE_LAUNCHER to configure this at compilation time.
local
p: PATH
ext: detachable READABLE_STRING_32
do
create p.make_from_string (execution_environment.arguments.command_name)
if attached p.entry as l_entry then
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
if ext.same_string (nature_cgi) then
Result := nature_cgi
end
if ext.same_string (nature_libfcgi) or else ext.same_string ("fcgi") then
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 (opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS)
local
launcher: WSF_NINO_SERVICE_LAUNCHER [G]
do
create launcher.make_and_launch (opts)
end
feature {NONE} -- cgi
nature_cgi: STRING = "cgi"
launch_cgi (opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS)
local
launcher: WSF_CGI_SERVICE_LAUNCHER [G]
do
create launcher.make_and_launch (opts)
end
feature {NONE} -- libfcgi
nature_libfcgi: STRING = "libfcgi"
launch_libfcgi (opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS)
local
launcher: WSF_LIBFCGI_SERVICE_LAUNCHER [G]
do
create launcher.make_and_launch (opts)
end
feature -- Default
default_nature: STRING
do
Result := nature_standalone
end
end

15
launcher/cgi-safe.ecf Normal file
View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<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="cgi_launcher" uuid="0FE4F1D0-BB70-4C7F-A66E-B27F1D718109" library_target="cgi_launcher">
<target name="common" abstract="true">
<root all_classes="true"/>
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
<library name="cms" location="..\cms-safe.ecf"/>
<library name="cms_app_env" location="..\library\app_env\app_env-safe.ecf" readonly="false"/>
<library name="wsf" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\wsf-safe.ecf"/>
</target>
<target name="cgi_launcher" extends="common">
<library name="default_cgi" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\default\cgi-safe.ecf"/>
<cluster name="src" location=".\" recursive="false"/>
<cluster name="launcher" location=".\default\" recursive="true"/>
</target>
</system>

View File

@@ -0,0 +1,19 @@
note
description: "[
Effective class for APPLICATION_LAUNCHER_I
You can put modification in this class
]"
date: "$Date: 2013-06-12 13:55:42 +0200 (mer., 12 juin 2013) $"
revision: "$Revision: 36 $"
class
APPLICATION_LAUNCHER [G -> WSF_EXECUTION create make end]
inherit
APPLICATION_LAUNCHER_I [G]
feature -- Custom
end

View File

@@ -0,0 +1,26 @@
note
description: "[
Specific application launcher
DO NOT EDIT THIS CLASS
you can customize APPLICATION_LAUNCHER
]"
date: "$Date: 2015-02-09 22:29:56 +0100 (lun., 09 févr. 2015) $"
revision: "$Revision: 96596 $"
deferred class
APPLICATION_LAUNCHER_I [G -> WSF_EXECUTION create make end]
feature -- Execution
launch (opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS)
local
launcher: WSF_DEFAULT_SERVICE_LAUNCHER [G]
do
create launcher.make_and_launch (opts)
end
end

15
launcher/libfcgi-safe.ecf Normal file
View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<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="libfcgi_launcher" uuid="04D7D1EA-059B-4024-B0DE-BBB57AB2D00C" library_target="libfcgi_launcher">
<target name="common" abstract="true">
<root all_classes="true"/>
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
<library name="cms" location="..\cms-safe.ecf"/>
<library name="cms_app_env" location="..\library\app_env\app_env-safe.ecf" readonly="false"/>
<library name="wsf" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\wsf-safe.ecf"/>
</target>
<target name="libfcgi_launcher" extends="common">
<library name="default_libfcgi" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\default\libfcgi-safe.ecf"/>
<cluster name="src" location=".\" recursive="false"/>
<cluster name="launcher" location=".\default\" recursive="true"/>
</target>
</system>

16
launcher/libfcgi.ecf Normal file
View File

@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-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="libfcgi_launcher" uuid="04D7D1EA-059B-4024-B0DE-BBB57AB2D00C" library_target="libfcgi_launcher">
<target name="common" abstract="true">
<root all_classes="true"/>
<option void_safety="none" />
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf"/>
<library name="cms" location="..\cms.ecf"/>
<library name="cms_app_env" location="..\library\app_env\app_env.ecf" readonly="false"/>
<library name="wsf" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\wsf.ecf"/>
</target>
<target name="libfcgi_launcher" extends="common">
<library name="default_libfcgi" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\default\libfcgi.ecf"/>
<cluster name="src" location=".\" recursive="false"/>
<cluster name="launcher" location=".\default\" recursive="true"/>
</target>
</system>

View File

@@ -1,12 +1,12 @@
note note
description: "[ description: "[
application service Reusable ROC CMS launcher.
]" ]"
date: "$Date: 2015-02-09 22:29:56 +0100 (lun., 09 févr. 2015) $" date: "$Date: 2015-02-09 22:29:56 +0100 (lun., 09 févr. 2015) $"
revision: "$Revision: 96596 $" revision: "$Revision: 96596 $"
class class
EWF_ROC_SERVER ROC_CMS_LAUNCHER [G -> CMS_EXECUTION create make end]
inherit inherit
WSF_LAUNCHABLE_SERVICE WSF_LAUNCHABLE_SERVICE
@@ -37,16 +37,27 @@ feature {NONE} -- Initialization
-- Initialize current service. -- Initialize current service.
local local
env: CMS_ENVIRONMENT env: CMS_ENVIRONMENT
l_app_name: detachable READABLE_STRING_32
do do
Precursor Precursor
create {WSF_SERVICE_LAUNCHER_OPTIONS_FROM_INI} service_options.make_from_file ("demo.ini")
create env.make_default create env.make_default
l_app_name := optional_application_name
if l_app_name = Void then
l_app_name := env.name
end
create {WSF_SERVICE_LAUNCHER_OPTIONS_FROM_INI} service_options.make_from_file (l_app_name + ".ini")
initialize_logger (env) initialize_logger (env)
end end
optional_application_name: detachable READABLE_STRING_32
-- Optional application name.
--| Redefine if needed.
do
end
feature {NONE} -- Launch operation feature {NONE} -- Launch operation
launcher: APPLICATION_LAUNCHER [EWF_ROC_SERVER_EXECUTION] launcher: APPLICATION_LAUNCHER [G]
launch (opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS) launch (opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS)
local local
@@ -70,7 +81,7 @@ feature {NONE} -- Launch operation
l_message.append ("%N%N") l_message.append ("%N%N")
end end
else else
l_message.append ("The application crash without available information") l_message.append ("The application crashed without information.")
l_message.append ("%N%N") l_message.append ("%N%N")
end end
-- send email shutdown -- send email shutdown

View File

@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<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="standalone_launcher" uuid="F42660A9-26C2-466B-A63C-C7823C808BE7" library_target="standalone_launcher">
<target name="common" abstract="true">
<root all_classes="true"/>
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
<library name="cms" location="..\cms-safe.ecf"/>
<library name="cms_app_env" location="..\library\app_env\app_env-safe.ecf" readonly="false"/>
<library name="wsf" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\wsf-safe.ecf"/>
</target>
<target name="standalone_launcher" extends="common">
<library name="default_standalone" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\default\standalone-safe.ecf"/>
<library name="standalone" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\connector\standalone-safe.ecf"/>
<cluster name="src" location=".\" recursive="false"/>
<cluster name="launcher" location=".\default\" recursive="true"/>
</target>
</system>

17
launcher/standalone.ecf Normal file
View File

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<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="standalone_launcher" uuid="F42660A9-26C2-466B-A63C-C7823C808BE7" library_target="standalone_launcher">
<target name="common" abstract="true">
<root all_classes="true"/>
<option void_safety="none" />
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf"/>
<library name="cms" location="..\cms.ecf"/>
<library name="cms_app_env" location="..\library\app_env\app_env.ecf" readonly="false"/>
<library name="wsf" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\wsf.ecf"/>
</target>
<target name="standalone_launcher" extends="common">
<library name="default_standalone" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\default\standalone.ecf"/>
<library name="standalone" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\connector\standalone.ecf"/>
<cluster name="src" location=".\" recursive="false"/>
<cluster name="launcher" location=".\default\" recursive="true"/>
</target>
</system>

View File

@@ -1,32 +1,33 @@
<?xml version="1.0" encoding="ISO-8859-1"?> <?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"> <target name="persistence_sqlite3">
<root all_classes="true"/> <root all_classes="true"/>
<option warning="true" void_safety="all"> <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> </option>
<setting name="console_application" value="true"/> <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="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="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"/>
<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="app_env" location="..\..\app_env\app_env-safe.ecf"/>
<library name="logging" location="$ISE_LIBRARY\library\runtime\logging\logging-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="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="thread" location="$ISE_LIBRARY\library\thread\thread-safe.ecf"/>
<library name="time" location="$ISE_LIBRARY\library\time\time-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"> <cluster name="persistence_sqlite" location=".\src\" recursive="true">
<file_rule> <file_rule>
<exclude>/old$</exclude>
<exclude>/EIFGENs$</exclude> <exclude>/EIFGENs$</exclude>
<exclude>/CVS$</exclude> <exclude>/CVS$</exclude>
<exclude>/.svn$</exclude> <exclude>/.svn$</exclude>
<exclude>/old$</exclude>
</file_rule> </file_rule>
</cluster> </cluster>
</target> </target>

View File

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