Programming Java 2 Micro Edition for Symbian OS 2004 (779882), страница 7
Текст из файла (страница 7)
Dependingon the security policy of the device, a user may also choose to allowunknown applications full or temporary access to advanced capabilities.1.3 CDC and Personal Profile1.3.1 CDCThe Connected Device Configuration (CDC) has been developed underthe Java Community Process, by JSR 36. Symbian was a member of theexpert group that developed it. The configuration has been designedfor devices with more memory, faster processors and greater networkbandwidth than those using CLDC.
Examples of such devices includeTV set-top boxes, residential gateways, in-vehicle telemetry and highend PDAs.CDC AND PERSONAL PROFILE17With this in mind, it is easier to understand that CDC was designed withthe aim of being based upon the J2SE 1.3 APIs while providing supportfor resource-constrained devices. This leaves a route open for existingJ2SE developers to leverage their skills and also provides a path for thecreation of secure enterprise-type applications for constrained devices.CDC offers more facilities than CLDC.
It provides a full Java 2 virtualmachine including floating point and core library features, such as customclass loading, thread support and security. Like CLDC, it is a subset ofthe full J2SE implementation; the classes have been optimized to create a smaller memory footprint and some J2SE libraries have modifiedinterfaces. An example of this is that the javax.microedition.iopackage provides the generic connection interface for input/outputand networking.Target devices are expected to have the following minimum specification:• 32-bit CPU• 2 MB RAM• 2 MB ROM.The Java environment for these devices is completed with the additionof one of three profiles which sit on top of the CDC classes to formthe complete implementation.
The CDC profiles, which are layered, areas follows:• the Foundation Profile (JSR 46) is the most basic CDC profile; itprovides the basic application support classes such as network andI/O support but does not provide a graphical user interface• the Personal Basis Profile (JSR 129) provides all of the FoundationProfile APIs and a structure for building lightweight component toolkitsand support for the Xlet application model• the Personal Profile (JSR 62) provides full AWT, applet and limitedbean support as well as the Foundation and Personal Basis Profiles; itrepresents a migration path for PersonalJava technology.We shall have a close look at the Personal Profile in Section 1.3.2.1.3.1.1 Core LibrariesThe following core packages are available within the CDC configuration:• java.io provides the system input and output through data streams,serialization and the file system18INTRODUCTION TO J2ME• java.lang provides the classes that are fundamental to the designof the Java language, for example, Object, which is the root of theclass hierarchy• java.lang.ref provides the reference-object classes, which support a limited degree of interaction with the garbage collector• java.lang.reflect provides the classes and interfaces for obtaining reflective information about classes and objects• java.math provides classes for performing arbitrary-precision integer (BigInteger) and decimal (BigDecimal) arithmetic• java.net provides the classes for implementing networking applications• java.security provides the classes and interfaces for the security framework• java.security.cert provides the classes and interfaces for parsing and managing certificates• java.text provides classes and interfaces for handling text, dates,numbers and messages in a manner independent of natural languages• java.util provides the classes which contain the collections framework, legacy collection classes, event model, date and time facilities,internationalization and miscellaneous utility classes such as the stringtokenizer and random number generator• java.util.jar provides classes for reading and writing the JARfile format, which is based upon the standard ZIP file format with anoptional manifest file• java.util.zip provides classes for reading and writing the standardZIP and GZIP file formats• javax.microedition.io provides the classes for generic connections.1.3.1.2 Optional PackagesThe optional packages give device manufacturers the ability to supportadditional technologies if they so wish:• RMI provides a subset of the J2SE RMI for Java-based network devices;it exposes distributed application protocols (through Java interfaces,classes and method invocations) and shields the application developerfrom the details of network communicationsCDC AND PERSONAL PROFILE19• JDBC provides a subset of the JDBC 3.0 API, which can be used toaccess flat files and tabular data sources such as spreadsheets; it alsoprovides cross-DBMS connectivity to a range of SQL databases.1.3.2 Personal ProfileThe Personal Profile provides a further way of specifying the subsetof APIs for a CDC-based device.
Its definition is based upon the JavaCommunity Process JSR 62, for which Symbian was a member of theexpert advisory group.As we have seen earlier, profiles provide a more specialized environment for devices common to a particular configuration. The PersonalProfile is aimed at devices that require full GUI or internet applet support,such as communicators or game consoles. It is the successor to PersonalJava, which was developed prior to the formalization of J2ME, andtherefore provides a clear migration path for PersonalJava applications tothe J2ME platform.The Personal Profile builds upon the Foundation Profile and thePersonal Basis Profile by adding graphical user interface classes to theenvironment.
It inherits networking and Xlet capabilities from the othertwo profiles. It has been designed to provide full graphical support and theability to run web-based applets designed for the desktop to mobile deviceapplications with web fidelity. The following outlines the core packagesincluded in the Personal Profile and from where they are derived.Added by the Foundation ProfileThe following packages provide full J2SE 1.3.1 support for basic classlibrary packages:• java.io• java.lang• java.lang.ref• java.net• java.security• java.security.acl• java.security.cert• java.security.interfaces• java.security.spec• java.text• java.util20INTRODUCTION TO J2ME• java.util.jar• java.util.zipThe following package provides compatibility for the CLDC 1.0 genericconnection framework:• javax.microedition.ioAdded by the Personal Basis ProfileThe following packages provide support for lightweight components andsome 2D Java graphics:• java.awt• java.awt.color• java.awt.event• java.awt.imageThe following package provides bean support by an external bean editor(IDE) running on a J2SE-based JRE:• java.beansThe following packages provide limited RMI support for Xlets and are notintended for general-purpose use:• java.rmi• java.rmi.registryThe following packages provide Xlet support:• javax.microedition.xlet• javax.microedition.clet.ixcAdded by the Personal ProfileThe following package provides support for applets:• java.appletThe following packages provide support for heavyweight componentsand 2D graphics:• java.awt• java.awt.datatransferJ2ME ON SYMBIAN OS211.4 J2ME on Symbian OSJava on Symbian OS has a long history dating back to Symbian OS Version5 (released in 1999).
This initial Java offering was based on Sun’s JDK 1.1.4platform. For the next major release, Symbian decided to take advantageof the reduced memory footprint offered by PersonalJava (compared tothe burgeoning JDK) and used the PersonalJava 1.1.1 specification as thebasis for the Java implementation. This release, Symbian OS Version 6.0,became available in 2000.PersonalJava was the forerunner of J2ME and the first attempt by Sun toprovide a Java environment for the more resource-constrained embeddeddevice.
It is the direct antecedent of the CDC-based Personal Profile.In 1999, acknowledging that ‘‘one size doesn’t fit all’’, Sun announcedthe splitting of Java into three versions:• Java 2 Enterprise Edition (J2EE)• Java 2 Standard Edition (J2SE)• Java 2 Micro Edition (J2ME).Symbian immediately became involved in shaping the Micro Editionvia the expert groups of the Java Community Process. Soon it wasclear that J2ME MIDP was gaining momentum in the wireless space asphone manufacturers endorsed the idea of a lightweight Java environmentsuitable for mass-market phones.