Control Unit Browser

The Control Unit Browser is designed for employing, diagnostics and test of control units (see "Control Unit Admin Bundle"). It is designed as a servlet, packed as an OSGi-compliant bundle.

Contents:


Bundle Information

Bundle JAR

The JAR of the Control Unit Browser bundle is cubrowser.jar located in the bin/tools/framework/cu/browser installation directory.

Import

Package Exporter Description
com.prosyst.mbs.services.useradmin Contains the Simple Login service for password-based authentication.
com.prosyst.util.encode ProSyst Util Bundle/
ProSyst Util Full Bundle
Contains the Base64 utility.
javax.servlet Hosts the components of the Java Servlet API 2.2, supported by the HTTP Bundle.
javax.servlet.http
org.mbs.services.cu Contain the APIs of the control unit paradigm.
org.mbs.services.cu.spi
org.mbs.services.metatype ProSyst Metatype Bundle Contains the ProSyst Metatype API.
org.osgi.service.cm Contains the OSGi Configuration Admin service implemented by the Config Bundle.
org.osgi.service.http Holds the components of the HTTP Service as defined in the OSGi HTTP Service Specification API. The HTTP Bundle offers an implementation of the OSGi HTTP Service.
org.osgi.service.metatype Contains the OSGi Metatype API, supported by the ProSyst Metatype Bundle.
org.osgi.service.useradmin Contains the OSGi User Admin API, implemented by the User Admin Bundle.
org.osgi.util.tracker The OSGi Service Tracker Package.

Export

The Control Unit Browser bundle exports no packages for use by other bundles.

Starting the Control Unit Browser

This chapter provides the steps to take in order to install the Control Unit Browser and launch it in a Web browser.

Note: In the described starting procedure, bundle JAR file installation is done through the mBS's text console. If you prefer, you can use the user-friendly interface of the mConsole to perform this operation.

Except for the Control Unit Admin Bundle, all bundles the Control Unit Browser depends on (see the "Import" section) are included in the base bundle configuration of mBS and are started by default unless additionally set otherwise. This suggests that the Control Unit Admin Bundle, whose JAR file is bundles/cuadmin.jar, should be explicitly installed and started in the OSGi framework.

  1. Install the Control Unit Admin Bundle (bundles/cuadmin.jar) or make sure it is active.
    i -s cuadmin.jar
  2. Install the Control Unit Browser bundle by using its JAR file (bin/tools/framework/cu/browser/cubrowser.jar).
    i -s cubrowser.jar
  3. To launch the Control Unit Browser in a Web browser, go to the following URL:

    http://<framework_host>/controlunit

  4. In displayed authentication dialog, specify the name and password of a user account saved in the OSGi User Admin service. Initially, you can use the default account "admin" with password "admin".

    If the OSGi User Admin service is not available in the framework, a user can login as anonymous with an empty password. This is possible only if the mbs.useradmin.anonymousConnect system property is true, and the user name is null or an empty String.

Using the Control Unit Browser

This section will help you to get more familiar with the Control Unit Browser and its usage.

When the Control Unit Browser is launched, it searches the OSGi framework for control unit instances and displays them in a tree in the left browser frame.

General Description of the Control Unit Tree

The main nodes in the control unit tree are the control unit instances. Depending on user's preferences, control units can be displayed with their type, name and ID. When a node is selected, its properties taken from the control unit's metadata appear in the right frame.

Figure 1: Control unit tree.
Legend :
Control unit type.
Control unit instance.
Control unit state variable.
Control unit action.

The Control Unit Browser shows the state variables and actions as children of the corresponding control unit node. Double click a type node or unit node to expand/collapse it and view/hide respectively control unit instances or state variables and actions.

To refresh the control unit tree content, click the Control Units link or refresh the page.

Control Unit Type Information

In case viewing control unit types is enabled (the Type preference is checked), for a selected type you can view its immediate subtypes along with their descendants down to the bottommost type.

Control Unit Information

For a selected control unit, the Control Unit Browser shows its ID, name, type and description, as specified in control unit's metadata. The Control Unit Browser also shows the IDs of parent and child control units of the chosen one along with links to the data available for them. Note that parents are shown with their ancestors up to the topmost control unit in the hierarchy, as well as children - with their descendants down to the bottommost control unit.


Figure 2: Control unit properties.

State Variable Information

A state variable represents a unit-specific parameter and has an ID, unique within the control unit scope. For a selected state variable, the Control Unit Browser shows the metadata of the state variable including its ID, name, data type, etc.


Figure 3: State Variable Properties.

You can add a listener to receive notifications when the value of a selected state variable changes by using the Add a listener command.


Figure 4: Receiving state variable events.

Viewing and Invoking Actions

The actions of a control unit are operations that the control unit supports for changing its state, e.g. turning a lamp on and off, resetting a clock, etc. An action can have input and/or output arguments.

For an action, the Control Unit Browser displays information based on the action's metadata, including its input/output arguments, as well as provides an interface for action execution.


Figure 5: Viewing action properties.

To invoke an action, enter input data and click Execute. As a result, the Control Unit Browser will redirect the action execution to the Control Unit Admin and will show action's output if output arguments are defined.

Issue on Constructor, Destructor and Finder Actions

The Control Unit Browser invokes control unit actions by using the invokeAction method of the Control Unit Admin. Constructor, destructor and finder actions are called by using other Control Unit Admin methods (see "Control Unit Admin Bundle") and are therefore not supported by the Control Unit Browser.

Specifying Arrays, Vectors and Dictionaries as Action Input

The Control Unit Browser converts action input supplied by the user as text to appropriate data format. For more complex data types, such as dictionary, array and vector (see "Control Unit Admin Bundle"), the Control Unit Browser supports a special syntax for definition of such data:

Turning User Authentication On and Off

The Control Unit Browser can be configured to require or not require user authentication at calling the tool from a Web browser (see step #4 from "Starting the Control Unit Browser"). The configuration can be done over the OSGi Configuration Admin service - most conventiently by using the mConsole or the config console commands. Control Unit Browser's configuration properties are exported under the mbs.cu.browser PID and the "Control Unit Browser Configuration" configuration name.

References


Control Unit Tools