ContextClient Lambda Functions

 

closeContext

Overview

Use closeContext to close a context on the AIS server that the contextClient instance is connected to.

Type: Function

Syntax examples

		    (myContextClient.closeContext "mycontext") ; close a context called mycontext
			

Arguments


ContextName String The context name.
ReturnType Number Optional return type: 0=Wait, 1=NoReturn, 2=ReturnRemote - 0 is default.
NotifyType Number Optional notify type: 0=NoNotify,1=FullNotify,2=Notify - 0 is default.
Returns Number RequestId - A positive number. An Notification Amp Message will arrive in the Local Context request queue that will be identified by this number.
Returns AmpStructure AisOut: "true" on success "false" on failure.

Examples

See contextClient.selfTest.

Notes & Hints

No special notes.

closeSession

Overview

Use closeSession to close the current session on the AIS server.

Type: Function

Syntax examples

		    (myContextClient.closeSession) ; close the current session
			

Arguments


ReturnType Number Optional return type: 0=Wait, 1=NoReturn, 2=ReturnRemote - 0 is default.
NotifyType Number Optional notify type: 0=NoNotify,1=FullNotify,2=Notify - 0 is default.
Returns Number RequestId - A positive number. An Notification Amp Message will arrive in the Local Context request queue that will be identified by this number.
Returns AmpStructure AisOut: "true" on success "false" on failure.

Examples

See contextClient.selfTest.

Notes & Hints

No special notes.

eval

Overview

Use eval to evaluate a Lisp expression in the remote context session.

Type: Function

Syntax examples

		    (myContextclient.eval "(+ 1 1)")
			

Arguments


Expression String The lisp expression to evaluate.
ReturnType Number Optional return type: 0=Wait, 1=NoReturn, 2=ReturnRemote - 0 is default.
NotifyType Number Optional notify type: 0=NoNotify,1=FullNotify,2=Notify - 0 is default.
Returns Number RequestId - A positive number. An Notification Amp Message will arrive in the Local Context request queue that will be identified by this number.
Returns AmpStructure AisOut: String representation of value returned from evaluation of expression.

Examples

See contextClient.selfTest.

Notes & Hints

No special notes.

evalAmp

Overview

Use evalAmp to evaluate an Lambda in the remote context session.

Type: Function

Syntax examples

		    (myContextclient.eval (new Structure: Target: "foo" SpeechAct: "you"))
			

Arguments


AmpStructure Structure The AMP message structure.
ReturnType Number Optional return type: 0=Wait, 1=NoReturn, 2=ReturnRemote - 0 is default.
NotifyType Number Optional notify type: 0=NoNotify,1=FullNotify,2=Notify - 0 is default.
Returns Number RequestId - A positive number. An Notification Amp Message will arrive in the Local Context request queue that will be identified by this number.
Returns AmpStructure Amp Structure with elements added by AMP Lambda that was evaluated.

Examples

See contextClient.selfTest.

Notes & Hints

No special notes.

getCurrentContexts

Overview

Use getCurrentContexts to get a list of contexts active on remote server.

Type: Function

Syntax examples

		    (myContextClient.getCurrentContexts)
			(myContextClient.getCurrentContexts 0)
			(myContextClient.getCurrentContexts 0 0)
			

Arguments


ContextName String Optional argument - contains context name of empty string for all contexts.
ReturnType Number Optional return type: 0=Wait, 1=NoReturn, 2=ReturnRemote - 0 is default.
NotifyType Number Optional notify type: 0=NoNotify,1=FullNotify,2=Notify - 0 is default.
Returns Number RequestId - A positive number. An Notification Amp Message will arrive in the Local Context request queue that will be identified by this number.
Returns AmpStructure AisOut: tab separated list of context names or "false" if error

When To Use

As required in by your application logic.

Examples

See the contextClient.selfTest Lambda.

Notes & Hints

No special notes.

getSubscriptions

Overview

Use getSubscriptions to retrieve a list of session information for a specified context or all contexts on the AIS server to which the contextClient instance is connected.

Type: Function

Syntax examples

		    (myContextClient.getSubscriptions) ; get all session information
			(myContextClient.getSubscriptions "") ; get all session information
			(myContextClient.getSubscriptions "mycontext") ; get sessions on mycontext
			

Arguments


ContextName String The context name or an empty string for all contexts.
ReturnType Number Optional return type: 0=Wait, 1=NoReturn, 2=ReturnRemote - 0 is default.
NotifyType Number Optional notify type: 0=NoNotify,1=FullNotify,2=Notify - 0 is default.
Returns Number RequestId - A positive number. An Notification Amp Message will arrive in the Local Context request queue that will be identified by this number.
Returns AmpStructure AisOut:

Examples

See contextClient.selfTest.

Notes & Hints

No special notes.

isContextOpen

Overview

Use isContextOpen to find out if a context is current open.

Type: Function

Syntax examples

		    (myContextClient.isContextOpen "mycontext") ; check if a context named mycontext is open
			

Arguments


ContextName String The context name.
ReturnType Number Optional return type: 0=Wait, 1=NoReturn, 2=ReturnRemote - 0 is default.
NotifyType Number Optional notify type: 0=NoNotify,1=FullNotify,2=Notify - 0 is default.
Returns Number RequestId - A positive number. An Notification Amp Message will arrive in the Local Context request queue that will be identified by this number.
Returns AmpStructure AisOut: "true" if open "false" otherwise.

Examples

See contextClient.selfTest.

Notes & Hints

No special notes.

logoff

Overview

Use logoff to end the current remote context session.

Type: Function

Syntax examples

		    (myContextclient.logoff)
			

Arguments


