From 1a01ce4fe5882fcc5b312172d7fdf409e0cb9765 Mon Sep 17 00:00:00 2001 From: jsdelfino Date: Mon, 20 Feb 2012 07:20:38 +0000 Subject: Fixes to the hosting module to correctly store ATOM feeds instead of raw collections and work with the sqldb component. git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1291136 13f79535-47bb-0310-9956-ffa450edef68 --- sca-cpp/trunk/components/cache/memcache.hpp | 2 +- sca-cpp/trunk/components/sqldb/pgsql-conf | 2 +- sca-cpp/trunk/components/sqldb/pgsql-standby-conf | 4 ++-- sca-cpp/trunk/components/sqldb/pgsql.hpp | 4 +++- sca-cpp/trunk/hosting/server/accounts.py | 2 +- sca-cpp/trunk/hosting/server/apps.py | 14 +------------- sca-cpp/trunk/hosting/server/composites.py | 2 +- sca-cpp/trunk/hosting/server/dashboards.py | 16 ++++++++++------ .../hosting/server/data/apps/testevents/app.composite | 4 ++-- .../hosting/server/data/apps/testhttp/app.composite | 2 +- .../trunk/hosting/server/data/apps/testurl/app.composite | 2 +- .../server/data/dashboards/jane@example.com/user.apps | 1 + .../server/data/dashboards/jane@localhost/user.apps | 2 +- .../server/data/dashboards/jane@sca-store.com/user.apps | 1 - .../server/data/dashboards/john@example.com/user.apps | 1 + .../server/data/dashboards/john@localhost/user.apps | 2 +- .../server/data/dashboards/john@sca-store.com/user.apps | 1 - sca-cpp/trunk/hosting/server/data/store/all/store.apps | 2 +- .../trunk/hosting/server/data/store/featured/store.apps | 2 +- sca-cpp/trunk/hosting/server/data/store/new/store.apps | 2 +- sca-cpp/trunk/hosting/server/data/store/top/store.apps | 2 +- sca-cpp/trunk/hosting/server/htdocs/graph/index.html | 2 +- sca-cpp/trunk/hosting/server/htdocs/page/index.html | 2 +- sca-cpp/trunk/hosting/server/pages.py | 2 +- sca-cpp/trunk/hosting/server/palettes.py | 2 +- sca-cpp/trunk/hosting/server/selector.py | 8 ++++---- sca-cpp/trunk/hosting/server/store.py | 16 ++++++++++------ sca-cpp/trunk/modules/http/Makefile.am | 2 +- sca-cpp/trunk/modules/http/http.hpp | 8 +++++--- 29 files changed, 56 insertions(+), 56 deletions(-) create mode 100644 sca-cpp/trunk/hosting/server/data/dashboards/jane@example.com/user.apps delete mode 100644 sca-cpp/trunk/hosting/server/data/dashboards/jane@sca-store.com/user.apps create mode 100644 sca-cpp/trunk/hosting/server/data/dashboards/john@example.com/user.apps delete mode 100644 sca-cpp/trunk/hosting/server/data/dashboards/john@sca-store.com/user.apps (limited to 'sca-cpp') diff --git a/sca-cpp/trunk/components/cache/memcache.hpp b/sca-cpp/trunk/components/cache/memcache.hpp index f19f18c4ec..2dcd6ea033 100644 --- a/sca-cpp/trunk/components/cache/memcache.hpp +++ b/sca-cpp/trunk/components/cache/memcache.hpp @@ -63,7 +63,7 @@ public: MemCached(const list& servers) : owner(true) { debug(servers, "memcache::memcached::servers"); apr_pool_create(&pool, NULL); - apr_memcache_create(pool, 1, 0, &mc); + apr_memcache_create(pool, (apr_uint16_t)length(servers), 0, &mc); addServers(servers); } diff --git a/sca-cpp/trunk/components/sqldb/pgsql-conf b/sca-cpp/trunk/components/sqldb/pgsql-conf index 4083160a02..2cfe47880b 100755 --- a/sca-cpp/trunk/components/sqldb/pgsql-conf +++ b/sca-cpp/trunk/components/sqldb/pgsql-conf @@ -98,7 +98,7 @@ host replication all samenet trust EOF # Create the db -$pgsql_prefix/bin/pg_ctl start -W -D $root/sqldb/data 2>&1 | sh $root/sqldb/logger +($pgsql_prefix/bin/pg_ctl start -W -D $root/sqldb/data 2>&1 | sh $root/sqldb/logger)& sti=0 while [ $sti -ne 30 ]; do st=`$pgsql_prefix/bin/pg_ctl status -D $root/sqldb/data | grep 'server is running'` diff --git a/sca-cpp/trunk/components/sqldb/pgsql-standby-conf b/sca-cpp/trunk/components/sqldb/pgsql-standby-conf index 59979f3ef2..b5dd238282 100755 --- a/sca-cpp/trunk/components/sqldb/pgsql-standby-conf +++ b/sca-cpp/trunk/components/sqldb/pgsql-standby-conf @@ -63,7 +63,7 @@ mkdir -p $root/sqldb/archive # Initialize from a backup of the master if [ ! -f $root/sqldb/data/postgresql.conf ]; then - (wget http://$mhost:$mhttpport/pgsql-backup -O - | tar -C $root/sqldb -xz) 2>&1 | sh $root/sqldb/logger + (curl -L http://$mhost:$mhttpport/pgsql-backup | tar -C $root/sqldb -xz) 2>&1 | sh $root/sqldb/logger rm -rf $root/sqldb/data/postmaster.pid $root/sqldb/data/pg_xlog mkdir -p $root/sqldb/data/pg_xlog/archive_status chmod 700 $root/sqldb/data/pg_xlog/archive_status @@ -104,7 +104,7 @@ primary_conninfo = 'host=$mhost port=$mport' # Failover trigger_file = '$root/sqldb/failover' -restore_command = 'wget http://$mhost:$mhttpport/pgsql-archive/%f -O "%p"' +restore_command = 'curl http://$mhost:$mhttpport/pgsql-archive/%f -o "%p"' EOF diff --git a/sca-cpp/trunk/components/sqldb/pgsql.hpp b/sca-cpp/trunk/components/sqldb/pgsql.hpp index df9b2724ff..74d638f370 100644 --- a/sca-cpp/trunk/components/sqldb/pgsql.hpp +++ b/sca-cpp/trunk/components/sqldb/pgsql.hpp @@ -231,7 +231,9 @@ const failable get(const value& key, const PGSql& pgsql) { return mkfailure(string("Couldn't execute select postgresql SQL statement: ") + pgfailure(r, pgsql.conn)); if (PQntuples(r) < 1) { PQclear(r); - return mkfailure(string("Couldn't get postgresql entry: ") + PQerrorMessage(pgsql.conn)); + ostringstream os; + os << "Couldn't get postgresql entry: " << key; + return mkfailure(str(os)); } const char* data = PQgetvalue(r, 0, 1); const value val(scheme::readValue(string(data))); diff --git a/sca-cpp/trunk/hosting/server/accounts.py b/sca-cpp/trunk/hosting/server/accounts.py index 4a50b15981..4415c69e62 100644 --- a/sca-cpp/trunk/hosting/server/accounts.py +++ b/sca-cpp/trunk/hosting/server/accounts.py @@ -20,7 +20,7 @@ from util import * # Convert a particular user id to an account id def accountid(user): - return ("'accounts", "'" + user.id(), "'user.account") + return ("accounts", user.id(), "user.account") # Get the current user's account def get(id, user, cache): diff --git a/sca-cpp/trunk/hosting/server/apps.py b/sca-cpp/trunk/hosting/server/apps.py index cc84544dd5..40d1da7dce 100644 --- a/sca-cpp/trunk/hosting/server/apps.py +++ b/sca-cpp/trunk/hosting/server/apps.py @@ -21,17 +21,7 @@ from util import * # Convert an id to an app id def appid(id): - return ("'apps", "'" + car(id), "'app.stats") - -# Link implementation resources into an app -def mkapplink(id): - try: - os.symlink('../../../../../../nuvem/nuvem-parallel/nuvem', 'data/apps/' + car(id) + '/nuvem') - os.symlink('../../../../../components', 'data/apps/' + car(id) + '/lib') - os.mkdir('data/apps/' + car(id) + '/htdocs') - except: - pass - return True + return ("apps", car(id), "app.stats") # Put an app into the apps db def put(id, app, cache, store, composites, pages): @@ -41,12 +31,10 @@ def put(id, app, cache, store, composites, pages): # Update app in apps db if car(id) == eid: cache.put(appid(id), appentry) - mkapplink(id) return True # Clone an app's composite and page cache.put(appid(id), appentry) - mkapplink(id) composites.put(id, composites.get((eid,))) pages.put(id, pages.get((eid,))) return True diff --git a/sca-cpp/trunk/hosting/server/composites.py b/sca-cpp/trunk/hosting/server/composites.py index d929716bd7..2b59ebdab4 100644 --- a/sca-cpp/trunk/hosting/server/composites.py +++ b/sca-cpp/trunk/hosting/server/composites.py @@ -20,7 +20,7 @@ from util import * # Convert an id to an app id def appid(id): - return ("'apps", "'" + car(id), "'app.composite") + return ("apps", car(id), "app.composite") # Put an app into the apps db def put(id, app, cache): diff --git a/sca-cpp/trunk/hosting/server/dashboards.py b/sca-cpp/trunk/hosting/server/dashboards.py index 22cf59f157..c7ea066d4e 100644 --- a/sca-cpp/trunk/hosting/server/dashboards.py +++ b/sca-cpp/trunk/hosting/server/dashboards.py @@ -20,14 +20,18 @@ from util import * # Convert a particular user id to a dashboard id def dashboardid(user): - return ("'dashboards", "'" + user.id(), "'user.apps") + return ("dashboards", user.id(), "user.apps") # Get a dashboard from the cache def getdashboard(id, cache): - dashboard = cache.get(id) - if isNil(dashboard) or dashboard is None: + val = cache.get(id) + if isNil(val) or val is None: return () - return dashboard + return cdddr(car(val)) + +# Put a dashboard into the cache +def putdashboard(id, dashboard, cache): + val = ((("'feed", ("'title", "Your Apps"), ("'id", cadr(id))) + dashboard),) # Put an app into the user's dashboard def put(id, app, user, cache, apps): @@ -40,7 +44,7 @@ def put(id, app, user, cache, apps): appentry = (("'entry", cadr(car(app)), ("'id", car(id))),) dashboard = putapp(appentry, getdashboard(dashboardid(user), cache)) - cache.put(dashboardid(user), dashboard) + putdashboard(dashboardid(user), dashboard, cache) # Update app in app repository apps.put(id, app); @@ -72,7 +76,7 @@ def delete(id, user, cache, apps): return cons(car(dashboard), deleteapp(id, cdr(dashboard))) dashboard = deleteapp(id, getdashboard(dashboardid(user), cache)) - cache.put(dashboardid(user), dashboard) + putdashboard(dashboardid(user), dashboard, cache) # Delete app from app repository apps.delete(id); diff --git a/sca-cpp/trunk/hosting/server/data/apps/testevents/app.composite b/sca-cpp/trunk/hosting/server/data/apps/testevents/app.composite index 61cd17ec81..4a45bd3a8f 100644 --- a/sca-cpp/trunk/hosting/server/data/apps/testevents/app.composite +++ b/sca-cpp/trunk/hosting/server/data/apps/testevents/app.composite @@ -123,7 +123,7 @@ - https://testhttp.sca-store.com:8453/components/property + https://testhttp.example.com:8453/components/property @@ -182,7 +182,7 @@ - https://testhttp.sca-store.com:8453/components/property + https://testhttp.example.com:8453/components/property diff --git a/sca-cpp/trunk/hosting/server/data/apps/testhttp/app.composite b/sca-cpp/trunk/hosting/server/data/apps/testhttp/app.composite index 6aabf6d4bb..11723c7207 100644 --- a/sca-cpp/trunk/hosting/server/data/apps/testhttp/app.composite +++ b/sca-cpp/trunk/hosting/server/data/apps/testhttp/app.composite @@ -146,7 +146,7 @@ - https://testhttp.sca-store.com:8453/components/property + https://testhttp.example.com:8453/components/property diff --git a/sca-cpp/trunk/hosting/server/data/apps/testurl/app.composite b/sca-cpp/trunk/hosting/server/data/apps/testurl/app.composite index 7b97b7a957..114fdcf20a 100644 --- a/sca-cpp/trunk/hosting/server/data/apps/testurl/app.composite +++ b/sca-cpp/trunk/hosting/server/data/apps/testurl/app.composite @@ -93,7 +93,7 @@ - http://sca-store.com/ + http://example.com/ diff --git a/sca-cpp/trunk/hosting/server/data/dashboards/jane@example.com/user.apps b/sca-cpp/trunk/hosting/server/data/dashboards/jane@example.com/user.apps new file mode 100644 index 0000000000..6126c4b88c --- /dev/null +++ b/sca-cpp/trunk/hosting/server/data/dashboards/jane@example.com/user.apps @@ -0,0 +1 @@ +((feed (title "Your Apps") (id "jane@example.com") (entry (title "An empty test app") (id "test")))) diff --git a/sca-cpp/trunk/hosting/server/data/dashboards/jane@localhost/user.apps b/sca-cpp/trunk/hosting/server/data/dashboards/jane@localhost/user.apps index 710de5f62e..c62dbfb6b8 100644 --- a/sca-cpp/trunk/hosting/server/data/dashboards/jane@localhost/user.apps +++ b/sca-cpp/trunk/hosting/server/data/dashboards/jane@localhost/user.apps @@ -1 +1 @@ -((entry (title "An empty test app") (id "test"))) +((feed (title "Your Apps") (id "jane@localhost") (entry (title "An empty test app") (id "test")))) diff --git a/sca-cpp/trunk/hosting/server/data/dashboards/jane@sca-store.com/user.apps b/sca-cpp/trunk/hosting/server/data/dashboards/jane@sca-store.com/user.apps deleted file mode 100644 index 710de5f62e..0000000000 --- a/sca-cpp/trunk/hosting/server/data/dashboards/jane@sca-store.com/user.apps +++ /dev/null @@ -1 +0,0 @@ -((entry (title "An empty test app") (id "test"))) diff --git a/sca-cpp/trunk/hosting/server/data/dashboards/john@example.com/user.apps b/sca-cpp/trunk/hosting/server/data/dashboards/john@example.com/user.apps new file mode 100644 index 0000000000..bc4d3f64fa --- /dev/null +++ b/sca-cpp/trunk/hosting/server/data/dashboards/john@example.com/user.apps @@ -0,0 +1 @@ +((feed (title "Your Apps") (id "john@example.com") (entry (title "An empty test app") (id "test")))) diff --git a/sca-cpp/trunk/hosting/server/data/dashboards/john@localhost/user.apps b/sca-cpp/trunk/hosting/server/data/dashboards/john@localhost/user.apps index 710de5f62e..ee20c1c2c5 100644 --- a/sca-cpp/trunk/hosting/server/data/dashboards/john@localhost/user.apps +++ b/sca-cpp/trunk/hosting/server/data/dashboards/john@localhost/user.apps @@ -1 +1 @@ -((entry (title "An empty test app") (id "test"))) +((feed (title "Your Apps") (id "john@localhost") (entry (title "An empty test app") (id "test")))) diff --git a/sca-cpp/trunk/hosting/server/data/dashboards/john@sca-store.com/user.apps b/sca-cpp/trunk/hosting/server/data/dashboards/john@sca-store.com/user.apps deleted file mode 100644 index 710de5f62e..0000000000 --- a/sca-cpp/trunk/hosting/server/data/dashboards/john@sca-store.com/user.apps +++ /dev/null @@ -1 +0,0 @@ -((entry (title "An empty test app") (id "test"))) diff --git a/sca-cpp/trunk/hosting/server/data/store/all/store.apps b/sca-cpp/trunk/hosting/server/data/store/all/store.apps index caf7142403..50b108402b 100644 --- a/sca-cpp/trunk/hosting/server/data/store/all/store.apps +++ b/sca-cpp/trunk/hosting/server/data/store/all/store.apps @@ -1 +1 @@ -((entry (title "Check my public social data") (id "me360")) (entry (title "Where are my friends") (id "nearme")) (entry (title "Where are my friends") (id "nearme2")) (entry (title "Our photos of an event") (id "ourphotos")) (entry (title "Slice") (id "slice")) (entry (title "My online store") (id "shoppingcart")) (entry (title "SMS send service") (id "twsms")) (entry (title "An empty test app") (id "test")) (entry (title "Test values and lists") (id "testvalues")) (entry (title "Test social components") (id "testsocial")) (entry (title "Test URL components") (id "testurl")) (entry (title "Test logic components") (id "testlogic")) (entry (title "Test text processing components") (id "testtext")) (entry (title "Test HTTP components") (id "testhttp")) (entry (title "Test SMS API") (id "testsms")) (entry (title "Test widgets") (id "testwidgets")) (entry (title "Test more widgets") (id "testwidgets2")) (entry (title "Test event components") (id "testevents")) (entry (title "Test search components") (id "testsearch")) (entry (title "Test database components") (id "testdb")) (entry (title "Test HTML generator components") (id "testwidgets3")) (entry (title "Test animation components") (id "testanimation"))) +((feed (title "App Store") (id "all") (entry (title "Check my public social data") (id "me360")) (entry (title "Where are my friends") (id "nearme")) (entry (title "Where are my friends") (id "nearme2")) (entry (title "Our photos of an event") (id "ourphotos")) (entry (title "Slice") (id "slice")) (entry (title "My online store") (id "shoppingcart")) (entry (title "SMS send service") (id "twsms")) (entry (title "An empty test app") (id "test")) (entry (title "Test values and lists") (id "testvalues")) (entry (title "Test social components") (id "testsocial")) (entry (title "Test URL components") (id "testurl")) (entry (title "Test logic components") (id "testlogic")) (entry (title "Test text processing components") (id "testtext")) (entry (title "Test HTTP components") (id "testhttp")) (entry (title "Test SMS API") (id "testsms")) (entry (title "Test widgets") (id "testwidgets")) (entry (title "Test more widgets") (id "testwidgets2")) (entry (title "Test event components") (id "testevents")) (entry (title "Test search components") (id "testsearch")) (entry (title "Test database components") (id "testdb")) (entry (title "Test HTML generator components") (id "testwidgets3")) (entry (title "Test animation components") (id "testanimation")))) diff --git a/sca-cpp/trunk/hosting/server/data/store/featured/store.apps b/sca-cpp/trunk/hosting/server/data/store/featured/store.apps index 18bd47e8dd..963b1615c2 100644 --- a/sca-cpp/trunk/hosting/server/data/store/featured/store.apps +++ b/sca-cpp/trunk/hosting/server/data/store/featured/store.apps @@ -1 +1 @@ -((entry (title "Check my public social data") (id "me360")) (entry (title "Where are my friends") (id "nearme")) (entry (title "Where are my friends") (id "nearme2")) (entry (title "Our photos of an event") (id "ourphotos")) (entry (title "Slice") (id "slice")) (entry (title "My online store") (id "shoppingcart")) (entry (title "SMS send service") (id "twsms"))) +((feed (title "App Store") (id "featured") (entry (title "Check my public social data") (id "me360")) (entry (title "Where are my friends") (id "nearme")) (entry (title "Where are my friends") (id "nearme2")) (entry (title "Our photos of an event") (id "ourphotos")) (entry (title "Slice") (id "slice")) (entry (title "My online store") (id "shoppingcart")) (entry (title "SMS send service") (id "twsms")))) diff --git a/sca-cpp/trunk/hosting/server/data/store/new/store.apps b/sca-cpp/trunk/hosting/server/data/store/new/store.apps index 18bd47e8dd..5a58805b74 100644 --- a/sca-cpp/trunk/hosting/server/data/store/new/store.apps +++ b/sca-cpp/trunk/hosting/server/data/store/new/store.apps @@ -1 +1 @@ -((entry (title "Check my public social data") (id "me360")) (entry (title "Where are my friends") (id "nearme")) (entry (title "Where are my friends") (id "nearme2")) (entry (title "Our photos of an event") (id "ourphotos")) (entry (title "Slice") (id "slice")) (entry (title "My online store") (id "shoppingcart")) (entry (title "SMS send service") (id "twsms"))) +((feed (title "App Store") (id "new") (entry (title "Check my public social data") (id "me360")) (entry (title "Where are my friends") (id "nearme")) (entry (title "Where are my friends") (id "nearme2")) (entry (title "Our photos of an event") (id "ourphotos")) (entry (title "Slice") (id "slice")) (entry (title "My online store") (id "shoppingcart")) (entry (title "SMS send service") (id "twsms")))) diff --git a/sca-cpp/trunk/hosting/server/data/store/top/store.apps b/sca-cpp/trunk/hosting/server/data/store/top/store.apps index 18bd47e8dd..95e6ff24d3 100644 --- a/sca-cpp/trunk/hosting/server/data/store/top/store.apps +++ b/sca-cpp/trunk/hosting/server/data/store/top/store.apps @@ -1 +1 @@ -((entry (title "Check my public social data") (id "me360")) (entry (title "Where are my friends") (id "nearme")) (entry (title "Where are my friends") (id "nearme2")) (entry (title "Our photos of an event") (id "ourphotos")) (entry (title "Slice") (id "slice")) (entry (title "My online store") (id "shoppingcart")) (entry (title "SMS send service") (id "twsms"))) +((feed (title "App Store") (id "top") (entry (title "Check my public social data") (id "me360")) (entry (title "Where are my friends") (id "nearme")) (entry (title "Where are my friends") (id "nearme2")) (entry (title "Our photos of an event") (id "ourphotos")) (entry (title "Slice") (id "slice")) (entry (title "My online store") (id "shoppingcart")) (entry (title "SMS send service") (id "twsms")))) diff --git a/sca-cpp/trunk/hosting/server/htdocs/graph/index.html b/sca-cpp/trunk/hosting/server/htdocs/graph/index.html index 6b750026b4..34b7ead90e 100644 --- a/sca-cpp/trunk/hosting/server/htdocs/graph/index.html +++ b/sca-cpp/trunk/hosting/server/htdocs/graph/index.html @@ -1997,7 +1997,7 @@ function installpalette(name, pos, g, bg, palette, gpalettes) { function save(savexml) { showStatus('Saving'); savedcomposxml = savexml; - var entry = '' + + var entry = '\n' + '' + '' + appname + '' + appname + '' + savedcomposxml + ''; composites.put(appname, entry, function(e) { diff --git a/sca-cpp/trunk/hosting/server/htdocs/page/index.html b/sca-cpp/trunk/hosting/server/htdocs/page/index.html index 9482cb4e32..c379dd3698 100644 --- a/sca-cpp/trunk/hosting/server/htdocs/page/index.html +++ b/sca-cpp/trunk/hosting/server/htdocs/page/index.html @@ -872,7 +872,7 @@ function save(newxml) { savedpagexhtml = newxml; // Update the page ATOM entry - var entry = '' + + var entry = '\n' + '' + '' + appname + '' + appname + '' + newxml + ''; diff --git a/sca-cpp/trunk/hosting/server/pages.py b/sca-cpp/trunk/hosting/server/pages.py index a1ec888a0f..ae641817ec 100644 --- a/sca-cpp/trunk/hosting/server/pages.py +++ b/sca-cpp/trunk/hosting/server/pages.py @@ -20,7 +20,7 @@ from util import * # Convert an id to an app id def appid(id): - return ("'apps", "'" + car(id), "'htdocs", "'app.html") + return ("apps", car(id), "htdocs", "app.html") # Put an app page into the apps db def put(id, app, cache): diff --git a/sca-cpp/trunk/hosting/server/palettes.py b/sca-cpp/trunk/hosting/server/palettes.py index 378f4da18f..321db3cf46 100644 --- a/sca-cpp/trunk/hosting/server/palettes.py +++ b/sca-cpp/trunk/hosting/server/palettes.py @@ -20,7 +20,7 @@ from util import * # Convert an id to a palette id def paletteid(id): - return ("'palettes", "'" + car(id), "'palette.composite") + return ("palettes", car(id), "palette.composite") # Put a palette into the palettes db def put(id, palette, cache): diff --git a/sca-cpp/trunk/hosting/server/selector.py b/sca-cpp/trunk/hosting/server/selector.py index 84ade136ba..7fcdd65a0f 100644 --- a/sca-cpp/trunk/hosting/server/selector.py +++ b/sca-cpp/trunk/hosting/server/selector.py @@ -19,10 +19,10 @@ from util import * # Get the database to use for a particular key -def get(id, db1, db2): +def get(id, db): if isNil(id): - return db1 + return db[0] if cadr(id)[0:1].lower() < 'm': - return db1 - return db2 + return db[0] + return db[1] diff --git a/sca-cpp/trunk/hosting/server/store.py b/sca-cpp/trunk/hosting/server/store.py index 014c07050e..930e8b3639 100644 --- a/sca-cpp/trunk/hosting/server/store.py +++ b/sca-cpp/trunk/hosting/server/store.py @@ -20,14 +20,18 @@ from util import * # Convert a particular store tag to a store id def storeid(tag): - return ("'store", "'" + tag, "'store.apps") + return ("store", tag, "store.apps") # Get a store from the cache def getstore(id, cache): - store = cache.get(id) - if isNil(store) or store is None: + val = cache.get(id) + if isNil(val) or val is None: return () - return store + return cdddr(car(val)) + +# Put a store into the cache +def putstore(id, store, cache): + val = ((("'feed", ("'title", "App Store"), ("'id", cadr(id))) + store),) # Put an app into a store def put(key, app, cache): @@ -40,7 +44,7 @@ def put(key, app, cache): tag = car(key) store = putapp(app, getstore(storeid(tag), cache)) - cache.put(storeid(tag), store) + putstore(storeid(tag), store, cache) return True # Get apps from a store @@ -75,6 +79,6 @@ def delete(key, cache): return cons(car(store), deleteapp(id, cdr(store))) store = deleteapp(id, getstore(storeid(tag), cache)) - cache.put(storeid(tag), store) + putstore(storeid(tag), store, cache) return True diff --git a/sca-cpp/trunk/modules/http/Makefile.am b/sca-cpp/trunk/modules/http/Makefile.am index 846c8ac6cc..2cbbfdbad7 100644 --- a/sca-cpp/trunk/modules/http/Makefile.am +++ b/sca-cpp/trunk/modules/http/Makefile.am @@ -20,7 +20,7 @@ INCLUDES = -I${HTTPD_INCLUDE} incl_HEADERS = *.hpp incldir = $(prefix)/include/modules/http -dist_mod_SCRIPTS = httpd-conf httpd-addr httpd-start httpd-stop httpd-restart ssl-ca-conf ssl-cert-conf ssl-cert-find httpd-ssl-conf basic-auth-conf cert-auth-conf form-auth-conf open-auth-conf passwd-auth-conf group-auth-conf proxy-conf proxy-ssl-conf proxy-member-conf proxy-ssl-member-conf proxy-ssl-nossl-member-conf vhost-conf vhost-ssl-conf tunnel-ssl-conf httpd-worker-conf httpd-event-conf minify-html minify-js minify-css +dist_mod_SCRIPTS = httpd-conf httpd-addr httpd-start httpd-stop httpd-restart ssl-ca-conf ssl-cert-conf ssl-cert-find httpd-ssl-conf basic-auth-conf cert-auth-conf form-auth-conf open-auth-conf passwd-auth-conf group-auth-conf proxy-conf proxy-ssl-conf proxy-member-conf proxy-ssl-member-conf proxy-ssl-nossl-member-conf vhost-conf vhost-ssl-conf tunnel-ssl-conf httpd-worker-conf httpd-event-conf httpd-loglevel-conf minify-html minify-js minify-css moddir = $(prefix)/modules/http curl_test_SOURCES = curl-test.cpp diff --git a/sca-cpp/trunk/modules/http/http.hpp b/sca-cpp/trunk/modules/http/http.hpp index 530f3c0c5c..0b4c9f6822 100644 --- a/sca-cpp/trunk/modules/http/http.hpp +++ b/sca-cpp/trunk/modules/http/http.hpp @@ -634,7 +634,7 @@ const failable > > contentRequest(const value& c, unused const if (isString(car(c)) && !isNil(cdr(c)) && isList(cadr(c))) return writeRequest(convertValues(cadr(c)), car(c)); - // Write an assoc value as a JSON result + // Write an assoc value as JSON if (isSymbol(car(c)) && !isNil(cdr(c))) { js::JSContext cx; const list lc = mklist(c); @@ -888,7 +888,7 @@ const string queryString(const list > args) { * Filter path segment in a list of arguments. */ const bool filterPath(const value& arg) { - return isString(arg); + return isString(arg) || isSymbol(arg); } /** @@ -914,11 +914,13 @@ struct proxy { } const value operator()(const list& args) const { + debug(args, "http::proxy::args"); const value fun = car(args); if (fun == "get") { const list lp = filter(filterPath, cadr(args)); - debug(lp, "http::queryString::arg"); + debug(lp, "http::proxy::path"); const list lq = map(escapeQuery, filter(filterQuery, cadr(args))); + debug(lp, "http::proxy::query"); const value p = path(lp); const value q = queryString(lq); const failable val = get(uri + p + (q != ""? string("?") + q : string("")), cs); -- cgit v1.2.3