List 1. Algorithm of mashup code generation using the data mapping model.
[Algorithm 1] Mashup code generation algorithm
Input: m: responding method just responded,
T: output tree of m,
MT: data mapping table, modeler’s output.
Output: The generated code for the output view.
including mashup context menu handler.
1) For each terminal node node of T,
1-1) tag = node.tag, value = node.text.
1-2) create <span> element e for value.
1-3) if MT(m, tag) ≠ ∅,
1-3-1) add onmouseover event handler to e,
1-3-2) call prepareContextMenu(e, m, tag, value),
1-3-1) menuDiv.show().
function prepareContextMenu(e,m
1
,t
1
,v)
Reset menuDiv.
∀(m
2
, t
2
) ∈ MT(m
1
, t
1
),
Add menu item “request m
2
with t
2
”.
Add a mouse handler; Call m
2
using v.
List 2 shows the data mapping table generated from the data mapping modeler. It
is serialized as javascript code where a key is a pair of method id and the parameter
name and the value is an array of the pairs of mashup methods and transfer data type.
Code generation system utilizes this information in order to reflect the modeling re-
sult which is designed at the modeler. Moreover, request function name and the doc
info for methods are also generated as javascript hash maps as shown below.
List 2. Serialized table data structure for the code generation system.
mappingTable={'b1/bus_stop':['b0/stop1'],'s2/st_name':['s1/name'],'b0/bus_no':['b0/bus…
reqMethodInfo={'b1/busId':['requestReadbuseBybusId_b1'],'b0/number':['requestSearc…
methodInfo={'b0':['Search Buses'],'b1':[Read Bus'],'s1':['Search Stations'],'s2':[‘Read S…
Figure 6 shows implementation result. The output view has context popup menus
as designed in data mapping table. Output handler function generates output data
presentations using the repeat structure presentation method (refer [7] for detail). We
extended the code with a line “constructReqDiv()” function call, which calls a static
function in popup.js file. This function creates context popup menus dynamically
depending on the data mapping table(the italicized line in Figure 5(c)).
The proposed approach is different from other tools and studies in several aspects
[4,5,8]. Although current user programmable mashup tools often create server side
services, our tool generates client code that is ready to use by end users. Moreover,
the data mapping modeler is easy to use since it provides an intuitive tooltip of navi-
gation menus, and the modeler output-data mapping graph governs the dynamic con-
text menu behavior as designed by the user.
On the other hand, CRUISe system proposed in [8] aims a client side mashup execu-
tion framework in model driven development, which is in common with our approach.
46