Open main menu

CDOT Wiki β

Teams Winter 2011/team9/Lab2

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)

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.

 


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

 


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.

 


Implementing the Service Provider