Teams Winter 2011/team9/Lab2

From CDOT Wiki
Revision as of 08:02, 13 April 2011 by SimonJ (talk | contribs) (Created page with '===Overview=== For our OSGi tutorial we will be creating a simple task manager that will allow you to add and delete new tasks in a small java interface. ===Creating the Service…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Overview

For our OSGi tutorial we will be creating a simple task manager that will allow you to add and delete new tasks in a small java interface.

Creating the Service Interface

The first step in our OSGi tutorial will be creating our TaskManager interface. Create a new plug-in project by right-clicking the Package Explorer and selecting New -> Project... -> Plug-in Project, then name it cs.ecl.osgi.taskmanager and make sure that you select the OSGi Equinox as your platform then press Next.

Taskmanager 00.png


Since we will not be needing an activator for the service interface, make sure to uncheck the Generate an activator... option.

Taskmanager 01.png


Now, right-click your cs.ecl.osgi.taskmanager package and create a new interface called TaskManager. Then enter the following:

package cs.ecl.osgi.taskmanager;

public interface TaskManager {
    boolean addTask(String name);
    String removeTask(int index);
}

Before going on to our next step we must define our MANIFEST.MF file to export the package we just created. To do this, double-click the MANIFEST.MF file and select the Runtime tab. From here, you just select Add... and then find our package cs.ecl.osgi.taskmanager.

Taskmanager 02.png


Implementing the Service Provider