JiGlue COM Bridge Programming
Guidelines
The JiGlue COM Bridge allows users to make COM-based VB.NET (or
other .NET-compatible language) calls to the Process Java APIs with the
effect of native Java statements for nearly all Windows programming tasks
and is required for Process applications with Open Client. The JiGlue
library files are provided during PJAC installation. For information,
on JiGlue file locations, etc., see Installing
the Process Development Environment - FileNet Open Client and Process
Java Applets Connectivity (PJAC).
Note: The JiGlue descriptions n this guide
are intended as Open Client-specific and are not meant to be comprehensive.
For a more detailed description of how to code using JiGlue, including
descriptions of developing Process applications for COM, setting up
for JiGlue, developing with JiGlue, and other topics, see the Help
for Process Developers on the Process Documentation for FileNet
Image Manager CD.
This topic provides information on guidelines to keep in mind when developing
application using the JiGlue COM Bridge. In addition, an example of coding
for JiGlue is provided below.
Subtopics include:
JiGlue Application Programming Guidelines
The following guidelines should be kept in mind when coding an application
using the JiGlue COM Bridge:
- When using the JiGlue COM Bridge, you must use the default (empty)
constructor; that is, a JiGlue method can only instantiate an object
whose class has a default constructor (without any argument).
- The JiGlue COM Bridge supports static method calls.
- The JiGlue COM Bridge requires that elements of a Variant array be
of a proper type, and they must be of the same type.
- For simple (non-object) types, you need not use the Set
statement in VB.NET code, as illustrated in the following general, sample
statements:
boolean = queuelement.getFieldValue("booleanField");
integer = queuelement.getFieldValue("intField");
float = queuelement.getFieldValue("floatField");
string = queuelement.getFieldValue("stringField");
time = queuelement.getFieldValue("timeField");
However, if a Java method returns an object other than the java.lang.*
(see below), the Set statement is needed.
- JiGlue supports both one-dimensional and multi-dimensional arrays.
The following API methods (in addition to other Attribute-related methods)
that take multi-dimensional arrays as parameters can be called for JiGlue:
VWEventDefinition
String[][] getAssignments()
void setAssignments(String[][] theAssignments)
VWCompoundStepDefinition
VWInstructionDefinition createCreateInstruction _ (String theWorkClassName, String[][] theFieldAssignList)
VWInstructionDEfinition createAssignInstruction(String[][] assignPairs)
VWStepDefinition
String[][] getPreAssignments()
void setPreAssigtnments(String[][] thePreAssignments)
String[][] getPostAssignments()
void setPostAssignments(String[][] thePostAssignments)
Declaring Integer Arrays
When specifying an integer array, be aware that in Visual Basic and VB.NET,
an integer is a 16-bit value, whereas in Java (and for the Process APIs),
an integer is a 32-bit value. If, for example, you specify a 2-byte integer
array in Visual Basic, it might be mapped in JiGlue to java.lang.Short,
thereby causing the Process Java API to throw an exception. For example,
the following call to setDataFields will fail:
Dim integerArray(2)
integerArray(0)=10
integerArray(1)=20
integerArray(2)=30
wob.setFieldValue "integerArrayField", integerArray,
false
dataFields = wob.getDataFields(127,1)
wob.setDataFields dataFields, false
However, if you change the array to 4-byte integers as follows, the call
to setDataFields succeeds:
Dim integerArray(2)
integerArray(0)=CLng(10)
integerArray(1)=CLng(20)
integerArray(2)=CLng(30)
wob.setFieldValue "integerArrayField", integerArray,
false
dataFields = wob.getDataFields(127,1)
wob.setDataFields dataFields, false
Tip: Alternatively, you may wish to use the
VB.NET Convert.ToInt32 Method (Int16) method,
which converts the value of the specified 16-bit signed integer to an
equivalent 32-bit signed integer.
- The JiGlue COM Bridge allows you to remove explicit assignments for
the object references. The following examples demonstrate two ways of
using the data types supported by the JiGlue COM Bridge:
Example 1:
Dim myDate As Variant
Dim mySimpleDate As Object
Set mySimpleDate = JiGlue.newInstance("java.text.SimpleDateFormat")
myDate = mySimpleDate.parse("09/12/2001 11:58 am")
Example 2:
Dim myDate As Variant
Dim mySimpleDate As Variant
Set mySimpleDate = JiGlue.newInstance("java.text.SimpleDateFormat")
myDate = mySimpleDate.parse("09/12/2001 11:59 am")
In the examples shown above, mySimpleDate
was declared as both Object and Variant (in the different examples); in
both cases, the object reference was assigned by using Set.
Notice that in both cases myDate was declared
as Variant without using the Set statement.
The reason this works as coded, is because a SimpleDateFormat.parse
returns java.util.Date which is mapped to
Visual Basic's Date type (which is non-object see table above).
As previously indicated, if a Java method returns an object other than
the java.lang.* (as indicated above), the Set
statement is needed. Note that the Jiglue.newInstance
method can only instantiate an object whose class has a default constructor;
that is, without any argument (see previous bullet).
Example JiGlue Usage
As an example, to use JiGlue to create and instantiate a Process VWSession
object and login (required for virtually all Process operations), you
might use VB code similar to:
Imports Jiglue Public Class FnJiglueSample
Protected m_aJiglue As New JiglueUtil()
Public Function Logon() As Boolean
...
'Use JiGlue to create a VWSession
object and logon
Dim aVWSession As Object
aVWSession = m_aJiglue.newinstance("filenet.vw.api.VWSession")
SetVWSession(aVWSession)
aVWSession.logon(strUserName,strPassWord,strRouterURL)
...
End Function
...
End Class
where strRouterURL is
the URL of the Process Engine router.
|