Difference between revisions of "Teams Winter 2011/team2/project"
Line 21: | Line 21: | ||
− | < | + | <syntaxhighlight lang="xml"> |
Manifest-Version: 1.0 | Manifest-Version: 1.0 | ||
Bundle-ManifestVersion: 2 | Bundle-ManifestVersion: 2 | ||
Line 29: | Line 29: | ||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6 | Bundle-RequiredExecutionEnvironment: JavaSE-1.6 | ||
Export-Package: ecl.team2.project.weather | Export-Package: ecl.team2.project.weather | ||
− | </ | + | </syntaxhighlight> |
− | 6. | + | 6. Create interface WeatherInterface. |
+ | <syntaxhighlight lang="java"> | ||
+ | package ecl.team2.project.weather; | ||
+ | |||
+ | import java.util.ArrayList; | ||
+ | |||
+ | public interface WeatherInterface { | ||
+ | WeatherAndCurrent getWeather(String city) throws Exception; | ||
+ | ArrayList<Location> getCity (String city) throws Exception; | ||
+ | } | ||
+ | </syntaxhighlight> |
Revision as of 15:50, 16 April 2011
Contents
Tutorial
In this tutorial, we will be elaborating on how to replicate our OSGI project application. We will provide a brief explanation of each plug-in project needed, the packages that corresponds to those projects, and of course the java source files that will be used to create the program.
Project
For this project, we are going to create a weather service program using the osgi framework. This project will contain three bundles: Consumer, Interface and Provider bundles. The Interface bundle will contain a set of interface and classes used by both Consumer and Provider. The Provider bundle will provide a service to return weather information for a selected city. The Consumer bundle will use the service reference to get weather information from the Provider and display in a GUI window based on Java Swing Library.
Prerequisites
- Download Eclipse
Steps
1. In Eclipse, create a new workspace.
2. Create a new Plug-in project following settings, name it consumer.
3. Likewise create 2 more plug-in projects called interface and provider. Uncheck the 'Generate Activator' option for interface.
4. In the interface bundle, we create a package, ecl.team2.project.weather. We will create classes and interface java files that are used by consumer and provider bundles.
5. The default MANIFEST.MF of interface bundle looks like this. It does not require any modification.
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Weather
Bundle-SymbolicName: interface
Bundle-Version: 1.0.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Export-Package: ecl.team2.project.weather
6. Create interface WeatherInterface.
package ecl.team2.project.weather;
import java.util.ArrayList;
public interface WeatherInterface {
WeatherAndCurrent getWeather(String city) throws Exception;
ArrayList<Location> getCity (String city) throws Exception;
}