Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Using the OSGi Application Model on Mobile Devices with CLDC JVM - Dimitar Valtchev, CTO, ProSyst

305 views

Published on

OSGi World Congress 2005

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Using the OSGi Application Model on Mobile Devices with CLDC JVM - Dimitar Valtchev, CTO, ProSyst

  1. 1. Using the OSGi Application Model on Mobile Devices with CLDC JVM Dimitar Valtchev, CTO, ProSystDimitar Valtchev, CTO, ProSyst
  2. 2. ContentContent •• IntroductionIntroduction -- existing Java application models (AM)existing Java application models (AM) •• Why to use OSGi AM on CLDC?Why to use OSGi AM on CLDC? •• Technical constrainsTechnical constrains •• SolutionSolution •• ConclusionConclusion
  3. 3. Java application modelsJava application models •• UnmanagedUnmanaged –– Standard Java applications usingStandard Java applications using main()main() as describedas described in the The Java Language Specificationin the The Java Language Specification •• ManagedManaged –– AppletsApplets –– MIDletsMIDlets –– XletsXlets –– OSGi bundlesOSGi bundles –– OSGi R4 MEG AMOSGi R4 MEG AM
  4. 4. The rationales of using OSGi AM on CLDCThe rationales of using OSGi AM on CLDC •• The CLDC class library is optimized for devices withThe CLDC class library is optimized for devices with limited system resourceslimited system resources •• This leads to faster startup time, less process andThis leads to faster startup time, less process and heap memory usage of the applicationsheap memory usage of the applications •• CLDC has already been ported for very variousCLDC has already been ported for very various platformsplatforms •• There is a significant existing device baseThere is a significant existing device base •• ItIt’’s a good test case for the flexibility of OSGis a good test case for the flexibility of OSGi •• It provides useful experience for the work on MID2It provides useful experience for the work on MID2 successorsuccessor
  5. 5. Limitations of CLDC in the context of OSGiLimitations of CLDC in the context of OSGi •• There is no way to write customThere is no way to write custom ClassLoaderClassLoader oror even to define a Class from byteeven to define a Class from byte •• This leads to problems whenThis leads to problems when some bundles havesome bundles have classes and resources with the same namesclasses and resources with the same names •• Java 2 security model is not availableJava 2 security model is not available •• Some important classes and methods are missingSome important classes and methods are missing •• Difficulties in reading the manifest files (one jar andDifficulties in reading the manifest files (one jar and more jars; JVM specific APIs could be used)more jars; JVM specific APIs could be used)
  6. 6. Usage modesUsage modes •• StandaloneStandalone –– the used MIDP/CLDC VM allowsthe used MIDP/CLDC VM allows running of applications, which are notrunning of applications, which are not MIDletsMIDlets •• MIDletMIDlet –– the OSGi framework and all neededthe OSGi framework and all needed bundles plus one special MIDlet are packaged in abundles plus one special MIDlet are packaged in a singlesingle midletmidlet jarjar •• MIDlet SuiteMIDlet Suite –– the OSGi framework and all neededthe OSGi framework and all needed bundles plus one or morebundles plus one or more midletsmidlets are packaged inare packaged in aa midletmidlet suite jar. In this way differentsuite jar. In this way different MIDletsMIDlets inin the suite can also use the services and packagesthe suite can also use the services and packages provided by OSGi frameworkprovided by OSGi framework
  7. 7. Architecture modelArchitecture model Mobile Device MIDP JVM Admin MIDlet OSGi Framework Bundles MIDlet 1 MIDlet 2 • Admin MIDlet - provides user interface for interaction with the OSGi Framework •OSGi framework – classes that implement the OSGi Framework specification •Bundles –In MIDlet mode some bundles could provide additional GUIs •MIDlet 1,2 – in MIDlet Suite mode additional MIDlets could be run in the same JVM
  8. 8. Supporting the OSGi bundle lifecycle 1(2)Supporting the OSGi bundle lifecycle 1(2) •• Specific JVM features could be used:Specific JVM features could be used: definingdefining classes with the system class loader, unloadingclasses with the system class loader, unloading classes, receiving notification on classclasses, receiving notification on class loading/unloading from the system class loader.loading/unloading from the system class loader. Such features allow the framework to performSuch features allow the framework to perform bundle operations install, uninstall and updatebundle operations install, uninstall and update without restarting of the JVM.without restarting of the JVM.
  9. 9. Supporting the OSGi bundle lifecycle 2(2)Supporting the OSGi bundle lifecycle 2(2) Mobile Device Backend (mPRM) MIDP JVM Admin MIDlet OSGi Framework Bundles MIDlet 1 MIDlet 2 Native agent
  10. 10. Missing classes added through theMissing classes added through the classpathclasspath •• java.java.ioio.File.File •• java.java.ioio..BufferedOutputStreamBufferedOutputStream •• java.net.URLjava.net.URL •• java.util.Dictionaryjava.util.Dictionary •• java.util.java.util.EventListenerEventListener •• java.util.java.util.EventObjectEventObject •• java.util.java.util.StringTokenizerStringTokenizer
  11. 11. Missing methods added through a new classMissing methods added through a new class •• publicpublic classclass MiscMisc {{ •• publicpublic staticstatic Hashtable sysPropsHashtable sysProps;; •• publicpublic staticstatic finalfinal Boolean TRUE =Boolean TRUE = newnew Boolean(Boolean(truetrue);); •• publicpublic staticstatic finalfinal Boolean FALSE =Boolean FALSE = newnew Boolean(Boolean(falsefalse);); •• publicpublic staticstatic booleanboolean equalsIgnoreCaseequalsIgnoreCase(String a, String b) {}(String a, String b) {} •• publicpublic staticstatic booleanboolean getBooleangetBoolean(String prop) {}(String prop) {} •• publicpublic staticstatic BooleanBoolean getBooleanObjectgetBooleanObject(String(String argarg) {}) {} •• publicpublic staticstatic StringString getPropertygetProperty (String prop, String def) {}(String prop, String def) {} •• publicpublic staticstatic StringString getPropertygetProperty(String prop) {}(String prop) {} •• publicpublic staticstatic StringString setPropertysetProperty(Object prop, Object(Object prop, Object valueOvalueO) {}) {} •• publicpublic staticstatic ClassClass getComponentTypegetComponentType(Class(Class clcl) {}) {} •• publicpublic staticstatic booleanboolean isPrimitiveisPrimitive(Class(Class clscls) {}) {} •• publicpublic staticstatic intint getArrayLengthgetArrayLength(Object(Object arrarr)) throwsthrows IllegalArgumentExceptionIllegalArgumentException {}{} •• publicpublic staticstatic IntegerInteger getIntegergetInteger(String prop) {}(String prop) {} •• }}
  12. 12. Classes which should not be usedClasses which should not be used •• jjava.lang.Floatava.lang.Float •• java.lang.Doublejava.lang.Double •• java.lang.java.lang.ThreadGroupThreadGroup •• java.lang.java.lang.ClassLoaderClassLoader •• java.security.* classesjava.security.* classes •• java.math.* classesjava.math.* classes •• java.util.zip.* classesjava.util.zip.* classes •• java.net.java.net.URLStreamHandlerURLStreamHandler •• java.net.Socketjava.net.Socket •• Reflection APIReflection API
  13. 13. Developing CLDC compatible bundlesDeveloping CLDC compatible bundles •• Manually modifying existing codeManually modifying existing code –– Framework codeFramework code –– Bundles codeBundles code •• Using preUsing pre--processors at the development timeprocessors at the development time •• Using preUsing pre--processors at the installation timeprocessors at the installation time
  14. 14. mBSmBS CLDC on SE K700iCLDC on SE K700i It is possible to run mBS-CLDC on devices with 60 - 100 MHz CPUs and 4-8 MB of RAM !
  15. 15. Some tested devicesSome tested devices •• NokiaNokia 66006600 •• NokiaNokia CommunicatorCommunicator 95009500 •• Sony Ericsson K700iSony Ericsson K700i •• Sony Ericsson P800Sony Ericsson P800 •• SiemensSiemens CX70CX70 •• Palm Tungsten EPalm Tungsten E
  16. 16. Unsupported OSGi R3 featuresUnsupported OSGi R3 features •• Package Admin ServicePackage Admin Service •• Permission Admin ServicePermission Admin Service •• URL Handlers ServiceURL Handlers Service •• Native libraries supportNative libraries support •• Security ManagerSecurity Manager •• Separate class loading per bundleSeparate class loading per bundle •• Java.lang.Double and java.lang.Float supportJava.lang.Double and java.lang.Float support •• Slightly different behaviour of install, update,Slightly different behaviour of install, update, uninstall (depends on the JVM and/or on theuninstall (depends on the JVM and/or on the implementation of the native agent)implementation of the native agent)
  17. 17. ConclusionsConclusions •• The OSGi application model could be used onThe OSGi application model could be used on mobile devices with CLDC JVM including themobile devices with CLDC JVM including the currently available onescurrently available ones •• It makes the OSGi benefits available on very lowIt makes the OSGi benefits available on very low-- cost devicescost devices •• It allows OSGi bundles to be modified andIt allows OSGi bundles to be modified and deployed on CLDC devicesdeployed on CLDC devices
  18. 18. Some questionsSome questions •• Should OSGi care about CLDC environments atShould OSGi care about CLDC environments at al?al? •• How OSGi R4 will coHow OSGi R4 will co--exist with MIDP3?exist with MIDP3? •• How will MIDP3 on CDC look like?How will MIDP3 on CDC look like? •• Should we think about formulating the future OSGiShould we think about formulating the future OSGi specifications in a more general way?specifications in a more general way?
  19. 19. Thank you! For further information please contact me!Thank you! For further information please contact me! ProSyst Software GmbHProSyst Software GmbH Duerener StraDuerener Straßßee 405405 DD--50858 Cologne, Germany50858 Cologne, Germany Tel. +49 221 6604Tel. +49 221 6604--00 Fax +49 221 6604Fax +49 221 6604--660660 info@info@prosystprosyst.com.com www.www.prosystprosyst.com.com

×