Author: keith Date: Thu Jul 17 10:37:02 2008 New Revision: 19425 URL: http://wso2.org/svn/browse/wso2?view=rev&revision=19425
Log: System host object doc updates Modified: trunk/mashup/java/xdocs/systemhostobject.html Modified: trunk/mashup/java/xdocs/systemhostobject.html URL: http://wso2.org/svn/browse/wso2/trunk/mashup/java/xdocs/systemhostobject.html?rev=19425&r1=19424&r2=19425&view=diff ============================================================================== --- trunk/mashup/java/xdocs/systemhostobject.html (original) +++ trunk/mashup/java/xdocs/systemhostobject.html Thu Jul 17 10:37:02 2008 @@ -1,253 +1,235 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<html><head> <!-- - ~ Copyright 2005-2008 WSO2, Inc. (http://wso2.com) - ~ - ~ Licensed under the Apache License, Version 2.0 (the "License"); - ~ you may not use this file except in compliance with the License. - ~ You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. - --> -<html> -<head> +~ Copyright 2005-2008 WSO2, Inc. (http://wso2.com) +~ +~ Licensed under the Apache License, Version 2.0 (the "License"); +~ you may not use this file except in compliance with the License. +~ You may obtain a copy of the License at +~ +~ http://www.apache.org/licenses/LICENSE-2.0 +~ +~ Unless required by applicable law or agreed to in writing, software +~ distributed under the License is distributed on an "AS IS" BASIS, +~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +~ See the License for the specific language governing permissions and +~ limitations under the License. +--> +<meta http-equiv="content-type" content=""><title>System Host Object</title> - - <meta http-equiv="content-type" content=""> - - - - <title>System Host Object</title> - <link href="css/mashup-docs.css" rel="stylesheet" type="text/css" media="all"> +<link href="css/mashup-docs.css" rel="stylesheet" type="text/css" media="all"> </head> - <body> - <div id="main-content"> <h1>System Host Object</h1> - <h3>1.0 Introduction</h3> - -<p>A 'system' hosted global object provides a set of system specific +<p>A 'system' hosted global object provides a set of system +specific utility functions. No explicit instantiation is necessary.</p> - <h3>1.1 Example</h3> - <div class="code"> -<pre>system.include("concatscript.js");<br>function add(first, last) {<br> print(system.localHostName);<br> //waits for 1 second<br> system.wait(1000);<br> // concat is a function in the included concatscript.js javascript<br> return concat(first,last);<br>}</pre> - +<pre>system.include("concatscript.js");<br>function add(first, last) {<br> system.log(system.localHostName);<br> //waits for 1 second<br> system.wait(1000);<br> // concat is a function in the included concatscript.js javascript<br> var answer = concat(first,last);<br> // Send a notification to the Desk tray specifying the answer<br> system.notifyMonitor("Result of concaternating" + first + " and " + last", answer);<br> return answer;<br>}</pre> </div> - <h3>2.0 System Object</h3> - <h3>2.1 System Object Interface</h3> - <p>{<br> - - function void include(string[] scriptPath);<br> - + function void include(string[] +scriptPath);<br> function void wait([optional int time]);<br> - readonly property string localHostName;<br> - function uuid setInterval(<span style="font-family: verdana; font-weight: normal;">String javascriptCode/Function javascriptFunctionName</span><span style="font-weight: normal;">, timeInterval, [optional] Array parameters, [optional] Date startTime, [optional] Date endtime);<br> - function void clearInterval(String uuid);</span><br> - + function +uuid +setTimeout (String javascriptCode/Function javascriptFunctionName, +Number startInMilliSeconds);<br> function void +clearTimeout(String uuid);<br> +<span style="font-weight: normal;"> +function +void notifyMonitor( string message, [optional] string title, +[optional] int severity);</span><br> + function XML getXML(String +url);<br> + function void log(String logmessage, [Optional] +String logLevel);<span style="font-weight: normal;"></span><br style="font-weight: bold;"> }</p> - <h3>2.2 API Documentation </h3> - <table class="MsoTableGrid" style="margin-left: 0.5in; border-collapse: collapse;" border="1" cellpadding="5" cellspacing="0"> - - <tbody> - - <tr> - - <td> Member</td> - - <td> Description</td> - - <td> Supported in version</td> - - </tr> - - <tr> - - <td><b>void include(string scriptPath*</b>);</td> - - <td> Imports the external scripts given as the arguments. Paths +<tbody> +<tr> +<td> Member</td> +<td> Description</td> +<td> Supported in version</td> +</tr> +<tr> +<td><b>void include(string scriptPath*</b>);</td> +<td> Imports the external scripts given as the arguments. +Paths of the scripts to be imported can be given using a comma separated list as arguments. Imported script files need to be placed in the <a href="http://www.wso2.org/wiki/display/mashup/scripts+folder+structure+and+deployment">service.resources -directory </a> of the mashup service. If the path represents a file it +directory </a> of the mashup service. If the path represents a +file it should be given relative to the service.resources directory. If a file is not found at this location, the path is treated as an URL. The URL can be given relative to the services context root (eg: <a href="http://127.0.0.1:7762/services">http://127.0.0.1:7762/services</a>) or it can also be an absolute URL to a JavaScript file. <br clear="all"> - - <em>system.include("include.js");</em> <br clear="all"> - + <em>system.include("include.js");</em> +<br clear="all"> <em>system.include("system/version?stub&lang=e4x", "lib2.js");</em> <br clear="all"> - - system.include("http://tempuri.org/js/temp.js"); <br clear="all"> - - </td> - - <td> 0.1</td> - - </tr> - - <tr> - - <td><b>void wait([optional int time])</b></td> - - <td> Waits for the execution of the script for the given time in + +system.include("http://tempuri.org/js/temp.js"); <br clear="all"> +</td> +<td> 0.1</td> +</tr> +<tr> +<td><b>void wait([optional int time])</b></td> +<td> Waits for the execution of the script for the given +time in milliseconds or waits for 10 milliseconds when the time is not given. <br clear="all"> - <em>system.wait();</em> <br clear="all"> - - <em> system.wait(1000);</em> </td> - - <td> 0.1</td> - - </tr> - - <tr> - - <td><b>readonly property string localHostName;</b> </td> - - <td> Gets the string defining the hostname of the +<em> system.wait(1000);</em> +</td> +<td> 0.1</td> +</tr> +<tr> +<td><b>readonly property string localHostName;</b> +</td> +<td> Gets the string defining the hostname of the system. <br clear="all"> - - <em>var hostname = system.localHostName;</em></td> - - <td> 0.1</td> - - </tr> - - <tr> - - <td><span style="font-weight: bold;">uuid + <em>var hostname = +system.localHostName;</em></td> +<td> 0.1</td> +</tr> +<tr> +<td><span style="font-weight: bold;">function</span> +<span style="font-weight: bold;">uuid setInterval (<br> - String javascriptCode/Function javascriptFunctionName, <br> - timeInterval, <br> - [optional] Array parameters, <br> - [optional] Date startTime, <br> - [optional] Date endtime<br> - ); </span></td> - - <td>This function allows the scheduling of a JavaScript function +<td>This function allows the scheduling of a JavaScript +function or a String of Javascript code periodically. There are 2 mandatory parameters.<br> - - - <ol> - - <li>A javascript function (or a javascript expression) and </li> - - <li>the time interval between two consecutive executions. </li> - - - </ol> - - <br> - -Optionally one can specify a start time, indicating when to begin +<ol> +<li>A javascript function (or a javascript expression) +and </li> +<li>the time interval between two consecutive executions. +</li> +</ol> +<br> +Optionally one can specify a start time, indicating when to +begin the function execution (after given number of milliseconds in the frequency parameter by default). It is also possible to give a start time and an end time.<br> - - <br> - +<br> The function returns a String UUID, which can be used to refer to this function scheduling instance.<br> - <span style="font-style: italic;">var id = system.setInterval('myJavaScriptFunction("I am a parameter value");', 2000);<br> - - <br> - - </span>For a demonstration of this feature, please refer the <span style="font-weight: bold; font-style: italic;">TomatoTube</span> +<br> +</span>For a demonstration of this feature, please refer +the <span style="font-weight: bold; font-style: italic;">TomatoTube</span> sample in your WSO2 Mashup Server distribution.<span style="font-style: italic;"></span></td> - - <td>0.2</td> - - </tr> - - <tr> - - <td style="font-weight: bold;">function void clearInterval(uuid); - </td> - - <td>Removes a JavaScript function scheduled for periodic +<td>0.2</td> +</tr> +<tr> +<td style="font-weight: bold;">function void +clearInterval(String uuid); </td> +<td>Removes a JavaScript function scheduled for periodic execution using the job uuid.<br> - <span style="font-style: italic;">system.clearInterval(uuid);</span> - </td> - - <td>0.2</td> - - </tr> - - <tr> - - <td style="vertical-align: top;"><span style="font-weight: bold;">function +</td> +<td>0.2</td> +</tr> +<tr> +<td><span style="font-weight: bold;">function</span> +<span style="font-weight: bold;">uuid +setTimeout (<br> +String javascriptCode/Function javascriptFunctionName, <br> +Number startInMilliSeconds<br> +);</span></td> +<td>setTimeout() allows you to specify that a piece of +JavaScript code (called an expression) will be run a specified number +of milliseconds from when the setTimeout() method was called. +setTimeout() also returns a numeric timeout ID that can be used to +track the timeout. This is most commonly used with the clearTimeout() +method.<br> +<span style="font-style: italic;"> + var id = system.setTimeout +('myJavaScriptFunction("I +am a parameter +value");, 2000);</span></td> +<td></td> +</tr> +<tr> +<td style="font-weight: bold;">function void +clearTimeout(String uuid);</td> +<td>Sometimes it's useful to be able to cancel a timer +before it goes off. The clearTimeout() method lets us do exactly that.<br> +<span style="font-style: italic;"> + system. clearTimeout ( id );<br> +</span>where timeoutId is the ID of the timeout as returned +from the setTimeout() method call.<span style="font-style: italic;"></span></td> +<td></td> +</tr> +<tr> +<td style="vertical-align: top;"><span style="font-weight: bold;">function void notifyMonitor( <br> - string message, <br> - - </span><span style="font-weight: bold;">[optional] string title</span><br> - - <span style="font-weight: bold;">[optional] int severity)</span><br> - - </td> - - <td style="vertical-align: top;">Sends the user a message via the +</span><span style="font-weight: bold;">[optional] +string title</span><br> +<span style="font-weight: bold;">[optional] int +severity)</span><br> +</td> +<td style="vertical-align: top;">Sends the user a +message via the desk tray icon of the monitor. The message string is the only mandatory parameter, with the title defaulting to 'Message' and the message severity defaulting to 'none'. The options for message severity are 0 - Informational, 1 - Error, 2 - Warning and 3 - None.<br> - <span style="font-style: italic;">system.notifyMonitor("My Error Message", "Title", 2);</span> </td> - - <td style="vertical-align: top;"><br> - - </td> - - </tr> - - - </tbody> +<td style="vertical-align: top;">1.5<br> +</td> +</tr> +<tr> +<td style="font-weight: bold;">function XML +getXML(String url);</td> +<td>Utility function to get an XML file over the network.<br> +<span style="font-style: italic;"> + + system.getXML('http://wso2.org/repos/wso2/trunk/mashup/java/modules/samples/upgradeChecker/upgradeChecker.resources/history.xml');</span></td> +<td>1.5</td> +</tr> +<tr> +<td style="font-weight: bold;">function void +log(String logmessage, [Optional] String logLevel);</td> +<td>Allows printing to the system log from a Mashup. Where +logmessage contains a string to be written to the system log and +(optional) loglevel indicates the logging level as * 'info', +'warn', 'debug', 'error' or 'fatal'. The logging level defaults to +'info' when one is not provided.<br> +<span style="font-style: italic;"> + system.log("Message", "error");</span></td> +<td>1.5</td> +</tr> +</tbody> </table> - <h3>3.0 References</h3> - <ul> - - <li><a href="apidocs/org/wso2/mashup/hostobjects/system/SystemHostObject.html">JavaDoc +<li><a href="apidocs/org/wso2/mashup/hostobjects/system/SystemHostObject.html">JavaDoc for the system host Object</a></li> - </ul> - </div> - <p>� WSO2 Inc.</p> - -</body> -</html> +</body></html> \ No newline at end of file _______________________________________________ Mashup-dev mailing list [email protected] http://wso2.org/cgi-bin/mailman/listinfo/mashup-dev
