An internal API for installing, loading, and removing MIDlet suites.

## MIDlet Suite Storage

The MIDlet Suite Storage component is responsible for the following:

- Persistently stores MIDlet suites
- Manages all the MIDlet suites' information
- Provides a way to load a MIDlet

Each MIDlet suite in persistent storage (each installed MIDlet suite) is uniquely identified by a storage name constructed from the combination of the values of the MIDlet-Name and MIDlet-Vendor attributes. The syntax and content of storage names are implementation dependent. Only packages installed or upgraded using this API appear in the list of known packages.

Managing a MIDlet suite's information means storing any data that is received or created during installation, and removing all the data when the MIDlet suite is removed. This component uses the native persistent storage services of the platform, and must be ported to different platforms.

### Detailed Design

The MIDlet suite storage component has a C interface and a secure Java platform interface. The C interface is in the file suitestore_common.h. The Java platform interface is MIDletSuiteStorage.

The default implementation is in the file suitestore_intern.c, which use midpStorage.c and rms.c. The figure below shows the MIDlet suite storage component's dependencies.

The MIDlet Suite Storage component provides the following services to both Java platform and native components:

- Provides a suite's unique identifier, given the name and vendor of the suite
- Creates a unique identifier for a suite, given its name and vendor
- Provides the total amount of persistent storage used by a suite
- Provides the amount of storage available for a suite to be installed
- Adds a MIDlet suite to the MIDlet suite storage, or updates an existing MIDlet suite. This service is designed to handle system-specific installation actions
- Removes a MIDlet suite from the MIDlet suite storage. This service is designed to handle system-specific uninstall actions
- Provides the installation information for a MIDlet suite such as the URL of its JAD file
- Provides the application-specific properties of a MIDlet suite such as its name, vendor, and version
- Provides the current permissions for a suite
- Updates the current permissions for a suite
- Provides the Push interrupt setting for a suite
- Updates the Push interrupt setting for a suite
- Provides a list of the unique identifiers of all the installed MIDlet suites
- Provides a list of delete-notification URLs for OTA installers
- Adds a URL to the list of delete-notification URLs
- Removes a URL from the list of delete-notification URLs

To avoid creating a class for only a few runtime environment services, the `MIDletSuiteStorage` class provides the following functionality:

- Sets the next suite to run after the current suite ends
- Sets the last suite to run after there is no current suite to run
- Gets a MIDletSuite object for scheduling a suite to run

See the com.sun.midp.main package for more information.

### Unique Suite IDs

MIDlet suites are identified globally by their name, vendor, and version. Because there can only be one version of a suite on a device at time, the name and vendor can be used to identify a MIDlet suite. However, it saves a lot of code if a MIDlet suite can be uniquely identified with only one value, a value that can be used in ASCII files. The MIDlet suite storage component gives each MIDlet suite a device-unique ASCII string of a arbitrary length that cannot be used for another suite, even after the suite is deleted.

An implementation of the MIDlet suite storage component MAY internally use the unique identifier as part of a file name, none of the other AMS components use the identifier to access MIDlet suite storage files directly.

### File Storage

The MIDlet Suite Storage component assumes the file system is one large repository. It also assumes that file names can be of arbitrary length and can be made up of any printable ASCII characters. Using these assumptions, the component builds file names by appending the following three strings, without directory separators:

- Application database root Enables the files in the MIDlet suite storage area to be distinguished from other files in the system. This string can be missing (zero characters long) if the feature is not needed. It can also be a directory name that ends with a directory separator.
- Unique suite root Identifies the MIDlet suite. This string is found by using a function that takes the unique ID of a suite.
- File extension Identifies the file's contents