Added CMS_MODULE_CONFIGURATOR.
Added a default implementation of CMS_MODULE_CONGIRATOR. Updated CMS_SERVICE, to use the new CMS_MODULE_CONFIGURATOR. Updated Example.
This commit is contained in:
@@ -12,13 +12,18 @@ inherit
|
|||||||
REFACTORING_HELPER
|
REFACTORING_HELPER
|
||||||
create
|
create
|
||||||
make
|
make
|
||||||
|
|
||||||
feature {NONE} -- Initialization
|
feature {NONE} -- Initialization
|
||||||
|
|
||||||
make (a_layout: CMS_LAYOUT)
|
make (a_layout: CMS_LAYOUT)
|
||||||
do
|
do
|
||||||
layout := a_layout
|
layout := a_layout
|
||||||
create configuration.make (layout)
|
create configuration.make (layout)
|
||||||
|
configure
|
||||||
|
end
|
||||||
|
|
||||||
|
configure
|
||||||
|
do
|
||||||
site_id := configuration.site_id
|
site_id := configuration.site_id
|
||||||
site_url := configuration.site_url ("")
|
site_url := configuration.site_url ("")
|
||||||
site_name := configuration.site_name ("EWF::CMS")
|
site_name := configuration.site_name ("EWF::CMS")
|
||||||
@@ -35,20 +40,14 @@ feature {NONE} -- Initialization
|
|||||||
initialize
|
initialize
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
initialize
|
initialize
|
||||||
do
|
do
|
||||||
build_api_service
|
build_api_service
|
||||||
build_auth_engine
|
|
||||||
build_mailer
|
build_mailer
|
||||||
build_modules
|
|
||||||
end
|
end
|
||||||
|
|
||||||
feature -- Access
|
feature -- Access
|
||||||
|
|
||||||
modules: ARRAYED_LIST [CMS_MODULE]
|
|
||||||
-- List of possible modules
|
|
||||||
|
|
||||||
is_html: BOOLEAN
|
is_html: BOOLEAN
|
||||||
-- <Precursor>
|
-- <Precursor>
|
||||||
do
|
do
|
||||||
@@ -63,34 +62,6 @@ feature -- Access
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
feature {NONE} -- Initialization
|
|
||||||
|
|
||||||
build_modules
|
|
||||||
-- Core modules. (User, Admin, Node)
|
|
||||||
-- At the moment only node is supported.
|
|
||||||
local
|
|
||||||
m: CMS_MODULE
|
|
||||||
do
|
|
||||||
create modules.make (3)
|
|
||||||
|
|
||||||
-- -- Core
|
|
||||||
-- create {USER_MODULE} m.make
|
|
||||||
-- m.enable
|
|
||||||
-- modules.extend (m)
|
|
||||||
|
|
||||||
-- create {ADMIN_MODULE} m.make
|
|
||||||
-- m.enable
|
|
||||||
-- modules.extend (m)
|
|
||||||
|
|
||||||
create {NODE_MODULE} m.make (Current)
|
|
||||||
m.enable
|
|
||||||
modules.extend (m)
|
|
||||||
|
|
||||||
create {BASIC_AUTH_MODULE} m.make (Current)
|
|
||||||
m.enable
|
|
||||||
modules.extend (m)
|
|
||||||
end
|
|
||||||
|
|
||||||
build_api_service
|
build_api_service
|
||||||
local
|
local
|
||||||
l_database: DATABASE_CONNECTION
|
l_database: DATABASE_CONNECTION
|
||||||
@@ -115,12 +86,4 @@ feature {NONE} -- Initialization
|
|||||||
to_implement ("Not implemented mailer")
|
to_implement ("Not implemented mailer")
|
||||||
end
|
end
|
||||||
|
|
||||||
feature -- Change
|
|
||||||
|
|
||||||
add_module (m: CMS_MODULE)
|
|
||||||
-- Add a module `m' to the list of modules `modules'.
|
|
||||||
do
|
|
||||||
modules.force (m)
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -17,13 +17,6 @@ feature -- Access
|
|||||||
api_service: CMS_API_SERVICE
|
api_service: CMS_API_SERVICE
|
||||||
-- cms api service.
|
-- cms api service.
|
||||||
|
|
||||||
modules: LIST[CMS_MODULE]
|
|
||||||
-- Possible list of modules.
|
|
||||||
-- |If we remove Modules from setup.
|
|
||||||
-- |we can let the CMS_SERVICE define the basic modules.
|
|
||||||
deferred
|
|
||||||
end
|
|
||||||
|
|
||||||
is_html: BOOLEAN
|
is_html: BOOLEAN
|
||||||
-- api with progresive enhacements css and js, server side rendering.
|
-- api with progresive enhacements css and js, server side rendering.
|
||||||
deferred
|
deferred
|
||||||
|
|||||||
30
cms/src/modules/cms_module_configurator.e
Normal file
30
cms/src/modules/cms_module_configurator.e
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
note
|
||||||
|
description: "Summary description for {CMS_MODULE_CONFIGURATOR}."
|
||||||
|
author: ""
|
||||||
|
date: "$Date$"
|
||||||
|
revision: "$Revision$"
|
||||||
|
|
||||||
|
deferred class
|
||||||
|
CMS_MODULE_CONFIGURATOR
|
||||||
|
|
||||||
|
feature -- Access
|
||||||
|
|
||||||
|
modules: LIST[CMS_MODULE]
|
||||||
|
-- Possible list of modules.
|
||||||
|
deferred
|
||||||
|
end
|
||||||
|
|
||||||
|
feature -- Add Module
|
||||||
|
|
||||||
|
add_module (a_module: CMS_MODULE)
|
||||||
|
-- Add module
|
||||||
|
do
|
||||||
|
modules.force (a_module)
|
||||||
|
end
|
||||||
|
|
||||||
|
remove_module (a_module: CMS_MODULE)
|
||||||
|
-- Remove module
|
||||||
|
do
|
||||||
|
modules.prune (a_module)
|
||||||
|
end
|
||||||
|
end
|
||||||
53
cms/src/modules/default/cms_default_module_configurator.e
Normal file
53
cms/src/modules/default/cms_default_module_configurator.e
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
note
|
||||||
|
description: "Summary description for {CMS_DEFAULT_MODULE_CONFIGURATOR}."
|
||||||
|
author: ""
|
||||||
|
date: "$Date$"
|
||||||
|
revision: "$Revision$"
|
||||||
|
|
||||||
|
class
|
||||||
|
CMS_DEFAULT_MODULE_CONFIGURATOR
|
||||||
|
|
||||||
|
inherit
|
||||||
|
|
||||||
|
CMS_MODULE_CONFIGURATOR
|
||||||
|
|
||||||
|
create
|
||||||
|
make
|
||||||
|
|
||||||
|
feature {NONE} -- Initialization
|
||||||
|
|
||||||
|
make (a_setup: CMS_SETUP)
|
||||||
|
do
|
||||||
|
build_modules (a_setup)
|
||||||
|
end
|
||||||
|
|
||||||
|
feature -- Access
|
||||||
|
|
||||||
|
modules: ARRAYED_LIST [CMS_MODULE]
|
||||||
|
-- List of possible modules
|
||||||
|
|
||||||
|
|
||||||
|
feature -- Configuration
|
||||||
|
|
||||||
|
build_modules (a_setup: CMS_SETUP)
|
||||||
|
-- Core modules. (User, Admin, Node)
|
||||||
|
-- At the moment only node is supported.
|
||||||
|
local
|
||||||
|
m: CMS_MODULE
|
||||||
|
do
|
||||||
|
create modules.make (3)
|
||||||
|
-- -- Core
|
||||||
|
-- create {USER_MODULE} m.make (a_setup)
|
||||||
|
-- m.enable
|
||||||
|
-- modules.extend (m)
|
||||||
|
|
||||||
|
-- create {ADMIN_MODULE} m.make (a_setup)
|
||||||
|
-- m.enable
|
||||||
|
-- modules.extend (m)
|
||||||
|
|
||||||
|
create {NODE_MODULE} m.make (a_setup)
|
||||||
|
m.enable
|
||||||
|
modules.extend (m)
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
@@ -37,16 +37,34 @@ inherit
|
|||||||
SHARED_LOGGER
|
SHARED_LOGGER
|
||||||
|
|
||||||
create
|
create
|
||||||
make
|
make,
|
||||||
|
make_with_module_configurator
|
||||||
|
|
||||||
feature {NONE} -- Initialization
|
feature {NONE} -- Initialization
|
||||||
|
|
||||||
make (a_setup: CMS_SETUP)
|
make (a_setup: CMS_SETUP)
|
||||||
|
-- Build a a default service with a CMS_DEFAULT_MODULE_CONFIGURATOR
|
||||||
do
|
do
|
||||||
setup := a_setup
|
setup := a_setup
|
||||||
configuration := a_setup.configuration
|
configuration := a_setup.configuration
|
||||||
modules := a_setup.modules
|
create {CMS_DEFAULT_MODULE_CONFIGURATOR} modules.make (a_setup)
|
||||||
create {ARRAYED_LIST[WSF_FILTER]} filters.make (0)
|
create {ARRAYED_LIST[WSF_FILTER]} filters.make (0)
|
||||||
|
initialize
|
||||||
|
end
|
||||||
|
|
||||||
|
make_with_module_configurator (a_setup: CMS_SETUP; a_module_configurator: CMS_MODULE_CONFIGURATOR)
|
||||||
|
-- Build a a default service with a custom CMS_MODULE_CONFIGURATOR
|
||||||
|
do
|
||||||
|
setup := a_setup
|
||||||
|
configuration := a_setup.configuration
|
||||||
|
modules := a_module_configurator
|
||||||
|
create {ARRAYED_LIST[WSF_FILTER]} filters.make (0)
|
||||||
|
initialize
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
initialize
|
||||||
|
do
|
||||||
initialize_users
|
initialize_users
|
||||||
initialize_auth_engine
|
initialize_auth_engine
|
||||||
initialize_mailer
|
initialize_mailer
|
||||||
@@ -75,7 +93,7 @@ feature {NONE} -- Initialization
|
|||||||
do
|
do
|
||||||
log.write_debug (generator + ".initialize_modules")
|
log.write_debug (generator + ".initialize_modules")
|
||||||
across
|
across
|
||||||
modules as m
|
modules.modules as m
|
||||||
loop
|
loop
|
||||||
if m.item.is_enabled then
|
if m.item.is_enabled then
|
||||||
router.import (m.item.router)
|
router.import (m.item.router)
|
||||||
@@ -178,13 +196,20 @@ feature -- Access
|
|||||||
-- CMS configuration.
|
-- CMS configuration.
|
||||||
-- | Maybe we can compute it (using `setup') instead of using memory.
|
-- | Maybe we can compute it (using `setup') instead of using memory.
|
||||||
|
|
||||||
modules: LIST [CMS_MODULE]
|
modules: CMS_MODULE_CONFIGURATOR
|
||||||
-- List of possible modules.
|
-- Configurator of possible modules.
|
||||||
-- | Maybe we can compute it (using `setup') instead of using memory.
|
|
||||||
|
|
||||||
filters: LIST[WSF_FILTER]
|
filters: LIST[WSF_FILTER]
|
||||||
-- List of possible filters.
|
-- List of possible filters.
|
||||||
|
|
||||||
|
feature -- Element Change: Modules
|
||||||
|
|
||||||
|
add_module (a_module: CMS_MODULE)
|
||||||
|
-- Add a module `a_module' to the module configurator `a_module'.
|
||||||
|
do
|
||||||
|
modules.add_module (a_module)
|
||||||
|
end
|
||||||
|
|
||||||
feature -- Execution
|
feature -- Execution
|
||||||
|
|
||||||
execute_default (req: WSF_REQUEST; res: WSF_RESPONSE)
|
execute_default (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||||
|
|||||||
@@ -111,7 +111,6 @@ feature -- CMS Initialization
|
|||||||
create layout.make_default
|
create layout.make_default
|
||||||
end
|
end
|
||||||
create Result.make (layout)
|
create Result.make (layout)
|
||||||
setup_modules (Result)
|
|
||||||
setup_storage (Result)
|
setup_storage (Result)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -121,20 +120,26 @@ feature -- CMS Initialization
|
|||||||
do
|
do
|
||||||
log.write_debug (generator + ".initialize_cms")
|
log.write_debug (generator + ".initialize_cms")
|
||||||
create cms.make (a_setup)
|
create cms.make (a_setup)
|
||||||
|
setup_modules (cms)
|
||||||
cms_service := cms
|
cms_service := cms
|
||||||
end
|
end
|
||||||
|
|
||||||
feature -- CMS setup
|
feature -- CMS setup
|
||||||
|
|
||||||
setup_modules (a_setup: CMS_SETUP)
|
setup_modules (a_service: CMS_SERVICE)
|
||||||
-- Setup modules to be added to the CMS ecosystem.
|
-- Setup modules to be added to the CMS ecosystem.
|
||||||
|
local
|
||||||
|
m: CMS_MODULE
|
||||||
do
|
do
|
||||||
to_implement ("To implement custom modules")
|
|
||||||
|
create {NODE_MODULE} m.make (a_service.setup)
|
||||||
|
m.enable
|
||||||
|
a_service.add_module (m)
|
||||||
end
|
end
|
||||||
|
|
||||||
setup_storage (a_setup: CMS_SETUP)
|
setup_storage (a_setup: CMS_SETUP)
|
||||||
do
|
do
|
||||||
|
to_implement ("To implement custom storage")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user