Tired of dual-language templates

When you run the translated versions of Lotus Notes templates there will be two copies of each design element. One for the English version and one for the translated version (Danish in our case). The version Notes uses are determined by the language property of the database (see the bottom of the fourth tab of the database property box).

One problem with the double set of design elements is that that the template takes up twice the size on the disk which is bad when you multiply the double disk usage by a couple of houndred users.

The storage space used by the template alone can be solved by using single copy templates so it is ok.

Much worse are the issues that arise when applications need to access the mail database. One example of an application that need to do this could be an application that synchronizes the mail database (calendar, to-do’s and e-mail) with a handheld device.

The problem here isn’t the calendar or to-do’s since these documents are located based on views (and the selection formula is the same for different language versions). The problem lies with the inbox since it is a folder. Folders hasn’t got a selection formula but contain the documents that are actively placed in the folder by the router in the case of the mail database.

Since the inbox is a folder the result is VERY different when looking in the English version of the design element rather than the Danish version. In this case the inbox will be empty.

The only solution I have been able to come up with has been modifying the standard template giving the Danish version of the inbox folder an alias. I tried this but it resolved in the router not being able to deliver mail to the user. Not really a practical solution…

I have to call Lotus Support about this.

Multiple form aliases

Looking at the “Reply with History” form I saw that the form has multiple aliases. The form name is specified like the below:

Reply | wReply | Reply

A simple test reveals that you can use both the aliases (wReply and Reply) from commands such as @Command([Compose]). This is really nice for backwards compability if you need to rename a form.

LotusScript.doc (part 3)

I have based the layout on the layout of the javadoc documentation generated by the Sun tools. The main windows is separated into three main frames:

  • Top left – frame showing the different design elements with LotusScript (forms, views, agents and script libraries)
  • Bottom left – frame showing all found LotusScript classes in a sorted list
  • Right frame – main frame showing design elements with LotusScript

Below is a screenshot of the opening window (click on image for a larger version)…

…and a screenshot showing the documentation of a class (click on the screenshot for a larger version):

LotusScript.doc (part 2)

The code has been expanded so it now also supports:

  • Constants (incl. datatype)
  • Class properties
  • Methods and functions with global scope
  • Views
  • Forms

I have inserted some sample documentation generated below. As previously mentioned the next thing I am going to approach is formatting the output for easy navigation and cross-reference.

ScriptLibrary @ FooBar

Constant @ PRIVATE_STRING_CONST

[CONST] (PRIVATE) PRIVATE_STRING_CONST As String = “abc123”

Constant @ PUBLIC_INTEGER_CONST

[CONST] (PUBLIC) PUBLIC_INTEGER_CONST As Integer = 12345
This is a comment for my PUBLIC_INTEGER_CONST constant.

Constant @ FRIENDLY_STRING_CONST

[CONST] (PRIVATE) FRIENDLY_STRING_CONST As String = “should be ignored”

Class @ Bar

Parent class.

Class @ Foo (inherits from Bar)

This is a class comment and it may span multiple lines. The class the inherits from the Bar class.

Property @ Lekkim

[PROPERTY] (PRIVATE SETTER) Lekkim As String
Sets the lekkim.

Property @ Lekkim

[PROPERTY] (PRIVATE GETTER) Lekkim As String
Returns the lekkim.

Method @ New

[SUB] (PUBLIC) New
Constructor.

Function @ GlobalFunction

[FUNCTION] (PUBLIC) GlobalFunction(arg1 As String, arg2 As Long) returns NotesDocument
I have also documented my global function.

Method @ GlobalMethod

[SUB] (PUBLIC) GlobalMethod

Form @ _1. TestTest Document

Method @ Querysend

[SUB] (FRIENDLY) Querysend(Source As Notesuidocument, Continue As Variant)
Form Querysend event.

Method @ Queryclose

[SUB] (FRIENDLY) Queryclose(Source As Notesuidocument, Continue As Variant)
Queryclose event.

View @ Test documents|notesTestDocuments

Method @ Querypaste

[SUB] (FRIENDLY) Querypaste(Source As Notesuiview, Continue As Variant)
Querypaste view event.

LotusScript.doc (part 1)

LotusScript.doc is a series of script libraries that can generate HTML documentation for LotusScript libraries. It is mainly targeted at class delevelopment in script libraries but should be applicable to LotusScript in forms, views and agents.

I wrote the code last night and it looks promising. Below is a sample of some documentation I have generated. As you can see the documentation isn’t much to look at – layout will be the next issue I will address.

Sample documentation:

ScriptLibrary @ CLASS: DocumentationWriter

Class @ DocumentationWriter

A DocumentationWriter is used to write the documentation to an OutputStream.

Method @ New

[SUB] (PUBLIC) New(scripts As Vector)
Constructor.

Method @ Write

[SUB] (PUBLIC) Write(filename As String)
Writes the documentations.

The method signatures and comments are actually based on parses LotusScript code and shows that the library can parse classes with nested methods and functions. Comments are also included.

I have based the documentation format on the JavaDoc syntax:

'/**
' * Parent class.
' */
Public Class Bar

End Class

'/**
' * This is a class comment
' * and it may span multiple lines. The class
' * the inherits from the Bar class.
' */
Public Class Foo As Bar
   '/**
   ' * Constructor.
   ' */
   Public Sub New()

   End Sub
End Class

The above code generates documentation that looks like this if the code is in a script library called “FooBarLib”:

ScriptLibrary @ Foo

Class @ Bar

Parent class.

Class @ Foo (inherits from Bar)

This is a class comment and it may span multiple lines. The class the inherits from the Bar class.

Method @ New

[SUB] (PUBLIC) New
Constructor.

I’ll post more once I have worked a little more on the presentation.

Using in JSTL under JBoss

The source of the problem could be found in the org.apache.taglibs.standard.tag.common.sql.DataSourceUtil class of the Jakarta implementation of JSTL. The problem is that the SQL function looks for the DataSource in the “java:comp/env” namespace where as my datasource was in the “java:” namespace.

The solution is to map the datasource to Tomcat using the web.xml and jboss-web.xml deployment descriptors:

web.xml

    <!-- JDBC DataSources (java:comp/env/jdbc) -->
    <resource-ref>
        <description>The used datasource</description>
        <res-ref-name>jdbc/DefaultDS</res-ref-name>
        <res-type>javax.sql.DataSource</res-type>
        <res-auth>Container</res-auth>
    </resource-ref>

jboss-web.xml

    <!-- make sure the web container can get jdbc connections -->
    <resource-ref>
        <res-ref-name>jdbc/DefaultDS</res-ref-name>
        <res-type>javax.sql.DataSource</res-type>
        <jndi-name>java:/pestikom2</jndi-name>
    </resource-ref>

The above makes the java:/pestikom2 datasource from JBoss available in the java:/comp/env namespace in Tomcat. The datasource can now be referenced from JSTL using:

<sql:query dataSource="jdbc/DefaultDS" var="some_var" scope="page" sql="select * from foo" />