Contents Previous Next Index

Chapter   9

The Application Management System


This chapter describes how to port and customize the application management system (AMS), which manages MIDlet suites on a device or device emulator. AMS loads, installs, lists, updates, and removes MIDlet suites. On development platforms it performs these functions either from a command line or from a graphical user interface.

The AMS implementation has both a native layer and a Java™ programming language layer (Java layer). The files for the native layer are in the
src/share/native/kvm directory and include the files main.c, midpServices.c, JarReader.c, and ResourceInputStream.c. The Java layer includes the packages com.sun.midp.dev, and com.sun.midp.midletsuite.

In addition to its own files, the AMS implementation requires persistent storage. This chapter assumes that you have ported it as described in Chapter 4, "Persistent Storage.” The AMS implementation also depends the modules com.sun.midp.security, com.sun.midp.publickeystore, and com.sun.midp.midlet.

This chapter contains the sections:

9.1 Porting main.c

The start up and initialization of the AMS runtime environment is implemented in the src/share/native/kvm/main.c file. The functions in the file parse the command line and initialize the command state structure that holds internal information. It sets up a command loop for the Java program com.sun.midp.Main, and then starts and stops the virtual machine (VM). (The VM is restarted between AMS commands.) The functions in main.c also clean up and reset the classpath between VM invocations.

The command state structure that main.c uses for its initialization is updated within Main.java, in order to save state between successive launches of the virtual machine. (For example, Main.java saves information for the push functionality. See Section 10.2 "Porting the Native Layer" for more information on push.)

As main.c carries out its tasks, its functions use the native storage interface. See Chapter 4, "Persistent Storage” if you have not yet ported the storage module. If you have changed the native calls for persistent storage, you must update main.c to match it.

If your implementation has a different way of specifying command line parameters, change main.c so that it can parse the new command line syntax.

Other changes, such as adding or removing commands or command options are part of customizing the AMS. Customization is covered in the next section.

9.2 Customizing AMS

There are many ways to customize AMS. For example you could:

Whatever customizations you make, you should also remove code you are no longer using. Concentrate your search in the following packages:

 


Contents Previous Next Index Porting MIDP
MIDP Reference Implementation, Version 2.0 FCS