Redesign part of CMS_MODULE, and implementation.
Prepare the module before creating the service. Remove the possibility to add module after the creation of the service. Renamed CMS_MODULE_CONFIGURATOR as CMS_MODULE_COLLECTION.
This commit is contained in:
@@ -16,40 +16,34 @@ create
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (a_config: CMS_SETUP)
|
||||
-- Create Current module, disabled by default.
|
||||
do
|
||||
name := "node"
|
||||
version := "1.0"
|
||||
description := "Service to manage content based on 'node'"
|
||||
package := "core"
|
||||
config := a_config
|
||||
setup_router
|
||||
enable
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
router: WSF_ROUTER
|
||||
-- Node router.
|
||||
|
||||
config: CMS_SETUP
|
||||
-- Node configuration.
|
||||
-- Node configuration.
|
||||
|
||||
feature -- Implementation
|
||||
feature -- Access: router
|
||||
|
||||
setup_router
|
||||
-- Setup `router'.
|
||||
router: WSF_ROUTER
|
||||
-- Node router.
|
||||
do
|
||||
create router.make (5)
|
||||
configure_api_node
|
||||
configure_api_nodes
|
||||
configure_api_node_title
|
||||
configure_api_node_summary
|
||||
configure_api_node_content
|
||||
create Result.make (5)
|
||||
configure_api_node (Result)
|
||||
configure_api_nodes (Result)
|
||||
configure_api_node_title (Result)
|
||||
configure_api_node_summary (Result)
|
||||
configure_api_node_content (Result)
|
||||
end
|
||||
|
||||
feature -- Configure Node Resources Routes
|
||||
feature {NONE} -- Implementation: routes
|
||||
|
||||
configure_api_node
|
||||
configure_api_node (a_router: WSF_ROUTER)
|
||||
local
|
||||
l_node_handler: NODE_HANDLER
|
||||
l_methods: WSF_REQUEST_METHODS
|
||||
@@ -59,7 +53,7 @@ feature -- Configure Node Resources Routes
|
||||
l_methods.enable_get
|
||||
l_methods.enable_post
|
||||
l_methods.enable_put
|
||||
router.handle_with_request_methods ("/node", l_node_handler, l_methods)
|
||||
a_router.handle_with_request_methods ("/node", l_node_handler, l_methods)
|
||||
|
||||
create l_node_handler.make (config)
|
||||
create l_methods
|
||||
@@ -67,11 +61,10 @@ feature -- Configure Node Resources Routes
|
||||
l_methods.enable_post
|
||||
l_methods.enable_put
|
||||
l_methods.enable_delete
|
||||
router.handle_with_request_methods ("/node/{id}", l_node_handler, l_methods)
|
||||
a_router.handle_with_request_methods ("/node/{id}", l_node_handler, l_methods)
|
||||
end
|
||||
|
||||
|
||||
configure_api_nodes
|
||||
configure_api_nodes (a_router: WSF_ROUTER)
|
||||
local
|
||||
l_nodes_handler: NODES_HANDLER
|
||||
l_methods: WSF_REQUEST_METHODS
|
||||
@@ -79,11 +72,10 @@ feature -- Configure Node Resources Routes
|
||||
create l_nodes_handler.make (config)
|
||||
create l_methods
|
||||
l_methods.enable_get
|
||||
router.handle_with_request_methods ("/nodes", l_nodes_handler, l_methods)
|
||||
a_router.handle_with_request_methods ("/nodes", l_nodes_handler, l_methods)
|
||||
end
|
||||
|
||||
|
||||
configure_api_node_summary
|
||||
configure_api_node_summary (a_router: WSF_ROUTER)
|
||||
local
|
||||
l_report_handler: NODE_SUMMARY_HANDLER
|
||||
l_methods: WSF_REQUEST_METHODS
|
||||
@@ -93,11 +85,11 @@ feature -- Configure Node Resources Routes
|
||||
l_methods.enable_get
|
||||
l_methods.enable_post
|
||||
l_methods.enable_put
|
||||
router.handle_with_request_methods ("/node/{id}/summary", l_report_handler, l_methods)
|
||||
a_router.handle_with_request_methods ("/node/{id}/summary", l_report_handler, l_methods)
|
||||
end
|
||||
|
||||
|
||||
configure_api_node_title
|
||||
configure_api_node_title (a_router: WSF_ROUTER)
|
||||
local
|
||||
l_report_handler: NODE_TITLE_HANDLER
|
||||
l_methods: WSF_REQUEST_METHODS
|
||||
@@ -107,11 +99,10 @@ feature -- Configure Node Resources Routes
|
||||
l_methods.enable_get
|
||||
l_methods.enable_post
|
||||
l_methods.enable_put
|
||||
router.handle_with_request_methods ("/node/{id}/title", l_report_handler, l_methods)
|
||||
a_router.handle_with_request_methods ("/node/{id}/title", l_report_handler, l_methods)
|
||||
end
|
||||
|
||||
|
||||
configure_api_node_content
|
||||
configure_api_node_content (a_router: WSF_ROUTER)
|
||||
local
|
||||
l_report_handler: NODE_CONTENT_HANDLER
|
||||
l_methods: WSF_REQUEST_METHODS
|
||||
@@ -121,7 +112,7 @@ feature -- Configure Node Resources Routes
|
||||
l_methods.enable_get
|
||||
l_methods.enable_post
|
||||
l_methods.enable_put
|
||||
router.handle_with_request_methods ("/node/{id}/content", l_report_handler, l_methods)
|
||||
a_router.handle_with_request_methods ("/node/{id}/content", l_report_handler, l_methods)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user