216 WebSphere Business Integration Adapters
Example 14-7 shows the getBoDefs() method for the ODA in our scenario.
Example 14-7 getBoDefs() method
public BusObjDef[] getBoDefs(long index) throws ODKException
{
BusObjDef[] bos = null;
if (index == ODKConstant.GET_ALL_OBJECTS)//were all BOs requested?
{
bos = new BusObjDef[m_generatedBOs.size()];
System.arraycopy(m_generatedBOs.toArray(), 0, bos, 0,
m_generatedBOs.size());
} else bos = new BusObjDef[]
{(BusObjDef)m_generatedBOs.get((int)index)};
return bos;
}
14.3 Testing the ODA
After you have written the application-specific component for the connector, you
must compile it into an executable format, its connector library.
To compile a Java connector:
1. Use a JDK 1.3.1 development environment.
2. Ensure that both of the following files are in the \lib\ subdirectory of the
product directory:
–crossworlds.jar
WBIA.jar
3. Include crossworlds.jar in the project path. Also, include in the project path
any application-specific .jar (Java archive) files that the application-specific
component requires.
4. Compile the connector source (.java) files into class (.class) files with the
Java compiler.
5. Create the Java connector’s library file, which is a .jar file containing the
compiled Java code.
After coding and compiling the ODA, you can test the ODA in the WebSphere
Studio Development environment.
Note: The source for the ODA in our scenario can be found in the Additional
Materials in the ODA .jar file.
Chapter 14. Object Discovery Agent 217
14.3.1 Setting up the test environment
To set up the test environment:
1. Select Run from the tool bar.
2. Select Debug, as shown in Figure 14-3.
Figure 14-3 Select Debug menu
218 WebSphere Business Integration Adapters
3. Select Java Application in the Launch Configurations window and then
select New as shown in Figure 14-4.
Figure 14-4 Launch Configurations window
Chapter 14. Object Discovery Agent 219
4. In Name field of the Launch Configurations window, specify an appropriate
name. In the Project field, specify your project. Enter
com.crossworlds.ODKInfrastructure.XRmiAgent in the Main class field
(Figure 14-5).
Figure 14-5 Main class
220 WebSphere Business Integration Adapters
5. Enter the class name in the Program arguments field (Figure 14-6) as follows:
-lRedMaintenance -ccom.ibm.itso.rm.oda.RedHouse.RedMaintenanceAgent
Figure 14-6 Arguments
6. Enter the following in the VM arguments field:
-Xbootclasspath/p:C:\WebSphereICS\jre\lib\ext\ibmorb.jar
-Djava.security.policy=c:\RedMaintenance\policy.txt
-Duser.home=C:\WebSphereICS
7. Select Debug to start.
The ODA is now running under WebSphere Studio. You can debug your ODA by
creating business objects as shown in 14.5, “Generating business objects using
the ODA” on page 225.
Note: -Djava.security.policy=c:\RedMaintenance\policy.txt is necessary
only when you run the ODA from our scenario. C:\WebSphereICS\ might
vary according to your Adapter Framework directory.

Get WebSphere Business Integration Adapters: An Adapter Development and WebSphere Business Integration Solution now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.