Generating Java Object API Code

Use the Code Generation Utility to generate object API code, which allows you to use APIs to develop device applications for Android devices.

Prerequisites
  • Use Unwired WorkSpace to develop and package your mobile business objects. See Sybase Unwired WorkSpace - Mobile Business Object Development > Develop > Developing a Mobile Business Object.
  • Deploy the package to Unwired Server, creating files required for code generation from the command line. See Sybase Unwired WorkSpace - Mobile Business Object Development > Develop > Packaging and Deploying Mobile Business Objects >Automated Deployment of Unwired WorkSpace Projects
Task
  1. Locate <domain name>_package.jar in your mobile project folder. For the SUP101 example, the project is deployed to the default domain, and the deploy jar file is in the following location: SUP101\Deployment\.pkg.profile\My_Unwired_server\default_package.jar.
  2. Make sure that the JAR file contains this file:
    • deployment_unit.xml
  3. Use a utility to extract the deployment_unit.xml file to another location.
  4. From <UnwiredPlatform_InstallDir>\MobileSDK\ObjectAPI\Utils\bin, run the codegen.bat utility, specifying the following parameters:
    codegen.bat -java -client -android -ulj deployment_unit.xml [-output <output_dir>] [-doc]
    • The -output parameter allows you to specify an output directory. If you omit this parameter, the output goes into the <UnwiredPlatform_InstallDir>\MobileSDK\ObjectAPI\Utils\genfiles directory, assuming codegen.bat is run from the <UnwiredPlatform_InstallDir>\MobileSDK\ObjectAPI\Utils\genfiles directory.
    • The -doc parameter specifies that documentation is generated for the generated code.
    Ignore these warnings:
    log4j:WARN No appenders could be found for logger ...
    log4j:WARN Please initialize the log4j system properly.