Application Server

The current spree implementation is based on the Turbogears web development framework which uses cherrypy

Contents

 

Controller modules

All clients interact with the server using the exposed controller methods which return html, xml or json content. Each exposed controller method is mapped to an url-path. The following controllers and mappings exist:

 URL-Path              Corresponding controller class
-------------------------------------------------------------
 /                     (controllers.py)
-- /registration (register_controllers.py)
-- /content (subcontrollers/content_controller.py)
-- -- /chat (subcontrollers/chat_controller.py)
-- -- /search (subcontrollers/search_controller.py)
-- -- /blog (subcontrollers/blog_controller.py)
-- -- /feedback (subcontrollers/feedback_controller.py)
-- -- /im (subcontrollers/im_controller.py)
-- /boxes (subcontrollers/boxes_controller.py)
-- /profile (subcontrollers/profile_controller.py)
-- /feed (subcontrollers/feed_controller.py)
-- /gadget (subcontrollers/gadget_controller.py)
-- /admin (subcontrollers/admin_controller.py)
-- /statistics (subcontrollers/statistics_controller.py)

More details on the exposed methods can be found in the source code documentation.

controllers

The main controller class as created by Turbogears. Handles login and logout behavior and delivers the content for the "help" and "about" pages. This controller is also the parent controller for all other controllers.

register_controllers

The registration controller provides methods during the registration process. This includes the verification of user data, the "forgot password" functionality and the activation of users after the email clearance. This controller is initially provided by Turbogears and was only slightly modified to better fit the needs of spree.

admin_controller

The admin controller methods provide administrative access to the running application. Currently this includes acces to lists of all user-email addresses and all users subscribed to the spree newsletter. The access to this controller is restricted to a limited number of users.

blog controller

Provides all functionality related to blogs such as:

  • getBlogContent - delivers a HTML snippet for the visualization of all notes of the current user
  • getBlogEntryContent - delivers a HTML snippet for the visualization of given note entry
  • getBlogEditContent - delivers a HTML snippet for editing a given note entry
  • deleteBlogEntry - deletes a given note
  • do_BlogPost - creates a new note entry

The corresponding javascript methods can be found in "spree/static/javascript/content/blog.js".

boxes_controller

Provides all functionality related to the incoming/outgoing questions boxes tooltip.

  • getQueries - delivers all incoming and outgoing queries and their current status. Uses the json-format for better efficiency. This is a method which is constantly polled by the client-side.

The corresponding javascript methods can be found in "spree/static/javascript/boxes/boxes.js".

chat_controller

Provides all functionality related to chatting.

  • join - delivers the html-snippet for the chat content.
  • send - adds a new chat entry to the chat
  • finish - finishes the given chat
  • getAllEntries - returns all entries for a given session newer than a given timestamp. This method is constantly polled by the client in order to get the chat session up to date. This message uses the json-format for efficiency.

The corresponding javascript methods can be found in "spree/static/javascript/content/chat.js".

content_controller

This controller provides no own functionality but acts as a parent controller for a controllers related to the content component.

The corresponding javascript methods can be found in "spree/static/javascript/content/content.js".

feed_controller

The controller that provides the rss feed.

The corresponding rss template is "spree/spree/templates/rss2_0.html".

gadget_controller

The controller that provides that serves the google gadget template.

The gadget templates are located under "spree/static/gadget".

im_controller

The instant messeging content controller. This controllers provides all functionality needed for the "Chat" tab content.

  • getUsers - provides the Users box html snippet
  • getUserDetails - provides the User Details box html snippet
  • doDirectChat - starts a direct chat with the selected user

The corresponding javascript methods can be found in "spree/static/javascript/content/im.js".

profile_controller

This controller provides all methods for the user profile creation and modification. This includes methods related to the users expertise profile as well as functionality related to the user's settings.

  • loadDocs - accepts the websites a user entered during the registration process and writes them to the db for the website crawler
  • extractNodes - loads the users expertise tree during the registration process
  • getNode/getNodesInfo - used during the dynamic loading of the expertise tree
  • getSettingsContent - returns the html snippet for the user settings content
  • setExpertise - changes a users expertise fields

The corresponding javascript methods can be found in "spree/static/javascript/content/registration.js", "spree/static/javascript/content/profile.js" and "spree/static/javascript/content/settings.js".

search_controller

The search controller provides all functionality needed for the query to expert matching process.

  • getSearchContent - provides the html snippet of the "Ask expert" tab content
  • getKeywordsAndCategories - provides the categorization for a given query
  • doQuery - accepts a new question from the user and identifies the best matching experts and blogs
  • getAllOpenQuestionsContent - provides the html snippet of the all open questions content
  • getWaitSearchContent - provides the html snippet when waiting for experts to accept showing the current status of this question.
  • getExpertStatus - provides new information about the status of the experts matched to the selected question. This function is constantly polled from the client whenever the user select an own ongoing question. The status of experts might change to "accepted" or "decline" or switch between "online" and "offline". The result is returned in the more efficient json format.
  • deleteQuery - deletes a question
  • getQueryOverviewContent - provides the html snippet which presents a new question to experts leaving the experts the choice between accepting or declining it.
  • getQueryStatus - checks whether the query was deleted or already accepted by some else. Constantly polled when in query overview content.

The corresponding javascript methods can be found in "spree/static/javascript/content/search.js".

The corresponding templates are "spree/spree/templates/content/search.html", "spree/spree/templates/content/waitsearch.html" and "spree/spree/templates/content/queryoverview.html".

statistics_controller

Provides the content of the score box and the user details for the tooltip and instant messenger.

  • getHighscoreList - the html snippet of the "score" box
  • getUserDetailsIM - the user details html snippet in the instant messenger (chat) content
  • getUserDetailsForTooltip - the user details html snippet for the user details tooltip

The javascript related to the tooltip can be found in "spree/static/javascript/layout/tooltip.js".

The corresponding templates are "spree/spree/templates/boxes/highscoreList.html", "spree/spree/templates/content/im_userDetails.html" and "spree/spree/templates/boxes/userDetailsTooltip.html".

Model

The spree database tables are auto-generated on server startup. When started in development mode (no arguments) the ontology is loaded using a smaller subset of the full ontology (1000 nodes). When started in productive mode with the "prod.cfg" argument the full ontology is chosen and automatically loaded. (See the file "spree/spree/subcontrollers/datainitializer.py" for details.

Spree uses SQLAlchemy v0.3 as persistency layer thus being mostly independent from the database solution. The only dependence to MySQL is given by the usage of the columntype "mysql.MSText" as blob datatypes differ from database to database.

Model defining classes are mainly located in "spree/spree/model.py" (User-Management) and "spree/spree/spree_model.py".