J2ME Overview (Part 3)

The Security Model

J2SE existing security stem was too large to fit the constraints of the CLDC target platform; it alone would likely have exceeded all available memory. A resived model cuts down many of the features, but requires far than resources. The good news is that this simplification makes it much easier to cover all the details.

There are two main sections to the CLDC security model:
  • Virtual Machine security
  • Application security
I know that security is not the most interesting subject, but I recommend you take the time to review this section. The resived security model for the CLDC lays some important for application execution models discussed later, and may be there's a really funny joke hidden in there somewhere -the world's first literary Easter egg, perhaps? The again, maybe there isn't.


The goal of the virtual machine security layer is to protect the underlying device from any damage executable code might cause. Under normal circumstances, a bytecode verification process carried out prior to any code execution takes care of this. This verification process essentially validates class file bytecode, thus ensuring it is correct for execution. The most important result of this process is the protection it offers againts the execution of invalid instructions -or worse, the creation of scenarios in which memory outside the Java environment is corrupted. Not pretty.

The standart bytecode verification prcess used with J2SE requires about 50 Kb of code space, along with up to 100 Kb of heap. While this is negligible on larger systems, it constitutes pretty much all the memory available to Java on many micro devices. Althought I have a great desire to spend all my resources doing program verification, smoe rude people insist on something more, like any form of application. So in an effort to appease this demanding bunch, the CLDC specifications provide an alternative.

The resulting verification implementation within the CLDC's virtual machine requires around 10 Kb of binary code space and as little as 100 bytes of run-time memory. From a dynamic memory standpoint, this is a reduction of about 1,000 times. Someone needs to get a little star stamp on the forehead for that one!

The reduction in resources essentially -comes from the removal of the iterative dataflow algorithm from the in memory verification process. The price is that you now have to undertake an additional step known as pre-verification to prepare code for execution on the KVM. The result of this process is the insertion of additional attributes into the class file.

A tool supplied with the J2ME development environment carries out the process of pre-verifying. It 's all rather painless. The important point is that the resource-intensive part of the verification process is carried out on your (overpowered) development PC (the build server).

Application Security

The class loader verification process discussed prviously is pretty limited. Basically, it just validates that bytecode is the legitimate result of the Java compilation process. Althought this is helpful, a further level of security is required to protect a device's resource.

As you might have guessed, the powerful (but rather large) J2SE security model is out that window. The CLDC incorporates a simplified security model based on the concept to protect a sandbox.

The term sandbox really just means that your Java code can play only within the confines of a small, controlled environment. Even if that big blue truck you love is outside and you really wanna play with it, you can't. Anything outside is completely out of bounds. So stop trying, or you 're going to your room!

Your code has restricted what's available in the sandbox environment. The CLDC defines a list of exactly what you can execute, and that's all you get. Protection is also in place so you can't change the base classes that make up the istalled API on the device-the so called core classes.
The CLDC specifcation mandates protection for these classes.

Application Management

Managing applications on micro devices is quite a different experience than doing so on typical PCs. Quite often there is no consept of a file system, let alone a file browser. In some extreme cases, micro devices won't even store class file permanently, the delete them after you finish playing.

Most of the time, especially on typical mobile devices, users have a limited amount of application space in which to store their favorite programs. (This space will be filled with your games, of course.)

To manage these applications, the device should provide a basic ability to review the installed applications, launch an application, and then subsequently delete it if the user so desires.

The CLDC doesn't mandate the form the application manager should take, however, typical implementations are simple menu based tools to browse and launch programs. Nothing fancy, but they certainly do the job.

J2ME Overview (Part 2)

Two Sizes Fit All

As I briefly covered in the previous section, the current J2ME architecture provide two distinct configuration, the CDC (Connected Device Configuration) and CLDC (Connected Limited Device Configuration).

The CDC

Built for larger devices such as digital TV set-top-boxes and PDAs (typically with multyple megabytes of memory), the CDC is the bigger brother of the J2ME configurations. It contains a single profile (the Fooundation profile) as well as high-performance virtual machine known as the Compact Virtual Machine (CVM). The Java language implementation and the API pretty much have all the power of J2SE.

Sounds great, doesn't it? Unfortunatelly, the CDC is not available on the platform where the vast majority of micro-game players are -mobile phone- so it's about as useful a blind sumo wretler in a midget bar brawl. If you want to develop games for the major audiences out here, then you 're interested in those "limited" devices.

The CLDC

The CLDC is all about micro devices, especially mobile phones. It essentially define a standard used by device manufacturers to implement a java run-time environtment. Third party developers, following this same standard, are then confident of the platform on which their software can run.

Developed as part of the Java Community Process (JSR-30), the CLDC configuration effects many aspects of Java development and delivery, while include :
  • Target device characteristic
  • The security model
  • Application management
  • Language differences
  • JVM differences
  • Included class libraries
