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)
-- Initialize `Current'.
local
p: PATH
do
layout := a_layout
create options.make_equal (10)
@@ -169,8 +167,6 @@ feature -- Change
end
get_root_location
local
utf: UTF_CONVERTER
do
root_location := layout.www_path
end

View File

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

View File

@@ -19,14 +19,34 @@ feature -- Access
theme_path: PATH
-- Directory for templates (HTML, etc).
once
Result := www_path.extended ("theme")
local
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
cms_config_ini_path: PATH
-- Database Configuration file path.
once
Result := config_path.extended ("cms.ini")
local
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
feature {NONE} -- Implementation
internal_theme_path: detachable like theme_path
internal_cms_config_ini_path: detachable like cms_config_ini_path
end

View File

@@ -27,7 +27,7 @@ feature -- Router
feature -- Filter
filters: detachable LIST[WSF_FILTER]
filters: detachable LIST [WSF_FILTER]
-- Possibly list of Filter's module.
feature -- Element Change: Filter
@@ -39,7 +39,7 @@ feature -- Element Change: Filter
do
l_filters := filters
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
end
l_filters.force (a_filter)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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