Tutorial:ServiceImplementation

Aus openAAL
Wechseln zu: Navigation, Suche

If you are a developer and want to implement an AAL service, you have to learn some points to have success in running your AAL service on top of openAAL. In general there are two ways to integrate an AAL service with openAAL. Either your AAL service is an OSGi bundle (java program with an Manifest file) or you develope it in the progamming langugage and framework of your choice and implement and support an appropriate Webservice which allows you to communicate with openAAL. The recommended way is to implement an OSGi service and so we will start with an easy example showing how to implement your AAL service as OSGi bundle for openAAL.

To create an OSGi project you have to install -if not already done- an Eclipse IDE, which is also containing the support of Plugin developement. If your installed Eclipse does not contain already a possibility to create Plugin Projects, you have to install an addon which supports this functionality. Further you need the Pax-Runner Plugin for your eclipse to create and execute your bundles in the Felix OSGi Framework.


Before you start with developing, you have to import openAAL into your workspace from SVN . You need an account to access the sourcecode of openAAL. There are further steps you have to pass through before you can begin your implementation. In the following all steps will be described completely and with screenshots, so don't be afraid if it is not clear already, what you have to do.

Inhaltsverzeichnis

Importing openAAL form SVN into workspace

You can import directly the openAAL projects into your workspace with Subclipse or another addon or you can access the projects via the Tortoise client. Take what fits better to your prefernces. But like already mentioned you need an account. For this you have to contact me: merkle[at]fzi.de. If you have your account you can request the openaal projects through the following url: https://ipesvn.fzi.de/svn-open/AHEAD/. This is the root directory of all AHEAD Software Components. You can find there Sub-Directories:

  • ahead_services: Here shall be the Ahead Services commited. There is one example service, which demonstrates how to setup and implement an OSGi Ahead service.
  • ahead_smartphone_app: Here shall be stored the Ahead Smartphone App, which connects the hearing glasses to openAAL.
  • context_manager: Here is the context management platform stored. You have to import these bundles if you want to test your developed service together with the context manager platform.

Every of these folders has sub folder in the same structure:

  • branches: different implementations of a component.
  • tags: tagged versions of the software.
  • sandbox: For implementing and testing and trying out new features.
  • trunk: the current and main version of the developed software.

For further information about SVN search at Google or another search engine.

Import the context managment platform from https://ipesvn.fzi.de/svn-open/AHEAD/context_manager/trunk into your workspace. At https://ipesvn.fzi.de/svn-open/AHEAD/ahead_services/trunk there is also an example for an Ahead service, which you can also import into your new eclipse workspace. It is not necessary because you will implement in this tutorial your Ahead service from scratch.

Creating a new Plugin Project

To implement your AAL service you have to create a Plugin Project. See the following screenshot.

First Click File->New->Others in your eclipse IDE. The view below appears. Select the Plugin Project and click Next.

Projektsetting.png

On the next view enter your project name into the appropriate text field. It is recommended to you use the same name convention like used in package names. As OSGi Framework select "standard" and select "No execution environment" because we don't want to be restricted in using Java runtime versions. Click "Next.

Pluginprojekt.png

In the next view you can fill out the empty fields and click "Next".

Projectfinish.png

Deselect "Create a plugin-in using one of the templates" and click "Finish". Now your new plugin project is created and you can start to program your AAL service.

Noplugin.png

The project tree should look like in the screenshot below.

Projecttree.png

Defining a declarative Service for consuming the Broker Service

Select in the project tree of your eclipse environment the root of your service project and create a new Directory called "OSGI-INF". Create in this new Directory a component.xml with help of the eclipse wizard.

Setting the run levels of the bundles

Now you have to go to the Run->Run Configurations. If the run configruation is not already opened, you have to go to the "OSGi Framework" node on the left side of the view. Now the run configuration view should be opened. Click the tab "Bundles" at the top of the view. A Editor view opens which shows all bundles available in your workspace. By default, they are all activated and have run level numbers and .