CLDC's Pedegree

Thankfully, the CLDC wasn't developed in isolation, some of the most influential companies involved in the micro device industry were involved in the Java Community Process expert group (JSR-30), which was responsible for the development of the specifications. Reading like a who's who of the micro hardware industry, the list of companies involved includes :
  • Amercian online
  • Bull
  • Ericsson
  • Fujitsu
  • Matsushita
  • Mitsubishi
  • Motorola
  • Nokia
  • NTT DoCoMo
  • Oracle
  • Palm Computing
  • RIM (Research In Motion)
  • Samsung
  • Sharp
  • Siemens
  • Sony
  • Sun Microsystems
  • Symbian

J2ME Overview

In this chapter, we will take a look at J2ME's place in the Java landscape, and you will get a bird's eye view of the different editions. Then you 'll look at the various components that make up J2ME before finally reviewing the tools, configuration, profiles, and virtual machines that make everything tick.

I shall Call It Mini-ME

Portable device are an exciting industry. Every time you turn around, there's another sexier model, with a bigger screen, more memory, higher bandwidth, and a faster CPU, usually with in an ever smaller form -and they come in a cool range of colors too.

Writing the software isn't the only problem. Delivering it to the device requires a platform capable of installing new software on demand, along with the channels to receive new code. And once installed, users must consider the security of the software and device.

So where do you turn for a solution to all these issues? Amidts a blaze of light, a big guy in your a yellow spandex suit leaps up, hands on hips, chest emblazoned with a big J and a small ME. Never fear, J2ME is here to make you look good in tights, I mean, to bring software to the micro masses! Had you worried, didn't it?

J2ME Architecture

From the enterprise development tools designed for use in servers to the micro system for which you 'r developing, each version has its own place in the Java landscape. It 's very important to not that the division between platforms is not simply categorical. The line between different platforms can get blurry. In fact, J2ME development sometimes requires the use of all three platforms (J2ME, J2SE, and J2EE). For example, when you 're developing a multilayer game, you use J2ME for the client-side device software, but you also benefit from the power of J2SE, and J2EE when you implement the backed server system.

We can see that the different java editions, along with the hardware each supports. As you can see, the various editions of Java suit distinctly different device classes. The hotspot VM is the default virtual machine supplied by Sun for executing the fullscale version of Java -Hotspot is a newer type of virtual machine capable of dynamically optimizing heavily executed code (hotspots) during runtime. The compact Virtual Machine (CVM) and Kilobyte Virtual Machine (KVM) are smaller virtual machine implementations designed to run within the constraints of the limited resources available on micro devices. We 'll look at which virtual machine is used for different devices a little later in the chapter.

In developing J2ME, it was obvious that trying to fit something like J2SE on a mobile phone would be like trying to stuff the Hindenburg down your pants. Since J2SE was obviosly way too big to fit on even the larger micro devices, Sun had to shrink it down. But which parts should they remove? With such a large variety of different devices, Sun didn't want to limit all J2ME appllications to the lowest compatible hardware set. This would unfairly compromise the functionality of the higher en devices.

The designer of J2ME came up with solution based on a revised Java architecture that provides for the exclusion of parts the platform (such as language, tools, JVM and API) while adding device category specific components. This is realized through a combination of J2ME configurations and profiles.

Configuration and Profiles

A configuration define the capabilities of a Java platform designed for use on a series of similiar hardware. Essentially, it provides for the minimization of the J2SE platform by removing components such as :
  • Java language component
  • Minimum hardware requirements, such as the memory, screen size, and processor power for the family of devices
  • Included Java libraries
Using this architecture, Sun created two initial configurations to suit the micro world -one for slightly limited devices such as PDAs and Set Top Boxes (like digital Tv receivers) and one for the "you wanna run Java on what?!" class of devices such as pagers, mobile phones, and pets. These two configurations are :
  • CDC (Connected Device Configuration)
  • CLDC (Connected Limited Device Configuration)
You will review both of these in more detail a little later. The important thing right now is that these configurations let you move forward, confident of the functionality of the underlying target platform. You will be developing for two platform at most, not two hundred.

However, configurations don't cover everything they merely limit Java to a suitable target platform's capablities - which is essentially a nice way of saying they rip out Java's guts. Additional functionality is required to handle the new breed of Java devices.

J2ME History

This chapter will cover the history behind the Java Language and other related technologies. We will then look at capabilities and limitations of device such as mobile phones before finally looking at the evolution of J2ME.

Java's Acorn

In early 1995, Sun released an alpha of a new software environment dubbed Java. During the first six months after Java's release, the Industry spent most its time making bad jokes and puns about coffee beans and Indonesian Islands. (Is it irony that there is great surfing around the island of Java?) It did not take long, however, for the "Write Once, Run Anywhere" call to arms to be taken up. Slowly and inexorably, Java began its march to the top. But before I rush off into Java's glory days, I want to take a brief look at Java's history.

