Difference between revisions of "Teams Winter 2011/team6/lab2"

From CDOT Wiki
Jump to: navigation, search
Line 1: Line 1:
 
=Lab 2 OSGI Tutorial=
 
=Lab 2 OSGI Tutorial=
After downloading the “Eclipse classic” from [http://www.eclipse.org/downloads/ Eclipse] then proceed with the following steps to create Chat Program with OSGi.
+
:After downloading the “Eclipse classic” from [http://www.eclipse.org/downloads/ Eclipse] then proceed with the following steps to create Chat Program with OSGi.
  
 
==Create the Chat Interface==
 
==Create the Chat Interface==
  
  
The first step is to create the Chat Interface which is the Service Provider in the Program. This defines and provides the services available and the requirements and outcomes for those services.
+
:The first step is to create the Chat Interface which is the Service Provider in the Program. This defines and provides the services available and the requirements and outcomes for those services.
  
 
===Define the service interface===
 
===Define the service interface===
  
  
a) Create a new Plug-in Project
+
:a) Create a new Plug-in Project
  
[[image:01NewProj.png|300px]]
+
:[[image:01NewProj.png|300px]]
  
b) Name your Plug-in Project (cs.dps914.osgi.lab.chatinterface) and be sure to select the target platform (OSGi framework: Equinox)
+
:b) Name your Plug-in Project (cs.dps914.osgi.lab.chatinterface) and be sure to select the target platform (OSGi framework: Equinox)
  
[[image:02newproj02.png|300px]]
+
:[[image:02newproj02.png|300px]]
  
c) Be sure to uncheck the “Generate an activator” option as you will not be needing an activator then go ahead and click finish.
+
:c) Be sure to uncheck the “Generate an activator” option as you will not be needing an activator then go ahead and click finish.
  
[[image:03newproj3.png|300px]]
+
:[[image:03newproj3.png|300px]]
  
 
===Create the bundle with the interface===
 
===Create the bundle with the interface===
  
a) You must now create three interfaces: IChatClient, IChatSystem and IMessage
+
:a) You must now create three interfaces: IChatClient, IChatSystem and IMessage
  
Be sure to edit the package name and the Interface Name.
+
:Be sure to edit the package name and the Interface Name.
  
[[image:04createinterface.png|300px]]
+
:[[image:04createinterface.png|300px]]
  
b) Fill the interfaces with the following information:
+
:b) Fill the interfaces with the following information:
Message
+
:Message
  
  
[[image:05IMessage.png|500px]]
+
:[[image:05IMessage.png|500px]]
  
Chat System
+
:Chat System
  
[[image:06ChatSystem.png|500px]]
+
:[[image:06ChatSystem.png|500px]]
  
Chat Client
+
:Chat Client
  
[[image:07ChatClient.png|500px]]
+
:[[image:07ChatClient.png|500px]]
  
 
===Export the Package===
 
===Export the Package===
To register our service we must export the package into the interface bundle
+
:To register our service we must export the package into the interface bundle
  
a) Select the MANIFEST.MF
+
:a) Select the MANIFEST.MF
  
b) In the Runtime tab select Add
+
:b) In the Runtime tab select Add
  
[[image:08ExportPackage.png|300px]]
+
:[[image:08ExportPackage.png|300px]]
  
c) Select the chatinterface package
+
:c) Select the chatinterface package
  
[[image:09PackageExported.png|300px]]
+
:[[image:09PackageExported.png|300px]]
  
  
Line 62: Line 62:
  
 
===Register the service in the class Activator===
 
===Register the service in the class Activator===
a) Create a new Plug-in Project
+
:a) Create a new Plug-in Project
  
b) Name your Plug-in Project (cs.dps914.osgi.lab.provider) again be sure to select the target platform correctly
+
:b) Name your Plug-in Project (cs.dps914.osgi.lab.provider) again be sure to select the target platform correctly
  
c) This time you can leave the Activator checked as you will need it. (Change the name of the activator to cs.dps914.osgi.lab.provider.ChatActivator)
+
:c) This time you can leave the Activator checked as you will need it. (Change the name of the activator to cs.dps914.osgi.lab.provider.ChatActivator)
 +
 
 +
:[[image:10PActivator.png|300px]]
 +
 
 +
 
 +
===Define MANIFEST.MF===

Revision as of 13:17, 12 April 2011

Lab 2 OSGI Tutorial

After downloading the “Eclipse classic” from Eclipse then proceed with the following steps to create Chat Program with OSGi.

Create the Chat Interface

The first step is to create the Chat Interface which is the Service Provider in the Program. This defines and provides the services available and the requirements and outcomes for those services.

Define the service interface

a) Create a new Plug-in Project
01NewProj.png
b) Name your Plug-in Project (cs.dps914.osgi.lab.chatinterface) and be sure to select the target platform (OSGi framework: Equinox)
02newproj02.png
c) Be sure to uncheck the “Generate an activator” option as you will not be needing an activator then go ahead and click finish.
03newproj3.png

Create the bundle with the interface

a) You must now create three interfaces: IChatClient, IChatSystem and IMessage
Be sure to edit the package name and the Interface Name.
300px
b) Fill the interfaces with the following information:
Message


05IMessage.png
Chat System
06ChatSystem.png
Chat Client
07ChatClient.png

Export the Package

To register our service we must export the package into the interface bundle
a) Select the MANIFEST.MF
b) In the Runtime tab select Add
08ExportPackage.png
c) Select the chatinterface package
09PackageExported.png


Implement the Chat Provider

Register the service in the class Activator

a) Create a new Plug-in Project
b) Name your Plug-in Project (cs.dps914.osgi.lab.provider) again be sure to select the target platform correctly
c) This time you can leave the Activator checked as you will need it. (Change the name of the activator to cs.dps914.osgi.lab.provider.ChatActivator)
10PActivator.png


Define MANIFEST.MF