My.ADVISOR.com Sign-In
ID
Password

Member Center / Sign-Up
   
SUBSCRIPTION STATUS
If you are a subscriber to this publication, sign-in to access locked articles. To subscribe or renew go to www.AdvisorStore.com.
Go to Article
Advanced Search 

DEVELOPMENT TOOLS

Simplify IBM Lotus Notes Java Application Development

Let Mental Notes JavaSpeak 1.0 extend your Web and networking capabilities with its Java class libraries

By Jack Dausman

Mental Notes, Inc. has recently released JavaSpeak 1.0, a set of efficient and productive Java class libraries specifically for Lotus Notes programmers. Although there are over sixty classes, they can generally be grouped under three headings: Web development, network programming, and general-purpose Notes Java programming.


Before thinking about what can be accomplished with JavaSpeak, you need to identify whether you're the kind of programmer that will benefit most from using it.


Domino Object Model

You don't need to be fully versed in Java before using JavaSpeak. But, because of the comprehensiveness of JavaSpeak, it can seem daunting to those who aren't steeped in Java. For example, not many Notes programmers are looking for ways to make their applications work with TCP/IP sockets.


Most of the JavaSpeak classes are specific to the Domino Object Model (DOM) and provide useful ways to manipulate the objects in a Domino database. Although programmers using JavaSpeak need to be familiar with DOM (using either LotusScript or Java), JavaSpeak extends their programming capability. Look at the three main categories of code JavaSpeak offers to the Notes programmer:

Web development

In the interaction between a Web browser and a Domino server, a context document is created. It's a little different than a regular Notes document because it contains information specific to the interaction between a Web server and a browser. For instance, the type of browser used, the HTTP port, any query strings, and the remote address are automatically created in the context document as fields.

JavaSpeak contains classes for working with the context document. The "isHTTPS()" method checks whether or not the connection has been secured through SSL. The "getQueryDecoded()" parses a URL query string containing multiple values into specific fields.

Network programming

