Personal tools
You are here: Home Developer Zone Documentation MUSIC in mobile devices MUSIC under phoneME and Knopflerfish
Document Actions

MUSIC under phoneME and Knopflerfish

by Jorge Lorenzo last modified 2009-04-20 16:15

A MUSIC distribution based on a complete open source infrastructure: phoneME and Knopflerfish.

MUSIC is a highly configurable middleware based on different mechanisms. One of these mechanisms is the selection of which MUSIC bundles will be deployed in the OSGi framework.

Downloads

Two different configurations of MUSIC under phoneME can be downloaded:

Both configurations are based on MUSIC version 0.3.0 and run over Windows XP/Vista (using Sun's JRE) and Windows Mobile 5/6.0/6.1 (using phoneME). For other OS, you need to download the corresponding phoneME binaries.

Simple configuration

You can download it here. The following configuration is a very simple one without communication services (standalone) and a very simple application which just reacts to a change in the screen orientation (context change which provokes an adaptation).

Installation of this distribution

The distribution is composed of the following directories:

  • pmea. It is the Java ME with a CDC Personal Profile. It was obtained from Davy's site. It was also modified to add the logging.properties file in the lib directory in order to configure the logging in MUSIC.
  • knopflerfish. It is the knopflerfish distribution (v2.2.0) with the MUSIC bundles to launch the MUSIC middleware. This distribution can be tested under Windows (launched with music_windows.bat) and Windows Mobile (launched with MUSIC.lnk).
  • music. This folder contains the MUSIC bundles to launch the MUSIC middleware, including the libraries (like eSWT) needed by the middleware.

This distribution is configured to work without any change if it is deployed in the "\Storage Card" directory of the Windows Mobile device. If the deployment directory is different, you will need to adjust the paths in the configuration files included in the knopflerfish directory and the link file to phoneME (MUSIC.lnk), because Windows Mobile does not have the concept of current directory and all the paths must be full paths.

A very simple way to test this MUSIC distribution is with a Windows Mobile emulator. By selecting File -> Configure..., you can configure a virtual storage card in the Shared folder field. If you select the directory of this distribution, it will be mounted correctly in the directory "\Storage Card" of the PDA.

Mounting the MUSIC platform in a Windows Mobile emulator

Configuration of the Knopflerfish framework

The MUSIC.lnk file launches the MUSIC middleware by invoking the phoneME VM:

255#"\Storage Card\pmea\bin\cvm.exe" -f "\Storage Card\knopflerfish\cvm.args"

These link files have a limit of 255 characters, imposed by Windows Mobile; to avoid exceeding this limitation, we use an additional file, cvm.args, where is specified some parameters of phoneME, the bootclasspath, the path for the Knopflerfish framework directory (fwdir), and the jar file to be executed (corresponding to the Knopflerfish framework):

-Xmx2m "-Xbootclasspath/a:/Storage Card/knopflerfish/regex.jar;/Storage
Card/knopflerfish/logging.jar;/Storage Card/knopflerfish/beans.jar"
"-Dorg.osgi.framework.dir=/Storage Card/knopflerfish/fwdir/"
-jar "/Storage Card/knopflerfish/framework.jar"

Finally, the Knopflerfish framework is configured with another file, init_WindowsCE.xargs, which includes the list of Knopflerfish bundles to be started, as well as the MUSIC bundles:

-Dorg.knopflerfish.verbosity=0
-Dorg.knopflerfish.framework.debug.packages=false
-Dorg.knopflerfish.framework.debug.errors=true
-Dorg.knopflerfish.framework.debug.classloader=false
-Dorg.knopflerfish.framework.system.export.all_13=false
-Dorg.osgi.framework.system.packages=
-Dorg.knopflerfish.startlevel.use=true
-Dorg.osgi.framework.dir=/Storage Card/knopflerfish/fwdir/
-Dorg.knopflerfish.gosg.jars=file:/Storage Card/knopflerfish/
-istart jars/log/log_all-2.0.2.jar
-istart jars/cm/cm_all-2.0.1.jar
-istart jars/console/console_all-2.0.1.jar
-istart jars/component/component_all-2.0.0.jar
-istart jars/consoletty/consoletty-2.0.0.jar
-istart jars/frameworkcommands/frameworkcommands-2.0.5.jar
-istart jars/logcommands/logcommands-2.0.0.jar
-istart ../music/org.eclipse.ercp.swt.wm6pro_1.2.0.jar
-istart ../music/music-model-0.3.0.0-SNAPSHOT.jar
-istart ../music/music-kernel-0.3.0.0-SNAPSHOT.jar
-istart ../music/music-manager-0.3.0.0-SNAPSHOT.jar
-istart ../music/music-resources-0.3.0.0-SNAPSHOT.jar

-istart ../music/music-adaptation-0.3.0.0-SNAPSHOT.jar
-istart ../music/music-context-0.3.0.0-SNAPSHOT.jar
-istart ../music/music-gui-eswt-0.3.0.0-SNAPSHOT.jar
-istart ../music/resource-plugins/memory-resource-plugin-0.3.0.0-SNAPSHOT.jar
-istart ../music/applications/org.istmusic.tutorials.realizations_0.1.0.jar
-launch

This configuration corresponds to Windows Mobile. The configuration for Windows XP/Vista is described in the init.xargs file. This file is selected as the default configuration for any OS unless another configuration is provided specifically (like the init_WindowsCE.xargs file, which is specific for Windows Mobile). The only difference between both configurations is the eSWT library.

Testing the distribution

After launching the MUSIC platform, by using the "\Storage Card\MUSIC.lnk" file, we need to launch our MUSIC application by using the following steps:

  • Select the "Application management" in the MUSIC GUI
  • Select the application "type/org.istmusic.tutorials.realizations/..." and press Launch.

The MUSIC GUI will display the status of the application. If the small man icon is grey, the application is stopped; if the color is green, then the application was successfully launched.

Monitoring the MUSIC applications

The adaptation of the application can be tested by changing the display orientation: Menu -> Switch orientation. The display orientation is a context element monitored by the adaptation manager (part of the MUSIC middleware) and a change of this context value will trigger an adaptation process which will select the most appropriate configuration of the application.

After several changes of the display orientation, we can verify that the adaptation has correctly worked by the output in the Java console. Depending on the configuration of the MUSIC application, the format of the string: "Hello, world!" will change. For this purpose, you need to close the MUSIC GUI. The Java console should display something like the next figure (we provide the one from Windows XP to provice all the traces of the execution).

The MUSIC console for a simple configuration


Complex configuration (with communication services)

This configuration, which can be downloaded here, adds communication features to the simple configuration. This allows the discovery of other MUSIC nodes in the same network in order to execute distributed applications. It also offers the possibility of discover services in the network using SLP.

The configuration of the distribution is similar to the simple one. The differences are found in the configuration file of Knopflerfish, which adds the communication bundles:

-istart ../music/net.sf.cglib_2.2_beta1.jar
-istart ../music/jslp-osgi-1.0.0.RC5.jar
-istart ../music/music-communication-0.3.0.0-SNAPSHOT.jar
-istart ../music/communication-plugins/music-communication-socket-0.3.0.0-SNAPSHOT.jar
-istart ../music/communication-plugins/music-communication-slp-0.3.0.0-SNAPSHOT.jar
-istart ../music/communication-plugins/music-communication-planner-0.3.0.0-SNAPSHOT.jar

Powered by Plone CMS, the Open Source Content Management System

This site conforms to the following standards: