FileDocCategorySizeDatePackage
AutoMIDletDescriptorImpl.javaAPI DocphoneME MR2 API (J2ME)4180Wed May 02 18:00:08 BST 2007com.sun.midp.automation

AutoMIDletDescriptorImpl

public final class AutoMIDletDescriptorImpl extends Object implements AutoMIDletDescriptor
AutoMIDletDescriptor implementation

Fields Summary
private MIDletInfo
midletInfo
MIDlet info
private AutoSuiteDescriptorImpl
suite
MIDlet's suite
boolean
isStarted
If MIDlet corresponding to this descriptor is started
Object
midletStartLock
Lock used when starting MIDlet
Constructors Summary
AutoMIDletDescriptorImpl(AutoSuiteDescriptorImpl suite, String midletAttr)
Constructor

param
suite MIDlet's suite
param
midletAttr MIDlet's attributes

        this.suite = suite;
        this.midletInfo = new MIDletInfo(midletAttr);
        this.midletStartLock = new Object();
        this.isStarted = false;
    
AutoMIDletDescriptorImpl(AutoSuiteDescriptorImpl suite, String midletName, String midletClassName)
Constructor

param
suite MIDlet's suite
param
midletName MIDlet's name
param
midletClassName MIDlet's class name

        this.suite = suite;
        this.midletInfo = new MIDletInfo(midletName, null, midletClassName);
    
Methods Summary
public java.lang.StringgetMIDletClassName()
Gets name of the class implementing MIDlet interface for this MIDlet.

return
name of the class implementing MIDlet interface as specified in jad/jar file

        suite.guaranteeSuiteValid("getMIDletClassName");

        return midletInfo.classname;
    
public java.lang.StringgetMIDletName()
Gets MIDlet's name.

return
MIDlet's name as specified in jad/jar file

        suite.guaranteeSuiteValid("getMIDletName");

        return midletInfo.name;
    
public AutoSuiteDescriptorgetSuiteDescriptor()
Gets MIDlet's suite descriptor.

return
AutoMIDletSuiteDescriptor representing MIDlet's suite

        return suite;
    
voidmidletDestroyed()
Called when MIDlet corresponding to this suite gets destroyed

        synchronized (midletStartLock) {
            isStarted = false;
        }
    
public AutoMIDletstart(java.lang.String[] args)
Starts this MIDlet.

param
args MIDlet's arguments
throws
throws RuntimeException if MIDlet couldn't be started
return
AutoMIDlet representing started MIDlet

        suite.guaranteeSuiteValid("start");

        AutoMIDlet midlet = null;
        synchronized (midletStartLock) {
            if (isStarted) {
                throw new RuntimeException("MIDlet is already started");
            }
            
            AutoMIDletStateController stateController = 
                AutoMIDletStateController.getMIDletStateController();

            midlet = stateController.startMIDlet(this, args);
            isStarted = true;
        }

        return midlet;