8/11

# 5 Using the Packaging Wizard

The following sections enable you to package and publish your mobile application definitions using the Packaging Wizard.

- Section 5.1, "Using the Packaging Wizard"

- Section 5.2, "Packaging Wizard Synchronization Support"

## 5.1 Using the Packaging Wizard

After you have completed the code implementation for your application, you need to define the SQL commands that retrieve the data for the user snapshot—also known as a publication. MDW (as described in Chapter 4, "Using Mobile Database Workbench to Create Publications") is a graphical tool that enables you to define the publications for your application. Then, use the Packaging Wizard to package the application and publish the final application product to the mobile server to complete the subscription.

In general, you can create a publication—or components of a publication—using one of the following methods:

- SQL on the back-end Oracle database

- Consolidator APIs

- MDW

- Packaging Wizard

Note:

If you create your publication using the Packaging Wizard, you cannot use remote databases for your application.

If you create the publication using any method other than the Packaging Wizard, you can import the definition into the Packaging Wizard. However, these tools and the Packaging Wizard are separate. Thus, once the publication is published by the Packaging Wizard, you can only modify it through the Packaging Wizard.

Important: If you modify the publication or any component of the publication using any method other than the Packaging Wizard, then it not show up in your published application.

The following is the recommended method for creating the publication for the application:

