Adding objects for MobiLink synchronization

About MobiLink

MobiLink is a session-based synchronization system that allows two-way synchronization between a main database, called the consolidated database, and multiple remote databases. You use the MobiLink Synchronization for ASA wizard on the Database tab of the New dialog box to create objects that make it easy to control database synchronization from a PowerBuilder application.

This section describes the MobiLink synchronization wizard and the objects it creates. For more detailed information about synchronization from PowerBuilder applications, see the chapter on MobiLink synchronization in Application Techniques.

What the wizard generates

You use the MobiLink synchronization wizard to create a nonvisual user object, a global external function, and a structure for holding database connection parameters. These objects make it easier to add database synchronization capabilities to a PowerBuilder target. By default, the wizard also adds two windows and a second global function, but these objects are optional.

Table 16-7 shows objects that can be generated by the wizard, listed by their default names, where appname stands for the name of the current application.

Table 16-7: Objects generated by MobiLink Synchronization wizard

Default name

Description

nvo_appname_sync

Nonvisual user object that starts synchronization from the remote client.

gf_appname_sync

Global function that instantiates nvo_appname_sync to start the synchronization. This function includes the logic to start the synchronization with or without a feedback window.

s_appname_sync_parms

Global structure used to store runtime information, such as connection parameters entered by the user in the w_appname_sync_options window.

w_appname_sync or w_sync_default_feedback

Optional feedback window that can be used to display synchronization status to the client instead of the standard MobiLink status window. Even if you do not use the optional status window, a generated feedback window must be instantiated by the gf_appname_sync function.

gf_appname_configure_sync

Optional global function that calls the w_appname_sync_options window, which allows the user to configure the dbmlsync client.

w_appname_sync_options

Window that allows the application user to change connection arguments at runtime.

Using a desktop database profile

Some information that you enter in the wizard is optional, but other information is required. The wizard prompts you for a database profile, which it uses to establish a connection to a remote database on the desktop. If you are not testing a connection on the desktop, you can select the option to proceed without a database connection and ignore the database profile field.

A database profile is required for automatic retrieval of publication names in the database. A publication is a database object describing data to be synchronized. A publication, along with a synchronization user name and a synchronization subscription, is required for MobiLink synchronization.

Selecting publication names

The wizard lets you select multiple publication names if they exist in the remote database defined by the connection profile. There must be subscriptions associated with the publication in order for them to display in the publication selection list.

If you selected the option to proceed without a database connection, the wizard prompts you to type a publication name (or a comma-separated list of publication names) in the MobiLink Client Publication wizard page instead of prompting you to select publication names retrieved from the database.

For more information about publications, see the MobiLink Synchronization User’s Guide on the Technical Library CD or the SQL Anywhere Studio online Help.

Overriding registry settings on the client machine

By default, information you enter in the wizard is saved in instance variables in the nvo_appname_sync user object that the wizard generates. This information includes values that you select for MobiLink logging and command line options and the MobiLink server and port. Prior to synchronization, the values of these instance variables can be modified with values entered by an application user in the nvo_appname_sync_options Options window. The first time synchronization is run, values of the instance variables are entered into the client machine registry. The next time the application is run, this information is available for retrieval from the registry.

The MobiLink Synchronization for ASA wizard has an optional Override Registry Settings screen that allows you to override client registry settings. When you enable runtime overrides to the client registry settings, you must assign a build number to the objects generated by the wizard.

The build number you assign can be any positive numeric value. To override the registry settings, the build number you assign must be higher than the build number in the registry, if there is one. Registry settings will be used if the build number in the registry is equal to or lower than the build number in the is_sync_object_bld instance variable of the nvo_appname_sync user object that the wizard generates.

The Override Registry Settings screen of the wizard displays only if you do not clear the default option (on the Optional Runtime Configuration Objects screen) to prompt the application user for password and runtime changes. If, however, you select the option to disallow runtime overrides to the synchronization, the wizard does not display the Override Registry Settings screen and does not generate the w_appname_sync_options Options window.

Wizard options

MobiLink Synchronization for ASA wizard options are listed in Table 16-8.

Table 16-8: MobiLink Synchronization for ASA wizard options

Option

Description

Destination library

Lets you select the target PBL file where you want to generate the MobiLink synchronization objects.

Desktop database connection

Lets you select a PowerBuilder database profile or proceed without a database connection.

Publication name

Lets you select a publication (or multiple publications) if you specified a database profile for a desktop database connection. If you did not, you can type the name of a publication you want to synchronize.

Override registry settings

Lets you override client registry settings with values that you (or the application user) select for MobiLink logging and command line options, and the MobiLink server and port for the application

Client logging options

Specifies what information gets written to the synchronization log and whether you save the information to a log file.

Additional command line options

Adds the options you specify to the command line for starting the MobiLink synchronization client. You can click the Usage button to see a list of valid options.

Extended options

Adds extended options you specify. You do not need to enter the “-e” switch for extended options in this field. You can click the Usage button to see a list of valid extended options.

Single quotes must be used for any extended option values requiring quotation marks. You must separate multiple options with semicolons; for example:

scn=on;adr='host=localhost;port=2439'

Host

Sets the host information for connecting to the MobiLink Synchronization Server. If you enter a value for this field, it overrides any value set in synchronization subscriptions and in the Extended Options field.

Port

Sets the port for connecting to the MobiLink Synchronization Server. The default port for MobiLink is 2439. The value you enter for this field overrides any value set in synchronization subscriptions and in the Extended Options field.

For more information about a wizard option, click inside the option field and press F1 for online Help.

StepsTo add objects for MobiLink synchronization

  1. Select File>New from the PowerBuilder menu bar.

  2. Click the Database tab, select the MobiLink Synchronization for ASA wizard, and click OK.

  3. Follow the instructions in the wizard, providing the information the wizard needs.

    On the last page of the wizard, make sure the Generate To-Do List check box is selected if you want the wizard to add items to the To-Do List to guide and facilitate your development work.

  4. When you are satisfied with your choices in the wizard, click Finish.

    The wizard generates objects that you can use for database synchronization.

    For information about using the generated objects to synchronize a target database, see the chapter on MobiLink synchronization in Application Techniques.