org.helma.javascript
Class GlobalFunctions

java.lang.Object
  extended by org.helma.javascript.GlobalFunctions

public class GlobalFunctions
extends java.lang.Object

This class contains the native functions Helma adds to the global scope.


Constructor Summary
GlobalFunctions()
           
 
Method Summary
static java.lang.Object getResource(org.mozilla.javascript.Context cx, org.mozilla.javascript.Scriptable thisObj, java.lang.Object[] args, org.mozilla.javascript.Function funObj)
          Add a resource to the application classpath.
static java.lang.Object getResources(org.mozilla.javascript.Context cx, org.mozilla.javascript.Scriptable thisObj, java.lang.Object[] args, org.mozilla.javascript.Function funObj)
          Get a list of resource wrapped as JS array.
static java.lang.Object importFromModule(org.mozilla.javascript.Context cx, org.mozilla.javascript.Scriptable thisObj, java.lang.Object[] args, org.mozilla.javascript.Function funObj)
          Evaluate a JavaScript resource.
static java.lang.Object importJar(org.mozilla.javascript.Context cx, org.mozilla.javascript.Scriptable thisObj, java.lang.Object[] args, org.mozilla.javascript.Function funObj)
          Add a resource to the application classpath.
static java.lang.Object importModule(org.mozilla.javascript.Context cx, org.mozilla.javascript.Scriptable thisObj, java.lang.Object[] args, org.mozilla.javascript.Function funObj)
          Evaluate a JavaScript resource.
static void init(org.mozilla.javascript.ScriptableObject scope)
          Init functions on a new top level scope
static java.lang.Object parseSkin(org.mozilla.javascript.Context cx, org.mozilla.javascript.Scriptable thisObj, java.lang.Object[] args, org.mozilla.javascript.Function funObj)
          Parse a string or resource as skin.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GlobalFunctions

public GlobalFunctions()
Method Detail

init

public static void init(org.mozilla.javascript.ScriptableObject scope)
Init functions on a new top level scope

Parameters:
scope - the global scope

importModule

public static java.lang.Object importModule(org.mozilla.javascript.Context cx,
                                            org.mozilla.javascript.Scriptable thisObj,
                                            java.lang.Object[] args,
                                            org.mozilla.javascript.Function funObj)
                                     throws org.mozilla.javascript.JavaScriptException,
                                            java.io.IOException
Evaluate a JavaScript resource.

Parameters:
cx - the current context
thisObj - the object the function is called on
args - the arguments
funObj - the function object
Returns:
null
Throws:
org.mozilla.javascript.JavaScriptException - javascript evaluation error
java.io.IOException - error reading the resource

importFromModule

public static java.lang.Object importFromModule(org.mozilla.javascript.Context cx,
                                                org.mozilla.javascript.Scriptable thisObj,
                                                java.lang.Object[] args,
                                                org.mozilla.javascript.Function funObj)
                                         throws org.mozilla.javascript.JavaScriptException,
                                                java.io.IOException
Evaluate a JavaScript resource.

Parameters:
cx - the current context
thisObj - the object the function is called on
args - the arguments
funObj - the function object
Returns:
null
Throws:
org.mozilla.javascript.JavaScriptException - javascript evaluation error
java.io.IOException - error reading the resource

importJar

public static java.lang.Object importJar(org.mozilla.javascript.Context cx,
                                         org.mozilla.javascript.Scriptable thisObj,
                                         java.lang.Object[] args,
                                         org.mozilla.javascript.Function funObj)
                                  throws java.net.MalformedURLException
Add a resource to the application classpath.

Parameters:
cx - the current context
thisObj - the object the function is called on
args - the arguments
funObj - the function object
Returns:
null
Throws:
java.net.MalformedURLException - resource delivered bogus URL

getResource

public static java.lang.Object getResource(org.mozilla.javascript.Context cx,
                                           org.mozilla.javascript.Scriptable thisObj,
                                           java.lang.Object[] args,
                                           org.mozilla.javascript.Function funObj)
Add a resource to the application classpath.

Parameters:
cx - the current context
thisObj - the object the function is called on
args - the arguments
funObj - the function object
Returns:
the resource

getResources

public static java.lang.Object getResources(org.mozilla.javascript.Context cx,
                                            org.mozilla.javascript.Scriptable thisObj,
                                            java.lang.Object[] args,
                                            org.mozilla.javascript.Function funObj)
Get a list of resource wrapped as JS array.

Parameters:
cx - the current context
thisObj - the object the function is called on
args - the arguments
funObj - the function object
Returns:
the resource

parseSkin

public static java.lang.Object parseSkin(org.mozilla.javascript.Context cx,
                                         org.mozilla.javascript.Scriptable thisObj,
                                         java.lang.Object[] args,
                                         org.mozilla.javascript.Function funObj)
                                  throws java.io.IOException,
                                         UnbalancedTagException
Parse a string or resource as skin.

Parameters:
cx - the current context
thisObj - the object the function is called on
args - the arguments
funObj - the function object
Returns:
the resource
Throws:
java.io.IOException - an I/O related error occurred
UnbalancedTagException - the skin contains unbalanced macro tags