How does the Online Community Grid work?

The Online Community Grid is a wrapper SWF (Flash) application. The application is powered by many open source projects and libraries.

The Flow

This main, framework file is named OnlineCommunityGrid.swf. It contains the Aswing library (which it downloads via the Flash DLL library). Aswing is an Actionscript 3 port of the Java Swing library. All of the tabs, sliders, textareas, and components of the framework are powered from this library.

In order to keep filesize down, the Aswing library is downloaded externally with the Flash DLL library. This happens right after the SWF is loaded. The framework then verfies that no other instances are running on the client's machine (using LocalConnection).

Afterwards, the framework instanciates the layout and loads some user saved data (such as last cpu slider percentage, last viewed tab, and last viewed project) which is stored in a Shared Object. The framework then loads a list of official projects from an XML file located on the OCG central server. The list is populated and the last viewed project is selected. If the application was previously running then the framework will immediately load the selected project.

The framework loads the selected project's libraries and code by loading the project's SWF file. After the libraries have been loaded, the SWF file (optionally, but strongly recommended) adds a "Project" JPanel (part of Aswing framework) tab to the Online Community Grid application. The framework then calls a specific function called OCG_RUN(API:Object) on the application. This OCG_RUN is the entry point of the project's application. API is the OCG_API, which is a list of functions that the project can access.

Saving Data

Whenever the project's applicatin needs to save data (i.e. checkpoint) on the client machine, it can do so with the API. When the project needs to send data to a central server, it can queue up a data packet to be transferred via HTTP (either POST or GET). When the project's tab is closed or the client leaves the grid destroy() is called on the project's application. Last second checkpoint saves can occur here as well as last second packet queues. However, this function should not be the only place for checkpoint saves as the framework has no way of contacting the function when the client leaves the webpage.