- Create a new mobile application definition—An application definition is more than the code that you have implemented. It consists of the implementation, the publication with its publication items, and other components. Use the Mobile Database Workbence (MDW) tool (as described in Chapter 4, "Using Mobile Database Workbench to Create Publications" for performing an iterative approach to defining your publications.

- Edit an existing mobile application definition within the Packaging Wizard—You can always go back and edit an existing mobile application definition for tuning purposes, to modify the publication, or other reasons.

- Package a mobile application definition for easy deployment within the Packaging Wizard—Once the application is finished with development, you need to package the components into a JAR file before you can publish the application definition.

- Publish an application definition to the mobile server—You can either publish your application definition to the mobile server with the Packaging Wizard or through the Mobile Manager.

The following sections describe how to use the Packaging Wizard tool:

- Section 5.1.1, "Starting the Packaging Wizard"

- Section 5.1.2, "Specifying New Application Definition Details"

- Section 5.1.3, "Listing Application Files"

- Section 5.1.4, "Publish the Application"

- Section 5.1.5, "Editing Application Definition"

- Section 5.1.6, "Troubleshooting"

### 5.1.1 Starting the Packaging Wizard

To launch the Packaging Wizard, enter the following using a Command Prompt window.

`runwtgpack`

Note:

If you enable the mobile server to be SSL-Enabled, then you have to change the configuration on the host where the Packaging Wizard is located in order for it to successfully communicate with the mobile server.

In order for Packaging Wizard to be SSL-Enabled, set the `SSL` parameter to `TRUE` in the `mobile.ora` file located on the host where the MDK is installed.

Figure 5-1 shows the Welcome screen for the Packaging Wizard, which enables you to create, edit, or remove the mobile application definition as described fully in Table 5-1.

Figure 5-1 Packaging Wizard - Make A Selection Dialog

Description of "Figure 5-1 Packaging Wizard - Make A Selection Dialog"

Table 5-1 Make a Selection Dialog

Feature | Description
--- | ---
Create a new application definition | Define a new mobile application definition with the application implementation, publication items, and so on.
Edit an existing application definition | Edit an existing mobile application definition. When selected, all existing application definitions are presented in a drop-down box. Users can select the desired mobile application definition from the list. All applications listed in this list have been created or published using the Packaging Wizard. Any application definition created by MDW not appear in this list.
Remove an existing application definition | Remove an existing mobile application definition. When selected, all existing application definitions are presented in a drop-down box. Users can select the desired mobile application definition from the list. This option removes the application definition from the Packaging Wizard; it does not delete the application from within the mobile server.
Open a Packaged application definition | Select an application definition that has been packaged a JAR file. You can enter the name of the packaged application or locate it using the 'Browse' button.

Click OK. This brings up the 'Select the client application attributes' dialog, with which you want to package your application definition. As Figure 5-2 displays, this dialog has a radio button group from which you can specify the database type, a pull-down menu from which you can specify the platform, and a pull-down menu from which you can specify the locale. The available platforms in the Platform pull-down menu only provide those options which are applicable to the selected database type.

For Berkeley DB, the available platform options are as follows:

- Java All Platforms stands for all Java platforms where BDB Java client is available

- Windows 32/64 stands for BDB WIN32 in the Mobile Managerd

- Linux 32/64 stands for BDB Linux x86 in the Mobile Manager

- Windows CE/Mobile ARMv4i stands for BDB PPC60 ARMV4I in the Mobile Manager

- Android stands for BDB Android in the Mobile Manager

For SQLite, the available platform options are as follow:

- Java All Platforms stands for all Java platforms where SQLite Java client is available

- Windows 32/64 stands for SQLite WIN32 in the Mobile Manager

- Linux 32/64 stands for SQLite Linux x86 in the Mobile Manager

- Windows CE/Mobile ARMv4i stands for SQLite PPC60 ARMV4I in the Mobile Manager

- Android stands for SQLite Android in the Mobile Manager

- BlackBerrystands for SQLite BlackBerry in the Mobile Manager

Once selected, click Next.

Figure 5-2 Select a Platform Dialog

Description of "Figure 5-2 Select a Platform Dialog"

### 5.1.2 Specifying New Application Definition Details

The Application dialog enables you to name a new application and specify its storage location on the mobile server.

Figure 5-3 Application Dialog

Description of "Figure 5-3 Application Dialog"

Table 5-2 describes the Application dialog.

Table 5-2 Application Dialog Description

Field Name | Description | Required
--- | --- | ---
Application Name | The name of the new mobile application definition. | Yes
Virtual Path | A path that is mapped from the root directory of the server repository to the mobile application itself. The virtual path eliminates the need to refer to the application entire directory structure. It indicates that all of the subdirectories and all of the files that are in the virtual path be uploaded exactly as they are in the directory structure to the mobile server repository when the application is published. It also provides the application with a unique identity. The name that you enter as the virtual path of the application becomes the application root directory within the mobile server repository, when the application is published. Consequently, you can specify the application root directory by the name that you enter in the virtual path field. This name can be different from the application name, but should not contain spaces. For example, your application name can be 'Sales Office' and your virtual path '/Admin'. In this case, '/Admin' becomes the name of the application root directory within the mobile server repository. The application root directory is the location where the actual application files are stored within the mobile server repository. When the administrator publishes the application, the Packaging Wizard automatically uses the name that you entered in the virtual path as the name of the application root directory in the mobile server repository. However, the administrator can change the name of the application root directory in the mobile server repository by entering a different name for it when the administrator publishes the application. | Yes
Description | A brief description of the mobile application. | Yes
Local Application Directory | The directory on the local machine that contains all components of the application. You can type this location or locate it using the 'Browse' button. During development, the application root directory is set to the local application directory. | Yes
Publication Name | Publication name of an existing application in the mobile server repository. You can enter the publication name or locate it using the Browse button. | No

Click Next to advance to the next screen.

### 5.1.3 Listing Application Files

Use the Files screen to list your application files and to specify their location on the local machine. The Packaging Wizard analyzes the contents of the Local Application Directory and displays each file's local path.

Figure 5-4 displays the Files screen.

Figure 5-4 Files Tab

Description of "Figure 5-4 Files Tab"

Table 5-3 Files Tab Description

Field | Description | Required
--- | --- | ---
Local Path | The absolute path of each mobile application file. Each entry on the list includes the complete path of the individual file or directory. | Yes

You can add, remove, or load any of the files that are listed in the 'Files' dialog. If you are creating a new application, the Packaging Wizard automatically analyzes and loads all files listed under the local directory when you proceed to the 'Files' dialog. If you are editing an existing application, upload your individual application files using the 'Load' button.

When you click the 'Load' button, the 'Input' dialog appears. You can use the 'Input' dialog to create a comma-separated list of filters that either include or exclude application files from the upload process. To exclude a file, type a preceding minus sign (-) before the file name. For example, to load all files but exclude files with the `.bak` and `.java` suffixes, enter the following.

`*,-*.bak,-*.java`

Figure 5-5 displays the Input dialog.

Figure 5-5 Input Dialog

Description of "Figure 5-5 Input Dialog"

Once you have loaded all relevant files, click Finish to complete the packaging and start the publishing of your application.

### 5.1.4 Publish the Application

Once the packaging is complete, the Packaging Wizard brings up the following screen, so you can choose whether to start the publishing or to complete the packaging to be published at another time.

Figure 5-6 Publish the Application

Description of "Figure 5-6 Publish the Application"

On this screen, you can choose one of the following:

- Create files: You can package all of the information you have gathered for the application and its files into a JAR file and you can generate all scripts for the application's database objects. This JAR file can be used at a future date to be published to any mobile server repository.

  If chosen, you be asked for a location on where to store the JAR file.

- Publish the current application: This publishes all of the information you have gathered for the application and its files directly to the mobile server repository.

  If chosen, you be prompted for the URL, user name and password for the mobile server repository. You also be asked for the repository directory and if you want to make this application public.

- Restart wizard: This does not save any of your work for this application and starts the Packaging Wizard without any saved data.

### 5.1.5 Editing Application Definition

You can edit application definitions by launching the Packaging Wizard and selecting "Edit an existing application definition."

### 5.1.6 Troubleshooting

The Packaging Wizard also supports development mode. In this mode, the Packaging Wizard only enables you to define application information, list the application files, and make registry changes. Since the application is packaged to your local machine, it requires neither connectivity nor database information.

To launch the Packaging Wizard in development mode, enter the following using the Command Prompt.

`runwtgpack -d`

## 5.2 Packaging Wizard Synchronization Support

The Packaging Wizard and the Mobile Manager provide the ability to perform the most commonly used functions of the publish and subscribe model, package and publish applications, create or drop users, and create or drop subscriptions. More sophisticated functionality is provided by the Consolidator Manager and Resource Manager APIs. Table 5-4 describes basic features.

Table 5-4 Packaging Wizard Synchronization Support

Function | Packaging Wizard | Mobile Manager | API
--- | --- | --- | ---
Open Connection | No | No | Yes
Create User | No | Yes | Yes
Drop User | No | Yes | Yes
Create Publication | Yes | No | Yes
Create Publication Item | Yes | No | Yes
Create Publication Item Index | Yes | No | Yes
Drop Publication | No | Yes | Yes
Drop Publication Item | Special - See the Packaging Wizard documentation for more details. | No | Yes
Drop Publication Item Index | Yes | No | Yes
Create Sequence | Yes | No | Yes
Create Sequence Partition | Yes | No | Yes
Drop Sequence | Yes | No | Yes
Drop Sequence Partition | Yes | No | Yes
Add Publication Item | Yes | No | Yes
Remove Publication Item | No | No | Yes
Create Subscription | No | Yes | Yes
Deinstantiate Subscription | No | No | Yes
Set Subscription Parameter | No | Yes | Yes
Drop Subscription | No | Yes | Yes
Commit Transaction | No | No | Yes
Rollback Transaction | No | No | Yes
Close Connection | No | No | Yes

More advanced features of Data Synchronization are only generally available by using the Consolidator Manager and Resource Manager APIs. Table 5-5 describes these features.

Table 5-5 Data Synchronization Advanced Function Description

Function | Packaging Wizard | Mobile Manager | API
--- | --- | --- | ---
Create Virtual Primary Key Column | Yes | No | Yes
Drop Virtual Primary Key Column | Yes | No | Yes
Add Mobile DML Procedure | Yes | No | Yes
Remove Mobile DML Procedure | Yes | No | Yes
Reinstantiate Publication Item | No | No | Yes
Parent Hint | Yes | No | Yes
Dependency Hint | Yes | No | Yes
Remove Dependency Hint | Yes | No | Yes
Enable Publication Item Query Cache | No | No | Yes
Disable Publication Item Query Cache | No | No | Yes
Primary Key Hint | Yes | No | Yes
Purge Transaction | No | No | Yes
Execute Transaction | No | No | Yes
Complete Refresh | Yes | Yes | Yes
Execute Statement | No | No | Yes
Generate Metadata | No | No | Yes
Reset Cache | No | No | Yes
Cache Dependencies | No | No | Yes
Remove Cache Dependencies | No | No | Yes
Get Current Time | No | No | Yes
Authenticate | No | Yes | Yes
Set Restricting Predicate | No | No | Yes
Alter Publication | Yes | No | Yes