diff options
Diffstat (limited to '')
25 files changed, 140 insertions, 78 deletions
diff --git a/sca-cpp/trunk/modules/edit/apps.py b/sca-cpp/trunk/modules/edit/apps.py index 4add10a239..a820f969cb 100644 --- a/sca-cpp/trunk/modules/edit/apps.py +++ b/sca-cpp/trunk/modules/edit/apps.py @@ -15,15 +15,13 @@ # specific language governing permissions and limitations # under the License. -# Apps collection implementation -import uuid -import sys +# App collection implementation import os from util import * # Convert an id to an app id def appid(id): - return ("'" + car(id), "'app.composite") + return ("'" + car(id), "'app.stats") # Link implementation resources into an app def mkapplink(id): @@ -31,45 +29,41 @@ def mkapplink(id): os.symlink('../../../../../nuvem/nuvem-parallel/nuvem', 'apps/' + car(id) + '/nuvem') os.symlink('../../../../components', 'apps/' + car(id) + '/lib') os.mkdir('apps/' + car(id) + '/htdocs') - os.symlink('../../../htdocs/cache-manifest.cmf', 'apps/' + car(id) + '/htdocs/cache-manifest.cmf'); - os.symlink('../../../htdocs/login', 'apps/' + car(id) + '/htdocs/login'); - os.symlink('../../../htdocs/logout', 'apps/' + car(id) + '/htdocs/logout'); - os.symlink('../../../htdocs/public', 'apps/' + car(id) + '/htdocs/public'); - os.symlink('../../../htdocs/data', 'apps/' + car(id) + '/htdocs/data'); - os.symlink('../../../htdocs/app/index.html', 'apps/' + car(id) + '/htdocs/index.html'); - os.symlink('../../../htdocs/robots.txt', 'apps/' + car(id) + '/htdocs/robots.txt'); - os.symlink('../../../htdocs/favicon.ico', 'apps/' + car(id) + '/htdocs/favicon.ico'); - os.symlink('../app.html', 'apps/' + car(id) + '/htdocs/app.html'); except: pass return True -# Post a new app to the apps db -def post(collection, app, cache): - id = appid((str(uuid.uuid1()),)) - comp = cdr(cadddr(car(app))) - cache.put((id,), comp) - mkapplink((id,)) - return id - # Put an app into the apps db -def put(id, app, cache): - comp = cdr(cadddr(car(app))) - cache.put(appid(id), comp) +def put(id, app, cache, store, composites, pages): + eid = cadr(caddr(car(app))) + appentry = (("'entry", cadr(car(app)), ("'id", car(id))),) + + # 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 # Get an app from the apps db -def get(id, cache): +def get(id, cache, store, composites, pages): if isNil(id): return (("'feed", ("'title", "Apps"), ("'id", "apps")),) app = cache.get(appid(id)); if (isNil(app) or app is None): return (("'entry", ("'title", car(id)), ("'id", car(id))),) - return (("'entry", ("'title", car(id)), ("'id", car(id)), ("'content", car(app))),) + return app # Delete an app from the apps db -def delete(id, cache): +def delete(id, cache, store, composites, pages): cache.delete(appid(id)) + composites.delete(id) + pages.delete(id) return True diff --git a/sca-cpp/trunk/modules/edit/apps/me360/app.stats b/sca-cpp/trunk/modules/edit/apps/me360/app.stats new file mode 100644 index 0000000000..a46c727280 --- /dev/null +++ b/sca-cpp/trunk/modules/edit/apps/me360/app.stats @@ -0,0 +1 @@ +((entry (title "Check my public social data") (id "me360")))
\ No newline at end of file diff --git a/sca-cpp/trunk/modules/edit/apps/nearme/app.stats b/sca-cpp/trunk/modules/edit/apps/nearme/app.stats new file mode 100644 index 0000000000..b2f5c5ea79 --- /dev/null +++ b/sca-cpp/trunk/modules/edit/apps/nearme/app.stats @@ -0,0 +1 @@ +((entry (title "Where are my friends") (id "nearme")))
\ No newline at end of file diff --git a/sca-cpp/trunk/modules/edit/apps/ourphotos/app.stats b/sca-cpp/trunk/modules/edit/apps/ourphotos/app.stats new file mode 100644 index 0000000000..e685d930dd --- /dev/null +++ b/sca-cpp/trunk/modules/edit/apps/ourphotos/app.stats @@ -0,0 +1 @@ +((entry (title "Our photos of an event") (id "ourphotos")))
\ No newline at end of file diff --git a/sca-cpp/trunk/modules/edit/apps/shoppingcart/app.stats b/sca-cpp/trunk/modules/edit/apps/shoppingcart/app.stats new file mode 100644 index 0000000000..4529005b54 --- /dev/null +++ b/sca-cpp/trunk/modules/edit/apps/shoppingcart/app.stats @@ -0,0 +1 @@ +((entry (title "My online store") (id "shoppingcart")))
\ No newline at end of file diff --git a/sca-cpp/trunk/modules/edit/apps/slice/app.stats b/sca-cpp/trunk/modules/edit/apps/slice/app.stats new file mode 100644 index 0000000000..96700a9085 --- /dev/null +++ b/sca-cpp/trunk/modules/edit/apps/slice/app.stats @@ -0,0 +1 @@ +((entry (title "Slice") (id "slice")))
\ No newline at end of file diff --git a/sca-cpp/trunk/modules/edit/apps/test/app.stats b/sca-cpp/trunk/modules/edit/apps/test/app.stats new file mode 100644 index 0000000000..9adad8c1a6 --- /dev/null +++ b/sca-cpp/trunk/modules/edit/apps/test/app.stats @@ -0,0 +1 @@ +((entry (title "An empty test app") (id "test")))
\ No newline at end of file diff --git a/sca-cpp/trunk/modules/edit/apps/testdb/app.stats b/sca-cpp/trunk/modules/edit/apps/testdb/app.stats new file mode 100644 index 0000000000..1128933dfd --- /dev/null +++ b/sca-cpp/trunk/modules/edit/apps/testdb/app.stats @@ -0,0 +1 @@ +((entry (title "Test database components") (id "testdb")))
\ No newline at end of file diff --git a/sca-cpp/trunk/modules/edit/apps/testevents/app.stats b/sca-cpp/trunk/modules/edit/apps/testevents/app.stats new file mode 100644 index 0000000000..51d6a0388e --- /dev/null +++ b/sca-cpp/trunk/modules/edit/apps/testevents/app.stats @@ -0,0 +1 @@ +((entry (title "Test event components") (id "testevents")))
\ No newline at end of file diff --git a/sca-cpp/trunk/modules/edit/apps/testhttp/app.stats b/sca-cpp/trunk/modules/edit/apps/testhttp/app.stats new file mode 100644 index 0000000000..be1fc6d254 --- /dev/null +++ b/sca-cpp/trunk/modules/edit/apps/testhttp/app.stats @@ -0,0 +1 @@ +((entry (title "Test HTTP components") (id "testhttp")))
\ No newline at end of file diff --git a/sca-cpp/trunk/modules/edit/apps/testlogic/app.stats b/sca-cpp/trunk/modules/edit/apps/testlogic/app.stats new file mode 100644 index 0000000000..e557346327 --- /dev/null +++ b/sca-cpp/trunk/modules/edit/apps/testlogic/app.stats @@ -0,0 +1 @@ +((entry (title "Test logic components") (id "testlogic")))
\ No newline at end of file diff --git a/sca-cpp/trunk/modules/edit/apps/testsearch/app.stats b/sca-cpp/trunk/modules/edit/apps/testsearch/app.stats new file mode 100644 index 0000000000..691c43875d --- /dev/null +++ b/sca-cpp/trunk/modules/edit/apps/testsearch/app.stats @@ -0,0 +1 @@ +((entry (title "Test search components") (id "testsearch")))
\ No newline at end of file diff --git a/sca-cpp/trunk/modules/edit/apps/testsocial/app.stats b/sca-cpp/trunk/modules/edit/apps/testsocial/app.stats new file mode 100644 index 0000000000..fa487f4d81 --- /dev/null +++ b/sca-cpp/trunk/modules/edit/apps/testsocial/app.stats @@ -0,0 +1 @@ +((entry (title "Test social components") (id "testsocial")))
\ No newline at end of file diff --git a/sca-cpp/trunk/modules/edit/apps/testtext/app.stats b/sca-cpp/trunk/modules/edit/apps/testtext/app.stats new file mode 100644 index 0000000000..35e43ff383 --- /dev/null +++ b/sca-cpp/trunk/modules/edit/apps/testtext/app.stats @@ -0,0 +1 @@ +((entry (title "Test text processing components") (id "testtext")))
\ No newline at end of file diff --git a/sca-cpp/trunk/modules/edit/apps/testurl/app.stats b/sca-cpp/trunk/modules/edit/apps/testurl/app.stats new file mode 100644 index 0000000000..b4142f40cf --- /dev/null +++ b/sca-cpp/trunk/modules/edit/apps/testurl/app.stats @@ -0,0 +1 @@ +((entry (title "Test URL components") (id "testurl")))
\ No newline at end of file diff --git a/sca-cpp/trunk/modules/edit/apps/testvalues/app.stats b/sca-cpp/trunk/modules/edit/apps/testvalues/app.stats new file mode 100644 index 0000000000..4b7a09cd38 --- /dev/null +++ b/sca-cpp/trunk/modules/edit/apps/testvalues/app.stats @@ -0,0 +1 @@ +((entry (title "Test values and lists") (id "testvalues")))
\ No newline at end of file diff --git a/sca-cpp/trunk/modules/edit/apps/testwidgets/app.stats b/sca-cpp/trunk/modules/edit/apps/testwidgets/app.stats new file mode 100644 index 0000000000..6a66748ab1 --- /dev/null +++ b/sca-cpp/trunk/modules/edit/apps/testwidgets/app.stats @@ -0,0 +1 @@ +((entry (title "Test widgets") (id "testwidgets")))
\ No newline at end of file diff --git a/sca-cpp/trunk/modules/edit/apps/testwidgets2/app.stats b/sca-cpp/trunk/modules/edit/apps/testwidgets2/app.stats new file mode 100644 index 0000000000..18f0cb50f8 --- /dev/null +++ b/sca-cpp/trunk/modules/edit/apps/testwidgets2/app.stats @@ -0,0 +1 @@ +((entry (title "Test more widgets") (id "testwidgets2")))
\ No newline at end of file diff --git a/sca-cpp/trunk/modules/edit/composites.py b/sca-cpp/trunk/modules/edit/composites.py new file mode 100644 index 0000000000..7eb8593d18 --- /dev/null +++ b/sca-cpp/trunk/modules/edit/composites.py @@ -0,0 +1,44 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# App composites collection implementation +from util import * + +# Convert an id to an app id +def appid(id): + return ("'" + car(id), "'app.composite") + +# Put an app into the apps db +def put(id, app, cache): + comp = cdr(cadddr(car(app))) + cache.put(appid(id), comp) + return True + +# Get an app from the apps db +def get(id, cache): + if isNil(id): + return (("'feed", ("'title", "Composites"), ("'id", "composites")),) + app = cache.get(appid(id)); + if (isNil(app) or app is None): + return (("'entry", ("'title", car(id)), ("'id", car(id))),) + return (("'entry", ("'title", car(id)), ("'id", car(id)), ("'content", car(app))),) + +# Delete an app from the apps db +def delete(id, cache): + cache.delete(appid(id)) + return True + diff --git a/sca-cpp/trunk/modules/edit/dashboard.py b/sca-cpp/trunk/modules/edit/dashboard.py index 4dd48ccc17..81ec447d10 100644 --- a/sca-cpp/trunk/modules/edit/dashboard.py +++ b/sca-cpp/trunk/modules/edit/dashboard.py @@ -16,8 +16,6 @@ # under the License. # Dashboards collection implementation -import uuid -import sys from util import * # Convert a particular user email to a dashboard id @@ -31,16 +29,8 @@ def getdashboard(id, cache): return () return dashboard -# Post a new app to the user's dashboard -def post(collection, app, user, cache): - id = (str(uuid.uuid1()),) - newapp = list("'entry", cadr(car(app)), list("'id", id), cadddr(car(app))) - dashboard = cons(newapp, getdashboard(dashboardid(user), cache)) - cache.put(dashboardid(user), dashboard) - return id - # Put an app into the user's dashboard -def put(id, app, user, cache): +def put(id, app, user, cache, apps): def putapp(app, dashboard): if isNil(dashboard): return app @@ -48,12 +38,16 @@ def put(id, app, user, cache): return cons(car(app), cdr(dashboard)) return cons(car(dashboard), putapp(app, cdr(dashboard))) - dashboard = putapp(app, getdashboard(dashboardid(user), cache)) + appentry = (("'entry", cadr(car(app)), ("'id", car(id))),) + dashboard = putapp(appentry, getdashboard(dashboardid(user), cache)) cache.put(dashboardid(user), dashboard) + + # Update app in app repository + apps.put(id, app); return True # Get apps from the user's dashboard -def get(id, user, cache): +def get(id, user, cache, apps): def findapp(id, dashboard): if isNil(dashboard): return None @@ -66,7 +60,7 @@ def get(id, user, cache): return findapp(id, getdashboard(dashboardid(user), cache)) # Delete apps from the user's dashboard -def delete(id, user, cache): +def delete(id, user, cache, apps): if isNil(id): return cache.delete(dashboardid(user)) @@ -79,5 +73,8 @@ def delete(id, user, cache): dashboard = deleteapp(id, getdashboard(dashboardid(user), cache)) cache.put(dashboardid(user), dashboard) + + # Delete app from app repository + apps.delete(id); return True diff --git a/sca-cpp/trunk/modules/edit/edit.composite b/sca-cpp/trunk/modules/edit/edit.composite index a7230296c2..c13c2ccc32 100644 --- a/sca-cpp/trunk/modules/edit/edit.composite +++ b/sca-cpp/trunk/modules/edit/edit.composite @@ -44,9 +44,10 @@ <component name="EditWidget"> <t:implementation.widget location="/index.html"/> <reference name="dashboard" target="Dashboard"/> + <reference name="apps" target="Apps"/> <reference name="store" target="AppStore"/> <reference name="palettes" target="Palettes"/> - <reference name="apps" target="Apps"/> + <reference name="composites" target="Composites"/> <reference name="pages" target="Pages"/> <reference name="log" target="Log"/> </component> @@ -58,6 +59,7 @@ </service> <reference name="user" target="User"/> <reference name="cache" target="DashboardCache"/> + <reference name="apps" target="Apps"/> </component> <component name="AppStore"> @@ -74,6 +76,17 @@ <t:binding.http uri="apps"/> </service> <reference name="cache" target="AppCache"/> + <reference name="store" target="AppStore"/> + <reference name="composites" target="Composites"/> + <reference name="pages" target="Pages"/> + </component> + + <component name="Composites"> + <t:implementation.python script="composites.py"/> + <service name="Composites"> + <t:binding.http uri="composites"/> + </service> + <reference name="cache" target="AppDocCache"/> </component> <component name="Pages"> @@ -81,7 +94,7 @@ <service name="Pages"> <t:binding.http uri="pages"/> </service> - <reference name="cache" target="AppCache"/> + <reference name="cache" target="AppDocCache"/> </component> <component name="Palettes"> @@ -89,7 +102,7 @@ <service name="Palettes"> <t:binding.http uri="palettes"/> </service> - <reference name="cache" target="PaletteCache"/> + <reference name="cache" target="PaletteDocCache"/> </component> <component name="DashboardCache"> @@ -146,29 +159,49 @@ <component name="AppDB"> <implementation.cpp path="../../components/filedb" library="libfiledb"/> <property name="dbname">apps</property> - <property name="format">xml</property> + <property name="format">scheme</property> <service name="AppDB"> <t:binding.http uri="appdb"/> </service> </component> - <component name="PaletteCache"> + <component name="AppDocCache"> + <implementation.cpp path="../../components/cache" library="libdatacache"/> + <service name="AppDocCache"> + <t:binding.http uri="appdoccache"/> + </service> + <reference name="l1reader" target="Memcache"/> + <reference name="l1writer" target="Memcache"/> + <reference name="l2reader" target="AppDocDB"/> + <reference name="l2writer" target="AppDocDB"/> + </component> + + <component name="AppDocDB"> + <implementation.cpp path="../../components/filedb" library="libfiledb"/> + <property name="dbname">apps</property> + <property name="format">xml</property> + <service name="AppDocDB"> + <t:binding.http uri="appdocdb"/> + </service> + </component> + + <component name="PaletteDocCache"> <implementation.cpp path="../../components/cache" library="libdatacache"/> - <service name="PaletteCache"> - <t:binding.http uri="palettecache"/> + <service name="PaletteDocCache"> + <t:binding.http uri="palettedoccache"/> </service> <reference name="l1reader" target="Memcache"/> <reference name="l1writer" target="Memcache"/> - <reference name="l2reader" target="PaletteDB"/> - <reference name="l2writer" target="PaletteDB"/> + <reference name="l2reader" target="PaletteDocDB"/> + <reference name="l2writer" target="PaletteDocDB"/> </component> - <component name="PaletteDB"> + <component name="PaletteDocDB"> <implementation.cpp path="../../components/filedb" library="libfiledb"/> <property name="dbname">palettes</property> <property name="format">xml</property> - <service name="PaletteDB"> - <t:binding.http uri="palettedb"/> + <service name="PaletteDocDB"> + <t:binding.http uri="palettedocdb"/> </service> </component> diff --git a/sca-cpp/trunk/modules/edit/log.py b/sca-cpp/trunk/modules/edit/log.py index 0b13569c2d..d316831db6 100644 --- a/sca-cpp/trunk/modules/edit/log.py +++ b/sca-cpp/trunk/modules/edit/log.py @@ -15,7 +15,7 @@ # specific language governing permissions and limitations # under the License. -# User info service component +# Log service component from sys import stderr # Log a message diff --git a/sca-cpp/trunk/modules/edit/pages.py b/sca-cpp/trunk/modules/edit/pages.py index 1fe475b67e..aa84f40162 100644 --- a/sca-cpp/trunk/modules/edit/pages.py +++ b/sca-cpp/trunk/modules/edit/pages.py @@ -16,21 +16,11 @@ # under the License. # App pages collection implementation -import uuid -import sys -from sys import stderr from util import * # Convert an id to an app id def appid(id): - return ("'" + car(id), "'app.html") - -# Post a new app page to the apps db -def post(collection, app, cache): - id = appid((str(uuid.uuid1()),)) - xhtml = cdr(cadddr(car(app))) - cache.put((id,), xhtml) - return id + return ("'" + car(id), "'htdocs", "'app.html") # Put an app page into the apps db def put(id, app, cache): diff --git a/sca-cpp/trunk/modules/edit/palettes.py b/sca-cpp/trunk/modules/edit/palettes.py index 7872bb3db7..abe28a3364 100644 --- a/sca-cpp/trunk/modules/edit/palettes.py +++ b/sca-cpp/trunk/modules/edit/palettes.py @@ -16,8 +16,6 @@ # under the License. # Palettes collection implementation -import uuid -import sys from util import * # Convert an id to a palette id diff --git a/sca-cpp/trunk/modules/edit/store.py b/sca-cpp/trunk/modules/edit/store.py index 052605d2d6..9598cdf7fa 100644 --- a/sca-cpp/trunk/modules/edit/store.py +++ b/sca-cpp/trunk/modules/edit/store.py @@ -16,8 +16,6 @@ # under the License. # stores collection implementation -import uuid -import sys from util import * # Convert a particular store tag to a store id @@ -31,15 +29,6 @@ def getstore(id, cache): return () return store -# Post a new app to a store -def post(collection, app, cache): - tag = car(collection) - id = (str(uuid.uuid1()),) - newapp = list("'entry", cadr(car(app)), list("'id", id), cadddr(car(app))) - store = cons(newapp, getstore(storeid(tag), cache)) - cache.put(storeid(tag), store) - return id - # Put an app into a store def put(key, app, cache): def putapp(app, store): |