ReturnType Number Optional return type: 0=Wait, 1=NoReturn, 2=ReturnRemote - 0 is default.
NotifyType Number Optional notify type: 0=NoNotify,1=FullNotify,2=Notify - 0 is default.
Returns Number RequestId - A positive number. An Notification Amp Message will arrive in the Local Context request queue that will be identified by this number.
Returns AmpStructure AisOut: "true" on success "false" on failure.

Examples

See contextClient.selfTest.

Notes & Hints

No special notes.

logon

Overview

Use logon to authenticate yourself on the remote server.

Type: Function

Syntax examples

		    (myContextClient.logon "tester" "cool dude")
			

Arguments


UserName String User name
Password String Password
ReturnType Number Optional return type: 0=Wait, 1=NoReturn, 2=ReturnRemote - 0 is default.
NotifyType Number Optional notify type: 0=NoNotify,1=FullNotify,2=Notify - 0 is default.
Returns Number RequestId - A positive number. An Notification Amp Message will arrive in the Local Context request queue that will be identified by this number.
Returns AmpStructure AisOut: "true" on success "false" on failure.

When To Use

Use after doing an openConnection and before calling openSession.

new

Overview

Use the new function to create a new instance of the contextClient Lambda.

Type: Function

Syntax examples

			(setq myContextClient (new contextClient "127.0.0.1" 81))
			

Arguments


hostAddress String An AIS server address.
appPort Number An AIS appServer port#.
Returns Lambda contextClient Lambda instance.

When To Use

No special circumstances.

Examples

See contextClient.selfTest

Notes & Hints

No special notes.

notify

Overview

Notification AMP Messages arrived addressed to contextClient.notify. This Lambda is responsible for redirecting the AMP Message to each application Lambda previously registered by calls to contextClient.notifyRegister.

Type: Function

Syntax examples

		    (myContextclient.notify ampMessage)
			

Arguments


ampMessage Structure The notification AMP message.
Returns none

Examples

See contextClient.selfTest.

Notes & Hints

No special notes.

notifyRegister

Overview

Use notifyRegister to register application Lambdas that should receive copies of incoming notification AMP messages.

Type: Function

Syntax examples

		    (myContextclient.notifyRegister "myapp.handleEvents")
			

Arguments


appLambda String The name of the application Lambda that should receive copies if incoming notification AMP messages.
Returns Boolean true

Examples

See contextClient.selfTest.

Notes & Hints

No special notes.

openConnection

Overview

Use openConnection to establish a connection with the AIS server.

Type: Lambda

Syntax examples

		    (setq result (myContextClient.openConnection))
			

Arguments


ReturnType Number Optional return type: 0=Wait, 1=NoReturn, 2=ReturnRemote - 0 is default.
NotifyType Number Optional notify type: 0=NoNotify,1=FullNotify,2=Notify - 0 is default.
Returns Number RequestId - A positive number. An Notification Amp Message will arrive in the Local Context request queue that will be identified by this number.
Returns AmpStructure AisOut: "true" on success "false" on failure.

When To Use

Use openConnection before attempting logon for the first time.

Examples

See contextClient.selfTest.

Notes & Hints

No special notes.

openContext

Overview

Use openContext to open a Remote Context.

Type: Function

Syntax examples

		    (myContextClient.openContext "worker1/astartup.sl" "worker1")
			

Arguments


StartupPath String The path to the context folder and its startup script. This may be a full path or a path relative to the install directory of the remote server. The startup script portion of the path is optional. If a startup script name is included, this script will be parsed for context specific parameters, ex: ;#memory=50. NOTE: The startup script is NOT executed when you call openContext.
ContextName String The name you want the context to have. Context names must be unique withing a single server.
ReturnType Number 0=Wait, 1=NoReturn, 2=ReturnRemote
NotifyType Number 0=NoNotify,1=FullNotify,2=Notify
Returns Number RequestId - A positive number. An Notification Amp Message will arrive in the Local Context request queue that will be identified by this number.
Returns AmpStructure AisOut: "true" on success "false" on failure.

When To Use

No special circumstances.

Examples

See contextClient.selfTest.

Notes & Hints

After opening a remote context it is usually necessary to open a user session and then run the remote contexts startup script. See contextClient.selfTest for an example of this sequence of calls.

openSession

Overview

Use openSession after calling logon and before calling eval on the remote context.

Type: Function

Syntax examples

		    (myContextclient.openSession "worker1")
			

Arguments


ContextName String The name of the Remote Context you want to open a session on.
ReturnType Number Optional return type: 0=Wait, 1=NoReturn, 2=ReturnRemote - 0 is default.
NotifyType Number Optional notify type: 0=NoNotify,1=FullNotify,2=Notify - 0 is default.
Returns Number RequestId - A positive number. An Notification Amp Message will arrive in the Local Context request queue that will be identified by this number.
Returns AmpStructure NumValue: A positive value greater than 1 is your session number. A value less than 1 indicates failure.

Examples

See contextClient.selfTest.

Notes & Hints

No special notes.

setSubscriptions

Overview

Use setSubscriptions to specify which sessions the current session should receive output from. Only sessions on the AIS server to which the contextClient instance is connected to may be specified.

Type: Function

Syntax examples

		    (myContextClient.setSubscriptions)
			

Arguments


ContextName String The context name or an empty string for all contexts.
ReturnType Number Optional return type: 0=Wait, 1=NoReturn, 2=ReturnRemote - 0 is default.
NotifyType Number Optional notify type: 0=NoNotify,1=FullNotify,2=Notify - 0 is default.
Returns Number RequestId - A positive number. An Notification Amp Message will arrive in the Local Context request queue that will be identified by this number.
Returns AmpStructure AisOut: "true" on success "false" on failure.

Examples

See contextClient.selfTest.

Notes & Hints

No special notes.