Pages

Wednesday, June 29, 2011

Understanding the CAI URL

CAI stands for “Computer Assisted (or-Aided) Instruction”.
CAI URLs are special URLs that are used in Composite applications to launch an application or to switch between a pages with in or across composite applications.
The CAI URL is broken into several parts, most of which are optional in many cases.


SYNTAX


 cai://[GUID]/[Page Id]?[pagealias][hint]
Where,
[GUID] - the optional GUID for the application. This parameter is actually not needed at all as long as the [Page Id], [pagealias], or the [hint] is specified.

[Page Id] - this is essentially the Eclipse perspective Id. Also an optional parameter if the [pagealias] or [hint] is specified.

[pagealias] - this corresponds to the com.ibm.rcp.alias parameter in the pages for a composite application. By including this parameter with a blank [GUID] and blank [Page Id] the composite application framework will attempt to open the page with the matching pagealias in the current application.Lotus Notes 8.5.2 and Lotus Expdeitor 6.2.2 and above.

[hint] - the url hint is used to tell the composite framework where to get the file for this cai url. The hint can be any kind of addressable URL: file, http, nrpc. The hint is the actual .ca file



Sample URLs and their behaviors



cai://?hint=http://acme.com/mycompapp.ca
- This will open the application stored at the http site and show its first visible page
- This will process the .CA file and install any features referenced by the .CA
- If any features are installed this will require a restart of the product

cai://DB1F567B0E6F6784084D923134028D4C_8525764000063159
- This will open an already installed application with the following GUID
- If the application is not installed it will error out.
- The first visible page will be opened
- If the hint URL is specified then this will process the .CA file and install any features referenced by the .CA. If any features are installed this will require a restart of the product

cai://DB1F567B0E6F6784084D923134028D4C_8525764000063159/BD973A4E8C0FCDED54C69CB23940B5FC_6_3KE527R200VQ502MGJOIMC20H7
- This will open an already installed application with the following GUID
- If the application is not installed it will error out.
- The page with the [Page Id] will be displayed.
- If the hint URL is specified then this will process the .CA file and install any features referenced by the .CA. If any features are installed this will require a restart of the product

cai://?hint=nrpc:/__8525729D0030946C/composite.xml?file=MyCompApp.nsf&name=CompAppMain
- This will install and launch the composite application from a Lotus Notes database using the nrpc URL.

cai://?pagealias=First Page
- This launches the page in the currently opened composite application with the com.ibm.rcp.alias set to "First Page"
- If the pagealias is not found in the current application the user will see an error dialog.

cai://?pagealias=First Page?hint=http://acme.com/mycompapp.ca?ColorScheme=Blue&Font=Arial
- This launches the page in the currently opened composite application with the com.ibm.rcp.alias set to "First Page"
- The application at the hint will be checked for an update prior to opening the page
- If the pagealias is not found in the current application the user will see an error dialog.
- The ColorScheme and Font parameters will be available as preferences for all components on the page.


Computing a cai URL in formula language



The following can be used to simply show a page in the same composite NSF from formula language as a URL:

"cai://?pagealias=Page 1"


The following snippet of code can be used in a Notes outline to show a specific page (using the [pagealias] parameter) and optionally install or update the composite using the [hint] parameter.

rep_id := @Left(@ReplicaID; 8) + @Right(@ReplicaID; 8);

"cai://?pagealias=Page 1&hint=nrpc:/__" + rep_id + "/composite.xml?file=PlayWithNavigator.nsf&name=CompAppMain"

Note :
1.    nrpc stands for  Notes Remote Procedure Calls
2.    The next section titled “Using Notes Outline for navigation in composite application” shows  CAI URL in action

No comments:

Post a Comment