Mashups in EMML : Advanced Mashup Techniques : Pre-Processing/Post-Processing Mashables with Mashups : Post-processing Mashup
Post-processing Mashup
At its simplest, any mashup that invokes a mashable and performs an action using the result is providing post-processing.
To implement post-processing logic that is directly provided by mashup script statements
1. Write the logic to handle the post-processing as a Java class or use Java libraries, as needed.
2. Add the custom Java classes to the classpath for the Presto Server. Copy them to:
*The external configuration folder, if any, for the Presto Server. See Setting Up an External Presto Configuration Folder for more information.
Important:  
Deploying additional resources, such as custom XPath classes, to an external configuration folder simplifies future deployments or Presto Server clusters.
*web-apps-home/presto/WEB-INF/classes. This is the default location, but is not recommended as it complicates Presto Server deployments.
*web-apps-home/presto/WEB-INF/lib. This is the default location, but is not recommended as it complicates Presto Server deployments.
3. Restart the Presto Server.
4. Create a mashup script with the following components:
a. <variable>s , as needed, to receive the results from the mashable or other data to be post-processed and an <output> variable for the result. For example:
...
<operation name="encryptResult">
<variable name="svcResult" type="document"/>
<output name="result" type="string"/>
b. Invoke the mashable. For example:
...
<output name="result" type="string"/>
<invoke service="AmazonREST" operation="getData"
inputvariables="'AWSECommerceService', '2007-07-16',
'xOtPy9Sy7JCI3Y8aNqEkZBxmkPQw/ZH8', 'ListSearch', 'WishList',
'someone@myOrg.com'"
filterexpr="//ns:List[ns:TotalItems > 1]"
outputvariable="$svcResult"/>
<constructor outputvariable="$svcResult">
<ns:mylist>{$svcResult/ns:ListSearchResponse/ns:Lists/ns:List}</ns:mylist>
</constructor>
5. Add a <script> statement to call the post-processing logic.
This example uses JavaScript scripting. It shows an encryption class that encrypts the filtered and constructed results from the mashable. To call the post-processing logic in JavaScript, you must use fully qualified class names starting with the Packages keyword.
...
</constructor>
<script type="text/javascript" inputvariables="$svcResult"
outputvariable="$result">
<![CDATA[
var encrypter = new
Packages.com.myOrg.services.Encrypter("My Pass Phrase!")
result = encrypter.encrypt(svcResult);
]]>
</script>
...
Copyright © 2006-2015 Software AG, Darmstadt, Germany.

Product LogoContact Support   |   Community   |   Feedback