opensocial gadgets at eclipse

21
OpenSocial Gadgets & Eclipse Benjamin Cabé <[email protected] >

Upload: benjamin-cabe

Post on 19-May-2015

1.404 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: OpenSocial gadgets at Eclipse

OpenSocial Gadgets& EclipseBenjamin Cabé

<[email protected]>

Page 2: OpenSocial gadgets at Eclipse

INTRODUCTION

Page 3: OpenSocial gadgets at Eclipse

What is OpenSocial?

• Open Specification– 1.0 version released in March– Many companies involved

• Lightweight web components• Modularity in mind• Social features

Page 4: OpenSocial gadgets at Eclipse

Write once, run anywhere

• Many social networking sites are OpenSocial compatible– MySpace, Hi5, LinkedIn, iGoogle, Orkut…

• Eclipse– e4 team working on an OpenSocial

implementation too

Page 5: OpenSocial gadgets at Eclipse

Enterprise usage

• Many enterprise-oriented gadgets– Calendar, To-Do List, Map, Doodle, …– Atlassian provides gadgets for JIRA metrics

• Bringing OpenSocial support into an existing application is not that hard– Existing web apps: Apache Shindig– Rich client apps: e4!

• “Social Enterprise”

Page 6: OpenSocial gadgets at Eclipse

Social, you said?

• Many APIs to crawl user’s social network• Data model– Person (friends, groups, tastes, …)• AppData for each gadget

– Activities (music being listened, …)– Messages, Albums, …

Page 7: OpenSocial gadgets at Eclipse

GADGETS DEVELOPMENT

Page 8: OpenSocial gadgets at Eclipse

Gadget/module definition

• XML file– Metadata– Dependencies– Application implementation• In-line HTML / CSS / JavaScript• or URL to external definition (a la IFRAME)

Page 9: OpenSocial gadgets at Eclipse

<?xml version="1.0" encoding="UTF-8"?><Module> <ModulePrefs title="Hello, world!« 

author="Benjamin Cabé"> <Require feature="opensocial-0.8"/> </ModulePrefs> <Content type="html"> <![CDATA[ <script type="text/javascript"> function init() { $("handler").innerHTML = "Hello, world." ; } gadgets.util.registerOnLoadHandler(function() { init(); }); </script> <div id="handler"></div> ]]> </Content></Module>

Page 10: OpenSocial gadgets at Eclipse

Core Gadget API

• gadgets.flash• gadgets.io• gadgets.json• gadgets.MiniMessage

• gadgets.Prefs• gadgets.pubsub• gadgets.rpc

• gadgets.skins• gadgets.Tab• gadgets.TabSet• gadgets.util• gadgets.views• gadgets.window

Page 11: OpenSocial gadgets at Eclipse

The simple way…

• Stand-alone HTML/JS/CSS in your preferred editor

• Worry about gadget.xml later– Debug made easier

• Wrap in gadget.xml at the very end– “url” content-type => IFRAME

Page 12: OpenSocial gadgets at Eclipse

OpenSocialDevelopment Environment

• Built-in Shindig server for local testing• Forms editor for the gadget definition• Social data handling (embedded database)• Testing– Easy iGoogle deployment– Performance testing with Firefox

Page 13: OpenSocial gadgets at Eclipse

E4, A GADGET CONTAINER?

Page 14: OpenSocial gadgets at Eclipse

Why?

• Deploy existing gadgets into views• … and develop new ones leveraging Eclipse

services– Only HTML, CSS & Javascript– Not mandatory to know the Eclipse API– OpenSocial spec fits quite well in Eclipse

architecture– De-facto self-hosting

Page 15: OpenSocial gadgets at Eclipse

Collaborative development

• Make e4 « social-aware » – Communicate with co-workers– Share information (project, code snippets) with

your social network– Share gadgets themselves (« Coworker John

suggests you to add the XYZ gadget »)

Page 16: OpenSocial gadgets at Eclipse

DEMO!

Page 17: OpenSocial gadgets at Eclipse

Implementation overview

• HTML rendering: SWT Browser widget• Since 3.5, the Browser is on steroids:– Browser#evaluate(String) allows

evaluation of arbitrary JavaScript from your Java code

– BrowserFunction allows to have Java implementation for JavaScript functions

Page 18: OpenSocial gadgets at Eclipse

Implementation overview

• Modules express dependencies towards features– Extension point to register new OpenSocial features

in the container– OSGi Resolver to solve constraints expressed by

a Module• Available features in the container: mapped to Bundles• Features required by a module: Require-Bundle

directives

• Eclipse specific APIs exposed through the e4 OpenSocial feature

Page 19: OpenSocial gadgets at Eclipse

Plan

• Create bridges to more Eclipse Application Services

• Merge some of recent investigations made in http://github.com/kartben

• ATF integration (JS/CSS debugging support)• Social REST APIs directly exposed by ECF

Page 20: OpenSocial gadgets at Eclipse

Questions?

Page 21: OpenSocial gadgets at Eclipse

Further reading• http://www.opensocial.org• http://wiki.opensocial.org/index.php?title=JavaScript_API_Reference• http://shindig.apache.org/• https://sites.google.com/site/opensocialdevenv/• http://borisoneclipse.blogspot.com/2009/11/opensocial-igoogle-gadgets-in-eclipse.html