Java Doc for MIDletStateHandler.java in  » 6.0-JDK-Modules » j2me » com » sun » midp » midlet » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » 6.0 JDK Modules » j2me » com.sun.midp.midlet 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.sun.midp.midlet.MIDletStateHandler

MIDletStateHandler
public class MIDletStateHandler (Code)
The MIDletStateHandler starts and controls MIDlets through the lifecycle states. MIDlets are created using its no-arg Constructor. Once created a MIDlet is sequenced through the ACTIVE, PAUSED, and DESTROYED states.

The MIDletStateHandler is a singleton for the suite being run and is retrieved with getMIDletStateHandler(). This allow the MIDletStateHandler to be the anchor of trust internally for the MIDP API, restricted methods can obtain the MIDletStateHandler for a MIDlet suite inorder to check the properties and actions of a suite. Because of this, there MUST only be one a MIDlet suite per MIDletStateHandler. In addition a method can assume that the application manager is the caller if there is no suite started.

The MIDlet methods are protected in the javax.microedition.midlet package so the MIDletStateHandler can not call them directly. The MIDletState object and MIDletTunnel subclass class allow the MIDletStateHandler to hold the state of the MIDlet and to invoke methods on it. The MIDletState instance is created by the MIDlet when it is constructed.

This implementation of the MIDletStateHandler introduces extra internal MIDlet states to allow processing of MIDlet requested state changes in the control thread and serialized with other state changes. The additional states are:

  • ACTIVE_PENDING - The MIDlet is still PAUSED but will be ACTIVE after startApp is called when the state is next processed.
  • PAUSE_PENDING - The MIDlet is still ACTIVE but will be PAUSED after pauseApp is called when the state is next processed.
  • DESTROY_PENDING - Indicates that the MIDlet needs to be DESTROYED. The MIDlet's destroyApp has not yet been called.
The MIDletStateHandler loops, looking for MIDlets that require state changes and making the requested changes including calling methods in the MIDlet to make the change.

When a MIDlet's state is changed to ACTIVE, PAUSED, or DESTROYED the MIDlet state listener is notified of the change, which in turn sends the notification onto the central AMS.
See Also:   MIDlet
See Also:   MIDletPeer
See Also:   MIDletLoader
See Also:   MIDletStateHandler





Method Summary
public  voiddestroySuite()
     Destroys all running MIDlets in this suite only.
public  StringgetFirstRunningMidlet()
     Gets the class name first midlet in the list of running MIDlets.
public  MIDletEventConsumergetMIDletEventConsumer(SecurityToken token, String name)
     Gets MIDlet event consumer of the named MIDlet.
public static  intgetMIDletState(MIDlet midlet)
     Retrieves current state of the MIDlet given.
public  MIDletSuitegetMIDletSuite()
     Provides a object with a mechanism to retrieve MIDletSuite being run.
public static synchronized  MIDletStateHandlergetMidletStateHandler()
     Gets the MIDletStateHandler that manages the lifecycle states of MIDlets running in an Isolate.

If the instance of the MIDletStateHandler has already been created it is returned.

public  voidinitMIDletStateHandler(SecurityToken token, MIDletStateListener theMIDletStateListener, MIDletLoader theMidletLoader, PlatformRequest thePlatformRequestHandler)
     Initializes MIDlet State Handler.
public  booleanisRunning(String name)
     Checks if the named MIDlet has already been instantiated.
public static  MIDletPeernewMIDletPeer(SecurityToken token, MIDlet m)
     Called by the MIDlet constructor to a new MIDletPeer object.
Parameters:
  token - security token for authorizing the caller
Parameters:
  m - the MIDlet for which this state is being created;must not be null.
public  voidstartMIDlet(String classname, String displayName)
     Starts a MIDlet from outside of the package.
public  voidstartMIDlet(int externalAppId, String classname, String displayName)
     Starts a MIDlet from outside of the package.
public  voidstartMIDlet(SecurityToken token, String classname, String displayName)
     Starts a MIDlet from outside of the package.
public  voidstartMIDlet(SecurityToken token, int externalAppId, String classname, String displayName)
     Starts a MIDlet from outside of the package.
public  voidstartSuite(MIDletSuiteExceptionListener exceptionHandler, MIDletSuite aMidletSuite, int externalAppId, String classname)
     Runs MIDlets until there are none.



Method Detail
destroySuite
public void destroySuite()(Code)
Destroys all running MIDlets in this suite only. This method is only used by the push registry in single VM mode.



getFirstRunningMidlet
public String getFirstRunningMidlet()(Code)
Gets the class name first midlet in the list of running MIDlets. the classname or null if no midlet are running



getMIDletEventConsumer
public MIDletEventConsumer getMIDletEventConsumer(SecurityToken token, String name)(Code)
Gets MIDlet event consumer of the named MIDlet.
Parameters:
  token - security token for authorizing the caller
Parameters:
  name - class name of MIDlet reference of the MIDlet event consumer



getMIDletState
public static int getMIDletState(MIDlet midlet)(Code)
Retrieves current state of the MIDlet given.
Parameters:
  midlet - the MIDlet of interest the MIDlet state as defined in MIDletPeer class



getMIDletSuite
public MIDletSuite getMIDletSuite()(Code)
Provides a object with a mechanism to retrieve MIDletSuite being run. MIDletSuite being run



getMidletStateHandler
public static synchronized MIDletStateHandler getMidletStateHandler()(Code)
Gets the MIDletStateHandler that manages the lifecycle states of MIDlets running in an Isolate.

