FileDocCategorySizeDatePackage
SuiteLister.javaAPI DocphoneME MR2 API (J2ME)3806Wed May 02 18:00:02 BST 2007com.sun.midp.scriptutil

SuiteLister

public class SuiteLister extends javax.microedition.midlet.MIDlet implements Runnable
List all installed suites.

Fields Summary
Constructors Summary
public SuiteLister()
Create and initialize the MIDlet.

        new Thread(this).start();
    
Methods Summary
public voiddestroyApp(boolean unconditional)
Destroy cleans up.

param
unconditional is ignored; this object always destroys itself when requested.

    
public voidpauseApp()
Pause; there are no resources that need to be released.

    
public voidrun()
Remove a MIDlet suite.

        try {
            MIDletSuiteStorage storage =
                MIDletSuiteStorage.getMIDletSuiteStorage();

            int[] suiteIds = storage.getListOfSuites();

            if (suiteIds.length == 0) {
                System.out.println("No suites installed.");
                notifyDestroyed();
                return;
            }

            for (int i = 0; i < suiteIds.length; i++) {
                MIDletSuite suite = storage.getMIDletSuite(suiteIds[i], false);
                String value;

                System.out.println("Suite: " + suiteIds[i]);

                value = suite.getProperty("MIDlet-Name");
                System.out.println("  Name: " + value);

                value = suite.getProperty("MIDlet-Version");
                System.out.println("  Version: " + value);

                value = suite.getProperty("MIDlet-Vendor");
                System.out.println("  Vendor: " + value);

                value = suite.getProperty("MIDlet-Description");
                if (value != null) {
                    System.out.println("  Description: " + value);
                }

                for (int j = 1; ; j++) {
                    value = suite.getProperty("MIDlet-" + j);
                    if (value == null) {
                        break;
                    }

                    if (j == 1) {
                        System.out.println("  MIDlets:");
                    }

                    MIDletInfo midlet = new MIDletInfo(value);
                    System.out.println("    " + midlet.name +
                                       ": " + midlet.classname);
                }
            }
        } catch (MIDletSuiteLockedException msle) {
            System.err.println("Error: MIDlet suite is locked");
        } catch (Throwable t) {
            System.err.println("Error listing suites.");
            t.printStackTrace();
        }

        notifyDestroyed();
    
public voidstartApp()
Start.