Mashups in EMML : Advanced Mashup Techniques : Making Mashup Scripts Dynamic : Dynamic Mashup Syntax : Create Generic Mashup Scripts
Create Generic Mashup Scripts
You can also make mashup scripts that are generic. Generic mashup scripts define a pattern of processing that can be applied to different mashable information sources or conditions based on input parameters. The flow of logic is the same, but what the logic acts on or how the logic is interpreted is dynamic.
Note:  
If instead you need the flow of logic within a mashup to change dynamically, see Generating Mashup Scripts Dynamically for more information.
Using parameter references in <invoke> or <directinvoke> allows generic mashup scripts to work with many different services. This is the most basic usage for a generic mashup script. To make a mashup generic, though, you typically also have to parameterize expressions for other statements using <template>.
This example shows two simple mashup scripts: 1) the generic script that invokes a mashable information source and applies a filter and 2) a mashup that uses the generic mashup as a component to apply to a specific situation.
The Generic Mashup Script
<mashup name="FilterOneService" ...>
<input name="thisService" type="string"/>
<input name="thisOp" type="string"/>
<input name="thisOpParams" type="string"/>
<input name="thisFilter" type="string"/>
<output name="filteredResult" type="document"/>
<invoke service="$thisService" operation="$thisOp"
inputparams="thisOpParams" outputvariable="$initialResult"/>
<filter inputvariable="$initialResult" filterexpr="$thisFilter"
outputvariable="$filteredResult"/>
</mashup>
The calling mashup defines input parameters using <template> and then invokes the generic mashup script as a component:
A Mashup Using the Generic Mashup Script
<mashup name="myMashup" ...>
<input name="filterBy" type="string"/>
<variables>
<variable name="myService" type="string" default="Artima"/>
<variable name="myOp" type="string" default="getFeed"/>
<variable name="myOpParams" type="string"/>
</variables>
<output name="myResult" type="document"/>
<template expr="/channel/items/item/{$filterBy}"
outputvariable="$myFilter"/>
<invoke service="FilterOneService" operation="Invoke"
inputparams="myService,myOp,myOpParams,myFilter"
outputvariable="$myResult"/>
</mashup>
Copyright © 2006-2015 Software AG, Darmstadt, Germany.

Product LogoContact Support   |   Community   |   Feedback