Pre-processing Mashup
To implement pre-processing
1. Write the logic to handle pre-processing as a Java class or useJava libraries, as needed.
2. Add the custom Java classes to the classpath for the MashZone NextGen Server.Copy them to:
The external configuration folder, if any, for the
MashZone NextGen Server.
Deploying additional resources, such as custom XPath classes, to an external configuration folder simplifies future deployments or MashZone NextGen Server clusters.
web-apps-home/mashzone/WEB-INF/classes. This is the default location, but is not recommended as it complicates
MashZone NextGen Server deployments.
web-apps-home/mashzone/WEB-INF/lib. This is the default location, but is not recommended as it complicates
MashZone NextGen Server deployments.
3. Restart the MashZone NextGen Server.
4. Create a mashup script with the following components:
a. <input> variables, as needed, to receive the data to be pre-processed and an <output> variable for the result. For example:
...
<operation name="getreviews">
<input name="userId" type="string" default="someone@myOrg.com" />
<input name="accessId" type="string"
default="xOtPy9Sy7JCI3Y8aNqEkZBxmkPQw/ZH8"/>
<output name="result" type="string"/>
b. Add a <script> statement to call the pre-processing logic.
This example uses JavaScript scripting and shows an encryption class that decrypts the accessId input parameter. To call the pre-processing logic in JavaScript, you must use fully qualified class names starting with the Packages keyword.
...
<output name="result" type="string" inputvariables="$accessId"
outputvariable="$accessId"/>
<script type="text/javascript">
<![CDATA[
var encrypter = new
Packages.com.myOrg.services.Encrypter("My Pass Phrase!")
accessId = encrypter.decrypt(accessId);
]]>
</script>
c. Invoke the mashable information source with the pre-processed data. For example:
...
</script>
<invoke service="AmazonREST" operation="getData"
inputvariables="'AWSECommerceService', '2007-07-16', accessId,
'ListSearch', 'WishList', userId"
filterexpr="//ns:List[ns:TotalItems > 1]"
outputvariable="$result"/>