One of the significant advantages of programming in Java is its networking capability. Java applications are expected to be networked and work with Internet technologies. By relying on the networking features of Java, it's possible for Notes applications to connect to a Web server, application and mail servers, and legacy and back-office systems. JavaSpeak packages its classes to make it easier to integrate networking functions. There's a set of client-server classes for networking over the Web. These classes let a remote host and server communicate over a TCP/IP socket (which can't be done with LotusScript). In addition, the tutorial provides a detailed example for creating a simple chat server.

Perhaps the most useful application of these networking classes is data integration through Java Database Connectivity (JDBC). JDBC is a collection of Java classes that abstract the creation of SQL applications. Notes programmers have been using LotusScript data object extensions to integrate with relational database management systems (RDBMSs), but these haven't proved to be robust enough for large sets of data. With Notes R5, there's some additional RDBMS integration with the introduction of Domino Enterprise Connectivity Services (DECS), and a new Lotus Connector Object. In both Notes 4.6 and R5, it's relatively straightforward to work with RDBMS using Java and a JDBC driver. From the client perspective, JDBC works simply to connect to the back-end database.

To make the JDBC work smoothly in a Notes environment, JavaSpeak has a "JDBCNotesConnector" class. Using a SQL query, the class creates a new Notes document. When you think about all the code you would normally have to write to make the connection, retrieve the data set, and then create a document, JavaSpeak starts to look like a bargain.

General-purpose Notes Java programming

Most of the time, Notes programmers don't create exciting Web applications that include JDBC access. Usually you're creating more mundane functions, and appreciate anything that can shorten the delivery timeline. JavaSpeak includes an entire range of classes that relieve some of the tedium involved in manipulating Notes documents and databases.

Here's a short list of examples:

  • The JSDatabase class has a method that deletes all orphan response documents in a database.
  • The searchByItem method retrieves a set of documents by a field value.
  • The putDocsInFolderByKey method drops documents into a folder.
  • The setAuthors method lets multiple authors be assigned to an Authors field.
  • The getValueCount method returns the number of values in a multi-valued field.
  • The removeValue method removes a single value from a multi-valued field.
  • The JSSearcher class helps create a multi-threaded agent that searches documents on one thread, then joins the main thread when it's finished.
  • The sort method alphabetizes an array of strings.

Time-saving functions

All of these methods represent functions that Notes programmers spend a lot of time creating and building into their applications. Here's an example of an agent that deletes orphaned response documents:

package com.javaspeak.notes.examples;
import lotus.notes.*;
import com.javaspeak.notes.*;
import java.util.*;


public class JSDatabase_DeleteOrphans extends AgentBase
{
   public void NotesMain()
    {
              try {
         Session s = getSession();
         AgentContext ag = s.getAgentContext();


          //Instantiate a new JSDatabase class
         //with the current db
         JSDatabase db = new
            JSDatabase(ag.getCurrentDatabase());


          //Delete documents with the
         //Invoice form and responses
         int cnt = db.deleteOrphanResponses();


          System.out.println("There were a total of " +
                cnt + " orphan responses deleted.");


               } catch (Exception e) {   e.printStackTrace(); }
    }
}


After you write the agent logic, "int cnt = db.deleteOrphanResponses()" is the single line that actually accomplishes the job.

Getting started

The version of JavaSpeak I tested only works with Notes 4.6x. Lotus has changed how Java exceptions are handled and Mental Notes, Inc. is busy polishing an R5 update, which should be ready by the time this review is published.

JavaSpeak comes on two floppies and creates a Notes database that includes an outstanding tutorial, samples, and examples. You also get a useful repository database (figure 1). The tutorial is perfect for someone who is just getting into Java programming and eager to apply its benefits to Domino applications. A good example is the tutorial with built-in complexity, beginning with simple Java agents that do things like send mail. The tutorial leads you through detailed examinations of Web server interaction, and shows how to add TCP/IP networking.

Source code

One surprise was how well the source code was documented. I'd be quite hesitant to rely on any class library without the source code -- but to actually find it readable was more than I expected. Mental Notes, Inc. is developing a source code documentation tool so anyone can mirror these efforts. It's clear that they've spent a great deal of effort in producing and testing these libraries.

Conclusion

JavaSpeak presents the Notes programmer with Java class libraries to simplify everyday 4.6x application development. It's not a surprise that former Iris developer Bob Balaban found JavaSpeak "worth a look from any serious Domino developer." It's not merely some exotic, add-on set of Java classes. In addition, it includes some features that can dramatically enhance Domino integration into existing Web and legacy-based infrastructures. I'm hoping it indicates a trend in the Domino community.

Printer-friendly
page layout

Simplify Java Application Development

No reader comments ... yet.

    What do YOU think about this topic? Share your advice and thoughts using this form.

    Your Name

    REQUIRED : PUBLIC

    Your E-Mail

    REQUIRED : PRIVATE

    Job, Company

    OPTIONAL : PUBLIC

    City, State, Country

    OPTIONAL : PUBLIC

    Your Web Site

    OPTIONAL : PUBLIC

    Your Comment

    Please help everyone by keeping your comments on-topic, using clean language, and not defaming or making personal attacks.


    Your e-mail address is required, but it will not be displayed to the public or given to anyone. See our Privacy Policy. Comments become visible after they pass our spam filter, and spammers and abusers are permanently blocked. Please report spam or abuse.

    ARTICLE INFO

    FREE ACCESS FREE ACCESS

    Keyword Tags: Application Development, Database Management, Development, IBM, IBM Lotus, IBM WebSphere, IT Networking, Java, Java 2 Enterprise Edition (J2EE), Java 2 Micro Edition (J2ME), Lotus Notes, Lotusscript, Mental Notes, Mental Notes JavaSpeak, Novell NetWare, Software Development, Web Development

    Use of this or any other site, content, product or service of Advisor Media constitutes acceptance of Terms of Use.
    Portions copyright ©1983-2010 Advisor Media, LLC. All Rights Reserved.
    Reuse or reproduction of any portion or quantity of Advisor Media's copyrighted content, in any form, for any purpose, requires written permission.
    ADVISOR®, the ADVISOR logo, and other names and logos that incorporate ADVISOR are registered trademarks, trademarks or service marks of Advisor Media, LLC in the United States and/or other countries.
    Other trademarks are used for identification, editorial or descriptive purposes and are the property of their owners.
    Hosted by Prominic.NET Website powered by
    LOTUS SOFTWARE
    ln9906 DAUSJ02 posted 1999-9-1 mod 03/10/2010 03:15:44 AM ztdbms/ztdbms
    domino-144.advisor.com my.advisor.com 03/11/2010 09:55:44 AM