Saturday, October 27, 2007

Component management in CLDC

There are several widely-known frameworks (like Spring or OSGi) that make component management easier. In a CLDC environment, however, they cannot be used, because (for security reasons) class loading is restricted to the system classes and the classes contained in the MIDlet Suite. This means that components outside the installed application cannot be loaded in a standard way, so the JAR file must contain every component we want to use in the application.
But how could we extend or modify our application after its deployment? A possible solution can be to assemble the MIDlet JAR automatically on server side from the requested set of components and to transfer the resulted JAR to the phone. Of course this requires the user to stop the running application and re-start it after the upgrade, but in most of the cases this is an acceptable compromise.

Sunday, October 14, 2007

OSGi on low-end mobiles?

There is only one thing that prevents the wide adoption of OSGi (JSR232 - Mobile Operational Management) in the J2ME world: according to the CLDC specification, it is not possible to dynamically load classes that are not part of the system and the MIDlet JAR. (Of course reflection would be useful, too, but we can live without it.)
If we give up portability, however, there are several ways to work around this issue. The first and probably the most easiest is when you can access the class loader via OEM-specific APIs, but these APIs (even if they exist) are often public and well-documented. On Symbian phones there is another way (I've never tried, but I think it could work): you can write a native Symbian application which listens to a local socket and handles the serialized class sent by the MIDlet. Of course you need to have access to local sockets from your MIDlet, but most of the MIDP 2.0-capable phones implement this feature. This is somewhat similar to what ProSyst's management agent does in his product (mBedded Server CLCD Edition).

Java closures update

Here is a presentation from Neal Gafter. It is recommended for anyone interested in closures for Java.

Saturday, October 13, 2007

OSGi in mobiles?

I came home from Eclipse Summit 2007 yesterday. Unfortunately I didn't have time to attend the symposia, but anyway, the conference itself has been a great pleasure.
I've been particularly interested in three topics: Equinox (and OSGi in general), MDSD and of course, anything else that relates to J2ME. I've seen great presentations (and not so great, but interesting ones), but my absolute favourite talks had been given by Uriel Liu of IBM about eRCP and Gorkem Ercan of Nokia who talked about eSWT.
I have been telling for years that MIDP 1.x and 2.x are missing the most important thing: a well-defined component model. Yes, I know, that MIDP 3.0 is underway, but can the industry (and of course, the application developers) wait for years for the first MIDP 3.0-ready phones?
I think OSGi can be a very nice solution for this problem, and finally it seems that at least Nokia thinks the same. I just hardly wait for eRCP for series60.