772
Chapter 34: Integrating COM and CORBA Objects in CFML Applications
To create Java stub files for COM objects:
1
Configure your system as follows:
a
Ensure that a JDK (Java Development Kit) is correctly installed, including proper
configuration of the CLASSPATH and the command prompt PATH variable.
b
Add
CF_root\
lib\jintegra.jar to your CLASSPATH.
2
Make a new directory for the Java stub files; for example:
mkdir C:\src\outlookXP
This directory can be temporary. You add files from the directory to a ColdFusion JAR file.
3
Run the
CF_root
\Jintegra\bin\com2java.exe program from a command line or the Windows
Start Menu. A window appears.
a
If a COM class implements multiple interfaces that define methods with the same names,
click the Options button and clear the Implement interfaces that may conflict option. The
generated Java stub classes do not implement the additional, conflicting, interfaces. You can
still access the interfaces using the getAs
XXX
method that is generated. See the generated
comments in the Java files.
b
Click on the
Select
button.
c
Select your COM object’s Type Library or DLL. For Microsoft Outlook in Windows XP, it
is normally Program Files\Microsoft Office\Office10\MSOUTL.OLB.
d
Enter a package name (for example,
outlookXP
) in the Java package field in the com2java
dialog box. This package will contain all the classes for the Java stubs for the COM object.
Note:
Macromedia uses a package name that starts with
coldfusion.runtime.com.com2java
for
the packages that contain the preinstalled Java stubs for Microsoft Excel, Microsoft Word, and
Microsoft Access. For example, the name for the package containing the Microsoft Word XP
Java stub classes is
coldfusion.runtime.com.com2java.wordXP
. This package name hierarchy
results in the wordXP classes having a path inside the msapps.jar file of coldfusion\runtime\
com\com2java\wordXP\className.class. Although this naming convention is not necessary,
consider using a similar package naming convention for clarity, if you use many COM objects.
e
Click the Generate Proxies button to display the File browser. Select the directory you
created in step 2, and click the file browser OK button to generate the stub files.
f
Click Close to close the com2java.exe utility.
The files generated in your directory include the following:
■
A Java interface and proxy class for each COM interface
■
A Java class for each COM class
■
A Java interface for each ENUM (a set of constant definitions)
4
Compile your Java code. In a command prompt, do the following:
a
Make the directory that contains the Java stubs (in this example, C:\src\outlookXP) your
working directory.
b
Enter the following line:
javac -J-mx100m -J-ms100m *.java
The compiler switches ensure that you have enough memory to compile all the necessary
files.
Note:
If you did not put jintegra.jar on your CLASSPATH in step 1b, add the switch
-classpath:/cf_root/lib/jintegra.jar
, where
cf_root
is the directory where ColdFusion is
installed, to the command.
Summary of Contents for COLDFUSION MX 61-DEVELOPING COLDFUSION MX
Page 1: ...Developing ColdFusion MX Applications...
Page 22: ...22 Contents...
Page 38: ......
Page 52: ...52 Chapter 2 Elements of CFML...
Page 162: ......
Page 218: ...218 Chapter 10 Writing and Calling User Defined Functions...
Page 250: ...250 Chapter 11 Building and Using ColdFusion Components...
Page 264: ...264 Chapter 12 Building Custom CFXAPI Tags...
Page 266: ......
Page 314: ...314 Chapter 14 Handling Errors...
Page 344: ...344 Chapter 15 Using Persistent Data and Locking...
Page 349: ...About user security 349...
Page 357: ...Security scenarios 357...
Page 370: ...370 Chapter 16 Securing Applications...
Page 388: ...388 Chapter 17 Developing Globalized Applications...
Page 408: ...408 Chapter 18 Debugging and Troubleshooting Applications...
Page 410: ......
Page 426: ...426 Chapter 19 Introduction to Databases and SQL...
Page 476: ...476 Chapter 22 Using Query of Queries...
Page 534: ...534 Chapter 24 Building a Search Interface...
Page 556: ...556 Chapter 25 Using Verity Search Expressions...
Page 558: ......
Page 582: ...582 Chapter 26 Retrieving and Formatting Data...
Page 668: ......
Page 734: ...734 Chapter 32 Using Web Services...
Page 760: ...760 Chapter 33 Integrating J2EE and Java Elements in CFML Applications...
Page 786: ...786 Chapter 34 Integrating COM and CORBA Objects in CFML Applications...
Page 788: ......