1
edit
Changes
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…'
===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'''.
[[File:Taskmanager_00.png]]
Since we will not be needing an activator for the service interface, make sure to uncheck the '''Generate an activator...''' option.
[[File:Taskmanager_01.png]]
Now, right-click your '''cs.ecl.osgi.taskmanager''' package and create a new interface called TaskManager. Then enter the following:
<pre>
package cs.ecl.osgi.taskmanager;
public interface TaskManager {
boolean addTask(String name);
String removeTask(int index);
}
</pre>
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'''.
[[File:Taskmanager_02.png]]
===Implementing the Service Provider===
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'''.
[[File:Taskmanager_00.png]]
Since we will not be needing an activator for the service interface, make sure to uncheck the '''Generate an activator...''' option.
[[File:Taskmanager_01.png]]
Now, right-click your '''cs.ecl.osgi.taskmanager''' package and create a new interface called TaskManager. Then enter the following:
<pre>
package cs.ecl.osgi.taskmanager;
public interface TaskManager {
boolean addTask(String name);
String removeTask(int index);
}
</pre>
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'''.
[[File:Taskmanager_02.png]]
===Implementing the Service Provider===