1 / 0

Modularity in Java ME Embedded world

Modularity in Java ME Embedded world. Andrey Petushkov Consulting Member of the Technical Staff, Oracle.

rafer
Download Presentation

Modularity in Java ME Embedded world

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Modularity inJava ME Embeddedworld AndreyPetushkovConsulting Member of the Technical Staff, Oracle
  2. The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle.
  3. Program Agenda Why modularity at all? Modularity in Java ME What is available and how to use Challenges
  4. Why would one want Java on embedded? Typically embedded is developed using Asm, C, Forth effort consuming high-grade developers (good but not enough) limited OS support, limited tooling Java comes with familiar to 9M+ developers sandbox model, multi-threading lots of rich and relevant standard APIs (communication and security!) extensive development tools and technologies
  5. “Small embedded” Footprint matters Mass volume -> low cost -> limited resources Not need to be universal Just the right set of features to do the job Need no extra code, no extra efforts Maintainability Performance Time to market Cost of development …
  6. Java ME? Java ME mobile Monolithic silver bullet platform Simple self-contained applications Java ME embedded? Lessons learned Adapt to new reality Flexibility is an answer Modularity and Optionality
  7. wikipedia.org “Modularity is the degree to which a system's components may be separated and recombined.”
  8. Software modularity Good by itself Easier to design, develop in a group or throughout time, test, maintain, deploy, update, evolve, share, … Comes in a variety of flavors Dynamic vsstatic Manual or assisted by the tools Existing implementations around Java: OSGi, project Jigsaw, MIDP3 LIBlets
  9. To fill a shape with an image. Use existing picture box, DO NOT delete and create new picture box. Right click on the shape. At the bottom of the submenu select “Format Shape” Select “Fill” at the top of the “Format Shape” dialog box. Select “Picture or Texture fill” from the options. And select “File” under the “Insert from” option. Navigate to the file you want to use and select “Insert” On the “Format” tab, in the Size group, click on “Crop to Fill” in the Crop tool and drag the image bounding box to the desired size DELETE THIS INSTRUCTION NOTE WHEN NOT IN USE Modularity in Java MEPlatform
  10. A bit of history Modularity in Java ME pre 8 days JSR-grained level: Configuration: CLDC or CDC Profile: MIDP, PP or PBP Optional packages Rarely single JSR is comprised of a few pieces
  11. So what’s coming? Java ME 8 CLDC 1.1 (JSR 139) CLDC8 (JSR 360) IMP-NG (JSR 338) Micro-edition Embedded Profile (JSR 361) Oracle JMEE extensions
  12. Platform APIs CLDC 8: Profiles: Compact API vs Full API Compact java.lang java.lang.annotation java.lang.ref java.security java.io java.net java.util Full Compact API + java.nio java.nio.file, java.nio.file.attribute, java.nio.channels java.util.logging
  13. Platform APIs CLDC 8: Profiles: Compact API vs Full API Compact java.lang java.lang.annotation java.lang.ref java.security java.io java.net java.util System.getProperty( “microedition.configuration”) Full Compact API + java.nio java.nio.file, java.nio.file.* java.nio.channels java.util.logging
  14. Platform APIs CLDC 8: more optionality Connector.isProtocolSupported( name, server) GCF API is present fully, if at all present Individual protocols can be either supported or not AccessPoint functionality optionally supported NIO File API can be present butnot implemented
  15. Platform APIs javax.microedition.cellular MEEP 8 javax.microedition.event Almost every package isindividually optional Moreover: Concurrency Provisioning LIBlets Security javax.microedition.io javax.microedition.key javax.microedition.lui javax.microedition.media javax.microedition.midlet javax.microedition.power javax.microedition.rms javax.microedition.swm
  16. Platform APIs MEEP 8 A.java if (“true”.equals(System.getProperty(“microedition.lui”)) A.jad MIDlet-Dependency-1= standard;required;microedition.securityframework MyDevice.xml <rdf:li>microedition.gcf true</rdf:li>
  17. MEEP 8: Right-Sizing The Platform Note: All footprint numbers approximate and subject to change Application(s) Optional JRSs Optional APIs MEEP 8 Full Profile Set Optional Package Optional Package Java ME 8 Platform Optional Package Note: IMP-NG Compatible Profile Set Not Shown. Recommended: 1 MB RAM, 2 MB Flash MEEP 8 Standard Profile Set MEEP 8 Minimal Profile Set CLDC 8
  18. Modularity in Java MEApplications
  19. Application modularity: LIBlets Individual packaging Individual yet dependentprovisioning/deployment Flexible version dependencydeclaration Automatic deployment and removal based on dependencies Shared storage Common execution environment MIDlet Suite MIDlet LIBlet
  20. Application modularity: Services Simple example, Service Provider and Consumer are two different apps MIDlet Suite 1 MIDlet Suite 2 MIDlet 2 MIDlet 1 LIBlet 2
  21. Application modularity: Services Simple example, Service Provider and Consumer are two different apps MIDlet Suite 1 MIDlet Suite 2 MIDlet 2 MIDlet 1 LIBlet 2 MIDletSuite1.jad LIBlet2.jar/META-INF/MANIFEST LIBlet-Services: com.example.CodecSet … MIDlet-Dependency-1: service; required; com.example.CodecSet … LIBlet2.jar/META-INF/services/com.example.CodecSet com.example.impl.StandardCodecs # Standard codecs
  22. Application modularity: Servcies Interface CodecSet public interface CodecSet { public Encoder getEncoder(String encodingName); public Decoder getDecoder(String encodingName); } Simple example, Service Provider and Consumer are two different apps MIDlet Suite 1 MIDlet Suite 2 MIDlet 2 MIDlet 1 LIBlet 2 class MIDlet1 private static ServiceLoader<CodecSet> codecSetLoader = ServiceLoader.load(CodecSet.class); public static Encoder getEncoder(String encodingName) { for (CodecSet cp : codecSetLoader) { Encoder enc = cp.getEncoder(encodingName); if (enc != null) return enc; } return null; } class StandardCodecs public class StadardCodecsimplementsCodecSet { public StadardCodecs() { … } public Encoder getEncoder(String encodingName) { return new EncoderImpl(…); } }
  23. Application modularity Manage execution Automatic invocation Auto-start when device starts Push Communication Inter-MIDlet communication protocol Light-weight stream-based communication Events Asynchronous packet based data transfer
  24. To fill a shape with an image. Use existing picture box, DO NOT delete and create new picture box. Right click on the shape. At the bottom of the submenu select “Format Shape” Select “Fill” at the top of the “Format Shape” dialog box. Select “Picture or Texture fill” from the options. And select “File” under the “Insert from” option. Navigate to the file you want to use and select “Insert” On the “Format” tab, in the Size group, click on “Crop to Fill” in the Crop tool and drag the image bounding box to the desired size DELETE THIS INSTRUCTION NOTE WHEN NOT IN USE Modularity challenges
  25. Take into account: Fragmentation Interfaces become more “standard” Have to be well thought And harder to change Takes time And footprint? Even when assisted by tools
  26. To fill a shape with an image. Use existing picture box, DO NOT delete and create new picture box. Right click on the shape. At the bottom of the submenu select “Format Shape” Select “Fill” at the top of the “Format Shape” dialog box. Select “Picture or Texture fill” from the options. And select “File” under the “Insert from” option. Navigate to the file you want to use and select “Insert” On the “Format” tab, in the Size group, click on “Crop to Fill” in the Crop tool and drag the image bounding box to the desired size DELETE THIS INSTRUCTION NOTE WHEN NOT IN USE The way we do itorWhat’s beneath iceberg’s waterline
  27. The way we do it Modular source base Subsystem Library Interface Implementation Interface Classes com/oracle/meep Native In only MEEP implementation 29 subsystems 190 libraries 230 library implementations
  28. The way we do it Platform build configurator Convenient way to describe dependencies between configuration parameters and modules Provides GUI front-end for customer use Exports value to the build system bool COMPILE_C_FILES_TOGETHER requires !SOURCE_BUNDLE prompt "Batch Compilation" default true help Batch sources compilation makes build process noticeably faster bool USE_SERIALIZATION prompt "Enables serialization" default [DEVICEACCESS] || ([MEEP] && !USE_SMALL_WORLD) help Enables serializarion of internal platform classes.
  29. The way we do it public class b { // Just comment // #define MAX_TASKS 16 // #if MAX_TASKS > 1 Thread thread; // #else Thread getThread() { return null; } // #endif int C = $(MAX_TASKS) * 2 / 3; public static void main(String[] args) { System.out.println("Done."); } } Preprocessor Both C … and Java Custom built based javac front-end Capable of processing #ifdefs as well as macro expansion and constant expression evaluation 2027 #ifdefs in 1503 classes (MEEP) Minimum 50 bytes per method Minimum 300 bytes per class
  30. The way we do it Code generation Java classes ROM image Properties (volatile product configuration) Generation of configuration file ROMization of properties Type and other verification information Constants based on configuration parameters Localization meta-information
  31. Questions please
More Related