Large Scale Java deployment

In order to deploy any large-scale enterprise java system in Notes it, most likely, has to be built outside of Notes in some third party IDE like Eclipse or JBuilder. Given this generally accepted conclusion, the question becomes: how does one maintain and deploy this solution through the Notes script library framework?The most obvious answer to this is through the DXL import facility built into the Domino designer. So, in order to use the DXL import facilities, you must first have a source DXL file. After analyzing the domino DTD and after numerous import tests, I’ve come up with a quite sophisticated DXL exporter engine for Eclipse including the following features:

Export and complete synchronization with Notes by the clicking on the project in Eclipse and running our custom “Eclipse external tool”

Corresponding Notes script libraries for each package in all Eclipse exported projects

Eclipse project tracing and DXL exporting for all export checked dependant projects, libraries and class files

Parsing of all Java source to prevent circular script library dependencies by the proper insertion of <sharedlibraryref> in the DXL

Then came the final test. Deploy an actual project that had a variety of mixed dependencies to Notes from Eclipse. The result: All packages were imported into Notes quite perfectly. Also, quite surprisingly, most script libraries were compiled and worked great. Unfortunately, that is where the success ended. Other than JDK versioning issues, which I guessed would happen, I had another quite serious and fatal problem.

Early on, I recognized that one script library could not depend on another script library, which in turn, depended on it unless the tag was used in the DXL. This prevents circular dependencies at the script library level, but unfortunately it doesn’t prevent them at the individual class level. Given any large scale system I can only imagine that it has several class level circular dependencies from factories. So again, as is the case with most Notes systems, we find ourselves back at square one asking the same question: how does one maintain and deploy this java solution through the Notes script library framework?

So far I have come up with three answers, none of which appeal to me.

  1. Develop a circular dependency detection algorithm based on some type of tree structure, then embed dependant class A into the script library of dependant class B. Meanwhile still taking care to copy or move all of the utilized by class A into the foreign script library that contains class B. As well as taking care not to create any other broken circular class references due to the moving of class A.

  2. Import all classes into one gigantic script library. I doubt this would work due to size limitations.

  3. Import source as usual then manually modify all source that contains circular references to do the following:

A. Modify class A to break dependency with class B.

B. Compile script library containing class A.

C. Compile script library containing class B since class A now exists.

D. Modify class A to re-add the dependency with class B.

E. Compile script library containing class A since class B now exists.

So my question is to all developers who have successfully deployed 400+ Java classes through the Notes script library framework. How do you do it?

Subject: Large Scale Java deployment

Just an idea, not tested:Instead of recompiling Java source code in Notes, just programatically replace the archive file inside Notes Script library. Be sure to use compatible version of compiler.

You must create jar-archives outside Domino and name them as “%%resource%%.jar”. Then you can run lotusscript to replace old jar file inside script library with a new jar.

In lotusscript (and in Java) you can treat script library as a document:

Sub Initialize

Dim session As New NotesSession

Dim db As NotesDatabase

Dim doc As NotesDocument

Dim rtitem As NotesRichTextItem

Dim object As NotesEmbeddedObject

Set db = session.CurrentDatabase

Set doc = db.GetDocumentByID("211A")  'java script library's ID

Set rtitem = New NotesRichTextItem( doc, "Body" )

Set object = doc.GetAttachment( "%%resource%%.jar" )

If Not object Is Nothing Then	Call object.Remove

Call doc.Save( True, False )

Set object = rtitem.EmbedObject _

( EMBED_ATTACHMENT, "", "C:\%%resource%%.jar")

Call doc.Save( True, False )

End Sub

Subject: Large Scale Java deployment

Wes,You have an innovative approach to importing Java script into Java script libraries.

I run Java inside Notes by calling Java ScriptLibraries from Java Agents which are called in turn from LotusScript front-end objects.

This works well, since I can use the Java scriptlibrary to centralise all my (back-end) code.

What you intend to do is tooo complicated to be effective. It would be as much effort to detect dependancies as it is to copy the code manually and compile.

Regards

Rolf Pfotenhauer

Subject: RE: Large Scale Java deployment

You’re very right from a single deployment standpoint. But when you figure any kind of refactoring could occur to the classes in the external IDE, the benefits far outweigh the costs. Adding changed classes, renaming packages and other such refactoring just isn’t feasible within Notes.

Subject: RE: Large Scale Java deployment

I take your point. I wonder if LS2J would be more effective in maintaining Java that is external to Notes.

The concept of refactoring makes your method much to clumsy to be effective in the long term.

Regards

Rolf Pfotenhauer

Subject: RE: Large Scale Java deployment

Since I planned on detecting dependancies and deploying the entire set external classes with each deployment, it really isn’t an issue. The problem with circular reference detection is designing a sound algorithm that is truely safe.