Dashboard > ringside > ... > Design Documentation > OpenSocial
OpenSocial Log In | Sign Up   View a printable version of the current page.

OpenSocial Support for Ringside Social Application Server

Background:

OpenSocial is an alternative social application development environment to FaceBook. It varies from Facebook in that a far larger amount rendering work is performed in your web browser than on the server. Most of the role of a canvas disappears and it is up to the browser to make OpenSocial api calls and then interpret the results to form HTML snippets at document load time. This is because OpenSocial is based on the Google Gadgets API and treats all of its social apps as gadgets. Essentially this makes OpenSocial = Google Gadgets + REST web service based social API + ATOM Feeds.

To learn more about OpenSocial go to http://code.google.com/apis/opensocial/, or take a look at our own architecture overview.

There is an Apache project which provides a file based implementation of OpenSocial called Shindig (http://incubator.apache.org/shindig/). Shindig provides an implementation of the JavaScript engine required to load the Gadget XML definition (Gadget Specification) and make OpenSocial API calls.

Shindig also provides implementations of the Web Service back end API for OpenSocial in both Java and PHP.

Architecture:

OpenSocial's REST API's revolve around some basic objects with can be mapped into equivalents in the Ringside schema.

These are the basic object types OS manipulates:
1 People - Equivalent to profile information about a user.
2 Relationships - Person a is friends with person b.
3 Activities - Represents events generated by the user. What our friends are doing when you are not online.
4 Persistence - Saved Application state data.
5 Views - Equivalent to ringside Flavors used to control how an gadget is rendered based on the location or context is is being rendered in.

In the Shindig implementations these use a file based repository to store and retrieve their results.

Below is a pseudo code description of the data structures we eill need to integrate into our data model to store Open Social Data.

Person (Primary Object) {
	String ID; // (PK) A string ID that can be permanently associated with this person.

	String ABOUT_ME; //A general statement about the person
	String[] ACTIVITIES //Person's favorite activities
	Address[] ADDRESSES; //Addresses associated with the person
	int AGE; //Person's age, specified as a number.
	enum opensocial.BodyType BODY_TYPE; // Person's body characteristics,
	String[] BOOKS; // Person's favorite books
	String[] CARS; //Person's favorite car
	String CHILDREN; //Description of the person's children
	Address CURRENT_LOCATION; //Person's current location, specified as an Address.
	Date DATE_OF_BIRTH; //Person's date of birth, specified as a Date object.
	enum opensocial.Enum.Drinker DRINKER;//Person's drinking status
	Emails[] EMAILS;//Emails associated with the person, specified as an Array of Emails.
	String ETHNICITY;//Person's ethnicity
	String FASHION; //Person's thoughts on fashion
	String[] FOOD;//Person's favorite food
	enum opensocial.Enum.Gender GENDER; //Person's gender
	String HAPPIEST_WHEN; //Describes when the person is happiest
	String[] HEROES; //Person's favorite heroes
	String HUMOR; //Person's thoughts on humor
	String[] INTERESTS; //Person's interests, hobbies or passions
	String JOB_INTERESTS; //Person's favorite jobs, or job interests and skills
	Organizations[] JOBS; //Jobs the person has held
	String[] LANGUAGES_SPOKEN; //List of the languages that the person speaks as ISO 639-1 codes
	String LIVING_ARRANGEMENT; //Description of the person's living arrangement
	String LOOKING_FOR; //Person's statement about who or what they are looking for,
	 					// or what they are interested in meeting people for.
	String[] MOVIES; //Person's favorite movies
	String[] MUSIC; //Person's favorite music
	opensocial.Name NAME; //A opensocial.Name object containing the person's name.
	String NICKNAME; //A String representing the person's nickname.
	String PETS; //Description of the person's pets
	Phones[] PHONE_NUMBERS; //Phone numbers associated with the person
	String POLITICAL_VIEWS; //Person's political views
	opensocial.Url PROFILE_SONG; //Person's profile song
	String PROFILE_URL; //Person's profile URL
	opensocial.Url PROFILE_VIDEO; //Person's profile video
	String [] QUOTES; //Person's favorite quotes
	String RELATIONSHIP_STATUS; //Person's relationship status
	String RELIGION; //Person's relgion or religious views
	String ROMANCE; //Person's comments about romance
	String SCARED_OF; //What the person is scared of
	Organization[] SCHOOLS; //Schools the person has attended
	String SEXUAL_ORIENTATION; //Person's sexual orientation
	opensocial.Enum.Smoker SMOKER; //Person's smoking status
	String[] SPORTS; //Person's favorite sports
	String STATUS; //Person's status, headline or shoutout
	String[] TAGS; //Arbitrary tags about the person
	String THUMBNAIL_URL; //Person's photo thumbnail URL
	long TIME_ZONE; //Person's time zone, specified as the difference in minutes
					//between Greenwich Mean Time (GMT) and the user's local time.
	String[] TURN_OFFS; //Person's turn offs
	String [] TURN_ONS; //Person's turn ons
	String[] TV_SHOWS; //Person's favorite TV shows
	String[] URLS; //URLs related to the person, their webpages, or feeds.
}

Activity  (Primary Object) {

	String ID; // (PK) A string ID that is permanently associated with this activity.
	String APP_ID; // (FK APP) A string specifying the application that this activity is associated with.
	String USER_ID; // (FK USERS) The string ID of the user who this activity is for.

	String BODY; //A string specifying an optional expanded version of an activity.
	String BODY_ID; //A string specifying the body template message ID in the gadget spec.
	String EXTERNAL_ID; //An optional string ID generated by the posting application.
	MediaItem[] MEDIA_ITEMS; //Any photos, videos, or images that should be associated with the activity.
	Date POSTED_TIME; //A string specifying the time at which this activity took place in milliseconds since the epoch.
	float PRIORITY; //A number between 0 and 1 representing the relative priority
	 				// of this activity in relation to other activities from the same source
	String STREAM_FAVICON_URL; //A string specifying the URL for the stream's favicon.
	String STREAM_SOURCE_URL; //A string specifying the stream's source URL.
	String STREAM_TITLE; //A string specifing the title of the stream.
	String STREAM_URL; //A string specifying the stream's URL.
	Map<String, Object> TEMPLATE_PARAMS; // A map of custom keys to values associated with this activity.
	String TITLE; //A string specifying the primary text of an activity.
	String TITLE_ID; //A string specifying the title template message ID in the gadget spec.
	String URL; //A string specifying the URL that represents this activity.
 }


MediaItem {
	String MIME_TYPE; //The MIME type of media, specified as a String.
	enum Activity.MediaItem.Type TYPE; //The type of media, specified as a MediaItem.Type object.
	String URL; //A string specifying the URL where the media can be found.
}


Address {
	String COUNTRY; //The country. Specified as a String.
	String EXTENDED_ADDRESS; //The extended street address. Specified as a String.
	int LATITUDE; //The latitude. Specified as a Number.
	String LOCALITY; //The locality. Specified as a String.
	int LONGITUDE; //The longitude. Specified as a Number.
	String PO_BOX; //The po box of the address if there is one. Specified as a String.
	String POSTAL_CODE; //The postal code. Specified as a String.
	String REGION; //The region. Specified as a String.
	String STREET_ADDRESS; //The street address. Specified as a String.
	String TYPE; //The address type or label. Examples: work, my favorite store, my house, etc Specified as a String.
	String UNSTRUCTURED_ADDRESS
}

Email {
	String ADDRESS;//The email address, specified as a String.
	String TYPE;//The email type or label, specified as a String. Examples: work, my favorite store, my house, etc.
}

Organization {
	Address ADDRESS; //The address of the organization.
	String DESCRIPTION; //A description or notes about the person's work in the organization.
	Date END_DATE; //The date the person stopped at the organization.
	String FIELD; //The field the organization is in.
	String NAME; //The name of the organization.
	String SALARY; //The salary the person receieves from the organization.
	Date START_DATE; //The date the person started at the organization.
	String SUB_FIELD; //The subfield the Organization is in.
	String TITLE; //The title or role the person has in the organization.
	String WEBPAGE; //A webpage related to the organization.
}

Name {
	String ADDITIONAL_NAME; //The additional name.
	String FAMILY_NAME; //The family name.
	String GIVEN_NAME; //The given name.
	String HONORIFIC_PREFIX; //The honorific prefix.
	String HONORIFIC_SUFFIX; //The honorific suffix.
	String UNSTRUCTURED; //The unstructured name.
}

Phone {
	String NUMBER;//The phone number, specified as a String.
	String TYPE; //The phone number type or label, specified as a String.
}

Url {
	String ADDRESS; //  The address the url points to
	String LINK_TEXT; //  The text of the link
	String TYPE; //  The url number type or label. Examples: work, blog feed, website, etc
}

enum BodyType {
	BUILD; //  The build of the person's body, specified as a string.
	EYE_COLOR; //  The eye color of the person, specified as a string.
	HAIR_COLOR; //  The hair color of the person, specified as a string.
	HEIGHT; //  The height of the person in meters, specified as a number.
	WEIGHT; //  The weight of the person in kilograms, specified as a number.
}

enum Activity.MediaItem.Type ={
	AUDIO: 'AUDIO',
	IMAGE: 'IMAGE',
	VIDEO: 'VIDEO',
}

enum Drinker = {
  NO : 'NO',
  YES : 'YES',
  SOCIALLY : 'SOCIALLY',
  OCCASIONALLY : 'OCCASIONALLY',
  REGULARLY : 'REGULARLY',
  HEAVILY : 'HEAVILY',
  QUITTING : 'QUITTING',
  QUIT : 'QUIT'
};

enum Gender = {
  MALE : 'MALE',
  FEMALE : 'FEMALE'
};

enum Smoker = {
  NO : 'NO',
  YES : 'YES',
  SOCIALLY : 'SOCIALLY',
  OCCASIONALLY : 'OCCASIONALLY',
  REGULARLY : 'REGULARLY',
  HEAVILY : 'HEAVILY',
  QUITTING : 'QUITTING',
  QUIT : 'QUIT'
};



Proposed Integration:

1. Shindig's Javascript client and gadget rendering engine should be copied as is to the API public folder. This client should not need to be modified since the concept of more than one OS server is built into the client.

2. The PHP File based OS API should be installed into the API layer as a new endpoint.
 
3. A set of API Unit tests should be developed to test the existing OS API. These tests and any cnahnges we might make to the Shindig API should be contributed back to Google.

4. This test suite should be automated.

5. The persistence code for the current OS/Shindig implementation should be transfered to the new Data Object Layer. This should result in a DB/Model neutral implementation of OS. This would also allow OS to read from the Ringside DB schema while continuing to pass the file based unit tests.

6. Authentication for Shindig is almost identical to Facebook's authtoken based system. Authentication should be integrated into our own Login.php.

7. Atom Feed support would be deferred until the next release.

8. A trail map would be produced that demonstrated the hello world gadget running from a Ringside server displaying user data which could also be edited using the facebook API. Other tutorials would be pointed to on Google's OS site.

Added by William Reichardt , last edited by Jason Kinner on Jul 01, 2008  (view change)
Labels: 
(None)