GWT Development for Handheld Devices

  • View
    107

  • Download
    1

Embed Size (px)

Text of GWT Development for Handheld Devices

Presentazione standard di PowerPoint

GWTcon FirenzeFrancesco RadaelliGWT Development for Handheld DevicesA successful story within a retail store chain

- November 2014 -Project Scope & Requirements

Remake of all mobile apps used by point of sales:Item Inventory, reorder, tracking; Competitor Price Survey; etc.Previous architecture:Native apps build with C# .NET + Oracle DB Lite;Windows CE on Motorola MC3090/MC3190.Requirements:Providing support to different:OS: Windows CE and Window Mobile (Android, etc);Device/Vendor models;Applications must work without network connectivity.Handheld Devices

Motorola MC3190Motorola MC55MEM256MB Ram 1GB FlashMEM256MB Ram1GB FlashCPUMarvel PXA320624MHzCPUMarvel PXA320624MHzRES320x320pxRES480x640pxOSWindows CEOSWindows Mobile 6.5Datalogic SkorpioDatalogic ElfMEM256MB Ram 512MB FlashMEM256MB Ram256MB FlashCPUXScale PXA310 624 MHzCPUXScale PXA310 624 MHzRES240x320pxRES480x640pxOSWindows Mobile 6.5OSWindows Mobile 6.5

Architecture

Web-based solution.Adopted technologies:Client:GWT: v.2.5.1;HTML5: application cache manifest, local storage, web message;JBoss Errai: CDI, JAX-RS;RhoMobile Suite: v.4.1.0.Server:Java EE: JAX-RS v1.1 (Jersey v.1.9.1), EJB (v.3.1), JPA v.2.0;Oracle Weblogic 12c;Apache HTTP Server (static content);

RhoMobile SuiteBuildnativeenterprise mobile apps usingweb skills: JS, HTML5 and CSS3.Includes: RhoMobile mobile application container:Rhodes JS/Ruby API: access to device level capabilities like camera, geo-location, etc.RhoElements JS/Ruby API: access to Motorola hardware capabilities like bar code scanner, etc.RhoStudio (Eclipse based)RhoConnect and RhoGallerySupports several mobile OSs:Android, Apple iOS, Windows Embedded Handheld, Windows CE and Windows Phone 8.Provides a Webkit based browser to Windows Mobile/CE platforms.

Framework Dependecies

PDA FrameworkRhoMobileGWT wrapperHTML5Application CacheHTML5 Web MessageGWT wrapperGWTJBoss ErraiRhoMobile JS APIApplications RhoMobile RuntimeRhoMobile ExtsMGWTPDA FrameworkPDA Framework ComponentsVariousUIManagersApplicationManagerBatteryManagerLocal DataManagerNotificationManagerRemote CommandManagerSignalManagerThemeManagerDialogsButtonsOthersCachesRemoteLoggingPersistent QueueLocal DatabasesThemesBarcodeManagerCacheManager

BatteryWrapperBatteryWrapperDatabaseWrapperSignalWrapperBarcodeWrapperRhoMobile JS APIBatteryManagerLocal DataManagerSignalManagerBarcodeManager

Barcode GWT Wrapper

Errai CDIGWT JSNI: Motorola (default) implementation

GWT Deferred Binding

GWT JSNI: Datalogic implementationCode Optimization- Deferred Binding -

Motorola MC3190Motorola MC55MEM256MB Ram 1GB FlashMEM256MB Ram1GB FlashCPUMarvel PXA320624MHzCPUMarvel PXA320624MHzRES320x320pxRES480x640pxOSWindows CEOSWindows Mobile 6.5Datalogic SkorpioDatalogic ElfMEM256MB Ram 512MB FlashMEM256MB Ram256MB FlashCPUXScale PXA310 624 MHzCPUXScale PXA310 624 MHzRES240x320pxRES480x640pxOSWindows Mobile 6.5OSWindows Mobile 6.5

Deferred Binding (1/2)

1. device.model property definition.

3. device.vendor property definition.

4. device.display property definition.

2. property device.model property-provider definition.Deferred Binding (2/2)

4 devices 4 permutations1. device.vendor property controls barcode and WIFI signals implementations and some others system properties.2. device.display property controls display/layout resource bundles e css classes.Web Applications and... offline

Requirements:Applications must boot in case of network/server problems (offline);Application data must persist in offline mode and after a reboot.Standard HTML5 features have been used:Application Cache Manifest;Local Storage.

Application Cache Manifest

Not available in GWTout of the box.MGWT library (v.1.1.2) has been used.Consists in:A further linker at compilation-time.A Servlet that returns the right manifest file at run-time.Custom permutation provider based on the property device.model.

Application Cache Manifest - Compile Time -

manifest.map

1

artifacts2PermutationMapLinker

Application Cache Manifest- Run Time -

servermanifest.map

2: read

4client6

mc3100

artifacts4: request5: response1: request3: response [content type: text/cache-manifest]

E4080E6DBA00EBDBFCDE21EB12A3F855.manifestApplicationCache.dbLocal Storage- Incoming Data Persistence -

Errai JSON marshallerHTML5 Local Storage

0110101010Local Storage- Outgoing Data Persistence -

Implementation of a custom persistent queue for outgoing data: PersistentQueue.Outgoing data is stored in Errai json format.Data is consumed asynchronously by generic consumer PersistentQueueConsumer. Outgoing data is sent to the server in Jackson json format (fast transformation) by PersistentQueueConsumerRemoteCallback with a PUT/POST.Consumer can be also connected to NotificationManager.

0110101010PersistentQueueConsumer

Consumes outgoing data when:Queue items number is greater than a lower bound;User does not interact with the device for specific amount of time.Tries to consume a single item:On success: Removes the item from the queue.Consumes other items all together (up to an upper bound).On failure: reschedules itself with a delay that grows exponentially (up to an upper bound).

App Architecture- Performance Considerations (MC3190)-256MB ~132MB really available.RhoMobile takes ~20s to start & ~ 23MB of memory 108MB free.Different Build Modes:Standalone applications (AppN.cache.js ~2MB):Useful during the application development.Low memory usage: ~58MB (~44%).Integration among applications was more tricky (one application running per time). Menu startup is slow (~30s, just once).Application launch is too slow (~40s, many times).Monolithic Application (AllApps.cache.js ~3.6MB):Full application startup is slower (~65s, just once).But application launch is very fast (~0s, many times).Higher integration among application.Higher memory usage: ~83MB (~63%).

ReferencesGWT:http://www.gwtproject.org/articles/mvp-architecture.html mgwt: http://www.m-gwt.com/ RhoMobile Suite: http://docs.rhomobile.com/ JBoss Errai: http://erraiframework.org/ HTML5 cache Manifest:http://www.w3.org/TR/2011/WD-html5-20110525/offline.htmlHTML5 Web Storage: http://www.w3.org/TR/webstorage/ HTML5 Web Messaging: http://www.w3.org/TR/webmessaging/

Q&A