How to create a sensor plugin
From RifidiWiki
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. |
- Follow the instructions on how to set up a Rifidi Edge Server development environment.
- 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.
- 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
- 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
- Add a new folder called 'spring' into the META-INF folder
- Add a new file called spring.xml in the spring folder
- Add a new file called osgi.xml in the spring folder
- 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.