Fields Summary |
---|
protected int | isolateIdThe ID of the MIDlte suite task Isolate |
protected int | amsIsolateIdThe ID of the AMS task Isolate |
protected int | suiteIdSuite ID of the MIDlet suite |
protected int | externalAppIdExternal application ID that can be provided by native AMS |
protected String | midletClassNameName of the class to start MIDlet suite execution |
protected String | midletDisplayNameDisplay name of a MIDlet suite |
protected String[] | argsThe arguments to start MIDlet suite with |
protected static SecurityToken | internalSecurityTokenThis class has a different security domain than the MIDlet suite |
protected com.sun.midp.events.EventQueue | eventQueueEvent queue instance created for this MIDlet suite execution |
protected MIDletSuite | midletSuiteMIDlet suite instance created and properly initialized for
a MIDlet suite invocation. |
protected ForegroundController | foregroundControllerForeground Controller adapter. |
protected DisplayEventProducer | displayEventProducerEvent producer for various screen change events. |
protected DisplayEventListener | displayEventListenerProvides interface for display preemption, creation and other
functionality that can not be publicly added to a javax package. |
protected RepaintEventProducer | repaintEventProducerEvent producer for all repaint events. |
protected DisplayContainer | displayContainerStores array of active displays for a MIDlet suite isolate. |
protected DisplayEventHandler | displayEventHandlerProvides interface for display preemption, creation and other
functionality that can not be publicly added to a javax package. |
protected ItemEventConsumer | itemEventConsumerHandles item events not associated directly with
particular Display . |
protected MIDletStateHandler | midletStateHandlerStarts and controls MIDlets through the lifecycle states. |
protected LCDUIEventListener | lcduiEventListenerThe event listener for LCDUI events. |
Methods Summary |
---|
protected boolean | allocateReservedResources()Allocates resources for a suite execution according to
global resource policy.
return true;
|
protected void | checkForShutdown()Checks whether an executed MIDlet suite has requested
for a system shutdown. User MIDlets most probably have
no right for it, however Java AMS MIDlet could do it.
// IMPL_NOTE: No checks for shutdown by default
|
protected void | closeSuite()Closes suite and unlock native suite locks
if (midletSuite != null) {
/* When possible, don't wait for the finalizer
* to unlock the suite. */
midletSuite.close();
}
|
protected abstract MIDletSuite | createMIDletSuite()Creates MIDlet suite instance by suite ID, the
|
protected void | createSuiteEnvironment()Creates all needed objects of a MIDlet suite environment, but
only initialization that is done, will be to pass other created objects,
and the current and AMS isolate IDs. It is mostly event-related
objects, however subclasses can extend the environment with more
specific parts
displayEventHandler =
DisplayEventHandlerFactory.getDisplayEventHandler(
internalSecurityToken);
displayEventProducer =
new DisplayEventProducer(
eventQueue);
repaintEventProducer =
new RepaintEventProducer(
eventQueue);
displayContainer = new DisplayContainer(
internalSecurityToken, isolateId);
/*
* Because the display handler is implemented in a javax
* package it cannot created outside of the package, so
* we have to get it after the static initializer of display the class
* has been run and then hook up its objects.
*/
displayEventHandler.initDisplayEventHandler(
displayEventProducer,
foregroundController,
repaintEventProducer,
displayContainer);
displayEventListener = new DisplayEventListener(
eventQueue,
displayContainer);
/* Bad style of type casting, but DisplayEventHandlerImpl
* implements both DisplayEventHandler & ItemEventConsumer IFs */
itemEventConsumer =
(ItemEventConsumer)displayEventHandler;
lcduiEventListener = new LCDUIEventListener(
internalSecurityToken,
eventQueue,
itemEventConsumer);
|
protected void | done()Final actions to finish a MIDlet suite loader
eventQueue.shutdown();
|
protected abstract void | exitLoader()Explicitly requests suite loader exit after MIDlet
suite execution is finished and created environment is done.
|
public abstract void | handleException(java.lang.Throwable t)Handles exception occurred during MIDlet suite execution.
|
protected void | init()Core initialization of a MIDlet suite loader
// Init security tokens for core subsystems
SecurityInitializer.initSystem();
eventQueue = EventQueue.getEventQueue(
internalSecurityToken);
|
protected void | initSuiteEnvironment()Does all initialization for already created objects of a MIDlet suite
environment. Subclasses can also extend the initialization with
various global system initializations needed for all suites.
The MIDlet suite has been created at this point, so it can be
used to initialize any per suite data.
displayEventHandler.initSuiteData(
midletSuite.isTrusted());
|
protected abstract void | reportError(int errorCode, java.lang.String details)Reports an error detected during MIDlet suite invocation.
|
protected void | reportError(int errorCode)Reports an error detected during MIDlet suite invocation.
reportError(errorCode, null);
|
protected void | restrictAPIAccess()Restricts suite access to internal API
// IMPL_NOTE: No restrictions by default
|
protected void | runMIDletSuite()Inits MIDlet suite runtime environment and start a MIDlet
suite with it
// WARNING: Don't add any calls before this!
//
// The core init of a MIDlet suite task should be able
// to perform the very first initializations of the environment
init();
try {
/*
* Prepare MIDlet suite environment, classes that only need
* the isolate ID can be create here.
*/
createSuiteEnvironment();
/* Check to see that all of the core object are created. */
if (foregroundController == null ||
displayEventProducer == null ||
repaintEventProducer == null ||
displayContainer == null ||
displayEventHandler == null ||
itemEventConsumer == null ||
lcduiEventListener == null ||
midletStateHandler == null) {
throw new
RuntimeException("Suite environment not complete.");
}
// Regard resource policy for the suite task
if (!allocateReservedResources()) {
reportError(Constants.MIDLET_RESOURCE_LIMIT);
return;
}
// Create suite instance ready for start
midletSuite = createMIDletSuite();
if (midletSuite == null) {
reportError(Constants.MIDLET_SUITE_NOT_FOUND);
return;
}
if (!midletSuite.isEnabled()) {
reportError(Constants.MIDLET_SUITE_DISABLED);
return;
}
/*
* Now that we have the suite and reserved its resources
* we can initialize any classes that need MIDlet Suite
* information.
*/
initSuiteEnvironment();
// Export suite arguments as properties, so well
// set any other properties to control a suite
setSuiteProperties();
// Restrict suite access to internal API
restrictAPIAccess();
if (Logging.REPORT_LEVEL <= Logging.WARNING) {
Logging.report(Logging.WARNING, LogChannels.LC_CORE,
"MIDlet suite task starting a suite");
}
// Blocking call to start MIDlet suite
// in the prepared environment
startSuite();
// Check for shutdown possibly requested from the suite
checkForShutdown();
if (Logging.REPORT_LEVEL <= Logging.WARNING) {
Logging.report(Logging.INFORMATION, LogChannels.LC_CORE,
"MIDlet suite loader exiting");
}
} catch (Throwable t) {
handleException(t);
} finally {
closeSuite();
done();
exitLoader();
}
|
protected void | setSuiteProperties()Sets MIDlet suite arguments as temporary suite properties.
Subclasses can override the method to export any other needed
suite properties.
if (args != null) {
for (int i = 0; i < args.length; i++) {
if (args[i] != null) {
midletSuite.setTempProperty(
internalSecurityToken,
"arg-" + i, args[i]);
}
}
}
|
protected void | startSuite()Start MIDlet suite in the prepared environment
midletStateHandler.startSuite(
this, midletSuite, externalAppId, midletClassName);
|