February 11, 2009

Design Concept

The main goal for this project is to develop a client-based actionscript-to-opensocial framework reusable across multiple container platforms. This means being able to write once a flash client application and run anywhere on any platform opensocial is supported. Our initial release will not have the complete implementation. However, as this is a framework and open source, we’ll build the features on an as-needed basis. We’ll also rely on the community to help expand and support the features for opensocial and other container specific platforms.



Currently, MySpace has an actionscript library which implements opensocial API using RESTful interface for communication with the backend server. There are two issues for the flash client in using this approach:

  1. If the client is directly communicating with the container itself, it must assume that the container has a ‘crossdomain.xml’ policy on its server to bypass the security restrictions of Flash applications. Otherwise, the aforementioned API will not work.
  2. The RESTful APIs as defined by Google’s opensocial are meant for Server-to-Server communication. So in essence, it’s not meant for a flash application to use such mechanism to communicate with the opensocial containers.

Here’s where our framework will come in. We want to create a framework/library which can be used by client-side flex application that can bypass security issues such as the cross-domain policy. This can be done by creating a framework/library which sits on top of the opensocial javascript library. By doing this, we will be bypassing the flash security restrictions which requires ‘crossdomain.xml’. Since this will also be using the Javascript implementations provided by the platform containers, it will also bypass any security restrictions of Javascript itself. The diagram shows our current design.

The framework/library will consist of an actionscript library which runs on top of a Actionscript/Javascript Bridge. The actionscript library will consists of all opensocial functions and classes created for a specific version. The Actionscript/Javascript bridge will link the library to the platform’s Javascript opensocial implementation using Flash’s ExternalInterface class and an XML file corresponding to the opensocial implementation. There are a couple benefits of doing it this way:

1. Using the bridge in this manner allows us to write everything in actionscript. There is no javascript code that needs to be loaded separately with this library. All Javascript code will be incorporated into the bridge through the XML files generated.

2. Having such decoupling promotes reusability. We now can create the library based on different versions of the opensocial API.

3. Designing it this way also creates flexibility. We now can build applications which can run on any opensocial platform by switching in and out the Container’s implementation. This means no change in the application code whatsoever.

4. As mentioned earlier, the Javascript opensocial implementation is a requirement for all opensocial containers. This means that applications running on our framework can technically run any opensocial network and work immediately as long as they have not used container specific opensocial calls.

Data Structure

The following are the initial design of actionscript classes created for this framework based on opensocial v. 0.81:

  • Activity – opensocial Activity
  • Address – opensocial Address
  • CreateActivityPriority – opensocial CreateActivityPriority
  • DataRequest – opensocial DataRequest
  • Environment – opensocial Environment
  • IdSpec – opensocial IdSpec
  • MediaItem – opensocial MediaItem
  • Message – opensocial Message
  • Name – opensocial Name
  • NavigationParameters – opensocial NavigationParameters
  • OSContainer – Represents the opensocial container
  • Organization – opensocial Organization
  • OrkutContainer – Implementation of OSContainer for Orkut
  • OrkutOSFactory – Bridge to map actionscript opensocial calls with javascript calls using XML files for Orkut
  • OSXmlFactory – Factory to load XML representation of opensocial Javascript function
  • Permission – opensocial Permission
  • Person – opensocial Person
  • Phone – opensocial Phone
  • Hi5Container – Implementation of OSContainer for Hi5
  • Hi5OSFactory – Bridge to map actionscript opensocial calls with javascript calls using XML files for Hi5
  • MySpaceContainer – Implementation of OSContainer for MySpace
  • MySpaceOSFactory – Bridge to map actionscript opensocial calls with javascript calls using XML files for MySpace
  • XMLLoader – Helper class to load the XML file





Figure 1

No comments:

Post a Comment