Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

burst.runtime.AbstractRuntime Class Reference

Inheritance diagram for burst.runtime.AbstractRuntime:

burst.runtime.DomRuntime burst.runtime.KJSRuntime burst.runtime.RhinoRuntime burst.runtime.SpiderMonkeyRuntime burst.runtime.WshRuntime List of all members.

Detailed Description

Abstract base class definining the minimum that an environment must provide.

Has both mandatory to implement methods and some that are implemented in this class.

The singleton instance is available from the static function burst.runtime.AbstractRuntime.getRuntime() which returns bu_Runtime

This interface includes such important matters as:

Note that differentiating among browsers is done in burst.web.UserAgent. This class is just for differentiating among whole environments, of which a browser is one.

(Note that maintainers must do more to add a new environment implementation than the methods defined here; in particular the constructor must implement isPresent() and must be in burst.runtime.AbstractRuntime.ALL_CTORS.)

Todo:
make the libraries auto-register so it isn't necessary to have all of them.

consider an abbreviated version that does no loading, just resolves and checks assertions


Public Member Functions

abstract String name ()
 Return an identifier for this environment, such as 'DOM' or 'SpiderMonkey'.

abstract String version ()
 Return the version string supplied by this environment.

abstract String getBaseURI (String relpath)
 Return the base url of this library's installation.

abstract void readEvalAsync (String url, Function done_handler)
 Read the contents of the specified url and execute it in the global scope.

abstract void readEvalSync (String url)
 The synchronous version.

abstract void getTextAsync (String url, Function handler, Boolean nocache)
 Fetch text contents at the specified url.

abstract void getDocumentAsync (String url, Function handler)
 Fetch Document object at the specified url.

abstract readEval (String url, Function done_handler)
 Convenience function, available from base class.

abstract void println (String line)
 Print the provided line.

abstract void exit (Number exitcode)
 Exit the whole process with the specified exit code.

abstract Boolean has_HttpRequest ()
 Whether the environment supports issuing http requests.


Member Function Documentation

abstract void burst.runtime.AbstractRuntime.exit Number  exitcode  )  [pure virtual]
 

Exit the whole process with the specified exit code.

Optional to implement, but there is no default implementation.

abstract String burst.runtime.AbstractRuntime.getBaseURI String  relpath  )  [pure virtual]
 

Return the base url of this library's installation.

All script urls will be resolved with this base url prior to calling readEvalAsync or readEvalSync . The return value typically ends with '/'. Mandatory to implement.

Parameters:
relpath Optional. The relative path of the file which contains the definition of this function, to aid in implementation.

abstract String burst.runtime.AbstractRuntime.name  )  [pure virtual]
 

Return an identifier for this environment, such as 'DOM' or 'SpiderMonkey'.

Mandatory to implement.

abstract void burst.runtime.AbstractRuntime.println String  line  )  [pure virtual]
 

Print the provided line.

The line does not itself contain an EOL; the callee should provide one. Optional to implement, but there is no default implementation. If the environment does not provide this, then there is no default destination for logging.

abstract burst.runtime.AbstractRuntime.readEval String  url,
Function  done_handler
[pure virtual]
 

Convenience function, available from base class.

If readEvalAsync is available, use that and return null. Else if readEvalSync is available, use that and return the result of immediately calling done_handler. Otherwise throw.

abstract void burst.runtime.AbstractRuntime.readEvalAsync String  url,
Function  done_handler
[pure virtual]
 

Read the contents of the specified url and execute it in the global scope.

In a ECMAScript shell, this is typically done via a global load() function. In a browser, this is typically done via a dynamically created script element.

This interface does not mandate a completion handler. The caller should expect that in general the implementation may finish asynchronously, though it may choose to actually be synchronous if it likes.

If there are errors (in reading, parsing, or execution) they are expected to be thrown.

The only urls that must be accepted are ones in the same origin as the library itself, and in fact it is expected that urls from any other origin will probably fail. This means for example that in a shell the url is a relative or absolute local file. In a browser, it would be 'http:' or 'ftp:' or 'file:' or whatever the library is loading as.

At least one of readEvalAsync or readEvalSync is mandatory to implement.

Implemented in burst.runtime.DomRuntime.

abstract void burst.runtime.AbstractRuntime.readEvalSync String  url  )  [pure virtual]
 

The synchronous version.

There is no requirement that the result of the eval be returned, but it might.

Implemented in burst.runtime.RhinoRuntime, burst.runtime.SpiderMonkeyRuntime, and burst.runtime.WshRuntime.

abstract String burst.runtime.AbstractRuntime.version  )  [pure virtual]
 

Return the version string supplied by this environment.

This is the version of its software, not the ECMAScript version it implements. Optional to implement; a default implementation returns null.


The documentation for this class was generated from the following file:
Generated on Tue Nov 30 04:03:09 2004 for BurstProject by doxygen 1.3.4