Layout: got rid of onces per thread function.

Renamed `launch_cms' as `initialize_cms' which reflects better the implementation.
Minor cosmetic or warning changes.
This commit is contained in:
2014-10-08 14:24:49 +02:00
parent b004ac8ae0
commit c94e5391e9
10 changed files with 139 additions and 48 deletions

View File

@@ -16,8 +16,6 @@ feature {NONE} -- Initialization
make (a_layout: CMS_LAYOUT) make (a_layout: CMS_LAYOUT)
-- Initialize `Current'. -- Initialize `Current'.
local
p: PATH
do do
layout := a_layout layout := a_layout
create options.make_equal (10) create options.make_equal (10)
@@ -169,8 +167,6 @@ feature -- Change
end end
get_root_location get_root_location
local
utf: UTF_CONVERTER
do do
root_location := layout.www_path root_location := layout.www_path
end end

View File

@@ -93,7 +93,6 @@ feature {NONE} -- Initialization
build_api_service build_api_service
local local
dn: PATH
l_database: DATABASE_CONNECTION l_database: DATABASE_CONNECTION
do do
to_implement ("Refactor database setup") to_implement ("Refactor database setup")

View File

@@ -19,14 +19,34 @@ feature -- Access
theme_path: PATH theme_path: PATH
-- Directory for templates (HTML, etc). -- Directory for templates (HTML, etc).
once local
Result := www_path.extended ("theme") p: detachable PATH
do
p := internal_theme_path
if p = Void then
p := www_path.extended ("theme")
internal_theme_path := p
end
Result := p
end end
cms_config_ini_path: PATH cms_config_ini_path: PATH
-- Database Configuration file path. -- Database Configuration file path.
once local
Result := config_path.extended ("cms.ini") p: detachable PATH
do
p := internal_cms_config_ini_path
if p = Void then
p := config_path.extended ("cms.ini")
internal_cms_config_ini_path := p
end
Result := p
end end
feature {NONE} -- Implementation
internal_theme_path: detachable like theme_path
internal_cms_config_ini_path: detachable like cms_config_ini_path
end end

View File

@@ -27,7 +27,7 @@ feature -- Router
feature -- Filter feature -- Filter
filters: detachable LIST[WSF_FILTER] filters: detachable LIST [WSF_FILTER]
-- Possibly list of Filter's module. -- Possibly list of Filter's module.
feature -- Element Change: Filter feature -- Element Change: Filter
@@ -39,7 +39,7 @@ feature -- Element Change: Filter
do do
l_filters := filters l_filters := filters
if l_filters = Void then if l_filters = Void then
create {ARRAYED_LIST[WSF_FILTER]}l_filters.make (1) create {ARRAYED_LIST [WSF_FILTER]} l_filters.make (1)
filters := l_filters filters := l_filters
end end
l_filters.force (a_filter) l_filters.force (a_filter)

View File

@@ -136,7 +136,6 @@ feature -- Filters
-- Create `filter'. -- Create `filter'.
local local
f, l_filter: detachable WSF_FILTER f, l_filter: detachable WSF_FILTER
fh: WSF_CUSTOM_HEADER_FILTER
do do
l_filter := Void l_filter := Void
-- Maintenance -- Maintenance

View File

@@ -45,19 +45,25 @@ feature -- Access
local local
i: INTEGER i: INTEGER
utf: UTF_CONVERTER utf: UTF_CONVERTER
once l_regions: like internal_regions
if attached information.regions as tb and then not tb.is_empty then do
i := 1 l_regions := internal_regions
create Result.make_filled ("", i, i + tb.count - 1) if l_regions = Void then
across if attached information.regions as tb and then not tb.is_empty then
tb as ic i := 1
loop create l_regions.make_filled ("", i, i + tb.count - 1)
Result.force (utf.utf_32_string_to_utf_8_string_8 (ic.key), i) -- NOTE: UTF-8 encoded ! across
i := i + 1 tb as ic
loop
l_regions.force (utf.utf_32_string_to_utf_8_string_8 (ic.key), i) -- NOTE: UTF-8 encoded !
i := i + 1
end
else
l_regions := <<"header", "content", "footer", "first_sidebar", "second_sidebar">>
end end
else internaL_regions := l_regions
Result := <<"header", "content", "footer", "first_sidebar", "second_sidebar">>
end end
Result := l_regions
end end
page_template: SMARTY_CMS_PAGE_TEMPLATE page_template: SMARTY_CMS_PAGE_TEMPLATE
@@ -87,6 +93,8 @@ feature -- Conversion
feature {NONE} -- Internal feature {NONE} -- Internal
internal_regions: detachable like regions
internal_page_template: detachable like page_template internal_page_template: detachable like page_template
invariant invariant

