View source | Discuss this page | Page history | Printable version   
Main Page
Upload file
What links here
Recent changes

PDF Books
Add page
Show collection (0 pages)
Collections help


Overview of the Mobile Server Controller API



This document gives an overview of the important parts of the mobile server controller api which is relevant for developing store and multi-server aware logic.

Installing the how to module

The store server howto modules provides good examples of the usage of the mobile server controller api. This howto can be found in the Store Server Howto module. The howto module can be downloaded using the hg clone command in the modules directory:

 hg clone

After this execute the 'ant smartbuild -Dlocal=no' command in the main project directory.

Main API: MobileServerController, MobileServerRequestExecutor, etc.

The main api is implemented by two types of classes, utility classes and classes which can be extended to hook into the OB logic or make use of default behavior.

Important utility classes:

Classes which are relevant to extend:

API Usage Examples

Obtaining the mobile server state

It can be important in your code to see what the current status is of a server. Here is a small code sample showing how to do that.

MobileServerState serverState = MobileServerController.getInstance().getThisMobileServerState();

Note that an enum is returned: MobileServerState.

Sending a request to the central server

For sending a request to the central server you can make use of the MobileServerRequestExecutor class. The request/execute methods in this class help to do service calls to another server. A main feature is that the system will take care of authentication. The main methods are:


Here is an example of calling a service:

            + "org.openbravo.retail.storeserver.howto.central.CheckProductCentral", json);

Detecting if the code runs in the store or central server

The code below shows how to check if your code is running in a central server or in a store server. The MobileServerController provides the main api to use.

if (MobileServerController.getInstance().isThisACentralServer()) {
  System.err.println("This is a central server");
if (MobileServerController.getInstance().isThisAStoreServer()) {
  System.err.println("This is a store server");

Retrieved from ""

This page has been accessed 2,138 times. This page was last modified on 11 June 2019, at 18:49. Content is available under Creative Commons Attribution-ShareAlike 2.5 Spain License.