Sonic ESB API

JavaScript
Class HelperFunctions

java.lang.Object
  extended by JavaScript.HelperFunctions

public abstract class HelperFunctions
extends java.lang.Object

IMPORTANT:
The methods documented in this class do NOT correspond to Java classes.

This file contains a description of the standard variables and helper functions available to SonicESB programmers who use the default JavaScript rules interpretter. This interpretter is standard with Content-based Routing, or XSLT Transformation Services. It can also be used to generate TrackingID's for SonicESB Processes.

The variables and functions described below are ONLY available in the context of the JavaScript interpretter where the default file: sonicfs:///System/SonicESB/7.0/Common/jsHelperFunctions.js is used. You can examine the contents of this file though the Resources branch of the SonicESB Domain in the Sonic Explorer tool.

The descriptions below are done using Javadoc and act as if the JavaScript functions were actual Java classes. This is done as a convenience to the programmer, but you must remember that, in reality, these are really JavaScript functions.

Practically speaking, this means two things:


Field Summary
 XQMessage XQMessage
          The Javascript engine provides access to the current message as variable XQMessage.
 XQServiceContext XQServiceContext
          The Javascript engine provides access to the current service context as variable XQServiceContext.
 
Constructor Summary
HelperFunctions()
           
 
Method Summary
abstract  XQAddress XQ_getEndpoint(java.lang.String endpointName)
          Returns an single Address object of type "ENDPOINT".
abstract  XQAddress XQ_getFaultAddress()
          Returns an single Address object correspoding to the Fault address of the service or process.
abstract  XQAddress XQ_getProcess(java.lang.String processName)
          Returns an single Address object of type "PROCESS".
abstract  java.lang.Object XQ_getProperty(java.lang.String propertyName, int msgPartIndex)
          Function XQ_getProperty(propertyName) returns the value of the specified propertyName from the XQMessage or XQPart header.
abstract  XQAddress XQ_getReplyToAddress()
          Returns an single Address object correspoding to the REPLY_TO address of the service or process.
abstract  XQAddress XQ_getService(java.lang.String serviceName)
          Returns an single Address object of type "SERVICE".
abstract  XQAddress XQ_getStepAddress(java.lang.String stepName)
          Returns the address corresponding to the step name, in the currently executing process.
abstract  java.lang.String XQ_getStringParameter(java.lang.String parameterName)
          Function XQ_getStringParameter(parameterName) returns the value of the specified parameterName from the XQServiceParameters associated with the current XQServiceContext.
abstract  java.lang.Object XQ_getXPath(java.lang.String xpathExpression, int msgPartIndex, java.lang.String namespaceString)
          Function XQ_getXPath(xpathExpression) returns the value of the specified XPath expression from the XQMessage's content.
abstract  boolean XQ_isLGSwitchTrue(java.lang.String switchName)
          Returns the status of the stabilizer switch.
abstract  void XQ_logError(java.lang.String error)
          Sends the string to the XQServiceContext's XQLog as an Error.
abstract  void XQ_logInformation(java.lang.String info)
          Sends the string to the XQServiceContext's XQLog as an information message.
abstract  void XQ_logWarning(java.lang.String warning)
          Sends the string to the XQServiceContext's XQLog as a warning.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

XQMessage

public XQMessage XQMessage
The Javascript engine provides access to the current message as variable XQMessage. This is the first incoming message to the XQService where the JavaScript interpretter is running.


XQServiceContext

public XQServiceContext XQServiceContext
The Javascript engine provides access to the current service context as variable XQServiceContext.

Constructor Detail

HelperFunctions

public HelperFunctions()
Method Detail

XQ_getProperty

public abstract java.lang.Object XQ_getProperty(java.lang.String propertyName,
                                                int msgPartIndex)
Function XQ_getProperty(propertyName) returns the value of the specified propertyName from the XQMessage or XQPart header. Part headers are always returned as String values. XQMessage headers may be any primative object or String.

