Livespaces
Training Workshop - Deployment Exercise

This exercise is broken down into two parts:

Exercise 3a: Deployment & Configuration

See the Deployment Exercise slides

Exercise 3b: Deployment & Configuration of a New Service

By the end of this exercise you will:

Files involved:

Run targets:

Steps:

  1. Ensure the elvin daemon is running.
  2. Open Eclipse from the desktop shortcut
  3. From the Window menu, select "Show View" -> "Ant"
  4. Drag the file build.xml from the livespace.osgi project into the newly opened panel. This panel allows us to run specific Ant targets.
  5. Drag the file build.xml from the livespace.services.examples.sound_player project into the same panel.
  6. Discuss the structure of the Sound Player application
  7. Go through SoundPlayerServer.java and run it.
    • Note the service properties in particular.
  8. Run the Livespace Browser App and manipulate the sound player.
    • Changing the sound file.
    • Changing the state and watching for it to be updated.
  9. Run the "Example - SoundPlayerTextUI" launch target to demonstrate a basic client.
  10. As a bundle the Activator does the work of the SoundPlayerServer class. Extending the RoomBasedActivator gives access to
    • the local Elvin connection,
    • the local RoomEntity as well as
    • configuration properties specific to the service.
  11. The build.xml Ant file creates a bundle from the service code.
  12. The service configuration should be stored at /development/livespace.osgi/config/test/services/livespace.examples.sound_player.properties, the filename of which matches the bundle name minus the version information. There is already a properties file at /development/livespace.osgi/config/default/services/livespace.examples.sound_player.properties, copy this file into your custom config directory (test) and modify it there
    • Change base.media.url property to http://ics-winserver:8090/livespaces/media/training
  13. Our test deployment configuration builds upon the default configuration, loading the livespace.examples.sound_player bundle specifically.
    • Update client.deploy to include livespace.examples.sound_player (Note: bundle should be started, not just installed)
    • NB For more information on deployment configuration see the Software Installation Manual.
  14. Run the Ant targets to build all the bundles
    1. livespace.osgi:livespace_core_bundles
    2. livespace.osgi:livespace_standard_bundles (if you get errors regarding jarsigner processes, don't worry about these right now, they're a known issue and don't affect the building of the bundles)
    3. livespace.examples.services.sound_player
  15. Start a cygwin terminal and change directory to /development/livespace.osgi with
    • cd /development/livespace.osgi
  16. Set the LIVESPACE_OSGI_PATH environment variable with
    • export LIVESPACE_OSGI_PATH="file:/C:\\development\\livespace.osgi"
  17. If the name of your custom configuration directory is not "test" (the default) then set the LIVESPACE_CONFIG environment variable with
    • export LIVESPACE_CONFIG=<config_dir_name>
  18. Now we can run the Livespace client locally
    1. Go to the cygwin terminal
    2. Run bin/start_osgi.sh
  19. Questions

Key points to remember

  1. Write the service and test it with a main() driver class.
  2. Write the Activator which takes the place of the main() method.
    • The bundle name is defined in the constructor. This must match the file name of the bundle jar and the name of property files for configuring the service.
  3. Write the build.xml to turn your code into a bundle.
    • Make sure you import all the classes you need (you may need to update this list several times during testing)
  4. Write any service property files
  5. Configure the deployment of your bundle
  6. Run the local Livespace client and test your bundle within OSGi locally.
  7. When working you can deploy it properly.
  8. To run a Livespace client locally
    1. Run the local elvin daemon
    2. Check your deployment configuration and service properties
    3. Ant build livespace.osgi:livespace_core_bundles
    4. Ant build livespace.osgi:livespace_standard_bundles
    5. Ant build your bundle
    6. Run a cygwin terminal
    7. execute export LIVESPACE_OSGI_PATH="file:/C:\development\livespace.osgi"
    8. execute bin/start_osgi.sh

category: Documentation, Public