From 4841039d4aa78ab4f6ef9484146c49ebab62abdc Mon Sep 17 00:00:00 2001 From: Jocelyn Fiat Date: Tue, 14 Oct 2014 15:24:24 +0200 Subject: [PATCH] Renamed void-safe ecf using -safe.ecf convention. Added a cms_demo_module, for now pretty empty, but it will be used to develop/test the cms core. --- cms/{cms.ecf => cms-safe.ecf} | 4 +- examples/api/roc_api.ecf | 4 +- .../modules/demo/cms_demo_module-safe.ecf | 23 +++++ .../roc_api/modules/demo/cms_demo_module.e | 93 +++++++++++++++++++ .../roc_api/{roc_api.ecf => roc_api-safe.ecf} | 5 +- examples/roc_api/src/ewf_roc_server.e | 5 + layout/{layout.ecf => layout-safe.ecf} | 0 ...e_mysql.ecf => persistence_mysql-safe.ecf} | 2 +- .../implementation/mysql/tests/tests.ecf | 2 +- ...sqlite.ecf => persistence_sqlite-safe.ecf} | 2 +- .../tests/{tests.ecf => tests-safe.ecf} | 2 +- 11 files changed, 132 insertions(+), 10 deletions(-) rename cms/{cms.ecf => cms-safe.ecf} (93%) create mode 100644 examples/roc_api/modules/demo/cms_demo_module-safe.ecf create mode 100644 examples/roc_api/modules/demo/cms_demo_module.e rename examples/roc_api/{roc_api.ecf => roc_api-safe.ecf} (91%) rename layout/{layout.ecf => layout-safe.ecf} (100%) rename persistence/implementation/mysql/{persistence_mysql.ecf => persistence_mysql-safe.ecf} (96%) rename persistence/implementation/sqlite/{persistence_sqlite.ecf => persistence_sqlite-safe.ecf} (96%) rename persistence/implementation/sqlite/tests/{tests.ecf => tests-safe.ecf} (97%) diff --git a/cms/cms.ecf b/cms/cms-safe.ecf similarity index 93% rename from cms/cms.ecf rename to cms/cms-safe.ecf index dc20d24..235bd74 100644 --- a/cms/cms.ecf +++ b/cms/cms-safe.ecf @@ -9,9 +9,9 @@ - + - + diff --git a/examples/api/roc_api.ecf b/examples/api/roc_api.ecf index adf512d..a68d4e1 100644 --- a/examples/api/roc_api.ecf +++ b/examples/api/roc_api.ecf @@ -16,12 +16,12 @@ - + - + diff --git a/examples/roc_api/modules/demo/cms_demo_module-safe.ecf b/examples/roc_api/modules/demo/cms_demo_module-safe.ecf new file mode 100644 index 0000000..dd678f2 --- /dev/null +++ b/examples/roc_api/modules/demo/cms_demo_module-safe.ecf @@ -0,0 +1,23 @@ + + + + + + /.git$ + /EIFGENs$ + /.svn$ + + + + + + + + + + + + + + diff --git a/examples/roc_api/modules/demo/cms_demo_module.e b/examples/roc_api/modules/demo/cms_demo_module.e new file mode 100644 index 0000000..aeabe7b --- /dev/null +++ b/examples/roc_api/modules/demo/cms_demo_module.e @@ -0,0 +1,93 @@ +note + description: "Summary description for {CMS_DEMO_MODULE}." + author: "" + date: "$Date$" + revision: "$Revision$" + +class + CMS_DEMO_MODULE + +inherit + CMS_MODULE + +create + make + +feature {NONE} -- Initialization + + make (a_config: CMS_SETUP) + do + name := "Demo module" + version := "1.0" + description := "Service to demonstrate and test cms system" + package := "demo" + config := a_config + end + + config: CMS_SETUP + -- Node configuration. + +feature -- Access: router + + router: WSF_ROUTER + -- Node router. + do + create Result.make (2) + + map_uri_template_agent (Result, "/demo/", agent handle_demo) + map_uri_template_agent (Result, "/book/{id}", agent handle_demo_entry) + end + +feature -- Handler + + handle_demo, + handle_demo_entry (req: WSF_REQUEST; res: WSF_RESPONSE) + local + m: WSF_NOT_FOUND_RESPONSE + do + create m.make (req) + m.set_body ("Not yet implemented!") + res.send (m) + end + +feature -- Mapping helper: uri template + + map_uri_template (a_router: WSF_ROUTER; a_tpl: STRING; h: WSF_URI_TEMPLATE_HANDLER) + -- Map `h' as handler for `a_tpl' + require + a_tpl_attached: a_tpl /= Void + h_attached: h /= Void + do + map_uri_template_with_request_methods (a_router, a_tpl, h, Void) + end + + map_uri_template_with_request_methods (a_router: WSF_ROUTER; a_tpl: READABLE_STRING_8; h: WSF_URI_TEMPLATE_HANDLER; rqst_methods: detachable WSF_REQUEST_METHODS) + -- Map `h' as handler for `a_tpl' for request methods `rqst_methods'. + require + a_tpl_attached: a_tpl /= Void + h_attached: h /= Void + do + a_router.map_with_request_methods (create {WSF_URI_TEMPLATE_MAPPING}.make (a_tpl, h), rqst_methods) + end + +feature -- Mapping helper: uri template agent + + map_uri_template_agent (a_router: WSF_ROUTER; a_tpl: READABLE_STRING_8; proc: PROCEDURE [ANY, TUPLE [req: WSF_REQUEST; res: WSF_RESPONSE]]) + -- Map `proc' as handler for `a_tpl' + require + a_tpl_attached: a_tpl /= Void + proc_attached: proc /= Void + do + map_uri_template_agent_with_request_methods (a_router, a_tpl, proc, Void) + end + + map_uri_template_agent_with_request_methods (a_router: WSF_ROUTER; a_tpl: READABLE_STRING_8; proc: PROCEDURE [ANY, TUPLE [req: WSF_REQUEST; res: WSF_RESPONSE]]; rqst_methods: detachable WSF_REQUEST_METHODS) + -- Map `proc' as handler for `a_tpl' for request methods `rqst_methods'. + require + a_tpl_attached: a_tpl /= Void + proc_attached: proc /= Void + do + map_uri_template_with_request_methods (a_router, a_tpl, create {WSF_URI_TEMPLATE_AGENT_HANDLER}.make (proc), rqst_methods) + end + +end diff --git a/examples/roc_api/roc_api.ecf b/examples/roc_api/roc_api-safe.ecf similarity index 91% rename from examples/roc_api/roc_api.ecf rename to examples/roc_api/roc_api-safe.ecf index fb9f85c..c8576e2 100644 --- a/examples/roc_api/roc_api.ecf +++ b/examples/roc_api/roc_api-safe.ecf @@ -10,8 +10,9 @@ - - + + + diff --git a/examples/roc_api/src/ewf_roc_server.e b/examples/roc_api/src/ewf_roc_server.e index 1e02a20..4919a54 100644 --- a/examples/roc_api/src/ewf_roc_server.e +++ b/examples/roc_api/src/ewf_roc_server.e @@ -137,6 +137,11 @@ feature -- CMS setup create {NODE_MODULE} m.make (a_setup) m.enable a_setup.modules.extend (m) + + create {CMS_DEMO_MODULE} m.make (a_setup) + m.enable + a_setup.modules.extend (m) + end setup_storage (a_setup: CMS_SETUP) diff --git a/layout/layout.ecf b/layout/layout-safe.ecf similarity index 100% rename from layout/layout.ecf rename to layout/layout-safe.ecf diff --git a/persistence/implementation/mysql/persistence_mysql.ecf b/persistence/implementation/mysql/persistence_mysql-safe.ecf similarity index 96% rename from persistence/implementation/mysql/persistence_mysql.ecf rename to persistence/implementation/mysql/persistence_mysql-safe.ecf index d66d48e..6811629 100644 --- a/persistence/implementation/mysql/persistence_mysql.ecf +++ b/persistence/implementation/mysql/persistence_mysql-safe.ecf @@ -12,7 +12,7 @@ - + diff --git a/persistence/implementation/mysql/tests/tests.ecf b/persistence/implementation/mysql/tests/tests.ecf index cf85bf2..363c33c 100644 --- a/persistence/implementation/mysql/tests/tests.ecf +++ b/persistence/implementation/mysql/tests/tests.ecf @@ -8,7 +8,7 @@ - + diff --git a/persistence/implementation/sqlite/persistence_sqlite.ecf b/persistence/implementation/sqlite/persistence_sqlite-safe.ecf similarity index 96% rename from persistence/implementation/sqlite/persistence_sqlite.ecf rename to persistence/implementation/sqlite/persistence_sqlite-safe.ecf index c4c203c..90af783 100644 --- a/persistence/implementation/sqlite/persistence_sqlite.ecf +++ b/persistence/implementation/sqlite/persistence_sqlite-safe.ecf @@ -10,7 +10,7 @@ - + diff --git a/persistence/implementation/sqlite/tests/tests.ecf b/persistence/implementation/sqlite/tests/tests-safe.ecf similarity index 97% rename from persistence/implementation/sqlite/tests/tests.ecf rename to persistence/implementation/sqlite/tests/tests-safe.ecf index d401b33..cdeb22e 100644 --- a/persistence/implementation/sqlite/tests/tests.ecf +++ b/persistence/implementation/sqlite/tests/tests-safe.ecf @@ -8,7 +8,7 @@ - +