Parameters:
propertyName - is the name of the header field whose value is to be retrieved.
msgPartIndex - can be omitted if you want to access the header fields of the XQMessage. Otherwise use 0..n for part headers (-1 will access the XQMessage headerfields.
Returns:
the value for that header field of that name, or null, if the header does not exist.

XQ_getXPath

public abstract java.lang.Object XQ_getXPath(java.lang.String xpathExpression,
                                             int msgPartIndex,
                                             java.lang.String namespaceString)
Function XQ_getXPath(xpathExpression) returns the value of the specified XPath expression from the XQMessage's content.

The evaluation of xpathExpression returns:

For more information on XPath see:

Parameters:
xpathExpression - is the XPath expression which is to be resolved.
msgPartIndex - can be omitted if you want to access the first part of the message. Otherwise use 0..n for part.
namespaceString - is a namespace mapping to be used by the xpathExpression. Only one namespace prefix is supported (e.g. SOAP-ENV=http://www.w3.org/2001/06/soap-envelope).
Returns:
the evaluation of the xpathExpression, or null, if the part is not XML in a text string.

XQ_getStringParameter

public abstract java.lang.String XQ_getStringParameter(java.lang.String parameterName)
Function XQ_getStringParameter(parameterName) returns the value of the specified parameterName from the XQServiceParameters associated with the current XQServiceContext. This function is expected to be used primarily to get runtime parameters, such as the service name or container name that are passed into every service (see com.sonicsw.xq.XQConstants for a list of the standard parameter names.)

Parameters:
parameterName - is the name of the parameter whose String value is to be retrieved.
Returns:
the value for that parameter as a string, or null, if the parameter does not exist.
See Also:
XQConstants

XQ_getEndpoint

public abstract XQAddress XQ_getEndpoint(java.lang.String endpointName)
Returns an single Address object of type "ENDPOINT".

Returns:
an XQAddress object for an endpoint of this name.
Throws:
java.lang.Exception - thrown if no Endpoint is defined with this name.

XQ_getService

public abstract XQAddress XQ_getService(java.lang.String serviceName)
Returns an single Address object of type "SERVICE".

Returns:
an XQAddress object for an service of this name.
Throws:
java.lang.Exception - thrown if no Service is defined with this name.

XQ_getProcess

public abstract XQAddress XQ_getProcess(java.lang.String processName)
Returns an single Address object of type "PROCESS".

Returns:
an XQAddress object for an process of this name.
Throws:
java.lang.Exception - thrown if no Process is defined with this name.

XQ_getReplyToAddress

public abstract XQAddress XQ_getReplyToAddress()
Returns an single Address object correspoding to the REPLY_TO address of the service or process. This returns null if the REPLY_TO was not set.

Returns:
an XQAddress object corresponding to REPLY_TO, if available.

XQ_getFaultAddress

public abstract XQAddress XQ_getFaultAddress()
Returns an single Address object correspoding to the Fault address of the service or process.

Returns:
an XQAddress object corresponding to the current Fault Endpoint.

XQ_logWarning

public abstract void XQ_logWarning(java.lang.String warning)
Sends the string to the XQServiceContext's XQLog as a warning.

Parameters:
warning - The text of the warning message.

XQ_logError

public abstract void XQ_logError(java.lang.String error)
Sends the string to the XQServiceContext's XQLog as an Error.

Parameters:
error - The text of the error message.

XQ_logInformation

public abstract void XQ_logInformation(java.lang.String info)
Sends the string to the XQServiceContext's XQLog as an information message.

Parameters:
info - The text of the message.

XQ_getStepAddress

public abstract XQAddress XQ_getStepAddress(java.lang.String stepName)
Returns the address corresponding to the step name, in the currently executing process.

Parameters:
stepName - String containing the name of a step within a process. It should not contain the ":" character.
Returns:
the XQAddress corresponding to the stepName. If step name is null, the return value is null
Throws:
XQAddressNotFoundException
java.lang.Exception

XQ_isLGSwitchTrue

public abstract boolean XQ_isLGSwitchTrue(java.lang.String switchName)

Returns the status of the stabilizer switch.

This method could also return false if LG is not enabled for the container.

Parameters:
switchName - The name of the stabilizer switch

Sonic ESB API

Copyright © 2001-2012 Progress Software Corporation. All Rights Reserved.
HTML formatted on 13-Mar-2012.