Skip Headers
Oracle® Java ME Embedded Application Management System API Guide
Release 3.4
E35109-03
  Go To Table Of Contents
Contents
Go To Index
Index

Previous
Previous
 
Next
Next
 

2 Application and Library Suites

This chapter introduces the basic data interfaces used throughout the AMS APIs.

The SuiteInfo Interface

All apps, libraries, and links maintain a basic set of identification and state information that acts as a descriptor. This descriptor is represented by an implementation of the SuiteInfo interface.

Suites can be one of four types, as shown in Table 2-1:

Table 2-1 AMS Suite Types

Suite Type Description

ST_APPLICATION

The suite contains one or more MIDlets with an entry point that can be executed by the AMS.

ST_LIBRARY

The suite is a library that can be used by one or more applications.

ST_LINK

The suite is a link, which references another application that has yet to be downloaded.

ST_INVALID

The suite is invalid and cannot be found or executed.


In addition, suites contain five binary flags that describe their state, as shown in Table 2-2:

Table 2-2 AMS Suite States

State Description

STATE_AVAILABLE

The suite is available for use.

STATE_ENABLED

The suite is enabled. When a suite is disabled, any attempt to run application or use a library from this suite should fail.

STATE_HIDDEN

The suite is hidden, and should not be visible to the user.

STATE_REMOVE_DENIED

The suite should not be removed.

STATE_UPDATE_DENIED

The suite should not be updated.


The suite state flags are not enforced by the AMS APIs. In other words, even though the STATE_REMOVE_DENIED or STATE_UPDATE_DENIED flags may be set to true, the AMS APIs do not prevent a removal or update if the appropriate method is invoked. It is up to the UI that implements the AMS APIs to enforce this behavior.

Programmers can use the getState() method to obtain the state information for the suites, then use the logical AND operator (&) to test if a given state is true. For example, to test if a suite is disabled:

if ((appSuite.getState() & SuiteInfo.STATE_DISABLED) != 0) {
        //  The app is disabled
}

The SuiteInfo interface contains the following methods to access basic information about a suite. Many methods throw a SuiteNotFoundException if the AMS can no longer locate the suite described by the SuiteInfo:

AppSuite Interface

The AppSuite interface extends the SuiteInfo interface, and is used to describe executable apps that are installed in the Oracle Java ME Embedded.

Apps can be one of three types: regular apps, system apps, or preinstalled apps, as shown in Table 2-3:

Table 2-3 Application Suite Types

Type Description

AT_PREINSTALLED

The application suite is preinstalled.

AT_REGULAR

A normal application suite.

AT_SYSTEM

A system application suite.


To determine the type that this suite belongs to, use the getType() method, int getType() throws SuiteNotFoundException. This method returns the type of the suite as one of the predefined constants shown in Table 2-3. If the suite can no longer locate information about the app referenced by this descriptor, this method throws a SuiteNotFoundException.

The programmer can also obtain more detailed information about the suite with the following methods:

In addition, you can use the AMS to start the app as a running task with either of the following methods:

LibSuite Interface

The LibSuite interface is used to provide descriptive information about a library suite that has been installed on the system. A library suite can have one of two types: regular and system, as shown in Table 2-4. Library suites can only be installed on a system if there is an application that has a dependency on them. See AppSuite.getDependencies() for more information.

Table 2-4 Library Suite Types

Type Description

LT_REGULAR

A regular application library.

LT_SYSTEM

A system library.


To determine the type that this suite belongs to, use the getType() method, int getType(). This method returns the type of the suite as one of the predefined constants shown in Table 2-4 above.

SuiteSetting Interface

The SuiteSetting interface provides the data for a single suite setting. Each setting has an optional title to be displayed to user, an optional description, and number of choices. For example, the following represents a possible suite setting:

Title:
               Check for New Mail
Description:
               How often should the application check for new mail?
Choices:
               -Every 5 Minutes
               -Every 10 Minutes
               -Every 30 Minutes
               -Every Hour
               -Only When Requested

The following methods are provided by the SuiteSetting interface:

SuiteSettingsGroup Interface

SuiteSettingsGroup is an interface for a logical group of settings. Each group has an optional title, an optional description, and contains several individual settings defined using the SuiteSetting interface in "SuiteSetting Interface". Each SuiteSettingsGroup can be part of a larger SuiteSettings object, defined in "SuiteSettings Interfaces".

SuiteSettings Interfaces

The SuiteSettings interface provides access to several SuiteSettingsGroup objects. Do not confuse the SuiteSettings (note the plural) object with the SuiteSetting object defined in "SuiteSetting Interface".

The SuiteSettings interface provides the ability to save the settings to persistent storage using the save() method. Before doing so, however, the programmer must call the checkForError() method to ensure that no settings, especially those from other MIDlet suites, contain a mutually exclusive combination with settings in this object.