View File

@@ -9,15 +9,11 @@
<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>
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/> <library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
<library name="layout" location="..\..\layout\layout.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="cms" location="..\..\cms\cms.ecf" readonly="false"/> <library name="cms" location="..\..\cms\cms.ecf" readonly="false"/>
<library name="layout" location="..\..\layout\layout.ecf" readonly="false"/>
<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"/>
</target> </target>
<target name="roc_api_any" extends="common"> <target name="roc_api_any" extends="common">
<root class="EWF_ROC_SERVER" feature="make_and_launch"/> <root class="EWF_ROC_SERVER" feature="make_and_launch"/>

View File

@@ -43,7 +43,7 @@ feature {NONE} -- Initialization
do do
Precursor Precursor
service_options := create {WSF_SERVICE_LAUNCHER_OPTIONS_FROM_INI}.make_from_file ("roc.ini") service_options := create {WSF_SERVICE_LAUNCHER_OPTIONS_FROM_INI}.make_from_file ("roc.ini")
launch_cms (cms_setup) initialize_cms (cms_setup)
end end
feature -- Service feature -- Service
@@ -115,11 +115,11 @@ feature -- CMS Initialization
setup_storage (Result) setup_storage (Result)
end end
launch_cms (a_setup: CMS_SETUP) initialize_cms (a_setup: CMS_SETUP)
local local
cms: CMS_SERVICE cms: CMS_SERVICE
do do
log.write_debug (generator + ".launch_cms") log.write_debug (generator + ".initialize_cms")
create cms.make (a_setup) create cms.make (a_setup)
cms_service := cms cms_service := cms
end end

View File

@@ -36,45 +36,118 @@ feature -- Access: internal
config_path: PATH config_path: PATH
-- Configuration file path. -- Configuration file path.
once local
Result := path.extended ("config") p: detachable PATH
do
p := internal_config_path
if p = Void then
p := path.extended ("config")
internal_config_path := p
end
Result := p
end end
application_config_path: PATH application_config_path: PATH
-- Database Configuration file path. -- Database Configuration file path.
once local
Result := config_path.extended ("application_configuration.json") p: detachable PATH
do
p := internal_application_config_path
if p = Void then
p := config_path.extended ("application_configuration.json")
internal_application_config_path := p
end
Result := p
end end
logs_path: PATH logs_path: PATH
-- Directory for logs. -- Directory for logs.
once local
Result := path.extended ("logs") p: detachable PATH
do
p := internal_logs_path
if p = Void then
p := path.extended ("logs")
internal_logs_path := p
end
Result := p
end end
documentation_path: PATH documentation_path: PATH
-- Directory for API documentation. -- Directory for API documentation.
once local
Result := path.extended ("doc") p: detachable PATH
do
p := internal_documentation_path
if p = Void then
p := path.extended ("doc")
internal_documentation_path := p
end
Result := p
end end
www_path: PATH www_path: PATH
-- Directory for www. -- Directory for www.
once local
Result := path.extended ("www") p: detachable PATH
do
p := internal_www_path
if p = Void then
p := path.extended ("www")
internal_www_path := p
end
Result := p
end end
assets_path: PATH assets_path: PATH
-- Directory for public assets. -- Directory for public assets.
-- css, images, js. -- css, images, js.
once local
Result := path.extended ("www").extended ("assets") p: detachable PATH
do
p := internal_assets_path
if p = Void then
p := www_path.extended ("assets")
internal_assets_path := p
end
Result := p
end end
template_path: PATH template_path: PATH
-- Directory for templates (HTML, etc). -- Directory for templates (HTML, etc).
once local
Result := www_path.extended ("template") p: detachable PATH
do
p := internal_template_path
if p = Void then
p := www_path.extended ("template")
internal_template_path := p
end
Result := p
end end
feature {NONE} -- Implementation
internal_config_path: detachable like config_path
-- Configuration file path.
internal_application_config_path: detachable like application_config_path
-- Database Configuration file path.
internal_logs_path: detachable like logs_path
-- Directory for logs.
internal_documentation_path: detachable like documentation_path
-- Directory for API documentation.
internal_www_path: detachable like www_path
-- Directory for www.
internal_assets_path: detachable like assets_path
-- Directory for public assets.
-- css, images, js.
internal_template_path: detachable like template_path
-- Directory for templates (HTML, etc).
end end

View File

@@ -80,7 +80,7 @@ feature -- Cursor
feature -- Action feature -- Action
action: FUNCTION [ANY, detachable TUPLE [], G] action: FUNCTION [ANY, detachable TUPLE, G]
-- Agent to create a new item of type G. -- Agent to create a new item of type G.
feature {NONE} -- Implementation feature {NONE} -- Implementation