Adapt to EWF concurrent version.

This commit is contained in:
2015-04-02 18:38:12 +02:00
parent 8382edf9d7
commit 7c1d1325eb
5 changed files with 73 additions and 98 deletions

View File

@@ -9,6 +9,7 @@
<option warning="true" full_class_checking="false" is_attached_by_default="true" void_safety="transitional" syntax="transitional"> <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"/> <assertions precondition="true" postcondition="true" check="true" invariant="true" loop="true" supplier_precondition="true"/>
</option> </option>
<setting name="console_application" value="true"/>
<setting name="concurrency" value="scoop"/> <setting name="concurrency" value="scoop"/>
<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"/>
@@ -23,16 +24,16 @@
<root class="EWF_ROC_SERVER" feature="make_and_launch"/> <root class="EWF_ROC_SERVER" feature="make_and_launch"/>
<setting name="concurrency" value="scoop"/> <setting name="concurrency" value="scoop"/>
<library name="cgi" location="$EWF_LIBRARY\library\server\wsf\connector\cgi-safe.ecf"/> <library name="cgi" location="$EWF_LIBRARY\library\server\wsf\connector\cgi-safe.ecf"/>
<library name="httpd" location="$EWF_LIBRARY\library\server\wsf\connector\httpd-safe.ecf"/>
<library name="libfcgi" location="$EWF_LIBRARY\library\server\wsf\connector\libfcgi-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="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="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_httpd" extends="common"> <target name="demo_standalone" extends="common">
<root class="EWF_ROC_SERVER" feature="make_and_launch"/> <root class="EWF_ROC_SERVER" feature="make_and_launch"/>
<setting name="concurrency" value="scoop"/> <setting name="concurrency" value="scoop"/>
<library name="default_httpd" location="$EWF_LIBRARY\library\server\wsf\default\httpd-safe.ecf"/> <library name="default_standalone" location="$EWF_LIBRARY\library\server\wsf\default\standalone-safe.ecf"/>
<cluster name="launcher" location=".\launcher\default\" recursive="true"/> <cluster name="launcher" location=".\launcher\default\" recursive="true"/>
<cluster name="src" location=".\src\" recursive="true"/> <cluster name="src" location=".\src\" recursive="true"/>
</target> </target>

View File

@@ -23,9 +23,9 @@ feature -- Execution
do do
nature := launcher_nature nature := launcher_nature
if nature = Void then if nature = Void then
launch_httpd (opts) launch_standalone (opts)
elseif nature = nature_httpd then elseif nature = nature_standalone then
launch_httpd (opts) launch_standalone (opts)
elseif nature = nature_nino then elseif nature = nature_nino then
launch_nino (opts) launch_nino (opts)
elseif nature = nature_cgi then elseif nature = nature_cgi then
@@ -54,8 +54,8 @@ feature {NONE} -- Access
ext := l_entry.extension ext := l_entry.extension
end end
if ext /= Void then if ext /= Void then
if ext.same_string (nature_httpd) then if ext.same_string (nature_standalone) then
Result := nature_httpd Result := nature_standalone
end end
if ext.same_string (nature_nino) then if ext.same_string (nature_nino) then
Result := nature_nino Result := nature_nino
@@ -70,13 +70,13 @@ feature {NONE} -- Access
Result := default_nature Result := default_nature
end end
feature {NONE} -- httpd feature {NONE} -- standalone
nature_httpd: STRING = "httpd" nature_standalone: STRING = "standalone"
launch_httpd (opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS) launch_standalone (opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS)
local local
launcher: WSF_HTTPD_SERVICE_LAUNCHER [G] launcher: WSF_STANDALONE_SERVICE_LAUNCHER [G]
do do
create launcher.make_and_launch (opts) create launcher.make_and_launch (opts)
end end
@@ -118,7 +118,7 @@ feature -- Default
default_nature: STRING default_nature: STRING
do do
Result := nature_httpd Result := nature_standalone
end end