The earliest traces of Java go back to eraly 1990s, when the Sun formed a special technical team asked with developing next wave of computing. After one those 18-month, secret-location, round the clock, caffeine-driven geek-fests, sounds like a game development project, if you ask me- the team emerged with the results: a handheld home-entertainment device controller with an animated touchscreen interface known as the *7 (star seven).

Now that a decade has passed, I would't really call *7 the next wave of computing, but hey -they didn't even have the Internet or mobile phones, let alone the Internet on mobile phones.

The real action, however, wasn't with the device, it was with the back end technology that powered it. One of the requirements of the project was an embedded sofware environment that was robust hardware-independent, and that facilitated low-cost development. Enter the hero of our story, James Gosling, a Canadian software engineer working with team.

Taking some of the best elements of C++, while including the trouble some memory management, pointers, and multiple inheritance -along with consepts from the early object oriented laguage SIMULA- James created a new language dubbed Oak. (It was named after a tree outside his window. I wonder if an Indonesian island appreared outside his window sometime later, in which case think he should really lay off the Jolt form while.)

Oak's power wasn't only in its language design; there were plenty of other object-oriented languages. Oak blossoed it encompassed everything. James didn't create a language and then let other people implement it as they saw it. The goal ofOak was hard environtment. From virtual computers to functional APIs, Oak provided -and, more imprtantly, controlled- everything.

Unfortunately, *7 flundered around like a legless cow in a butcher shop until 1994, when, during a three day, non step, mountain reteat geek-fest, James (along with Bill Joy, Wayne Rosing, John Gage, Eric Schmidt, and Patrick Naughton) saw a new opportunity for their acorn- the Internet.

Arrount the same time, that new fangled Internet thing was emerging as a mainstream technology. The word wide web was being used to transfer and display digital content in the form of pictures, text, and even audio almost universally on a variety of hardware.

The goals of the Web were not dissimiliar to that of Oak: profide a system to let you write content once, but view it anywhere. Sound familiar? Oak was attempting to do the same thing, but for programming. Imaging if the Internet where used as the framework upon which Oak software could be distributed and universally deployed. James and his pocket protected buddies were on to something big.


Java's Growth in the Sun

After the Oak meet Internet epiphany, James and the team at Sun developed a host technologies around the concept of a universally deploy able language and platform. One of their first task was to develop the Java-compatible browser known as Hot java (although the early versions had the much cooler name WebRunner, after the movie Black Runner).

On May 23, 1995, one of the defining moments in the history of computing occurred. They then young Netscape Corporation agreed to integrate Java into its almost universal popular Navigator Web browser, thus creating an unprecedented audience for the Java software.

Sun programmers from all across the globe flooded the Java Web site to download the new platform. Sun complete underestimated the platform's popularity and struggled the upgrade bandwidth to cope with the rush. Before anyone realized it, something changed in the IT word. Kicking and screaming, Java had arrived.

Development of the Java platform continued aggressively over the following years, with the subsequent release of a great deal of supporting technology. New editions, especially one targeting enterprise software development, have arguably become more popular that the original technology.

However, one thing remains the same for me -I still chose Java over any language. The code simpler, the development is faster, and the bugs are easier to find. It just works -almost everywhere.

What is Java?

Java is more than a programming language, it is a way of life. You should immediately terminate all other activities and devote your life entirely to the pursuit of perfection in your Java code. Not! But seriously, coding Java programs is a great a way to kill a few hours.

Java is a little different than your typical programming language. First, most programming language process code by either compiling or interpreting; Java does both. The initial compile phase translates your source code (.php file) into an intermediate language called java bytecode (.class files). The resulting bytecode is then ready to be executed (interpreted) within a special virtual computer known as the JVM (Java Virtual Machine).

The Java Virtual Machine is a simulated computer that executes all the bytecode instructions. It's through the JVM that Java gains its portability because it acts as a consistent layer between bytecode and the actual machine intructions -bytecode instructions are translated into machine specific instructions by the JVM at runtime.

Compiled bytecode is the power behind Java's "Write once, Run Anywhere" flexibility. All a target platform on which they were originally compiled.

However, to make all this work successfully, you need more than just a programming language -you need a programming platform. The Java platform is made up of three significant components :
  • The Java compiler and toos
  • The Java Virtual Machine
  • The Java API (Application Programming Interface)
The JVM's role is to provide an interface to the functionality of the underlying devices, whereas the Java API provides a limited view of this functionality to the Java program. In this manner, the JVM is the judge, jury, and executor of program code.

The Java API is a collection of Java class covering a vast range of funcionallity incuding containers, data management, communications, IO, security, and more. There are literally thousand of classes available as part of the Java platform.


 
Themes by Ex Templates Blogger Templates l PC Tablet News l Blogger Pemula