Custom system service

This document describes how to create your own system service for a Nexaweb Java application.

The major steps to create your own system service include the following:

  1. Get ClientSession.
  2. Get SystemContainer.
  3. Construct the new system service object.
  4. Add new system service object to the SystemContainer.

Getting ClientSession

Nexaweb recommends using AbstractMCO as the base class for a system service.

To get the ClientSession from the AbstractMCO class use:

getSession()

Getting SystemContainer

To get the SystemContainer use:

getSystemContainer()

Constructing Object

To construct a new system service object specify a line similar to the following:

MySystemService myService = new MySystemService();

MySystemService.java .  .  .

Adding Object to Container

To add the system service object to the SystemContainer specify a line similar to the following:

SystemContainer.put("myServiceName", myService);

Putting It Together

import AbstractMCO getSession() getSystemContainer() MySystemService myService = new MySystemService(); MySystemService.java . . . SystemContainer.put("myServiceName", myService);

Calling SystemContainer From UI

To call a SystemContainer from an event handler in the UI, you specify, for example:

<button text="Call service test method" onCommand="myServiceName.test()" />

Note: Since the system service object is in a top-level container, you do not need to use mco: to call it.