This topic describes how to
develop the DB2 Everyplace ISYNC4J for MIDP with ANT and the Sun Wireless
Toolkit Command Line.
Prerequisites
Download and install the following software to work with the examples provided:
- Sun Microsystems JavaTM 2 Platform Micro Edition, Wireless Toolkit
- Apache ANT
- RetroGuard Ofuscator
Procedure
- Optional: Recompile the demos if you want to modify them.
The lib directory contains precompiled JAD and JAR files. The build.bat and build.xml scripts are provided
to illustrate the use of Apache ANT, the DeployManifest tool, and the RetroGuard
obfuscator.
- Add retroInstallDir\lib\retroguard.jar to
your CLASSPATH variable. Set the following variables in your environment:
- ANT_HOME - to the root of your ANT installation
- DB2m_HOME - to the %DSYINSTDIR%\Clients\Midp directory
- J2MEWTK_HOME - to the root of your Sun Wireless Toolkit installation
- JAVA_HOME - to the root of your jdk13 or jdk131 (only) installation
- JAVA14_HOME - set to the root of your jdk14 directory.
- Execute the build.bat file in the root of
the MIDP clients directory to re-populate the lib directory under MIDP with new JAR and JAD files. There is one JAR file
and several JAD files for each user and device id configuration.
You will
find several new build\*classes directories, which are used for pre-verification
and obfuscation. There is one JAR file and several JAD files for each user
and device ID configuration. View the JAD files to see how the user ID, password,
and device ID are set and passed into the MIDLet application.
- The DeployManifest class is included in the lib\FilterServlet*.jar and
is called from the build.xml file. Use this class
to generate both the JAR Manifest file and the JAD file. Use the following
syntax when generating the files.
To generate the Manifest file:
java DeployManifest -m <midletName> <className> <imageFileName> <outputfileName>
To generate the JAD file:
java DeployManifest -j <midletJarName> -U <uploadMaxPacket> -D \
<downloadMaxPacket> -n <numClients> <JadBaseName> <outputFileName>
- The DeployManifest class is called internally from build.xml by Apache ANT. Edit the setJad entries in the build.xml file to permanently change the user ID, password or other attributes.
The default is nurse1 and nurse1.
- Run the insync4j application.
The DB2 Everyplace installation creates
a Vnurse database with subscription sets, users, and groups.
- Select Start -> DB2 Everyplace -> Start MDAC and verify that a user named nurse1 exists. The password of
this user is set to nurse1. You can use this user name, or you can
edit the lib\<midlet>.jad file that you are
passing to the run script. Note that each time you compile your changes,
the JAD files are overwritten. See samples\DeployManifest.java to change the user and password permanently.
-
You must start the Sync Server using either Tomcat or Websphere Version
4.0 or later. HTTP Connections from MIDP phones use HTTP Transfer-encoding,
which requires a servlet engine that supports the HTTP Servlet 2.3 specification
and HTTP 1.1.
- Execute the BATCH file in the Midp\bin directory
passing it the name of a JAD file from the Midp\lib dir:
- To run the non-debug version of the demo, type:
run VNurse
- To run the debug version using "nurse3" as the user ID and password for
device # 213, type:
run VNurseDebug3
The J2ME MIDP Sync Client uses the interfaces and classes that are defined
in the com.ibm.mobileservices.isync.midp as well as those in the com.ibm.mobileservices.isync
and com.ibm.mobileservices.isync.event packages.
Related tasks
Related reference