Main menu:

Site search

December 2008
S M T W T F S
     
 123456
78910111213
14151617181920
21222324252627
28293031  

Categories

Tags

Upgrading Embedded IDM to FileNet P8

Project: Upgrade a multi-tier Delphi application to include P8 functionality.

The existing application embedded the IDM viewer to display documents in the object store and also contained some forms for managing and working queues. The FileNet system was being upgraded to P8 and some code needed to be changed for the new API. Since the IDM viewer was no longer available the design called for an embedded Internet Explorer control to load the ViewOne viewer written in Java.

One particular problem is the P8 API is written in Java and so is ViewOne. Creating the java classes through the COM bridge (JiGlue) worked fine and displaying ViewOne worked fine, but Java raised errors if both happened at the same time. As it turns out only one instance of the JVM can be loaded in a single process. The JiGlue bridge is an in process COM object so it is loaded into the client process and starts a Java Virtual Machine (JVM). The IE control is also an in-proc dll and was trying to create it’s own JVM to launch ViewOne. The second attempt at starting a JVM would throw the previously mentioned errors.

The solution was to move one of the JVMs out of the client process. The IE control had to remain embedded in the client so the obvious choice was the calls to the P8 API. There was already a lot of code scattered through the client using OleVariants for calling methods on the API classes. Instead of moving all the API code into the out of process COM server and potentially adding bugs with the deadline approaching, the COM server contained two simple methods.

type
  TFNWrapper = class(TAutoObject, IFileNetWrapper)
  private
    FJiGlue: JiGlueUtil;
  protected
    function GetSession: OleVariant; safecall;
    function GetAttachment: OleVariant; safecall;
  public
    procedure Initialize; override;
    destructor Destroy; override;
  end;
...
function TFNWrapper.GetAttachment: OleVariant;
begin
  Result := FJiglue.NewInstance('filenet.vw.api.VWAttachment');
end;

function TFNWrapper.GetSession: OleVariant;
begin
  Result := FJiglue.NewInstance('filenet.vw.api.VWSession');
end;

The implementation of GetSession and GetAttachment called the COM bridge the same as in the client. Since it now runs as a separate process it can load it’s own JVM. The client application calls these two methods and stores the returned dispatch interfaces in the existing OleVariants as before and the rest of the client functions normally.

Write a comment