From 0399674af7a6a97d2783bca4b8247e445dad7112 Mon Sep 17 00:00:00 2001 From: matzman Date: Fri, 12 Jun 2015 09:05:18 +0200 Subject: [PATCH] . --- .../i18n-test/build-test-targets.sh | 0 .../_base/loader/requirejs/layers/build.sh | 0 .../webroot/libs/dojo/tests/io/upload.cgi | 0 .../libs/dojo/tests/resources/JSON.php | 0 .../libs/dojo/tests/resources/testClass.php | 0 .../tests/resources/test_JsonRPCMediator.php | 0 .../libs/dojox/calendar/CONTRIBUTING.md | 0 .../webroot/libs/dojox/calendar/LICENSE | 0 .../libs/dojox/calendar/nls/bg/buttons.js | 0 .../libs/dojox/calendar/nls/he/buttons.js | 0 .../libs/dojox/calendar/nls/hr/buttons.js | 0 .../libs/dojox/calendar/nls/uk/buttons.js | 0 .../libs/dojox/calendar/tests/hcalendar.html | 0 .../libs/dojox/dgauges/CONTRIBUTING.md | 0 .../libs/dojox/flash/tests/buildFlashTest.sh | 0 .../webroot/libs/dojox/mobile/build/build.sh | 0 .../libs/dojox/mobile/themes/utils/cleanup.sh | 0 .../libs/dojox/mobile/themes/utils/compile.sh | 0 .../libs/dojox/storage/buildFlashStorage.sh | 0 .../webroot/libs/hos/RuleEngine.js | 34 ++++++++++++------- .../webroot/libs/util/buildscripts/build.sh | 0 .../libs/util/buildscripts/build_release.sh | 0 .../libs/util/buildscripts/clean_release.sh | 0 .../libs/util/buildscripts/mk_branch.sh | 0 .../webroot/libs/util/docscripts/dumpObj.php | 0 .../webroot/libs/util/docscripts/generate.php | 0 .../webroot/libs/util/docscripts/makeCix.php | 0 .../webroot/libs/util/doh/runner.sh | 0 .../webroot/libs/util/less/bin/lessc | 0 .../webroot/libs/util/shrinksafe/build.sh | 0 .../libs/util/shrinksafe/tests/runner.sh | 0 src/hos_cosgi_testwebapp/webroot/rule01.html | 27 +++++++++++++-- .../webroot/widgettest01.html | 3 ++ .../webserver/WebServerServiceImpl.cpp | 17 ++++++++++ .../service/webserver/WebServerServiceImpl.h | 15 ++++++-- 35 files changed, 77 insertions(+), 19 deletions(-) mode change 100755 => 100644 src/hos_cosgi_testwebapp/webroot/libs/dojo/tests/_base/loader/i18n-exhaustive/i18n-test/build-test-targets.sh mode change 100755 => 100644 src/hos_cosgi_testwebapp/webroot/libs/dojo/tests/_base/loader/requirejs/layers/build.sh mode change 100755 => 100644 src/hos_cosgi_testwebapp/webroot/libs/dojo/tests/io/upload.cgi mode change 100755 => 100644 src/hos_cosgi_testwebapp/webroot/libs/dojo/tests/resources/JSON.php mode change 100755 => 100644 src/hos_cosgi_testwebapp/webroot/libs/dojo/tests/resources/testClass.php mode change 100755 => 100644 src/hos_cosgi_testwebapp/webroot/libs/dojo/tests/resources/test_JsonRPCMediator.php mode change 100755 => 100644 src/hos_cosgi_testwebapp/webroot/libs/dojox/calendar/CONTRIBUTING.md mode change 100755 => 100644 src/hos_cosgi_testwebapp/webroot/libs/dojox/calendar/LICENSE mode change 100755 => 100644 src/hos_cosgi_testwebapp/webroot/libs/dojox/calendar/nls/bg/buttons.js mode change 100755 => 100644 src/hos_cosgi_testwebapp/webroot/libs/dojox/calendar/nls/he/buttons.js mode change 100755 => 100644 src/hos_cosgi_testwebapp/webroot/libs/dojox/calendar/nls/hr/buttons.js mode change 100755 => 100644 src/hos_cosgi_testwebapp/webroot/libs/dojox/calendar/nls/uk/buttons.js mode change 100755 => 100644 src/hos_cosgi_testwebapp/webroot/libs/dojox/calendar/tests/hcalendar.html mode change 100755 => 100644 src/hos_cosgi_testwebapp/webroot/libs/dojox/dgauges/CONTRIBUTING.md mode change 100755 => 100644 src/hos_cosgi_testwebapp/webroot/libs/dojox/flash/tests/buildFlashTest.sh mode change 100755 => 100644 src/hos_cosgi_testwebapp/webroot/libs/dojox/mobile/build/build.sh mode change 100755 => 100644 src/hos_cosgi_testwebapp/webroot/libs/dojox/mobile/themes/utils/cleanup.sh mode change 100755 => 100644 src/hos_cosgi_testwebapp/webroot/libs/dojox/mobile/themes/utils/compile.sh mode change 100755 => 100644 src/hos_cosgi_testwebapp/webroot/libs/dojox/storage/buildFlashStorage.sh mode change 100755 => 100644 src/hos_cosgi_testwebapp/webroot/libs/util/buildscripts/build.sh mode change 100755 => 100644 src/hos_cosgi_testwebapp/webroot/libs/util/buildscripts/build_release.sh mode change 100755 => 100644 src/hos_cosgi_testwebapp/webroot/libs/util/buildscripts/clean_release.sh mode change 100755 => 100644 src/hos_cosgi_testwebapp/webroot/libs/util/buildscripts/mk_branch.sh mode change 100755 => 100644 src/hos_cosgi_testwebapp/webroot/libs/util/docscripts/dumpObj.php mode change 100755 => 100644 src/hos_cosgi_testwebapp/webroot/libs/util/docscripts/generate.php mode change 100755 => 100644 src/hos_cosgi_testwebapp/webroot/libs/util/docscripts/makeCix.php mode change 100755 => 100644 src/hos_cosgi_testwebapp/webroot/libs/util/doh/runner.sh mode change 100755 => 100644 src/hos_cosgi_testwebapp/webroot/libs/util/less/bin/lessc mode change 100755 => 100644 src/hos_cosgi_testwebapp/webroot/libs/util/shrinksafe/build.sh mode change 100755 => 100644 src/hos_cosgi_testwebapp/webroot/libs/util/shrinksafe/tests/runner.sh diff --git a/src/hos_cosgi_testwebapp/webroot/libs/dojo/tests/_base/loader/i18n-exhaustive/i18n-test/build-test-targets.sh b/src/hos_cosgi_testwebapp/webroot/libs/dojo/tests/_base/loader/i18n-exhaustive/i18n-test/build-test-targets.sh old mode 100755 new mode 100644 diff --git a/src/hos_cosgi_testwebapp/webroot/libs/dojo/tests/_base/loader/requirejs/layers/build.sh b/src/hos_cosgi_testwebapp/webroot/libs/dojo/tests/_base/loader/requirejs/layers/build.sh old mode 100755 new mode 100644 diff --git a/src/hos_cosgi_testwebapp/webroot/libs/dojo/tests/io/upload.cgi b/src/hos_cosgi_testwebapp/webroot/libs/dojo/tests/io/upload.cgi old mode 100755 new mode 100644 diff --git a/src/hos_cosgi_testwebapp/webroot/libs/dojo/tests/resources/JSON.php b/src/hos_cosgi_testwebapp/webroot/libs/dojo/tests/resources/JSON.php old mode 100755 new mode 100644 diff --git a/src/hos_cosgi_testwebapp/webroot/libs/dojo/tests/resources/testClass.php b/src/hos_cosgi_testwebapp/webroot/libs/dojo/tests/resources/testClass.php old mode 100755 new mode 100644 diff --git a/src/hos_cosgi_testwebapp/webroot/libs/dojo/tests/resources/test_JsonRPCMediator.php b/src/hos_cosgi_testwebapp/webroot/libs/dojo/tests/resources/test_JsonRPCMediator.php old mode 100755 new mode 100644 diff --git a/src/hos_cosgi_testwebapp/webroot/libs/dojox/calendar/CONTRIBUTING.md b/src/hos_cosgi_testwebapp/webroot/libs/dojox/calendar/CONTRIBUTING.md old mode 100755 new mode 100644 diff --git a/src/hos_cosgi_testwebapp/webroot/libs/dojox/calendar/LICENSE b/src/hos_cosgi_testwebapp/webroot/libs/dojox/calendar/LICENSE old mode 100755 new mode 100644 diff --git a/src/hos_cosgi_testwebapp/webroot/libs/dojox/calendar/nls/bg/buttons.js b/src/hos_cosgi_testwebapp/webroot/libs/dojox/calendar/nls/bg/buttons.js old mode 100755 new mode 100644 diff --git a/src/hos_cosgi_testwebapp/webroot/libs/dojox/calendar/nls/he/buttons.js b/src/hos_cosgi_testwebapp/webroot/libs/dojox/calendar/nls/he/buttons.js old mode 100755 new mode 100644 diff --git a/src/hos_cosgi_testwebapp/webroot/libs/dojox/calendar/nls/hr/buttons.js b/src/hos_cosgi_testwebapp/webroot/libs/dojox/calendar/nls/hr/buttons.js old mode 100755 new mode 100644 diff --git a/src/hos_cosgi_testwebapp/webroot/libs/dojox/calendar/nls/uk/buttons.js b/src/hos_cosgi_testwebapp/webroot/libs/dojox/calendar/nls/uk/buttons.js old mode 100755 new mode 100644 diff --git a/src/hos_cosgi_testwebapp/webroot/libs/dojox/calendar/tests/hcalendar.html b/src/hos_cosgi_testwebapp/webroot/libs/dojox/calendar/tests/hcalendar.html old mode 100755 new mode 100644 diff --git a/src/hos_cosgi_testwebapp/webroot/libs/dojox/dgauges/CONTRIBUTING.md b/src/hos_cosgi_testwebapp/webroot/libs/dojox/dgauges/CONTRIBUTING.md old mode 100755 new mode 100644 diff --git a/src/hos_cosgi_testwebapp/webroot/libs/dojox/flash/tests/buildFlashTest.sh b/src/hos_cosgi_testwebapp/webroot/libs/dojox/flash/tests/buildFlashTest.sh old mode 100755 new mode 100644 diff --git a/src/hos_cosgi_testwebapp/webroot/libs/dojox/mobile/build/build.sh b/src/hos_cosgi_testwebapp/webroot/libs/dojox/mobile/build/build.sh old mode 100755 new mode 100644 diff --git a/src/hos_cosgi_testwebapp/webroot/libs/dojox/mobile/themes/utils/cleanup.sh b/src/hos_cosgi_testwebapp/webroot/libs/dojox/mobile/themes/utils/cleanup.sh old mode 100755 new mode 100644 diff --git a/src/hos_cosgi_testwebapp/webroot/libs/dojox/mobile/themes/utils/compile.sh b/src/hos_cosgi_testwebapp/webroot/libs/dojox/mobile/themes/utils/compile.sh old mode 100755 new mode 100644 diff --git a/src/hos_cosgi_testwebapp/webroot/libs/dojox/storage/buildFlashStorage.sh b/src/hos_cosgi_testwebapp/webroot/libs/dojox/storage/buildFlashStorage.sh old mode 100755 new mode 100644 diff --git a/src/hos_cosgi_testwebapp/webroot/libs/hos/RuleEngine.js b/src/hos_cosgi_testwebapp/webroot/libs/hos/RuleEngine.js index c8db1a2c..1126b0c5 100644 --- a/src/hos_cosgi_testwebapp/webroot/libs/hos/RuleEngine.js +++ b/src/hos_cosgi_testwebapp/webroot/libs/hos/RuleEngine.js @@ -1,25 +1,33 @@ define([ "dojo/_base/config", 'dojo/_base/declare', - 'dstore/Rest', - 'dstore/RequestMemory', - 'dstore/SimpleQuery', - 'dstore/Trackable', - 'dstore/Tree', + 'dojo/_base/lang', + 'dstore/Store', + 'dojo/request', + 'dstore/QueryResults', + 'dstore/Cache', "hos/Socket", "dojo/request/xhr", "dojox/uuid/generateRandomUuid" -], function(config, declare, Rest, RequestMemory, SimpleQuery, Trackable, Tree, Socket, xhr, generateRandomUuid){ +], function(config, declare, lang, Store, request, QueryResults, Cache, Socket, xhr, generateRandomUuid){ - var RuleEngineStore = declare([Rest, RequestMemory, SimpleQuery, Trackable, Tree], { - _getTarget: function(id){ - var target = this.target; - if(!target.slice(-1) == '/'){ - target += "/"; - } - return target + "packages" + id; + var _RuleEngineStore = declare([Store], { + + _request: function (target, options) { + // Most responses will be in JSON, so we make that the default expected format. + options = lang.mixin({ handleAs: 'json' }, options); + options.headers = lang.mixin({}, this.headers, options.headers); + return request(this.target + target, options); + }, + + fetch: function () { + return new QueryResults(this._request('packages')); } }); + + var RuleEngineStore = declare([_RuleEngineStore, Cache], { + isValidFetchCache: true + }); var _store = new RuleEngineStore({ target: config.hos.ruleEngineUrl diff --git a/src/hos_cosgi_testwebapp/webroot/libs/util/buildscripts/build.sh b/src/hos_cosgi_testwebapp/webroot/libs/util/buildscripts/build.sh old mode 100755 new mode 100644 diff --git a/src/hos_cosgi_testwebapp/webroot/libs/util/buildscripts/build_release.sh b/src/hos_cosgi_testwebapp/webroot/libs/util/buildscripts/build_release.sh old mode 100755 new mode 100644 diff --git a/src/hos_cosgi_testwebapp/webroot/libs/util/buildscripts/clean_release.sh b/src/hos_cosgi_testwebapp/webroot/libs/util/buildscripts/clean_release.sh old mode 100755 new mode 100644 diff --git a/src/hos_cosgi_testwebapp/webroot/libs/util/buildscripts/mk_branch.sh b/src/hos_cosgi_testwebapp/webroot/libs/util/buildscripts/mk_branch.sh old mode 100755 new mode 100644 diff --git a/src/hos_cosgi_testwebapp/webroot/libs/util/docscripts/dumpObj.php b/src/hos_cosgi_testwebapp/webroot/libs/util/docscripts/dumpObj.php old mode 100755 new mode 100644 diff --git a/src/hos_cosgi_testwebapp/webroot/libs/util/docscripts/generate.php b/src/hos_cosgi_testwebapp/webroot/libs/util/docscripts/generate.php old mode 100755 new mode 100644 diff --git a/src/hos_cosgi_testwebapp/webroot/libs/util/docscripts/makeCix.php b/src/hos_cosgi_testwebapp/webroot/libs/util/docscripts/makeCix.php old mode 100755 new mode 100644 diff --git a/src/hos_cosgi_testwebapp/webroot/libs/util/doh/runner.sh b/src/hos_cosgi_testwebapp/webroot/libs/util/doh/runner.sh old mode 100755 new mode 100644 diff --git a/src/hos_cosgi_testwebapp/webroot/libs/util/less/bin/lessc b/src/hos_cosgi_testwebapp/webroot/libs/util/less/bin/lessc old mode 100755 new mode 100644 diff --git a/src/hos_cosgi_testwebapp/webroot/libs/util/shrinksafe/build.sh b/src/hos_cosgi_testwebapp/webroot/libs/util/shrinksafe/build.sh old mode 100755 new mode 100644 diff --git a/src/hos_cosgi_testwebapp/webroot/libs/util/shrinksafe/tests/runner.sh b/src/hos_cosgi_testwebapp/webroot/libs/util/shrinksafe/tests/runner.sh old mode 100755 new mode 100644 diff --git a/src/hos_cosgi_testwebapp/webroot/rule01.html b/src/hos_cosgi_testwebapp/webroot/rule01.html index 88a336c3..e3e970bb 100644 --- a/src/hos_cosgi_testwebapp/webroot/rule01.html +++ b/src/hos_cosgi_testwebapp/webroot/rule01.html @@ -41,10 +41,31 @@ "dojo/on", "dojo/domReady!" ], function(RuleEngine, domConstruct, dom, on){ - var test1 = RuleEngine.get("rulepkg01"); + //var test1 = RuleEngine.get("rulepkg01"); + var test1 = RuleEngine.fetch().then(function(results){ + console.log("results1: ", results); + }); console.log("test1: ", test1); - var test2 = RuleEngine.filter({arg01: "param01"}); - console.log("test2: ", test2); + var f1 = RuleEngine.filter(); + var c1 = f1.fetch(); + c1.then(function(data) { + console.log("data: ", data); + RuleEngine.emit('update', {id: data.id, target: data}); + }); + f1.on('update', function(data) { + console.log("update"); + }); + RuleEngine.filter().fetch().then(function(data) { + console.log("data1: ", data); + }); + RuleEngine.filter().fetch().then(function(data) { + console.log("data2: ", data); + }); + RuleEngine.filter().fetch().then(function(data) { + console.log("data3: ", data); + }); + //var test2 = RuleEngine.filter({arg01: "param01"}); + //console.log("test2: ", test2); }); diff --git a/src/hos_cosgi_testwebapp/webroot/widgettest01.html b/src/hos_cosgi_testwebapp/webroot/widgettest01.html index e052491a..43331c2b 100644 --- a/src/hos_cosgi_testwebapp/webroot/widgettest01.html +++ b/src/hos_cosgi_testwebapp/webroot/widgettest01.html @@ -102,6 +102,9 @@ console.log("Update: ", update); } ); + _devices.filter().on('update', function(event){ + console.log("Observe2 triggered: ", event); + }); _devices.on('update', function(event){ // this will be called any time a market is added, removed, or updated console.log("Observe triggered: ", event); diff --git a/src/hos_cosgi_webserver/src/hos/cosgi/service/webserver/WebServerServiceImpl.cpp b/src/hos_cosgi_webserver/src/hos/cosgi/service/webserver/WebServerServiceImpl.cpp index 04ea8f09..631338cd 100644 --- a/src/hos_cosgi_webserver/src/hos/cosgi/service/webserver/WebServerServiceImpl.cpp +++ b/src/hos_cosgi_webserver/src/hos/cosgi/service/webserver/WebServerServiceImpl.cpp @@ -97,6 +97,8 @@ void WebServerServiceImpl::init() noexcept { webServerParams->setSoftwareVersion("Home Operating System alpha"); webServerParams->setMaxThreads(10); + ErrorHandler::set(&errorHandler); + try { Net::ServerSocket webServerSocket(8080); webServer.reset(new Poco::Net::HTTPServer(&handlerFactory, webServerSocket, webServerParams)); @@ -235,6 +237,21 @@ bool WebServerServiceImpl::checkAuthentication( const Poco::Net::HTTPServerReque } +void WebServerServiceImpl::ErrorHandler::exception(const Poco::Exception& exc) { + ROS_ERROR_STREAM("Webserver caught exception (" << exc.code() << "): " << exc.displayText()); +} + + +void WebServerServiceImpl::ErrorHandler::exception(const std::exception& exc) { + ROS_ERROR_STREAM("Webserver caught exception: " << exc.what()); +} + + +void WebServerServiceImpl::ErrorHandler::exception() { + ROS_ERROR_STREAM("Webserver caught unknown exception."); +} + + } // namespace webserver } // namespace service } // namespace cosgi diff --git a/src/hos_cosgi_webserver/src/hos/cosgi/service/webserver/WebServerServiceImpl.h b/src/hos_cosgi_webserver/src/hos/cosgi/service/webserver/WebServerServiceImpl.h index a0b33405..f5fe663c 100644 --- a/src/hos_cosgi_webserver/src/hos/cosgi/service/webserver/WebServerServiceImpl.h +++ b/src/hos_cosgi_webserver/src/hos/cosgi/service/webserver/WebServerServiceImpl.h @@ -15,9 +15,6 @@ #include #include - - - #include #include #include @@ -26,6 +23,7 @@ #include #include #include +#include @@ -39,12 +37,23 @@ namespace webserver { + + + class WebServerServiceImpl : public virtual WebServerService, public implementation::Service { private: + class ErrorHandler + : public Poco::ErrorHandler { + public: + virtual void exception(const Poco::Exception& exc); + virtual void exception(const std::exception& exc); + virtual void exception(); + } errorHandler; + class RequestHandlerFactory : public Poco::Net::HTTPRequestHandlerFactory { private: