406 WebSphere Business Integration Adapters
23.5 Creating the startup script
A connector requires a startup script for the system administrator to start the
connector process. The startup script that you use depends on the operating
system on which you are developing your connector. Figure 23-5 shows the
steps to start a connector on a Windows system.
Figure 23-5 Starting a connector on a Windows System
Connector startup script:
start_
connName.bat
1
2
3
Environment file:
CWSharedEnv.bat
Connector invocation script:
start_adapter.bat
JVM
Connector
Chapter 23. Packaging the custom adapter for distribution 407
23.5.1 Startup script for our connector
We have tailored a standard startup script for use with our custom adapter.
Example 23-1 shows this startup script. Copy this script into the RMConnector
directory. It is in the Additional Materials in the RM folder.
Example 23-1 RMConnector startup script
REM @echo off
call "%CROSSWORLDS%"\bin\CWConnEnv
REM set the directory where the specific connector resides
set CONNDIR="%CROSSWORLDS%"\connectors\%1
REM goto the connector specific drive & directory
cd /d %CONNDIR%
REM set the name to be the application connector that is starting
set CONNAME=%1
REM set the package name to the connector package name
set CONNPACKAGENAME=com.ibm.itso.RedHouse.RM.Adapter.RMAgent
REM set the server name
set SERVER=%2
set
DataHandler_JAR="%CROSSWORLDS%"\DataHandlers\CwDataHandler.jar;"%CROSSWORLDS%"\
DataHandlers\CustDataHandler.jar
if %CWVERSION%=="4.X" set XML_PARSER="%CROSSWORLDS%"\lib\xerces.jar
if %CWVERSION%=="3.X" set
XML_PARSER="%CROSSWORLDS%"\DataHandlers\Dependencies\IBM\xml4j.jar
set VBJTOOLS="%CROSSWORLDS%"\lib\vbjtools.jar
set AGENT="%CONNDIR%"\RMAdapter.jar
set RED_MAINT="%CONNDIR%"\common.jar
set
JCLASSES=.;%JCLASSES%;%RED_MAINT%;%XML_PARSER%;%DataHandler_JAR%;%VBJTOOLS%;%AG
ENT%
REM start the Java connector under the Java Application End
%CWJAVA% -version
%CWJAVA% -mx128m %ORB_PROPERTY% -Djava.security.policy=policy.txt
-Djava.ext.dirs="%MQ_LIB%";%JRE_EXT_DIRS%
408 WebSphere Business Integration Adapters
-Djava.library.path="%CROSSWORLDS%"\bin;%CONNDIR%;"%MQ_LIB%";%JRE_EXT_DIRS%
-Duser.home="%CROSSWORLDS%" -cp %JCLASSES%;%CONNDIR%\%CONNAME%.jar;
AppEndWrapper
-l%CONNPACKAGENAME% -n%CONNAME%Connector -s%SERVER% %3 %4 %5
endlocal
pause
Note the following about our startup script:
Calling the environment file
There is nothing specific or different for our connector.
Moving into the connector directory
There is nothing specific or different for our connector.
Setting the environment variables
In the start_connName.bat script, we must provide any of the
connector-specific information that the environment variables listed in
Table 23-4 specify.
Table 23-4 Environment variables in the connector startup script
Here we have our own environment variable of RED_MAINT for the library
files for the back-end adapter API. Ensure that this variable is
concatenated with the JCLASSES.
We also specify the language-specific startup parameters required for a
Java connector to specify connector-specific classes
(CONNPACKAGENAME):
com.ibm.itso.RedHouse.RM.Adapter.RMAgent
Variable name Value
ExtDirs None
JCLASSES Specify any application-specific jar files. Jar files
are separated with a semicolon (;). See below
JVMArgs None
LibPath None
Chapter 23. Packaging the custom adapter for distribution 409
Invoking the connector
To actually invoke the connector within the JVM™, the start_connName.bat
script usually calls the start_adapter.bat script. The start_adapter.bat script
provides information to initialize the necessary environment for the connector
run-time (which includes the Adapter Framework) with its startup parameters.
We do not have any of the external variables that require setup. Those
variables that are not set as part of our system environment are set by the call
to the CWConnEnv environment setup utility.
We are making the call to start the adapter from within our
start_RMConnector.bat file as shown in Example 23-2.
Example 23-2 Adapter start
%CWJAVA% -mx128m %ORB_PROPERTY% -Djava.security.policy=policy.txt
-Djava.ext.dirs="%MQ_LIB%";%JRE_EXT_DIRS%
-Djava.library.path="%CROSSWORLDS%"\bin;%CONNDIR%;"%MQ_LIB%";%JRE_EXT_DIRS%
-Duser.home="%CROSSWORLDS%" -cp %JCLASSES%;%CONNDIR%\%CONNAME%.jar;
AppEndWrapper -l%CONNPACKAGENAME% -n%CONNAME%Connector -s%SERVER% %3 %4 %5
When we start the connector, we pass the following parameters:
The name of connector definition: -n (RM)
The name of the broker instance: -s (WMQI_WAS)
The location of the local connector configuration file: -c
C:\IBM\WebSphereAdapters\connectors\RM\RMConnector.cfg
Note: The Java security policy parameter uses a file named policy.txt. This
file sets the security permissions and is included in the Additional
Materials. Copy this file to the RMConnector directory with all of the other
required files.

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.