FileDocCategorySizeDatePackage
AmsUtil.javaAPI DocphoneME MR2 API (J2ME)5444Wed May 02 18:00:08 BST 2007com.sun.midp.main

AmsUtil

public class AmsUtil extends Object
Implements utilities that are different for SVM and MVM modes.

Fields Summary
private static MIDletProxyList
midletProxyList
Cached reference to the MIDletProxyList.
Constructors Summary
Methods Summary
static booleanexecuteWithArgs(com.sun.midp.midletsuite.MIDletSuiteStorage midletSuiteStorage, int externalAppId, int id, java.lang.String midlet, java.lang.String displayName, java.lang.String arg0, java.lang.String arg1, java.lang.String arg2, int memoryReserved, int memoryTotal, int priority, java.lang.String profileName)
Queues the execution of the named Application suite to run. The current application suite should terminate itself normally to make resources available to the new application suite. Only one package and set of MIDlets can be queued in this manner. If multiple calls to execute are made, the package and MIDlets specified during the last invokation will be executed when the current application is terminated.

param
midletSuiteStorage reference to a MIDletStorage object
param
externalAppId ID of MIDlet to invoke, given by an external application manager (MVM only)
param
id ID of an installed suite
param
midlet class name of MIDlet to invoke
param
displayName name to display to the user
param
arg0 if not null, this parameter will be available to the MIDlet as application property arg-0
param
arg1 if not null, this parameter will be available to the MIDlet as application property arg-1
param
arg2 if not null, this parameter will be available to the MIDlet as application property arg-2
param
memoryReserved the minimum amount of memory guaranteed to be available to the isolate at any time; < 0 if not used
param
memoryTotal the total amount of memory that the isolate can reserve; < 0 if not used
param
priority priority to set for the new isolate; <= 0 if not used
param
profileName name of the profile to set for the new isolate; null if not used
return
true to signal that the MIDlet suite MUST first exit before the MIDlet is run


        if (id != MIDletSuite.UNUSED_SUITE_ID) {

            // The MIDlet running already shoudln't be started again.
            // Each started MIDlet has matching MIDletProxy instance
            // created on MIDLET_CREATED_NOTIFICATION event. In SVM mode
            // the event system is not used for MIDlet execution, so
            // MIDletProxy can not exist yet for a MIDlet just started.
            // Instead of MIDletProxyList browsing the MIDletStateHandler
            // is checked for the running MIDlet.

            if (MIDletStateHandler.getMidletStateHandler().isRunning(midlet)) {
                // No need to exit, MIDlet already loaded
                return false;
            }
        }

        MIDletSuiteUtils.nextMidletSuiteToRun = id;
        MIDletSuiteUtils.nextMidletToRun = midlet;
        MIDletSuiteUtils.arg0ForNextMidlet = arg0;
        MIDletSuiteUtils.arg1ForNextMidlet = arg1;
        MIDletSuiteUtils.arg2ForNextMidlet = arg2;
        MIDletSuiteUtils.memoryReserved = memoryReserved;
        MIDletSuiteUtils.memoryTotal = memoryTotal;
        MIDletSuiteUtils.priority    = priority;
        MIDletSuiteUtils.profileName = profileName;

        return true;
    
static voidinitClass(MIDletProxyList theMIDletProxyList, MIDletControllerEventProducer theMidletControllerEventProducer)
Initializes AmsUtil class. shall only be called from MIDletSuiteLoader's main() in MVM AMS isolate or in SVM main isolate. No need in security checks since it is package private method.

param
theMIDletProxyList MIDletController's container
param
theMidletControllerEventProducer utility to send events


        midletProxyList = theMIDletProxyList;
    
static voidterminateIsolate(int id)
Does nothing in SVM mode

param
id Isolate Id