Class Index | File Index

Classes


Built-In Namespace _global_

Field Summary
Field Attributes Field Name and Description
 
The cave_poller is the object that maintains contact with the gateway and sends/gets the messages
 
this is the type of a database column when it is a boolean value
 
this is the type of a database column when it is an 8 bit character
 
this is the type of a database column when it is a 64 bit float
 
this is the type of a database column when it is a 32 bit float
 
this is the type of a database column when it is a 16 bit short integer
 
this is the type of a database column when it is a 32 bit integer
 
this is the type of a database column when it is a 64 bit integer
 
this is the type of a database column when it is an 8 bit integer
 
this is the type of a database column when it is a 128 bit float
 
this is the type of a column when its NULL
 
this is the type of a database column when it contains a string (text, char, varchar etc)
 
this is the type of a database column when it is a 16 bit unsigned integer
 
this is the type of a database column when it is a 32 bit unsigned integer
 
this is the type of a database column when it is a 64 bit unsigned integer
 
this is the type of a database column when it is an 8 bit unsigned integer
 
 
Method Summary
Method Attributes Method Name and Description
 
beginTransaction(name, doneCallback)
Create a new caveTransaction object and insert it into the list of waiting transactions.
 
Check if there is a transaction already in progress with the same name.
 
Stop the poller.
 
This will extract the numeric part of a string or object.
 
createCaveList(id, columns)
This is a convenience function for creating a caveList object.
 
debug(str)
This is a handy function to use while debugging.
 
This function deletes the specified (by ID) caveList object.
 
This function finds the specified caveList object in the list.
 
Pass this function the transaction object and an array of caveParam objects which you are interested it, and it will search through the transaction to find the parameters you are intersted in, set their type and value.
 
fromIEEE(num, mantissa_width, mantissa_mask, mancap, exponent_mask, exponent_bias, negative_bit)

See also the  

getHexOfPreparedCaveQuery(name, id, params, seq)
This function will be called by a FORM with via the "onsubmit" attribute.
 
Get a random alpha-numeric character.
 
getType(val)
Gets the type of an Object.
 
initCave(poll_delay, url)
This function initiates the cave interface.
 
This is a generally useful function for parsing a boolean value from an Object.
 
sendCaveQuery(name, id, params, doneCallback, rock_name)
This is a convenience function for sending a message to the cave rock.
 
setBusy(busy)
Call this function to cause the busy icon to spin.
 
toIEEE(val, mantissa_width, mantissa_mask, mancap, exponent_mask, exponent_bias, negative_bit)
Writes a floating point number into IEEE binary format.
 
