How to create a sensor plugin

From RifidiWiki

Revision as of 16:20, 23 November 2009 by Kyle (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

This page describes how to develop a plugin using the Rifidi Edge Server Sensor API that connects to a sensor and collects information from it. For a more detailed description of the architecture of the sensor API, see this page. This HOWTO assumes that you know java, are relatively familiar with eclipse (or an equivalent IDE such as netbeans). It does not require that you know OSGi or spring dependency injection, but knowledge in these areas will help you understand why the steps are being taken and will help debugging.

Prerequisites

Naming your project
We recommend a name such as the following: com.yourcompany.org.rifidi.edge.sensorplugin.yourreadertype where yourcompany is the name of your company, and yourreadertype is the brand or model of the sensor you are making the plugin for.
  1. Follow the instructions on how to set up a Rifidi Edge Server development environment.
  2. Use the Plug-in Project wizard in eclipse to create a new plugin-project. Make sure that the target platform is set to run with a standard OSGi framework. In the second page, uncheck the option to automatically generate an Activator. In the third page, do not use a template.
  3. Open up the Manifest.MF file. Click on the dependencies tab. Add the following Plug-in dependencies:
    org.rifidi.edge.core
    org.rifidi.edge.core.services
    org.rifidi.edge.api
  4. Add 'Import package' dependencies to the following pacakges:
    javax.jms
    org.apacahe.activemq.command
    org.apache.commons.logging
    org.osgi.framework
    org.springframework.core
    org.springframework.jms.core
    org.springframework.osgi.service.importer
  5. Add a new folder called 'spring' into the META-INF folder
  6. Add a new file called spring.xml in the spring folder
  7. Add a new file called osgi.xml in the spring folder
  8. Add a new package. Typically the package has the same name as your project (for example, if the project is called com.yourcompany.org.rifidi.edge.readerplugin.yourreadertype, that is also the name of the top level package.
Personal tools