If the instance of the MIDletStateHandler has already been created it is returned. If not it is created. The instance becomes the MIDletStateHandler for this suite.

The fact that there is one handler per Isolate is a security feature. Also a security feature, is that getMIDletStateHandler is static, so API can find out what suite is calling, if in the future multiple suites can be run in the same VM, the MIDlet state handler for each suite should be loaded in a different classloader or have some other way having multiple instances of static class data. the MIDlet state handler for this Isolate




initMIDletStateHandler
public void initMIDletStateHandler(SecurityToken token, MIDletStateListener theMIDletStateListener, MIDletLoader theMidletLoader, PlatformRequest thePlatformRequestHandler)(Code)
Initializes MIDlet State Handler.
Parameters:
  token - security token for initilaization
Parameters:
  theMIDletStateListener - processes MIDlet states in aVM specific way
Parameters:
  theMidletLoader - loads a MIDlet in a VM specific way
Parameters:
  thePlatformRequestHandler - the platform request handler



isRunning
public boolean isRunning(String name)(Code)
Checks if the named MIDlet has already been instantiated.
Parameters:
  name - class name of MIDlet to test ifcurrently run true if an instance of the MIDlet is alreadyrunning



newMIDletPeer
public static MIDletPeer newMIDletPeer(SecurityToken token, MIDlet m)(Code)
Called by the MIDlet constructor to a new MIDletPeer object.
Parameters:
  token - security token for authorizing the caller
Parameters:
  m - the MIDlet for which this state is being created;must not be null. the preallocated MIDletPeer for the MIDlet being constructed byMIDletStateHandler.createMIDlet
exception:
  SecurityException - AMS permission is not granted andif is constructor is not being called in the context ofcreateMIDlet.



startMIDlet
public void startMIDlet(String classname, String displayName) throws ClassNotFoundException, InstantiationException, IllegalAccessException(Code)
Starts a MIDlet from outside of the package.
Parameters:
  classname - name of MIDlet class
Parameters:
  displayName - name to show the user
exception:
  SecurityException - if the suite does not have theAMS permission.
exception:
  ClassNotFoundException - is thrown, if the MIDlet main class isnot found
exception:
  InstantiationException - is thrown, if the MIDlet can not becreated
exception:
  IllegalAccessException - is thrown, if the MIDlet is notpermitted to perform a specific operation



startMIDlet
public void startMIDlet(int externalAppId, String classname, String displayName) throws ClassNotFoundException, InstantiationException, IllegalAccessException(Code)
Starts a MIDlet from outside of the package.
Parameters:
  externalAppId - ID of given by an external application manager
Parameters:
  classname - name of MIDlet class
Parameters:
  displayName - name to show the user
exception:
  SecurityException - if the suite does not have theAMS permission.
exception:
  ClassNotFoundException - is thrown, if the MIDlet main class isnot found
exception:
  InstantiationException - is thrown, if the MIDlet can not becreated
exception:
  IllegalAccessException - is thrown, if the MIDlet is notpermitted to perform a specific operation



startMIDlet
public void startMIDlet(SecurityToken token, String classname, String displayName) throws ClassNotFoundException, InstantiationException, IllegalAccessException(Code)
Starts a MIDlet from outside of the package.
Parameters:
  token - security token of the caller
Parameters:
  classname - name of MIDlet class
Parameters:
  displayName - name to show the user
exception:
  SecurityException - if the caller does not have theAMS permission.
exception:
  ClassNotFoundException - is thrown, if the MIDlet main class isnot found
exception:
  InstantiationException - is thrown, if the MIDlet can not becreated
exception:
  IllegalAccessException - is thrown, if the MIDlet is notpermitted to perform a specific operation



startMIDlet
public void startMIDlet(SecurityToken token, int externalAppId, String classname, String displayName) throws ClassNotFoundException, InstantiationException, IllegalAccessException(Code)
Starts a MIDlet from outside of the package.
Parameters:
  token - security token of the caller
Parameters:
  externalAppId - ID of given by an external application manager
Parameters:
  classname - name of MIDlet class
Parameters:
  displayName - name to show the user
exception:
  SecurityException - if the caller does not have theAMS permission.
exception:
  ClassNotFoundException - is thrown, if the MIDlet main class isnot found
exception:
  InstantiationException - is thrown, if the MIDlet can not becreated
exception:
  IllegalAccessException - is thrown, if the MIDlet is notpermitted to perform a specific operation



startSuite
public void startSuite(MIDletSuiteExceptionListener exceptionHandler, MIDletSuite aMidletSuite, int externalAppId, String classname) throws ClassNotFoundException, InstantiationException, IllegalAccessException(Code)
Runs MIDlets until there are none. Handle any pending state transitions of any MIDlet. If there are none, wait for transitions. If there is no foreground MIDlet select one that is ACTIVE and has setCurrent != null.

If the foreground MIDlet changes from the ACTIVE_FOREGROUND state it automatically looses the foreground and and new one is selected.
Parameters:
  exceptionHandler - the handler for midlet execution exceptions.
Parameters:
  aMidletSuite - the current midlet suite
Parameters:
  externalAppId - ID of given by an external application manager
Parameters:
  classname - name of MIDlet class
exception:
  ClassNotFoundException - is thrown, if the MIDlet main class isnot found
exception:
  InstantiationException - is thrown, if the MIDlet can not becreated
exception:
  IllegalAccessException - is thrown, if the MIDlet is notpermitted to perform a specific operation




Methods inherited from java.lang.Object
public boolean equals(Object obj)(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.