View File

@@ -8,7 +8,7 @@ class
EWF_ROC_SERVER_EXECUTION EWF_ROC_SERVER_EXECUTION
inherit inherit
WSF_EXECUTION CMS_EXECUTION
redefine redefine
initialize initialize
end end
@@ -25,52 +25,6 @@ feature {NONE} -- Initialization
initialize initialize
do do
Precursor Precursor
initialize_cms (cms_setup)
end
feature -- Access
cms_service: CMS_SERVICE
-- cms service.
layout: CMS_LAYOUT
-- cms layout.
feature -- Execution
execute
local
do
cms_service.execute (request, response)
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)
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
initialize_cms (a_setup: CMS_SETUP)
local
cms: CMS_SERVICE
api: CMS_API
do
write_debug_log (generator + ".initialize_cms")
setup_modules (a_setup)
create api.make (a_setup)
create cms.make (api)
cms_service := cms
end end
feature -- CMS setup feature -- CMS setup

View File

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

View File

@@ -6,53 +6,49 @@ note
even for a specific handler. even for a specific handler.
]" ]"
class deferred class
CMS_SERVICE CMS_EXECUTION
inherit inherit
WSF_ROUTED_SKELETON_SERVICE WSF_FILTERED_ROUTED_SKELETON_EXECUTION
rename
execute as execute_service
undefine undefine
requires_proxy requires_proxy
redefine redefine
execute_default execute_default,
end filter_execute,
initialize
WSF_FILTERED_SERVICE
WSF_FILTER
rename
execute as execute_filter
end end
WSF_NO_PROXY_POLICY 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 REFACTORING_HELPER
SHARED_LOGGER SHARED_LOGGER
create --create
make -- make
feature {NONE} -- Initialization feature {NONE} -- Initialization
make (a_api: CMS_API) initialize
-- Build a CMS service with `a_api' -- Build a CMS service with `a_api'
do do
api := a_api initialize_cms (cms_setup)
initialize Precursor
ensure
api_set: api = a_api
end end
initialize initialize_cms (a_setup: CMS_SETUP)
-- Initialize various parts of the CMS service.
do do
setup := a_setup
write_debug_log (generator + ".initialize_cms")
setup_modules (a_setup)
create api.make (a_setup)
-- CMS Initialization
initialize_modules initialize_modules
initialize_users initialize_users
initialize_auth_engine initialize_auth_engine
@@ -88,6 +84,17 @@ feature {NONE} -- Initialization
to_implement ("To Implement authentication engine") to_implement ("To Implement authentication engine")
end 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 feature -- Settings: router
setup_router setup_router
@@ -155,12 +162,12 @@ feature -- Settings: router
feature -- Execute Filter feature -- Execute Filter
execute_filter (req: WSF_REQUEST; res: WSF_RESPONSE) filter_execute (req: WSF_REQUEST; res: WSF_RESPONSE)
-- Execute the filter. -- Execute the filter.
do do
res.put_header_line ("Date: " + (create {HTTP_DATE}.make_now_utc).string) res.put_header_line ("Date: " + (create {HTTP_DATE}.make_now_utc).string)
res.put_header_line ("X-EWF-Server: CMS_v1.0") res.put_header_line ("X-EWF-Server: CMS_v1.0")
execute_service (req, res) Precursor (req, res)
end end
feature -- Filters feature -- Filters
@@ -225,13 +232,27 @@ feature -- Filters
feature -- Access feature -- Access
layout: CMS_LAYOUT
api: CMS_API api: CMS_API
-- API service. -- API service.
setup: CMS_SETUP setup: CMS_SETUP
cms_setup: CMS_DEFAULT_SETUP
-- CMS setup. -- CMS setup.
local
utf: UTF_CONVERTER
do 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 end
modules: CMS_MODULE_COLLECTION modules: CMS_MODULE_COLLECTION