Posts Tagged ‘Java’

Avatar : HTML5 and JavaME

Posted: October 8, 2011 in IT/Dev
Tags: , , ,

While previews of JDK7 and JavaFX 2 are available for MacOSX (here and there), Oracle announced its strategy to unify Java and HTML5 :

– by standardising communications between HTML5 clients and Java server side (listed technologies – Websockets, etc. – are however still in use, and Oracle didn’t provide hints about a common JSON description format for describing action messages).

You can make an HTML5 client work with a Java back-end today, but it’s not that fun, it’s not that easy to use, and it’s not that easy for HTML folks to collaborate with Java folks.
HTML5 brings new standard for new and/or existing features (Canvas) provided by browsers, and mainly derived from WebKit advances. However Avatar does not provide abstraction/media layer to these various APIs (Canvas, WebGL, CSS3) that allow to display a modern user interface (in such a way as Cappuccino’s DocumentBridge and implementation of Quartz/Core Animation), nor an applicative framework (such as Cappuccino’s implementation of AppKit).
Finally there is no information about client/server bridge solution (messages serializing, session and profiles management, authentication, access to remote data through cursor, sorting) like CP2JavaWS.

– by providing access to HTML5 layer from a Java JME application code on mobile devices, through a new sort of a JVM (JIT that creates native code instead bytecode – however it isn’t completed yet), in order to circumvent Apple’s restrictions. Other solutions still exist, like GWT4Titanium, that allows developing in Java and then converting code in javascript and finally in native code.

As I had supposed, Google may use Cappuccino to replace Java as Android SDK. Besides solving the licensing problems, this solution could lure iOS developers, easing Cocoa to Android porting.
The new Google mobile OS would just have to be based on WebKit, in the same way Palm/HP’s WebOS does.

A new 1.1 version of CP2JavaWS (Cappuccino to remote Java services framework) is available here. It includes the following new features/enhancements :

– Added Basic Authentication scheme besides Digest, and a generic Active Directory/Ldap authentication service (automatic check of user password and retrieve of its profiles related to the application from the directory, that are then stored on the client side’s endpoint for UI conditional display – besides being used on the server side from the authorization service).

– global authentication to an endpoint (in order to allow connect/disconnect menu for login/logout) besides per service check, by calling a dummy service listed in authenticated services (needed to keep – not duplicate – authentication process managed by the authentication filter).

– better error management, and easy to read full server error trace in the client’s alert window.

– parameter to set the encoding information sent from the Json filter to the client (depends from encoding used in custom services and/or database).

A new release (1.0.1) of CP2JavaWS is available. It adds support for Cappuccino 0.8 (won’t work with previous versions – use CP2JavaWS 1.0 for these).

Note : when creating a tableView manually, and setting CP2JavaWSTableViewDelegate as the delegate,
we now have to define the sortDescriptor on each column, for example :
[column setSortDescriptorPrototype:[[CPSortDescriptor alloc] initWithKey:[column identifier] ascending:true]];
This is done automatically when using Direct2CP mode (see CP2JavaWSMasterDetailView).

Documentation :

We knew Xmlvm, a Java to Objective-C cross-compiler (that uses XSL stylesheets to transform JVM calls to Objective-C instructions) – that also provides a subset of Cocoa APIs in Java. Now we can discover iSpectrum from FlexyCore (french startup founded in 2008 by people that worked at INRIA and Texas Instruments), a solution composed of an Eclipse plugin (3.4 version min), Java ports of iPhone APIs (UIKit, CoreLocation, MediaPlayer), and an emulator. The Java code is compiled into Objective-C, and the Eclipse debugger is available. Compiling and using the emulator however require an Intel mac.

A 30 days demo (15 compilations) is downloadable, and a free open licence is provided for applications released under open source licences (for commercial applications, a Pro or Entreprise licence has to be purchased – prices not listed yet).

The Cappuccino/Java bridge, CP2JavaWS, follows its growth, and now reaches 150 downloads a month. It has been completed in late November, however it will be maintained as Cappuccino evolves (and may be included as an Atlas plugin).

The final version (1.0) of CP2JavaWS is available :

Added support for service protocol (CP class with methods signatures) specifying when retrieving a proxy, in order to allow :
– arguments type check
– nil arguments values (the expected type can then be retireved from the protocol – required for Java reflect)
– generic methods arguments (CPObject in CP, Object in Java)

Renamed HabiltationService/Filter to AuthorizationService/Filter.

Bug fix in CP2JavaWSJSONPConnection (synch. with latest code since addition of URL class).

MasterDetailView now uses alternating row color for table view, and background for detail view .

Note : documentation has been moved to MediaWiki.