Use ← and → to move around. Press h for getting more info
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Introduction to WireCloud
+
Introduction
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Introduction
+
+
WireCloud is the Reference Implementation of the FIWARE’s Application Mashup
Generic Enabler
@@ -130,71 +99,45 @@
Introduction
under any license without any restriction
-
-
-
-
-
-
-
-
-
-
-
-
Introduction to WireCloud
-
Basic Concepts
-
-
-
-
-
-
Presenter Notes
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Workspace / Dashboard
-
-
-
+
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Introduction to WireCloud
+
Basic Concepts
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Workspace / Dashboard
+
+
A workspace represents the place where users can edit their dashboards.
A dashboard contains the set of widgets that will conform the frontend
@@ -202,84 +145,54 @@
Workspace / Dashboard
Users can place/resize/name... their widgets as they wish on the workspace.
A workspace is also composed of tabs.
-
-
-
-
-
-
-
-
-
-
-
-
-
Widget
-
-
-
+
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Widget
+
+
A widget is a UI component developed using web technologies (HTML, CSS,
JavaScript, ...)
It provides the atomic functionality of the application mashup
It can send data to other widgets and/or receive events from them.
-
-
-
-
-
-
-
-
-
-
-
-
-
Wiring
-
-
-
+
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Wiring
+
+
WireCloud provides a data flow- or event-based mechanism that widgets can use
to notify other widgets about changes in their state
@@ -291,224 +204,138 @@
Wiring
It allows you to easily connect widgets with operators in a mashup
to create a full-fledged dashboard with RIA functionality
-
-
-
-
-
-
-
-
-
-
-
-
-
Piping and Operators
-
-
-
+
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Piping and Operators
+
+
Piping allows you to easily connect widgets to back-end services or data sources
through an extendable set of operators, including filters, aggregators,
adapters, etc...
-
-
-
-
-
-
-
-
-
-
-
-
-
Piping and Operators
-
-
-
-
-
-
-
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Piping and Operators
+
+
+
-
-
Presenter Notes
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Mashup
-
-
-
+
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Mashup
+
+
A mashup represents your application.
It is built from widgets, operators, and backend services, all of them
connnected by wiring and piping.
The are built in the context of workspaces/dashboards
-
-
-
-
-
-
-
-
-
-
-
-
Introduction to WireCloud
-
Architecture
-
-
-
-
-
-
Presenter Notes
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Architecture
-
-
-
-
-
-
-
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Introduction to WireCloud
+
Architecture
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Architecture
+
+
+
-
-
Presenter Notes
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Architecture
-
-
-
+
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Architecture
+
+
As shown in the previous diagram, WireCloud internally follows a client-server
architecture.
From the user's perspective, WireCloud mainly runs on client side (in her
@@ -525,71 +352,45 @@
Architecture
-
-
-
-
-
-
-
-
-
-
-
-
Introduction to WireCloud
-
APIS
-
-
-
-
-
-
Presenter Notes
-
-
-
-
-
-
-
-
-
-
-
-
-
-
APIS
-
-
-
+
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Introduction to WireCloud
+
APIS
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
APIS
+
+
MashupPlatform:
Core API provided by WireCloud to widgets and operators.
+
+
\ No newline at end of file
diff --git a/docs/slides/1.2_Integration with other GEs.html b/docs/slides/1.2_Integration with other GEs.html
index 849954f8a5..4bb2288d15 100644
--- a/docs/slides/1.2_Integration with other GEs.html
+++ b/docs/slides/1.2_Integration with other GEs.html
@@ -1,4 +1,5 @@
+
-
-
-
-
- Integration with other GEs
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Use ← and → to move around. Press h for getting more info
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Integration with other GEs
+
Introduction
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Introduction
+
+
WireCloud provides integration with several of the generic enablers provided by
by FIWARE. Some of those GE has been integrated in the core of WireCloud by
means of providing a plugin for FIWARE. This core integration provides support
for the following GEs:
@@ -131,109 +100,68 @@
Introduction
CKAN
...
-
-
-
-
-
-
-
-
-
-
-
-
-
Introduction
-
-
-
This documnet will describe what can you expect from the integration of each of
+
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Introduction
+
+
This documnet will describe what can you expect from the integration of each of
these generic enablers, from the perspective of an end-user and from the
perpective of a developer.
-
-
-
-
-
-
-
-
-
-
-
-
Integration with other GEs
-
IdM
-
-
-
-
-
-
Presenter Notes
-
-
-
-
-
-
-
-
-
-
-
-
-
-
IdM
-
-
-
+
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Integration with other GEs
+
IdM
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
IdM
+
+
IdM is integrated directly in Wirecloud, there is no API for making request to
the IdM server from widgets/operators
This integration provides the following features:
@@ -243,71 +171,45 @@
IdM
-
-
-
-
-
-
-
-
-
-
-
-
Integration with other GEs
-
WStore
-
-
-
-
-
-
Presenter Notes
-
-
-
-
-
-
-
-
-
-
-
-
-
-
WStore
-
-
-
+
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Integration with other GEs
+
WStore
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
WStore
+
+
WStore is integrated directly in WireCloud, there is no API for making request to the WStore from widgets/operators
Requires IdM integration for using user credentials when connecting with the WStore
This integration provides the following features:
@@ -317,71 +219,45 @@
WStore
-
-
-
-
-
-
-
-
-
-
-
-
Integration with other GEs
-
Orion Context Broker
-
-
-
-
-
-
Presenter Notes
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Orion Context Broker
-
-
-
+
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Integration with other GEs
+
Orion Context Broker
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Orion Context Broker
+
+
Orion Context Broker subscriptions/notifications requires what is called
ngsi-proxy (You have to deploy it for custom deployments, but there is a
global instance at FIWARE Lab)
@@ -399,71 +275,45 @@
Orion Context Broker
-
-
-
-
-
-
-
-
-
-
-
-
Integration with other GEs
-
Object Storage
-
-
-
-
-
-
Presenter Notes
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Object Storage
-
-
-
+
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Integration with other GEs
+
Object Storage
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Object Storage
+
+
WireCloud provides a JavaScript API:
Has minimal support for querying KeyStone services
This API provides integration for authenticating through the KeyStone server using tokens obtained from the IdM server
@@ -471,71 +321,45 @@
Object Storage
-
-
-
-
-
-
-
-
-
-
-
-
Integration with other GEs
-
Other GEs
-
-
-
-
-
-
Presenter Notes
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Other GEs
-
-
-
Kurento
+
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Integration with other GEs
+
Other GEs
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Other GEs
+
+
Kurento
Kurento is a
WebRTC media server and a set of client APIs making simple the development of
@@ -546,42 +370,27 @@
Other GEs
You can develop widgets using Kurento without requiring special support from
WireCloud.
-
-
-
-
-
-
-
-
-
-
-
-
-
Other GEs
-
-
-
CKAN
+
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Other GEs
+
+
CKAN
CKAN is a powerful data management system that makes data accessible – by
@@ -597,42 +406,27 @@
Other GEs
CKAN.
-
-
-
-
-
-
-
-
-
-
-
-
-
Other GEs
-
-
-
Cosmos
+
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Other GEs
+
+
Cosmos
Comsos is planned to be integrated soon. This integration will provide support
for:
We recommend you to see it after completing the tutorial or in case you get stalled.
-
-
-
-
-
-
-
-
-
-
-
-
Quick Start Tutorial
-
Basic chat widget
-
-
-
-
-
-
Presenter Notes
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Basic chat widget
-
-
-
Initial version
+
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Quick Start Tutorial
+
Basic chat widget
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Basic chat widget
+
+
Initial version
The first step is to build a blank widget. It must have defined the metadata and a basic HTML. The metadata is written in the config.xml file, that could be similar to this:
That template indicates widget metadata such as author/vendor, together with longer descriptions that can be written using Markdown.
Note the vendor, name and version indicated as attributes of the root element. Please consider that, depending on the WireCloud configuration, it might not admit uploading a widget twice (same version/name/vendor), so you should increase version, subversion or revision number to upload new versions of the widget. Moreover, you must change the vendor, since WireCloud will not upload the widget if another user has uploaded already the same widget (version, name and vendor).
Two remarkable elements are the rendering element, with basic information about the size of the widget, and the reference to the main HTML file. Such file will be the entry point to the widget, and contains references to JavaScript or CSS files.
-
-
-
-
-
-
-
-
-
-
-
-
-
Basic chat widget
-
-
-
Initial version
+
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Basic chat widget
+
+
Initial version
A basic HTML, named index.html as indicated in config.xml is indicated below. This document contains a basic header for user photo and nickname, a panel for messages, and a basic form for sending messages.
This HTML code refers to the js/main.js JavaScript file, that should contain the necessary code. JavaScript code will be throroughly described below. In addition, a CSS file is referenced, containing basic styling for our chat application.
body{padding:0;margin:0;
@@ -415,51 +298,36 @@
Basic chat widget
body,html{height:100%;}
-
-
-
-
-
-
-
-
-
-
-
-
-
Basic chat widget
-
-
-
Initial version
+
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Basic chat widget
+
+
Initial version
Finally, the referenced js/main.js is created. Here we include some basic elements such as a closure, an init() function and two functions to deal with the HTML interface.
(function(){
- "use strict";
+ "use strict";// object with the data received from gravatarvaruserData=null;functioninit(){
- document.getElementById("send").onclick=sendBtnHandler;
+ document.getElementById("send").onclick=sendBtnHandler;getInfoFromGravatar();}
@@ -467,17 +335,17 @@
The first feature that we are adding is preferences. Widget preferences must be declared in the config.xml, and after they're accessed through the WireCloud JavaScript API. The declaration of a preference for getting user gravatar profile would be like this:
<preferences>
- <preferencename="gravatar"type="text"label="Gravatar URL"description="URL to the gravatar profile of the user"/>
+ <preferencename="gravatar"type="text"label="Gravatar URL"description="URL to the gravatar profile of the user"/></preferences>
-
This <preferences> section must be inside the root element <widget>. Now we can access its value using the name we've chosen. The following line will be inside the getInfoFromGravatar() function, so it can make the HTTP request to the specific URL.
If we did this only, once the user has indicated his profile we would have to reload the widget so as to get the profile from Gravatar. To do things smartly, we're being notified from the platform on any preferences change, and react accordingly. In this case, we will invoke getInfoFromGravatar() again. Following code goes inside init() function:
Now it's time to make the HTTP request to gather other information from the user. Gravatar offers a JSON version of the profile on the same URL, appending a '.json' extension, so that will be the base URL for our request.
This structure is invoked with the URL resulted from the concatenation of the obtained user preference gravatarURL and the string '.json'. And the actions to be performed are storing the data on the userData variable, and making it appear on the widget using the previously created printUserData() function:
Chat functionality on the widget is done through the wiring mechanism of WireCloud. First of all, input and output endpoints have to be declared on the config.xml file:
<wiring>
- <outputendpointname="sendMsg"type="text"label="Send a message"description="The messages sent by the user are sent through this output endpoint"friendcode="message"/>
- <inputendpointname="receiveMsg"type="text"label="Receive a message"description="This is where messages sent by other widgets can be received"friendcode="message"/>
+ <outputendpointname="sendMsg"type="text"label="Send a message"description="The messages sent by the user are sent through this output endpoint"friendcode="message"/>
+ <inputendpointname="receiveMsg"type="text"label="Receive a message"description="This is where messages sent by other widgets can be received"friendcode="message"/></wiring>
-
Sending messages implies invoking the MashupPlatform.wiring.pushEvent() function referencing the output endpoint name as declared.
It shall be added to the sendBtnHandler(). To be able to send messages with metadata (i.e. the Gravatar hash that allows getting sender's image), a JSON serialized object is sent:
Now the message is sent through wiring, but the widget needs to receive other widgets' messages and print them on the conversations panel. This is performed registering a callback function on the platform registering for messages received on a specific input endpoint. identified by its name. On the init() function we would write somethint like this:
And a processMsg() function shall be created to indicate the desired behaviour. In our case, creating a message in the conversations panel. Since messages are sent as serialized JSON objects, they are de-serialized for accessing its elements. It is a bit tricky, since it detects my own messages and prints them as sent (different CSS style). This is how the echo is going to work.
functionprocessMsg(event_data){varreceivedMsg=JSON.parse(event_data);if(userData!=null&&receivedMsg.hash!==userData.entry[0].hash){
- createMsgDiv(receivedMsg.msg,'http://www.gravatar.com/avatar/'+receivedMsg.hash,true,receivedMsg.id);
+ createMsgDiv(receivedMsg.msg,'http://www.gravatar.com/avatar/'+receivedMsg.hash,true,receivedMsg.id);}else{// My message, echo, mark as sent
- createMsgDiv(receivedMsg.msg,'http://www.gravatar.com/avatar/'+receivedMsg.hash,false,receivedMsg.id);
- document.getElementById(receivedMsg.id).parentElement.className='sent';
+ createMsgDiv(receivedMsg.msg,'http://www.gravatar.com/avatar/'+receivedMsg.hash,false,receivedMsg.id);
+ document.getElementById(receivedMsg.id).parentElement.className='sent';}}
-
-
-
-
-
-
-
-
-
-
-
-
Quick Start Tutorial
-
Basic NGSI chat operator
-
-
-
-
-
-
Presenter Notes
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Basic NGSI chat operator
-
-
-
Initial operator
+
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Quick Start Tutorial
+
Basic NGSI chat operator
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Basic NGSI chat operator
+
+
Initial operator
The operator is defined on a config.xml declarative file, which references one or many JavaScript files containing its behaviour.
Like widgets, the config.xml has vendor, name and version information that should be updated so as to avoid conflicts or WireCloud rejecting an operator.
The widget has some preferences for easy indicating the URLs of the NGSI server and the proxy for accessing it from widgets/operators. Moreover, a chatroom preference has been added.
<preferences>
- <preferencename="ngsi_server"
- type="text"label="NGSI server URL"
- description="URL of the Orion Context Broker to use for retrieving entity information"
- default="http://orion.lab.fiware.org:10026/"/>
- <preferencename="ngsi_proxy"
- type="text"
- label="NGSI proxy URL"
- description="URL of the PubSub Context Broker proxy to use for receiving notifications about changes"
- default="https://ngsiproxy.lab.fiware.org/"/>
- <preferencename="chatroom"
- type="text"
- label="Chat room"
- description="Chat room to send and receive messages"
- default="Startup Weekends"/>
+ <preferencename="ngsi_server"
+ type="text"label="NGSI server URL"
+ description="URL of the Orion Context Broker to use for retrieving entity information"
+ default="http://orion.lab.fiware.org:10026/"/>
+ <preferencename="ngsi_proxy"
+ type="text"
+ label="NGSI proxy URL"
+ description="URL of the PubSub Context Broker proxy to use for receiving notifications about changes"
+ default="https://ngsiproxy.lab.fiware.org/"/>
+ <preferencename="chatroom"
+ type="text"
+ label="Chat room"
+ description="Chat room to send and receive messages"
+ default="Startup Weekends"/></preferences>
-
-
-
-
-
-
-
-
-
-
-
-
-
Basic NGSI chat operator
-
-
-
Initial operator
+
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Basic NGSI chat operator
+
+
Initial operator
Wiring is also used in the widget. It sends received messages back to the widget, and forwards user messages to the NGSI API:
<wiring>
- <outputendpointname="toBeReceived"
- type="text"
- label="Messages from NGSI"
- description="Forward a message to a chat widget"
- friendcode="message"/>
- <inputendpointname="toBeSent"
- type="text"
- label="Message to NGSI"
- description="Receive messages to be sent to the chat room"
- friendcode="message"/>
+ <outputendpointname="toBeReceived"
+ type="text"
+ label="Messages from NGSI"
+ description="Forward a message to a chat widget"
+ friendcode="message"/>
+ <inputendpointname="toBeSent"
+ type="text"
+ label="Message to NGSI"
+ description="Receive messages to be sent to the chat room"
+ friendcode="message"/></wiring>
-
-
-
-
-
-
-
-
-
-
-
-
-
Basic NGSI chat operator
-
-
-
Initial operator
+
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Basic NGSI chat operator
+
+
Initial operator
Basic JavaScript file is written below, containing initialization function, preferences and wiring subscriptions and some skeletons:
An NGSI connection must be stablished so as to make requests over it. It is authenticating using FIWARE tokens from the user logged on WireCloud. I've declared a global (closure) variable to hold it and access from other functions.
To create a new entity or modify an existing one, function addAttributes() of
the connection is used. For the chat application, a new instance of class
ChatMessageis created, using its hash and msg attributes (exactly as the
event sent by wiring). Further information can be found on the NGSI API of
WireCloud documentation or on the Orion Context Broker with WireCloud
tutorial.
Note that the ID of the entity has been created with a fixed part (a preference indicating the chat room), plus a timestamp and the hash of the user writing.
-
-
-
-
-
-
-
-
-
-
-
-
-
Basic NGSI chat operator
-
-
-
NGSI subscription
+
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Basic NGSI chat operator
+
+
NGSI subscription
This operator wants to receive the modification (creation is a kind of
modification) of any instance of type ChatMessage whose ID starts with the
chat room. If we had previously created the subscription (stored on chatroom
@@ -1454,56 +1037,41 @@
Basic NGSI chat operator
parameters (like the id of the entities to monitorize, the list of attribute
your interested on, the duration of the subscription, etc), in the next slide
you will see an example of use for our scenario.
The subscription duration is set to 30 minutes, and should be renewed (or the
page reloaded) before that time. How to renew the subscription will be addressed
in future versions of this tutorial (in the meantime, you can take a look to the
Orion Context Broker with WierCloud tutorial
for a generic tutorial of how to do it).
Use ← and → to move around. Press h for getting more info
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Creating widget and operator descriptions
+
Introduction
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Introduction
+
+
In WireCloud, every application mashup component have to provide a config.xml
file providing metadata info. Moreover, every component must provide the
following info:
@@ -131,42 +100,27 @@
Introduction
appended to. So, revision 2.4 is newer than revision 2.4rc1, which in turn is
newer than 2.4b1 or 2.4a1
-
-
-
-
-
-
-
-
-
-
-
-
-
Introduction
-
-
-
These tree attributes (vendor, name and version) uniquely identify the resource,
+
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Introduction
+
+
These tree attributes (vendor, name and version) uniquely identify the resource,
therefore there can not be a repetition of such identifier in any collection of
WireCloud resources (including widgets, mashups, operators, ...). In addition to
these attributes, every resource can, optionally, provide the following
@@ -190,42 +144,27 @@
Introduction
authors field
-
-
-
-
-
-
-
-
-
-
-
-
-
Introduction
-
-
-
+
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Introduction
+
+
email: E-mail address for getting support
license: Name of the license associated to the mashable application
component
@@ -241,115 +180,74 @@
Introduction
doc: Absolute or template-relative URL of the mashable application
component documentation.
-
-
-
-
-
-
-
-
-
-
-
-
Creating widget and operator descriptions
-
XML
-
-
-
-
-
-
Presenter Notes
-
-
-
-
-
-
-
-
-
-
-
-
-
-
XML
-
-
-
Mashable application components described using XML should use the
+
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Creating widget and operator descriptions
+
XML
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
XML
+
+
Mashable application components described using XML should use the
http://wirecloud.conwet.fi.upm.es/ns/macdescription/1 namespace for the root
element that must be called widget or operator depending on the
component that you want to develop. This root element must have the three
attributes (vendor, name and version) that identify the resource. In addition,
it should contain another element details that will carry on all the basic
information about the resource, as explained before.
-
-
-
-
-
-
-
-
-
-
-
-
-
XML
-
-
-
The following code shows you the description of a widget using XML:
In addition to the XML format, widget and operator descriptions (config.xml
+
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Creating widget and operator descriptions
+
RDF
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
RDF
+
+
In addition to the XML format, widget and operator descriptions (config.xml
files) can also be written using one of the following RDF notations: n3, turtle
or rdf/xml. These RDF notations usually are more complex than the XML notation
provided by WireCloud, making them more suitable when you want to add extra
@@ -493,42 +350,27 @@
RDF
component metadata to other systems that uses RDF (but this is transparent to
the user).
We recommend you to stick using the XML notation when possible.
-
-
-
-
-
-
-
-
-
-
-
-
-
RDF
-
-
-
The first thing that you have to include in your config.xml file is the header
+
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
RDF
+
+
The first thing that you have to include in your config.xml file is the header
in order to have all the namespaces available in the rest of the document. At
least you need to import the WireCloud namespace
("http://wirecloud.conwet.fi.upm.es/ns/widget"), but you can import other
@@ -536,53 +378,38 @@
RDF
you can find an example. As can be seen, the WireCloud namespace has been tagged
as "wire". In addition, some other namespaces has been imported (usdl-core,
foaf, rdfs,...):
-
Once added the RDF header, the next step is adding the required node:
+
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
RDF
+
+
Once added the RDF header, the next step is adding the required node:
wire:Operator or wire:Widget depending on the component that you want to
create. This will be the root node, so all the metadata associated to the widget
or operator should be a descendant of this node.
@@ -645,316 +457,214 @@
RDF
smartphoneimage: wire:hasiPhoneImageUri
doc: foaf:page
-
-
-
-
-
-
-
-
-
-
-
-
-
RDF
-
-
-
The following code show an example of the description of an Operator:
The following code show an example of the description of an Operator:
+
<wire:Operatorrdf:about="http://wirecloud.conwet.fi.upm.es/ns/widget#CoNWeT/entity-service/2.3.2"><usdl:hasProvider>
- <gr:BusinessEntityrdf:nodeID="Ne2a8644226d049239a5a9856bafcd7c6">
+ <gr:BusinessEntityrdf:nodeID="Ne2a8644226d049239a5a9856bafcd7c6"><foaf:name>CoNWeT</foaf:name></gr:BusinessEntity></usdl:hasProvider>
- <wire:hasImageUrirdf:resource="images/catalogue.png"/>
- <wire:hasiPhoneImageUrrdf:resource="images/catalogue_mob.png"/>
+ <wire:hasImageUrirdf:resource="images/catalogue.png"/>
+ <wire:hasiPhoneImageUrrdf:resource="images/catalogue_mob.png"/><wire:displayName>Entity Service</wire:displayName><dcterms:title>entity-service</dcterms:title><usdl:versionInfo>2.3.2</usdl:versionInfo><dcterms:description>This operator permits us gather information about several entities (Lamp posts, AMMSs and Regulators) from any NGSI service.</dcterms:description>
- <foaf:pagerdf:resource="docs/index.html"/>
+ <foaf:pagerdf:resource="docs/index.html"/><dcterms:creator>
- <foaf:Personrdf:nodeID="Ne3468f9471d349908dd8e81167153ac8">
+ <foaf:Personrdf:nodeID="Ne3468f9471d349908dd8e81167153ac8"><foaf:name>sblanco</foaf:name></foaf:Person></dcterms:creator><vcard:addr>
- <vcard:Workrdf:nodeID="N6d57fc77a0e643138195f0db44b95fb2">
+ <vcard:Workrdf:nodeID="N6d57fc77a0e643138195f0db44b95fb2"><vcard:email>example@example.com</vcard:email></vcard:Work></vcard:addr></wire:Operator>
-
-
-
-
-
-
-
-
-
-
-
-
-
RDF
-
-
-
Evidently, other RDF formats can also be used (e.g. n3):
+
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
RDF
+
+
Evidently, other RDF formats can also be used (e.g. n3):
<http://wirecloud.conwet.fi.upm.es/ns/widget#CoNWeT/entity-service/2.3.2>awire:Operator;dcterms:creator[afoaf:Person;
- foaf:name"example"];
-dcterms:description"This operator permits us gather information about several entities (Lamp posts, AMMSs and Regulators) from any NGSI service.";
-dcterms:title"entity-service";
-wire:displayName"Entity Service";
+ foaf:name"example"];
+dcterms:description"This operator permits us gather information about several entities (Lamp posts, AMMSs and Regulators) from any NGSI service.";
+dcterms:title"entity-service";
+wire:displayName"Entity Service";wire:hasImageUri<images/catalogue.png>;usdl:hasProvider[agr:BusinessEntity;
- foaf:name"CoNWeT"];
-usdl:versionInfo"2.3.2";
+ foaf:name"CoNWeT"];
+usdl:versionInfo"2.3.2";vcard:addr[avcard:Work;
- vcard:email"example@example.com"];
+ vcard:email"example@example.com"];foaf:page<docs/display/wirecloud>.
-
-
-
-
-
-
-
-
-
-
-
-
Creating widget and operator descriptions
-
Entry Points
-
-
-
-
-
-
Presenter Notes
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Entry Points
-
-
-
Widgets and operators are very similar but not equals. There are some difference
+
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Creating widget and operator descriptions
+
Entry Points
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Entry Points
+
+
Widgets and operators are very similar but not equals. There are some difference
between them since the operators don't have a view. This means that operators
descriptors don't use an initial HTML document as entry point. Instead,
operators define the list of javascript files in their descriptor file.
-
-
-
-
-
-
-
-
-
-
-
-
-
Entry Points
-
-
-
Widgets
+
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Entry Points
+
+
Widgets
If you use XML to define your widget, you must define the contents element to
set the HTML entry point. This element is contained by the root element (widget)
(as we explained before):
-
<contentssrc="index.html"/>
+
<contentssrc="index.html"/>
-
Just in case you use RDF to describe your widget, you must set the element
usdl:utilizedResource to set the HTML entry point. The following code is an
example using N3:
usdl:utilizedResource<index.html>;
-
-
-
-
-
-
-
-
-
-
-
-
Entry Points
-
-
-
Operators
+
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Entry Points
+
+
Operators
If you have developed your operator using XML, you must use the scripts
element to define the JS files that will be executed. This element must be
contained by the root one (operator) as can be sen in the following snippet:
To set the JS files of your operator in RDF, you must set the element
usdl:utilizedResource and set the index of each file. To do so, you can stick
to the following example:
WireCloud provides tools for automatically convert the format of your mashable
+
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Creating widget and operator descriptions
+
Switching between supported description formats
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Switching between supported description formats
+
+
WireCloud provides tools for automatically convert the format of your mashable
application component descriptions. If you want to do it, you can make use of
the convert command (WireCloud must be installed in order to use this tool, see
the Installation and Administration Guide for more info):
The most important options supported by this command are the -d flag, that
allows you to specify the output format (currently you can use the following
formats: xml, rdf and old_xml); and the --rdf-format option that allows you to
@@ -1053,118 +735,76 @@
This will print the new description to the standard output. For saving the
+
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Switching between supported description formats
+
+
This will print the new description to the standard output. For saving the
result into a file, you should use the [dest_file] argument. The next example
will convert the config.ttl description file from RDF/turtle to xml creating a
config.xml file:
$ wirecloud-admin convert -d xml config.ttl config.xml
-
Remember that you can always obtain more info about the convert command using
the help command:
$ wirecloud-admin help convert
-
-
-
-
-
-
-
-
-
-
-
-
Creating widget and operator descriptions
-
Examples
-
-
-
-
-
-
Presenter Notes
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Examples
-
-
-
The following tutorials will guide you to create a widget or an operator. These
+
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Creating widget and operator descriptions
+
Examples
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Examples
+
+
The following tutorials will guide you to create a widget or an operator. These
tutorials include some other configurations that can be added to your
config.xml file. But the best way to understand the structure of these
documents is to see some examples.
Use ← and → to move around. Press h for getting more info
-
-
-
-
Presenter Notes
-
-
-
-
-
-
-
-
-
-
-
-
-
Logging error messages
-
Logging error messages
-
-
-
-
-
-
Presenter Notes
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Logging error messages
-
-
-
WireCloud provides support for logging error messages from widgets/operators. Those messages will be stored as info associated to the widget/operator and will be used to provide feedback to the user/developer (not only while the developer is testing a widget/operator, but also as part of bug reports).
-
MashupPlatform.widget.log("This is an error message");// defaults to MashupPlatform.log.ERROR
-MashupPlatform.widget.log("This is also an error message",MashupPlatform.log.ERROR);
-MashupPlatform.widget.log("This is a warning message",MashupPlatform.log.WARN);
-MashupPlatform.widget.log("This is an info message",MashupPlatform.log.INFO);
+
+
+
+
+Logging error messages
+
+
+
+
+
+
+
+
+
+
+
Use ← and → to move around. Press h for getting more info
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Logging error messages
+
Logging error messages
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Logging error messages
+
+
WireCloud provides support for logging error messages from widgets/operators. Those messages will be stored as info associated to the widget/operator and will be used to provide feedback to the user/developer (not only while the developer is testing a widget/operator, but also as part of bug reports).
+
MashupPlatform.widget.log("This is an error message");// defaults to MashupPlatform.log.ERROR
+MashupPlatform.widget.log("This is also an error message",MashupPlatform.log.ERROR);
+MashupPlatform.widget.log("This is a warning message",MashupPlatform.log.WARN);
+MashupPlatform.widget.log("This is an info message",MashupPlatform.log.INFO);
-
-
-
-
-
-
-
-
-
-
-
-
-
Logging error messages
-
-
-
WireCloud will provide a visual hint about widgets/operators having problems when a widget/operator calls to the log method using the ERROR level. This is an example of the visual hint for widgets:
-
-
-
-
-
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Logging error messages
+
+
WireCloud will provide a visual hint about widgets/operators having problems when a widget/operator calls to the log method using the ERROR level. This is an example of the visual hint for widgets:
+
+
-
-
Presenter Notes
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Logging error messages
-
-
-
Clicking on the alert icon will open the logs view. Anyway, you can always visit this view at any time using the widget's dropdown menu:
-
-
-
-
-
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Logging error messages
+
+
Clicking on the alert icon will open the logs view. Anyway, you can always visit this view at any time using the widget's dropdown menu:
+
+
-
-
Presenter Notes
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Logging error messages
-
-
-
-
-
-
-
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Logging error messages
+
+
+
-
-
Presenter Notes
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Logging error messages
-
-
-
The API for logging messages from operators is very similar:
-
MashupPlatform.operator.log("This is an error message");// defaults to MashupPlatform.log.ERROR
-MashupPlatform.operator.log("This is also an error message",MashupPlatform.log.ERROR);
-MashupPlatform.operator.log("This is a warning message",MashupPlatform.log.WARN);
-MashupPlatform.operator.log("This is an info message",MashupPlatform.log.INFO);
+
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Logging error messages
+
+
The API for logging messages from operators is very similar:
+
MashupPlatform.operator.log("This is an error message");// defaults to MashupPlatform.log.ERROR
+MashupPlatform.operator.log("This is also an error message",MashupPlatform.log.ERROR);
+MashupPlatform.operator.log("This is a warning message",MashupPlatform.log.WARN);
+MashupPlatform.operator.log("This is an info message",MashupPlatform.log.INFO);
-
-
-
-
-
-
-
-
-
-
-
-
-
Logging error messages
-
-
-
Since Opertators are not shown in the Editor view, WireCloud provides you graphical elements to inform you when an Operator arises an error. If you are in the Editor view, you will be able to see that an error bag with the number of detected errors appears attached to the Wiring element in the menu, as you can note in the following image:
-
-
-
-
-
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Logging error messages
+
+
Since Opertators are not shown in the Editor view, WireCloud provides you graphical elements to inform you when an Operator arises an error. If you are in the Editor view, you will be able to see that an error bag with the number of detected errors appears attached to the Wiring element in the menu, as you can note in the following image:
+
+
-
-
Presenter Notes
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Logging error messages
-
-
-
When you are in the Wiring View, you will easily identify the Operator that caused the error because it will have an alert icon attached as you can be seen in the following picture:
-
+
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Logging error messages
+
+
When you are in the Wiring View, you will easily identify the Operator that caused the error because it will have an alert icon attached as you can be seen in the following picture:
+
As happened with the widgets, clicking on the alert icon will show you the logs view. In the same way, you can use the widget's dropdown menu at any time to show that view.
Use ← and → to move around. Press h for getting more info
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Making requests and wiring
+
Introduction
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Introduction
+
+
In this example, we are going to implement a Weather Widget as an excuse to
learn how to use the most commonly used features of WireCloud from a point of
view of Widgets. Our intention is to create a Widget capable of making AJAX
request to a external service and of communicating with other widgets in a
@@ -125,123 +94,82 @@
Introduction
code contains a widget example skeleton including basic html/style code.
Also, you will need to create a new API key for the Weather Underground API
using this link.
-
-
-
-
-
-
-
-
-
-
-
-
Making requests and wiring
-
Making request to Weather Underground
-
-
-
-
-
-
Presenter Notes
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Making request to Weather Underground
-
-
-
Weather Underground provide a rest API for this purpose (documented at
+
+
+
+
The getForecastByCoord function makes the appropriated request to Weather
Underground and passes the result to the onSuccess callback.
-
-
-
-
-
-
-
-
-
-
-
-
Making requests and wiring
-
Adding an input endpoint
-
-
-
-
-
-
Presenter Notes
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Adding an input endpoint
-
-
-
Input endpoints must be declared into the widget template before it can be used
+
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Making requests and wiring
+
Adding an input endpoint
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Adding an input endpoint
+
+
Input endpoints must be declared into the widget template before it can be used
by the javascript code of the widget. To do so, open config.xml and add an
inputendpoint element into the wiring section. The final result should look
like:
@@ -332,53 +233,38 @@
Adding an input endpoint
<wiring><inputendpoint
- name="coord"
- type="text"
- label="Show forecast by coord"
- description="Shows the weather forecast for a given location (a latitude longitude coordinate)."
- friendcode="location"
+ name="coord"
+ type="text"
+ label="Show forecast by coord"
+ description="Shows the weather forecast for a given location (a latitude longitude coordinate)."
+ friendcode="location"/></wiring>
...
-
-
-
-
-
-
-
-
-
-
-
-
-
Adding an input endpoint
-
-
-
Input endpoint metadata
+
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Adding an input endpoint
+
+
Input endpoint metadata
The name attribute will be use to reference to the input endpoint when
using the javascript API
@@ -396,133 +282,88 @@
Adding an input endpoint
by output endpoints with a friendcode of "location". The format of this data
is a string with the longitude and the latitude separated by a comma
-
-
-
-
-
-
-
-
-
-
-
-
-
Adding an input endpoint
-
-
-
This is how to declare the input endpoint when using RDF (turtle):
+
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Adding an input endpoint
+
+
This is how to declare the input endpoint when using RDF (turtle):
...wire:hasPlatformWiring[a<http://WireCloud.conwet.fi.upm.es/ns/widget#PlatformWiring>;wire:hasInputEndpoint[a<http://wirecloud.conwet.fi.upm.es/ns/widget#InputEndpoint>;
- rdfs:label"Show forecast by coord";
- dcterms:description"Shows the weather forecast for a given location (a latitude longitude coordinate).";
- dcterms:title"coord";
- wire:friendcode"location";
- wire:type"text"]];
+ rdfs:label"Show forecast by coord";
+ dcterms:description"Shows the weather forecast for a given location (a latitude longitude coordinate).";
+ dcterms:title"coord";
+ wire:friendcode"location";
+ wire:type"text"]];...
-
-
-
-
-
-
-
-
-
-
-
-
-
Adding an input endpoint
-
-
-
Once declared the input endpoint in the widget template, you can register a
+
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Adding an input endpoint
+
+
Once declared the input endpoint in the widget template, you can register a
callback for this endpoint making use of the
MashupPlatform.wiring.registerCallback method. In
addition to registering the input endpoint, we need to process event data before
using it and to notify the user that the forecast data for the given location is
being requested.
-
-
-
-
-
-
-
-
-
-
-
-
-
Adding an input endpoint
-
-
-
This can be accomplished by using the following code:
+
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Adding an input endpoint
+
+
This can be accomplished by using the following code:
As we did with the input endpoint, we need to declare the new output endpoint in
+
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Making requests and wiring
+
Adding an output endpoint
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Adding an output endpoint
+
+
As we did with the input endpoint, we need to declare the new output endpoint in
the weather widget's description. This is the final result of the Wiring section
after adding it:
...
<wiring>
- <inputendpointname="coord"type="text"label="Show forecast by coord"description="Shows the weather forecast for a given location (a latitude longitude coordinate)."friendcode="location"/>
+ <inputendpointname="coord"type="text"label="Show forecast by coord"description="Shows the weather forecast for a given location (a latitude longitude coordinate)."friendcode="location"/><outputendpoint
- name="location_coord"
- type="text"
- label="Forecast location"
- description="This event is launched when the user clicks on the location name of current forecast."
- friendcode="location"
+ name="location_coord"
+ type="text"
+ label="Forecast location"
+ description="This event is launched when the user clicks on the location name of current forecast."
+ friendcode="location"/></wiring>
...
-
-
-
-
-
-
-
-
-
-
-
-
-
Adding an output endpoint
-
-
-
Output endpoint metadata
+
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Adding an output endpoint
+
+
Output endpoint metadata
The name attribute will be use to reference to the output endpoint when
using the javascript API
@@ -677,565 +477,398 @@
Adding an output endpoint
recommendations. In this case, we are declaring that we send data aligned with
the friendcode "location"
-
-
-
-
-
-
-
-
-
-
-
-
-
Adding an output endpoint
-
-
-
This is how to declare the output endpoint when using RDF (turtle):
+
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Adding an output endpoint
+
+
This is how to declare the output endpoint when using RDF (turtle):
...wire:hasPlatformWiring[a<http://wirecloud.conwet.fi.upm.es/ns/widget#PlatformWiring>;wire:hasInputEndpoint[a<http://wirecloud.conwet.fi.upm.es/ns/widget#InputEndpoint>;
- rdfs:label"Show forecast by coord";
- dcterms:description"Shows the weather forecast for a given location (a latitude longitude coordinate).";
- dcterms:title"coord";
- wire:friendcode"location";
- wire:type"text"]];
+ rdfs:label"Show forecast by coord";
+ dcterms:description"Shows the weather forecast for a given location (a latitude longitude coordinate).";
+ dcterms:title"coord";
+ wire:friendcode"location";
+ wire:type"text"]];wire:hasOutputEndpoint[a<http://wirecloud.conwet.fi.upm.es/ns/widget#OutputEndpoint>;
- rdfs:label"Forecast location";
- dcterms:description"This event is launched when the user clicks on the location name of current forecast.";
- dcterms:title"location_coord";
- wire:friendcode"location";
- wire:type"text"];
+ rdfs:label"Forecast location";
+ dcterms:description"This event is launched when the user clicks on the location name of current forecast.";
+ dcterms:title"location_coord";
+ wire:friendcode"location";
+ wire:type"text"];...
-
-
-
-
-
-
-
-
-
-
-
-
-
Adding an output endpoint
-
-
-
After adding the output endpoint to the widget description, we can send data
+
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Adding an output endpoint
+
+
After adding the output endpoint to the widget description, we can send data
through it using the MashupPlatform.wiring.pushEvent method.
The following code adds an event listener to the location title that sends the
location of the current forecast:
Now that we have implemented the weather widget we can make use of it to test it
+
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Making requests and wiring
+
Testing it
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Testing it
+
+
Now that we have implemented the weather widget we can make use of it to test it
is working as expected. One of the Widget that should be compatible with our
newly created weather widget is the "Web Map Service" Widget so a way to test
our widgets is to create a new Workspace with both widgets.
You can download Web Map Service widget from this link.
-
-
-
-
-
-
-
-
-
-
-
-
-
Testing it
-
-
-
Here is a screenshot of a workspace with both widgets:
-
-
-
-
-
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Testing it
+
+
Here is a screenshot of a workspace with both widgets:
+
+
-
-
Presenter Notes
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Testing it
-
-
-
And how to wire them:
-
-
-
-
-
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Testing it
+
+
And how to wire them:
+
+
-
-
Presenter Notes
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Testing it
-
-
-
Go back to your dashboard and click in any place of the map. Your weather widget
+
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Testing it
+
+
Go back to your dashboard and click in any place of the map. Your weather widget
should be update and you should see something similiar to this:
-
-
-
-
-
+
-
-
Presenter Notes
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Testing it
-
-
-
Also you should test that sending events from the widget is working correctly,
+
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Testing it
+
+
Also you should test that sending events from the widget is working correctly,
so move the map viewport to another part of the world and click on the location
title on the weather widget ("Horndon on the Hill, United kingdom" in the screenshot) so
visit other places using the Web Map Service Widget and click on the location
title to see if the Web Map Service goes back to the forecast location.
You can download both our implementation of the widget as the mashup example.
Use ← and → to move around. Press h for getting more info
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Adding preferences
+
Introduction
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Introduction
+
+
This widget represents the reference implementation of the "Adding preferences"
tutorial. This tutorial is based on previous tutorials were we have used a
hardcoded value of the API key for the weather underground service. This may be
good enough for a basic version of the widget, but in the real world this
@@ -122,123 +91,82 @@
Introduction
For this tutorial, we're are going to use the proposed solution from the "[Making requests and wiring][prev_tutorial]" tutorial as base. You can download
the code of the widget using this link.
The first step for adding a preference is declaring it in the config.xml file.
+
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Adding preferences
+
Adding preferences to the config.xml
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Adding preferences to the config.xml
+
+
The first step for adding a preference is declaring it in the config.xml file.
This can be accomplished by adding a preference element into the
preferences element. The final result should look like:
Preferences of type list need to provide the list of options to be provided in
+
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Adding preferences to the config.xml
+
+
Preferences of type list need to provide the list of options to be provided in
the user interface. This is accomplished by means of using the option element.
This element requires two attributes:
@@ -340,118 +238,77 @@
Adding preferences to the config.xml
The label attribute will be used in the user interface when referencing this
option/value. This attribute can be translated.
-
-
-
-
-
-
-
-
-
-
-
-
-
Adding preferences to the config.xml
-
-
-
This is an example of how to declare a list preference:
+
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Adding preferences to the config.xml
+
+
This is an example of how to declare a list preference:
Once declared the users preference in the widget or operator descriptor, you
+
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Adding preferences
+
Basic usage
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Basic usage
+
+
Once declared the users preference in the widget or operator descriptor, you
will be able to read the current value of the preference using the
MashupPlatform.prefs.get method. This method will return a value
using the type associated with the type of the preference:
@@ -460,49 +317,34 @@
Basic usage
number for preferences of type number
and boolean for boolean preferences
-
-
-
-
-
-
-
-
-
-
-
-
-
Basic usage
-
-
-
For example, taking into account the code used in previous tutorials:
+
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Basic usage
+
+
For example, taking into account the code used in previous tutorials:
After this change, the API_KEY constant is not used anymore, so you can safely remove it from the source code.
-
-
-
-
-
-
-
-
-
-
-
-
Adding preferences
-
Reacting to preference changes
-
-
-
-
-
-
Presenter Notes
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Reacting to preference changes
-
-
-
Some times widgets need to react to changes in the preferences. This can be
+
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Adding preferences
+
Reacting to preference changes
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Reacting to preference changes
+
+
Some times widgets need to react to changes in the preferences. This can be
accomplished using the
MashupPlatform.prefs.registerCallback method. For
example, we can make use of this support for displaying an alert message to the
user just in case the new value for the api-key preference is not valid:
Evidently, this only check the value of the preference when this is changed, so
+
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Reacting to preference changes
+
+
Evidently, this only check the value of the preference when this is changed, so
you need to call manually the updateMissingAPIKeyAlert function when the widget
is loaded. This can be accomplished using the following code:
Once implemented our new widget we should test if it works as expected. This
+
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Adding preferences
+
Testing it
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Testing it
+
+
Once implemented our new widget we should test if it works as expected. This
widget has the same functionallity provided by the widget created by following
the steps of the "[Making requests and wiring][prev_tutorial]"
You can download both our implementation of the widget as the
mashup example.
Use ← and → to move around. Press h for getting more info
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Accessing context information
+
Introduction
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Introduction
+
+
WireCloud provides context at three levels: platform, mashup and widget/operator levels. Those context are accesible through the following objects:
MashupPlatform.widget.context// Widget context (Only available to widgets)MashupPlatform.operator.context// Operator context (Only available to operators)MashupPlatform.mashup.context// Mashup contextMashupPlatform.context// Platform context
-
-
-
-
-
-
-
-
-
-
-
-
-
Introduction
-
-
-
Each of these context managers supports three methods:
+
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Introduction
+
+
Each of these context managers supports three methods:
getAvailableContext: That provides information about what concepts are available for the given level
get: Retrieves the current value for a concept
registerCallback: Allows to register a callback that will be called when any of the concepts are modified
Basically you'll make use of the get method. For example:
Discovering the available context information of a WireCloud instance
-
-
-
-
-
-
Presenter Notes
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Discovering the available context information of a WireCloud instance
-
-
-
The available context information depends on the version and the list of addons
+
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Accessing context information
+
Discovering the available context information of a WireCloud instance
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Discovering the available context information of a WireCloud instance
+
+
The available context information depends on the version and the list of addons
installed in the concrete instance of WireCloud. Here you have to options:
Discovering available context information using the getAvailableContext method
Using widget context for resizing widget's content
-
-
-
-
-
-
Presenter Notes
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Using widget context for resizing widget's content
-
-
-
One of the main uses that developers can give to the context support is using it
+
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Accessing context information
+
Using widget context for resizing widget's content
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Using widget context for resizing widget's content
+
+
One of the main uses that developers can give to the context support is using it
for receiving notification about changes in the size of a widget. This is due to
the fact that CSS is better prepared for managing horizontal dimensions than
vertical ones. In addition to this, the resize event is not fired inside widgets
@@ -312,7 +214,7 @@
Using widget context for resizing widget's content
Use ← and → to move around. Press h for getting more info
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Translating widgets
+
Translating widget metadata
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Translating widget metadata
+
+
Using XML templates
XML templates allows translations of some fields that will be displayed to users
in WireCloud platform, this translations can be included in the template adding
the translations node with the attribute default specifying the default language
@@ -126,44 +95,29 @@
Translating widget metadata
(matching the translation names with the name attribute) to the translation
nodes. These msg elements, will provide the string that will be used to remplace
the translations patterns.
-
-
-
-
-
-
-
-
-
-
-
-
-
Translating widget metadata
-
-
-
Using XML templates
+
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Translating widget metadata
+
+
Using XML templates
The structure of a config.xml file before and after adding the translations can be seen below:
<doc>doc/index.html</doc></details><wiring>
- <outputendpointname="location_coord"type="text"label="Forecast location"description="This event is launched when the user clicks on the location name of current forecast."friendcode="location"/>
- <inputendpointname="coord"type="text"label="Show forecast by coord"description="Shows the weather forecast for a given location (a latitude longitude coordinate)."friendcode="location"/>
+ <outputendpointname="location_coord"type="text"label="Forecast location"description="This event is launched when the user clicks on the location name of current forecast."friendcode="location"/>
+ <inputendpointname="coord"type="text"label="Show forecast by coord"description="Shows the weather forecast for a given location (a latitude longitude coordinate)."friendcode="location"/></wiring>
- <contentssrc="weather.html"contenttype="text/html"charset="utf-8"/>
- <renderingheight="24"width="6"/>
+ <contentssrc="weather.html"contenttype="text/html"charset="utf-8"/>
+ <renderingheight="24"width="6"/></widget>
...
- <translationsdefault="en">
- <translationlang="en">
- <msgname="displayName">Weather Widget Example</msg>
- <msgname="description">Example of widget for the Wirecloud Plaftorm.</msg>
- <msgname="eventDescription">This event is launched when the user clicks on the location name of current forecast.</msg>
- <msgname="slotDescription">Shows the weather forecast for a given location (a latitude longitude coordinate).</msg>
- <msgname="slotLabel">Show forecast by coord</msg>
- <msgname="eventLabel">Forecast location</msg>
+ <translationsdefault="en">
+ <translationlang="en">
+ <msgname="displayName">Weather Widget Example</msg>
+ <msgname="description">Example of widget for the Wirecloud Plaftorm.</msg>
+ <msgname="eventDescription">This event is launched when the user clicks on the location name of current forecast.</msg>
+ <msgname="slotDescription">Shows the weather forecast for a given location (a latitude longitude coordinate).</msg>
+ <msgname="slotLabel">Show forecast by coord</msg>
+ <msgname="eventLabel">Forecast location</msg></translation>
- <translationlang="es">
- <msgname="displayName">Ejemplo de widget del tiempo</msg>
- <msgname="description">Ejemplo de un widget para la plataforma Wirecloud.</msg>
- <msgname="eventDescription">Este evento se lanza cuando el usuario hace click en el nombre de la ubicación de la previsión actual.</msg>
- <msgname="slotDescription">Muestra las previsiones meteorológicas para una ubicación dada (coordenadas en latitud y longitud).</msg>
- <msgname="slotLabel">Muestra las prevesiones por coordenadas</msg>
- <msgname="eventLabel">Ubicación de la previsión</msg>
+ <translationlang="es">
+ <msgname="displayName">Ejemplo de widget del tiempo</msg>
+ <msgname="description">Ejemplo de un widget para la plataforma Wirecloud.</msg>
+ <msgname="eventDescription">Este evento se lanza cuando el usuario hace click en el nombre de la ubicación de la previsión actual.</msg>
+ <msgname="slotDescription">Muestra las previsiones meteorológicas para una ubicación dada (coordenadas en latitud y longitud).</msg>
+ <msgname="slotLabel">Muestra las prevesiones por coordenadas</msg>
+ <msgname="eventLabel">Ubicación de la previsión</msg></translation></translations></widget>
-
-
-
-
-
-
-
-
-
-
-
-
-
Translating widget metadata
-
-
-
Using RDF templates
+
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Translating widget metadata
+
+
Using RDF templates
Translations in RDF descriptions are based in the use of RDF literal attribute
lang. To translate a field it is included in the template for every language to
be translated, specifying the language with the attribute lang.
-
-
-
-
-
-
-
-
-
-
-
-
-
Translating widget metadata
-
-
-
Using RDF templates
+
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Translating widget metadata
+
+
Using RDF templates
The structure of a RDF (xml) description without translations:
...
-<wire:Widgetrdf:about="http://wirecloud.conwet.fi.upm.es/ns/weather-example">
+<wire:Widgetrdf:about="http://wirecloud.conwet.fi.upm.es/ns/weather-example"><dcterms:title>weather-example</dcterms:title><dcterms:description>Example of widget for the Wirecloud Plaftorm.</dcterms:description><wire:displayName>Weather Widget Example</wire:displayName>
@@ -386,425 +280,313 @@
The structure of a RDF (xml) description with translations:
...
-<wire:Widgetrdf:about="http://wirecloud.conwet.fi.upm.es/ns/weather-example">
+<wire:Widgetrdf:about="http://wirecloud.conwet.fi.upm.es/ns/weather-example"><dcterms:title>weather-example</dcterms:title>
- <dcterms:descriptionxml:lang="en">Example of widget for the Wirecloud Plaftorm.</dcterms:description>
- <dcterms:descriptionxml:lang="es">Ejemplo de un widget para la plataforma Wirecloud.</dcterms:description>
- <wire:displayNamexml:lang="en">Weather Widget Example</wire:displayName>
- <wire:displayNamexml:lang="es">Ejemplo de widget del tiempo</wire:displayName>
+ <dcterms:descriptionxml:lang="en">Example of widget for the Wirecloud Plaftorm.</dcterms:description>
+ <dcterms:descriptionxml:lang="es">Ejemplo de un widget para la plataforma Wirecloud.</dcterms:description>
+ <wire:displayNamexml:lang="en">Weather Widget Example</wire:displayName>
+ <wire:displayNamexml:lang="es">Ejemplo de widget del tiempo</wire:displayName><dcterms:creator><foaf:Person><foaf:name>aarranz</foaf:name></foaf:Person></dcterms:creator><usdl-core:versionInfo>1.0</usdl-core:versionInfo>
- <wire:hasImageUrirdf:resource="images/catalogue.png"/>
- <wire:hasiPhoneImageUrirdf:resource="images/catalogue_iphone.png"/>
+ <wire:hasImageUrirdf:resource="images/catalogue.png"/>
+ <wire:hasiPhoneImageUrirdf:resource="images/catalogue_iphone.png"/>
...
-
-
-
-
-
-
-
-
-
-
-
-
-
Translating widget metadata
-
-
-
Using RDF templates
+
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Translating widget metadata
+
+
Using RDF templates
The structure of a RDF (turtle) description without translations:
...<http://wirecloud.conwet.fi.upm.es/ns/weather-example>awire:Widget;
- dcterms:title"weather-example";
- wire:displayName"Weather Widget Example";
- dcterms:description"Example of widget for the Wirecloud Plaftorm.";
+ dcterms:title"weather-example";
+ wire:displayName"Weather Widget Example";
+ dcterms:description"Example of widget for the Wirecloud Plaftorm.";dcterms:creator_:b1;
- usdl-core:versionInfo"1.0";
+ usdl-core:versionInfo"1.0";wire:hasImageUri<images/catalogue.png>;wire:hasiPhoneImageUri<images/catalogue_iphone.png>;...
-
-
-
-
-
-
-
-
-
-
-
-
-
Translating widget metadata
-
-
-
Using RDF templates
+
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Translating widget metadata
+
+
Using RDF templates
The structure of a RDF (turtle) description with translations:
...<http://wirecloud.conwet.fi.upm.es/ns/weather-example>awire:Widget;
- dcterms:title"weather-example";
- wire:displayName"Weather Widget Example"@en;
- wire:displayName"Ejemplo de widget del tiempo"@es;
- dcterms:description"Example of widget for the Wirecloud Plaftorm."@en;
- dcterms:description"Ejemplo de un widget para la plataforma Wirecloud."@es;
+ dcterms:title"weather-example";
+ wire:displayName"Weather Widget Example"@en;
+ wire:displayName"Ejemplo de widget del tiempo"@es;
+ dcterms:description"Example of widget for the Wirecloud Plaftorm."@en;
+ dcterms:description"Ejemplo de un widget para la plataforma Wirecloud."@es;dcterms:creator_:b1;
- usdl-core:versionInfo"1.0";
+ usdl-core:versionInfo"1.0";wire:hasImageUri<images/catalogue.png>;wire:hasiPhoneImageUri<images/catalogue_iphone.png>;...
-
-
-
-
-
-
-
-
-
-
-
-
Translating widgets
-
Translating widget contents
-
-
-
-
-
-
Presenter Notes
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Translating widget contents
-
-
-
The content of the widget should be translated using javascript and the support
+
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Translating widgets
+
Translating widget contents
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Translating widget contents
+
+
The content of the widget should be translated using javascript and the support
for accessing to the context of the platform. Platform context support is needed
for knowing what language is currently in use:
Use ← and → to move around. Press h for getting more info
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Dynamic dashboards
+
Introduction
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Introduction
+
+
This tutorial will show you how to use the Dashboard Management API from
widgets and operators by providing some examples of what can be done by using
it.
Widgets and operators using the Dashboard Management API will be able to add new
@@ -125,144 +94,92 @@
Introduction
You can find the reference documentation of the Dashboard Management API on the
WidgetAPI documentation (Search DashboardManagement to discover the relevant
documentation sections).
-
-
-
-
-
-
-
-
-
-
-
-
Dynamic dashboards
-
Enabling the Dashboard Management API
-
-
-
-
-
-
Presenter Notes
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Enabling the Dashboard Management API
-
-
-
The first step for being able to use the Dashboard Management API is to add the
+
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Dynamic dashboards
+
Enabling the Dashboard Management API
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Enabling the Dashboard Management API
+
+
The first step for being able to use the Dashboard Management API is to add the
DashboardManagement feature as a requirement of the widget/operator.
For example, if you use the xml version of the MACDL this is done by adding the
following code inside the <widget> or <operator> element (depending if you
are adding this feature into a widget or an operator):
The previous code will add the Kurento One2one widget placed it at an static
position: 0px, 66%. Also, we are using the permissions option to block users
to configure and close the Kurento One2one widget. By using the preferences
@@ -372,636 +259,451 @@
Videoconference example
alternative to to use the top and left options, in this case, is to use the
refposition option. This way, the Kurento One2one widget will be placed near
the button the user has clicked.
-
-
-
-
-
-
-
-
-
-
-
-
-
Videoconference example
-
-
-
Adding the one2one widget
+
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Videoconference example
+
+
Adding the one2one widget
To use the refposition option, you have to obtain a ClientRect instance
representing your button, you can obtain such an object by using the
getBoundingClientRect method:
We can make use the enpoints defined in the widget/operator description
(config.xml file) for connecting with the Kurento One2one widget, so it's
not mandatory to create new endpoints in a dynamic way. However, by creating
them using the Dashboard Management API we are declaring that they are going to
be used exclusively from the widget/operator code: Users won't be able to create
connections using those endpoint in the Wiring Editor view.
-
-
-
-
-
-
-
-
-
-
-
-
-
Videoconference example
-
-
-
Wiring configuration
+
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Videoconference example
+
+
Wiring configuration
The needed endpoints can be created using this code:
varcall_endpoint=MashupPlatform.widget.createOutputEndpoint();varstate_endpoint=MashupPlatform.widget.createInputEndpoint(function(state){
- if(state==='REGISTERED'){
+ if(state==='REGISTERED'){// Update the call button that tiggered the videoconference to become a// hang button. This button should call one2one_widget.remove() to end// the videoconference// By sending this event, the one2one widget will start the videoconferececall_endpoint.pushEvent(information.username);
- }elseif(state==='ENABLED_CALL'){
+ }elseif(state==='ENABLED_CALL'){one2one_widget.remove();}});
-
-
Note: If you are developing an operator you should use
MashupPlatform.operator.createOutputEndpoint and
MashupPlatform.operator.createInputEndpoint instead.
-
-
-
-
-
-
-
-
-
-
-
-
-
Videoconference example
-
-
-
Wiring configuration
+
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Videoconference example
+
+
Wiring configuration
The connection between those dynamic endpoint and the endpoints of the
Kurento One2one widget can be established using the following code:
This example will show you how to use the Map viewer widget for displaying
some Point of Interest in a map in a dynamic way (without displaying a map
viewer widget all the time).
The main difference with the previous example is that in this case, we are going
to use a NGSI Entity 2 PoI operator for transforming the event data to be
compatible with the one expected by the Map Viewer widget.
-
-
-
-
-
-
-
-
-
-
-
-
-
Map example
-
-
-
Adding the Map viewer widget
+
+
+
+
+
Presenter Notes
+
+
+
+
+
+
+
+
+
Map example
+
+
Adding the Map viewer widget
This step can be accomplished in the same way as we did with the Kurento One2one widget: