THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
...
See http://svn.apache.org/repos/asf/incubator/wookie/trunk/connector/ for the latest available code.
Basic usage of the framework
In this section we document the most basic use of the connector framework. All example code is written in Java, but it should be the same in other languages (if not, help us bring them all up to date).
In general to To use the framework you will need to do the following:
- get a WookieConnectorService
- set the current user
- get or create a widget instance
- provide the instance URL to the hosting environment and display it
...
Getting a connection to a Wookie server
Code Block |
---|
//* * Get the wookie service connector StringBuilder sbUrl = new StringBuilder(request.getScheme()); sbUrl.append("://"); sbUrl.append(request.getServerName()); sbUrl.append(":"); sbUrl.append(request.getServerPort()); sbUrl.append(request.getContextPath()); serverURL = "http://foo.org/wookie"; apiKey = "TEST"; sharedDataKey = "myshareddata"; */ public WookieConnectorService getWookieConnectorService(String serverURL, String apiKey, String sharedDataKey ) { if (connectorService == null) { connectorService = new WookieConnectorService(serverURL, apiKey, sharedDataKey); } return connectorService; // Set the current user connectorService} |
Working with users
Set the current user:
Code Block |
---|
WookieConnectorService conn = getWookieConnectorService(url, apiKey, datakey); conn.setCurrentUser("testuser"); // get or create a widget |
Working with widgets
Get a widget instance.
Code Block |
---|
String guid = "....."; WidgetInstance instance = connectorServiceconn.getOrCreateInstance(guid); {code{ // show widget showWidget(h3. Displaying widgets Displaying the widgets is the job of the platform in which you wish to embed widgets. The easiest way to embed a widget is simply to place it in an iframe. To do this you will need a URL for retrieving the widget instance: |
String url = instance.getUrl();
displayWidget(url);
...
Code Block |
---|
Connector Framework API
Building Plugins without a Connector Framework
...