remove all queued transactions (so they don't get sent, or if they already have been sent, so their replies are ignored.
Field Detail
{server_poller} cave_poller
The cave_poller is the object that maintains contact with the gateway and sends/gets the messages
Defined in: cave.js.

DB_DATA_TYPE_BOOL
this is the type of a database column when it is a boolean value
Defined in: cave.js.
See:
caveParam

DB_DATA_TYPE_CHAR
this is the type of a database column when it is an 8 bit character
Defined in: cave.js.
See:
caveParam

DB_DATA_TYPE_DOUBLE
this is the type of a database column when it is a 64 bit float
Defined in: cave.js.
See:
caveParam

DB_DATA_TYPE_FLOAT
this is the type of a database column when it is a 32 bit float
Defined in: cave.js.
See:
caveParam

DB_DATA_TYPE_INT_16
this is the type of a database column when it is a 16 bit short integer
Defined in: cave.js.
See:
caveParam

DB_DATA_TYPE_INT_32
this is the type of a database column when it is a 32 bit integer
Defined in: cave.js.
See:
caveParam

DB_DATA_TYPE_INT_64
this is the type of a database column when it is a 64 bit integer
Defined in: cave.js.
See:
caveParam

DB_DATA_TYPE_INT_8
this is the type of a database column when it is an 8 bit integer
Defined in: cave.js.
See:
caveParam

DB_DATA_TYPE_LONG_DOUBLE
this is the type of a database column when it is a 128 bit float
Defined in: cave.js.
See:
caveParam

DB_DATA_TYPE_NULL
this is the type of a column when its NULL
Defined in: cave.js.
See:
caveParam

DB_DATA_TYPE_STRING
this is the type of a database column when it contains a string (text, char, varchar etc)
Defined in: cave.js.
See:
caveParam

DB_DATA_TYPE_UNSIGNED_16
this is the type of a database column when it is a 16 bit unsigned integer
Defined in: cave.js.
See:
caveParam

DB_DATA_TYPE_UNSIGNED_32
this is the type of a database column when it is a 32 bit unsigned integer
Defined in: cave.js.
See:
caveParam

DB_DATA_TYPE_UNSIGNED_64
this is the type of a database column when it is a 64 bit unsigned integer
Defined in: cave.js.
See:
caveParam

DB_DATA_TYPE_UNSIGNED_8
this is the type of a database column when it is an 8 bit unsigned integer
Defined in: cave.js.
See:
caveParam

server_poller_arr

Defined in: client.js.

server_poller_id

Defined in: client.js.
Method Detail
{caveTransaction} beginTransaction(name, doneCallback)
Create a new caveTransaction object and insert it into the list of waiting transactions.

See also the overview and examples.


Defined in: cave.js.
Parameters:
{string} name
unique transaction name from the client-side. This is used as a key into the list of waiting transactions, for associating requests with replies.
{function} doneCallback
the function to call when a reply comes in for this transaction.
Returns:
the transaction object
See:
sendCaveQuery

caveQueryInProgress(name)
Check if there is a transaction already in progress with the same name. This is useful for stopping overload and confusion if a user keeps clicking a send button for example.

See also the overview and examples.


Defined in: cave.js.
Parameters:
{string} name
the client-side unique name of the transaction that was used when beginTransaction was called.
Returns:
true if there is a transaction in progress now.

caveStop()
Stop the poller. If your application knows that there are no messages that will be sent to your application that is running in the web browser, then there is no need to keep polling (for something that will not happen.) Once the poller has been stopped, it will not start again until you send another message from the web application. Then it will resume polling as it was previously configured.

See also the overview and examples.


Defined in: cave.js.

{number} convertToNumber(n)
This will extract the numeric part of a string or object.
Defined in: client.js.
Parameters:
n
the Object that represents a number
Returns:
the Object after parsing to a number

createCaveList(id, columns)
This is a convenience function for creating a caveList object. It also adds the caveList object to an array of lists so that when events happen, the system can apply them to the appropriate caveList object.

See also the overview and examples.


Defined in: cave.js.
Parameters:
{string} id
the unique ID of this list widget
{Array} columns
an array of caveColumn objects

debug(str)
This is a handy function to use while debugging. If the console object is not available, I.e. if Firebug is not installed, then it will pop up an alert instead.
Defined in: client.js.
Parameters:
{string} str
the message to be displayed

deleteCaveList(id)
This function deletes the specified (by ID) caveList object.

See also the overview and examples.


Defined in: cave.js.
Parameters:
{string} id
the unique ID of this list widget

{caveList} findCaveList(id)
This function finds the specified caveList object in the list.

See also the overview and examples.


Defined in: cave.js.
Parameters:
{string} id
the unique ID of this list widget
Returns:
the caveList object or null if not found

findParametersInTransaction(trans, params)
Pass this function the transaction object and an array of caveParam objects which you are interested it, and it will search through the transaction to find the parameters you are intersted in, set their type and value. On return from this function you can check teh array of parameters (that you passed to it), and extract the values that it found. Any it could not find will have a null value.

See also the overview and examples.


Defined in: cave.js.
Parameters:
{caveTransaction} trans
the transaction object from the remote cave object
{Array} params
an array of CaveParam objects

{number} fromIEEE(num, mantissa_width, mantissa_mask, mancap, exponent_mask, exponent_bias, negative_bit)

See also the overview and examples.


Defined in: client.js.
Parameters:
{number} num
the binary format
{number} mantissa_width
e.g. for a 32 bit float, this is 23
{number} mantissa_mask
e.g. for a 32 bit float, this is 0x007FFFFF
{number} mancap
this is the mantissa cap e.g. for a 32 bit float, it is 0x00800000
{number} exponent_mask
e.g. for a for a 32 bit float, it is 0x7F800000
{number} exponent_bias
e.g. for a for a 32 bit float, it is 127
{number} negative_bit
e.g. for a for a 32 bit float, it is 0x80000000
Returns:
the number once converted

{string} getHexOfPreparedCaveQuery(name, id, params, seq)
This function will be called by a FORM with via the "onsubmit" attribute. This function creates a hex encoded message body which will be sent as part of a file submit via a "multipart/form-data" FORM post.

See also the overview and examples.


Defined in: cave.js.
Parameters:
{string} name
the client-side unique name of the transaction
{string} id
the cave session ID to be called.
{Array} params
an array of caveParam objects containing the parameters to be sent to the service
{number} seq
a unique sequence number
Returns:
a HEX encoded message body reaty for sending to a service

{string} getRandomChar()
Get a random alpha-numeric character.
Defined in: client.js.
Returns:
a randomly selected alpha-numeric character

{string} getType(val)
Gets the type of an Object.
Defined in: client.js.
Parameters:
val
the object to be queried
Returns:
"number", "string", or "array".

initCave(poll_delay, url)
This function initiates the cave interface.

See also the overview and examples.


Defined in: cave.js.
Parameters:
{number} poll_delay
the number of milliseconds between polls, 5000 is recommended (5 seconds).
{string} url
the URL of the service.
Returns:
there is no return value.

parseBoolean(val)
This is a generally useful function for parsing a boolean value from an Object.

See also the overview and examples.


Defined in: cave.js.
Parameters:
val
the object to be parsed
Returns:
true if the val was "true"

sendCaveQuery(name, id, params, doneCallback, rock_name)
This is a convenience function for sending a message to the cave rock.

See also the overview and examples.

Assuming you have a service defined in your cave rock's configuration file something like this:
Defined in: cave.js.
<service name="user" id="login">
  <sql transaction="commit">
    select permission,username,sessionid from login(
      <parameter name="username"/>,
      <parameter name="password"/>);
  </sql>
</service>
... then you could have something like the following as the javascript
that is called when the "login" button is clicked:
function doLogin()
{
  if (!caveQueryInProgress("login")) {
    var params = new Array();
    params[0] = new caveParam("username", DB_DATA_TYPE_STRING, username);
    params[1] = new caveParam("password", DB_DATA_TYPE_STRING, password);
    sendCaveQuery("login", "login", params, doneLoginCallback, "ke-cave");
  }
}

The callback function will eventually be called and passed one parameter:
the caveTransaction object.
function doneLoginCallback(trans)
{
  var params = new Array();
  params[0] = new caveParam("permission");
  params[1] = new caveParam("sessionid");
  findParametersInTransaction(trans, params);
  permission = 0;
  sessionid = null;
  if (params[0].value) {
    permission = params[0].value;
  }
  if (params[1].value) {
    sessionid = params[1].value;
  }
  if (permission == 0) {
    alert("invalid username or password");
  }
  else if ((permission & 3) != 3) {
    alert("no permission to make changes");
  }
  if ((permission & 3) != 3) {
    logout();
  }
  else {
    login();
  }
  caveStop(); // stop the polling now, no need to, we have the reply
}
Parameters:
{string} name
the client-side unique name of the transaction
{string} id
the ID of the cave service that you are calling
{Array} params
an array of caveParam objects that are being used to send parameters to the service
{function} doneCallback
the function to call when the reply has completed
{string} rock_name
the name of the cave rock.
See:
findParametersInTransaction

setBusy(busy)
Call this function to cause the busy icon to spin.

See also the overview and examples.


Defined in: cave.js.
Parameters:
{boolean} busy
true if it is busy

toIEEE(val, mantissa_width, mantissa_mask, mancap, exponent_mask, exponent_bias, negative_bit)
Writes a floating point number into IEEE binary format.

Oops there should be a problem: this should only work for up to 32 bit floats. Above that, there will be a rounding off of precision because the Javascript number is actually a 64-bit float, with only 48 bits for pure integer values. This must be fixed, probably best to convert it so it uses a string, and hex encoded values. Suprisingly, it works!


Defined in: client.js.
Parameters:
{number} val
the floating point number
{number} mantissa_width
e.g. for a 32 bit float, this is 23
{number} mantissa_mask
e.g. for a 32 bit float, this is 0x007FFFFF
{number} mancap
this is the mantissa cap e.g. for a 32 bit float, it is 0x00800000
{number} exponent_mask
e.g. for a for a 32 bit float, it is 0x7F800000
{number} exponent_bias
e.g. for a for a 32 bit float, it is 127
{number} negative_bit
e.g. for a for a 32 bit float, it is 0x80000000
Returns:
the binary format

zapTransactions()
remove all queued transactions (so they don't get sent, or if they already have been sent, so their replies are ignored.

See also the overview and examples.


Defined in: cave.js.

Documentation generated by JsDoc Toolkit 2.3.2 on Sun Nov 29 2009 14:58:50 GMT+0200 (SAST)