Changes

Jump to: navigation, search

Teams Winter 2011/team4/lab2

1,435 bytes added, 17:14, 27 March 2011
no edit summary
=Lab 2=
*[http://zenit.senecac.on.ca/wiki/index.php/Teams_Winter_2011/team4 Teampage]
 
==Tutorial==
* Your workspace should look similar to this:
* Now click Run in the bottom right of your workspace, if everything went correctly, you will see a message saying '''osgi> TimeZones System Registered !'''
==Implement the Service Consumer==
===Define the MANIFEST.MF for the service consumer bundle===
*By selecting generate activator, when Eclipse creates your plugin, it also creates an activator class which is used to handle the lifecycle of the plug-in and provides access to both the underlying OSGi system and the content of the plug-in.
*Select the dependencies tab, and under the the right heading Imported Packages, select the add button (refer to picture below)
[[File:T4L2-9.png]]
* Like before, enter the name of your package and select ok.
===Use the class Activator to find the service===
*Open the '''Activator''' class in the consumer plug in project
*Get the servers reference in the '''Activator's''' ''start()'' method, And provide code to start your consumer class. Example code in the picture below.
[[File:T4L2-10.png]]
===Implement a class where one can consume the service===
*Create your consumer class in the consumer project
*Ensure that you create a static field in your consumer: ''static TimeZones tzs'' You will need this to use service provided
[[File:T4L2-11.png]]
 
===Install and run the Service Consumer Bundle===
*Run your consumer project: ''Right click -> Run As -> OSGi Framework''. As with the provider select the 3 bundles in our project
*Uncheck ''Target Platform''
*Check ''Add Required Bundles''
*Click ''Run!''
[[File:T4L2-12.png]]
*A sample of our code running, seamless updating of timezones!

Navigation menu