Skip to content

Installation Guide

Hylke van der Schaaf edited this page Nov 20, 2015 · 35 revisions

#Local Deployment of the OpenIoT Platform:

Notice: Please follow the sequence in this manual because any change in the sequence may cause errors.

Notice: In this manual, JAVA is in the location:/Library/Java/JavaVirtualMachines/jdk1.7.0_71.jdk/Contents/Home, MAVEN is in the location:/apache-maven-3.2.5, JBOSS is in the location:/jboss-as-7.1.1.Final and THE CODE in the location: /openiot. Please use appropriate paths based on your local installation location.

Notice: In this document,
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_71.jdk/Contents/Home.
MAVEN_HOME=/apache-maven-3.2.5.
JBOSS_HOME=/jboss-as-7.1.1.Final.
Please use appropriate paths based on your local installation location.

##1) Install JDK 1.7

This process is required only one time if it hasn't been done already.

MAC OS X specific example:

  • Open the terminal and open the .bash_profile file to store JAVA environment variables so that you can use them every time you use the terminal without the need of writing them down every time:
vi  ~/.bash_profile
  • Write in the following configurations then save:
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_71.jdk/Contents/Home      //(please change according to the location of your JDK)

export  JAVA=$JAVA_HOME/bin

export PATH=$JAVA:$PATH
  • To make sure that everything is correct, run:
echo $JAVA_HOME
echo $JAVA
echo $PATH
java –version   
env

Notice: you can follow any other steps according to your own experience.

Notice: vim is a text editor. For more information about using it, follow this link:
http://www.linux.com/learn/tutorials/228600-vim-101-a-beginners-guide-to-vim

##2) Install Maven

This process is required only one time if it hasn't been done already.

MAC OS X specific example:

  • Open the terminal and open the .bash_profile file to store maven environment variables so that you can use them every time you use the terminal without the need of writing them down every time:
vi  ~/.bash_profile
  • Write in the following configurations then save:
export M2_HOME=/apache-maven-3.2.5  //(please change according to the location of your MAVEN folder)

export M2=$M2_HOME/bin

export PATH=$M2:$PATH
  • To make sure that every thing is correct run:
echo $M2_HOME
echo $M2
echo $PATH
mvn –version
env 

Notice: you can follow any other steps according to your own experience.

##3) Installing Local Virtuoso:

OpenIoT is using Virtuoso OpenSource v7.0.0 and above. This process is required only one time if it hasn't been done already.

Note: for Linux & Windows installations, virtuoso V7 requires a 64 bit machine.

Linux Installation:

  • Please follow this link for detailed instructions on installing Virtuoso Open Source 7 in Ubuntu.

Windows Installation

  • Download the latest prebuild binaries for Windows from [here](http://virtuoso.openlinksw.com/dataspace/doc/dav/wiki/Main/VOSDownload#Pre-built binaries for Windows)
  • Directions on how to install Virtuoso Open-Source Edition on Windows can be found here
  • Register a new Virtuoso Service by executing in a command prompt (with administrative rights)
    • virtuoso-t +service create +instance "OpenIoT" +configfile virtuoso.ini Start the registered service by executing in a command prompt (with administrative rights)
    • virtuoso-t +instance "OpenIoT" +service start
    • you can later stop it by executing virtuoso-t +instance "OpenIoT" +service stop
  • After having started virtuoso Go to http://localhost:8890/conductor/
  • Log in using dba / dba (the default Virtuoso Open-Source Edition Administrator username and password are both dba)

Configuration

  • Go to System Admin -> User Accounts and edit user dba
  • Change the password (2x) and click Save
  • edit user SPARQL
  • Add the role SPARQL_UPDATE and click Save

Next is setting up virtuoso for use by LSM. Go to Linked Data and execute the query:

CREATE GRAPH <http://lsm.deri.ie/OpenIoT/sensormeta#>
CREATE GRAPH <http://lsm.deri.ie/OpenIoT/sensordata#>
CREATE GRAPH <http://lsm.deri.ie/OpenIoT/functionaldata#>

If you want to use different graph names, make sure to also change those in the configuration file jboss/standalone/configuration/openiot.properties

Virtuoso should now be ready for use by LSM.

Quick Notes:

  • Default Virtuoso Open-Source Edition Administrator username and password are both dba
  • By default, the Virtuoso server will listen for HTTP connections at TCP port 8890, and for SQL data access (via iSQL, ODBC, JDBC, OLE DB, ADO.NET, etc.) at TCP port 1111 http://localhost:8890/conductor/

##4) Configuring JBoss:

For Linux: JBOSS_HOME/bin/standalone.sh
For Windows: JBOSS_HOME\bin\standalone.bat

  • If JBoss is running on a server and you want to open it from your localhost or any other PC:

For Linux: JBOSS_HOME/bin/standalone.sh –b 0.0.0.0
For Windows: JBOSS_HOME\bin\standalone.bat –b 0.0.0.0

  • To make sure that JBoss is running correctly, go to the following URL:
    http://localhost:8080 or
    http://SERVER_HOSTNAME:8080 (if you are using JBoss from a server not the localhost)

  • Enable SSL in JBoss in order to run the security modules illustrated later in this document correctly (this is done only once when you are configuring JBoss for the first time):

    • Run: mkdir JBOSS_HOME/standalone/configuration/ssl

    • Run: cd JBOSS_HOME/standalone/configuration/ssl

    • Run: keytool -genkey -alias jbosskey -keypass YOUR_PASSWORD_HERE -keyalg RSA -keystore server.keystore

      As answer to "What is your first and last name"?

      * If you are deploying on a stand alone PC use "localhost" as Common Name . 
      
      * If you are deploying on a server, use the DNS name of the server instead of "localhost".
      
      * If you are deploying on a server with public IP (no DNS), use ip address as Common Name 
      

      In the case you are deploying on a server with public IP or DNS also add the following option to the keytool command -genkey -ext san=ip:a.b.c.d where a.b.c.d is the IP of the server.

      Note: change the YOUR_PASSWORD_HERE in the commands and scripts with your personal password. Make sure that it is the same in all commands and scripts.

    • Run: keytool -export -alias jbosskey -keypass YOUR_PASSWORD_HERE -file server.crt -keystore server.keystore

    • Run: keytool -import -alias jbosscert -keypass YOUR_PASSWORD_HERE -file server.crt -keystore server.keystore . Ignore the warninig!

    • In JBOSS_HOME/standalone/configuration/standalone.xml, add the following connector in <subsystem xmlns="urn:jboss:domain:web:1.1" ..

    ``` **Note**: at the YOUR_SSL_DIR_PATH use the full path of your SSL folder "JBOSS_HOME/standalone/configuration/ssl/server.keystore"
    • Restart JBoss and go to https://localhost:8443 to see if SSL is enabled and works correctly.

    • Next, you will have to import this certificate into the java trust-store. Keep in mind that when asked the default keystor password is changeit:

      * **For Mac**:  
        `cd JBOSS_HOME/standalone/configuration/ssl`.  
      
        `keytool -import -keystore  $JAVA_HOME/Contents/Home/jre/lib/security/cacerts  -file server.crt -alias incommon`. 
      
      * **For Windows**:  
        `keytool -import -keystore JAVA_HOME\jre\lib\security\cacerts -file server.crt -alias incommon`.  
      
        Example in Windows:  
        `keytool -import -keystore "C:\ProgramFiles(x86)\Java\jdk1.7.0_71\jre\lib\security\cacerts" -file    server.crt -alias incommon`.  
      
      * **For Linux**:   
        `keytool -import -keystore $JAVA_HOME/jre/lib/security/cacerts -file server.crt -alias incommon`.
      
        In Linux you will have to do this as root.
      
    • For troubleshooting please follow this link:
      https://github.com/OpenIotOrg/openiot/wiki/Security-Use-Server#jboss-ssl-troubleshooting (Only troubleshooting)

    • If you want to stop JBoss, run the following command:
      cd JBOSS_HOME/bin.
      For Linux: ./jboss-cli.sh --connect command=:shutdown

Notice: you can follow any other steps according to your own experience

##5) Download the openIoT code:

Use a git client and download the OpenIoT code which is available at the following path https://github.com/OpenIotOrg/openiot.git.

  • For the latest version use the "develop" branch.

  • For the stable version use the "master" branch.

Generating the Binaries

After downloading the source code, in a command prompt go to the openiot folder and execute the following command: mvn clean install

This command will build all the required modules (note that if it is the first time it will take a while).

Required files

For a basic deployment, the following files are required:

  • /openiot/utils/utils.commons/src/main/resources/security-config.ini
  • /openiot/utils/utils.commons/src/main/resources/properties/openiot.properties

which should be copied in the folder JBOSS_HOME/standalone/configuration

  1. openiot/modules/lsm-light/lsm-light.server/target/lsm-light.server.war
  2. openiot/modules/security/security-server/target/openiot-cas.war
  3. openiot/modules/security/security-management/target/security.management.war
  4. openiot/modules/scheduler/scheduler.core/target/scheduler.core.war
  5. openiot/modules/sdum/sdum.core/target/sdum.core.war
  6. openiot/ui/ui.requestDefinition/target/ui.requestDefinition.war
  7. openiot/ui/ui.requestPresentation/target/ui.requestPresentation.war
  8. openiot/ui/ui.schemaeditor/target/ui.schemaeditor.war
  9. openiot/ui/ide/ide.core/target/ide.core.war

Which should be copied in the folder JBOSS_HOME/standalone/deployments. The JBoss server should be running and the sequence listed above should be followed. Please note that after this deployment (and till undeployed) the modules will automatically be started every time JBoss server is started. This deployment is described in more detail in step 6.

The X-GSN module which can be found at the folder openiot/modules/x-gsn will be used as it is. See step 7 for X-GSN

##6) Deployment of the Modules (only for the first time to deploy the platform):

Notice: If you have already copied the 9 war files and 2 configuration files as part of step 5, then you do not need to copy these files again. Notice: OpenIoT modules depend on each other, so it is recommended that you follow the below order while deploying the full platform.

###utils.commons:

  • Navigate to /openiot/utils/utils.commons/src/main/resources

  • Copy the file security-config.ini to the location: JBOSS_HOME/standalone/configuration
    cp security-config.ini JBOSS_HOME/standalone/configuration

  • Navigate to /openiot/utils/utils.commons/src/main/resources/properties

  • Copy the file openiot.properties to the location: JBOSS_HOME/standalone/configuration
    cp openiot.properties JBOSS_HOME/standalone/configuration

###Lsm-light Server:

  • Navigate to /openiot/modules/lsm-light/lsm-light.server and run the command: mvn jboss:deploy

  • Alternative: copy openiot/modules/lsm-light/lsm-light.server/target/lsm-light.server.war to JBOSS_HOME/standalone/deployments
    cp lsm-light.server.war JBOSS_HOME/standalone/deployments

  • To make sure that everything is working, go to link:
    http://localhost:8080/lsm-light.server/ (or replace localhost with the name of your server if you are running JBoss from a remote server)

Notice: if jboss:deploy doesn’t work, replace it with jboss-as:deploy

###Security Management and Server:

  • Navigate to /openiot/modules/security/security-server and run the command: mvn jboss:deploy

  • Alternative: copy openiot/modules/security/security-server/target/openiot-cas.war to JBOSS_HOME/standalone/deployments
    cp openiot-cas.war JBOSS_HOME/standalone/deployments

  • To make sure that everything is working, go to link:
    https://localhost:8443/openiot-cas (or replace localhost with the name of your server if you are running JBoss from a remote server)

Notice: if jboss:deploy doesn’t work, replace it with jboss-as:deploy

  • Navigate to /openiot/modules/security/security-management and run the command: mvn jboss:deploy

  • Alternative: copy openiot/modules/security/security-management/target/security.management.war to JBOSS_HOME/standalone/deployments
    cp security.management.war JBOSS_HOME/standalone/deployments

  • To make sure that everything is working, go to link:
    http://localhost:8080/security.management (or replace localhost with the name of your server if you are running JBoss from a remote server)

Notice: if jboss:deploy doesn’t work, replace it with jboss-as:deploy

####Adding a New User and Some Modifications:

  • Navigate to http://localhost:8080/security.management
  • Sign up for a new user: eg: openiot/openiot
  • Log-out (make sure you are logged out from the application and from CAS log-out at the end of the page) and close the browser
  • Log-in again with: admin/secret
  • Go to Manage Users and click on the user you have created

[](Documentation/images/manual-installation-guide/Security_Management_2.png) * Click on Select Service and add roles to each of the following: LSM usage role Schema editor usage role Scheduler usage role Sdum usage role X-GSN usage role * The following link will help you understand what is a role and how to use the security management interface: * Log-out again (from both) and close the browser.

###Scheduler Core:

  • Navigate to /openiot/modules/scheduler/scheduler.core and run the command: mvn jboss:deploy

  • Alternative: copy openiot/modules/scheduler/scheduler.core/target/scheduler.core.war to JBOSS_HOME/standalone/deployments
    cp scheduler.core.war JBOSS_HOME/standalone/deployments

  • To make sure that everything is working, go to link:
    http://localhost:8080/scheduler.core/rest/services (or replace localhost with the name of your server if you are running JBoss from a remote server)

Notice: if jboss:deploy doesn’t work, replace it with jboss-as:deploy

###SDUM Core:

  • Navigate to /openiot/modules/sdum/sdum.core and run the command: mvn clean package jboss:deploy

  • Alternative: copy openiot/modules/sdum/sdum.core/target/sdum.core.war to JBOSS_HOME/standalone/deployments
    cp sdum.core.war JBOSS_HOME/standalone/deployments

  • To make sure that everything is working, go to link:
    http://localhost:8080/sdum.core/rest/services (or replace localhost with the name of your server if you are running JBoss from a remote server)

Notice: if jboss:deploy doesn’t work, replace it with jboss-as:deploy

Notice: Both SDUM and Scheduler provide clients to test the server functions. These are SWING java programs. Please execute them as any other java swing program if needed.

###ui.requestDefinition:

  • Navigate to /openiot/ui/ui.requestDefinition and run the command: mvn clean package jboss:deploy

  • Alternative: copy openiot/ui/ui.requestDefinition/target/ui.requestDefinition.war to JBOSS_HOME/standalone/deployments
    cp ui.requestDefinition.war JBOSS_HOME/standalone/deployments

  • To make sure that everything is working, go to link:
    http://localhost:8080/ui.requestDefinition/ (or replace localhost with the name of your server if you are running JBoss from a remote server)

  • Log-in with the new user you have created before in security management

  • To know how to use this interface after pushing data into the platform (will be shown later), please follow this link:

https://github.com/OpenIotOrg/openiot/wiki/Request-definition-use

  • UI Overview

[](Documentation/images/request-definition/01-ui-overview.png)

Notice: if jboss:deploy doesn’t work, replace it with jboss-as:deploy

###ui.requestPresentation:

  • Navigate to /openiot/ui/ui.requestPresentation and run the command: mvn clean package jboss:deploy

  • Alternative: copy openiot/ui/ui.requestPresentation/target/ui.requestPresentation.war to JBOSS_HOME/standalone/deployments
    cp ui.requestPresentation.war JBOSS_HOME/standalone/deployments

  • To make sure that everything is working, go to link:
    http://localhost:8080/ui.requestPresentation/ (or replace localhost with the name of your server if you are running JBoss from a remote server)

  • Log-in with the new user you have created before in security management

  • To know how to use this interface after pushing data into the platform (will be shown later), please follow this link:

https://github.com/OpenIotOrg/openiot/wiki/Request-presentation-use

  • UI Overview

[](Documentation/images/manual-installation-guide/Request_Presentation.png)

Notice: if jboss:deploy doesn’t work, replace it with jboss-as:deploy

###ui.schemaeditor:

  • Navigate to /openiot/ui/ui.schemaeditor and run the command: mvn clean package jboss:deploy

  • Alternative: copy openiot/ui/ui.schemaeditor/target/ui.schemaeditor.war to JBOSS_HOME/standalone/deployments
    cp ui.schemaeditor.war JBOSS_HOME/standalone/deployments

  • To make sure that everything is working, go to link:
    http://localhost:8080/ui.schemaeditor (or replace localhost with the name of your server if you are running JBoss from a remote server)

  • Log-in with the new user you have created before in security management

  • Details on how to use this interface are given later in this document.

Notice: if jboss:deploy doesn’t work, replace it with jboss-as:deploy

###Ide Core:

  • Navigate to /openiot/ui/ide/ide.core and run the command: mvn clean package jboss:deploy

  • Alternative: copy openiot/ui/ide/ide.core/target/ide.core.war to JBOSS_HOME/standalone/deployments
    cp ide.core.war JBOSS_HOME/standalone/deployments

  • To make sure that everything is working, go to link:
    http://localhost:8080/ide.core/ (or replace localhost with the name of your server if you are running JBoss from a remote server)

Notice: if jboss:deploy doesn’t work, replace it with jboss-as:deploy

##7) Running X-GSN:

  • Navigate to /openiot/modules/x-gsn/and run the command: mvn clean package

  • A folder named target will be created under this directory. This folder contains a file called: xgsn-1.1.4.jar

  • Run the script:

For Linux: ./gsn-start.sh

  • If you want to stop X-GSN for any reason, run the following script:

For Linux: ./gsn-stop.sh

Notice: the first two steps are done only for the first time to deploy the platform or if you change anything within the x-gsn folder or code.

####For better understanding of the platform, please read the documentation found here: https://github.com/OpenIotOrg/openiot/wiki/Documentation

https://github.com/OpenIotOrg/openiot/wiki/Developer-Setup-Instructions-Eclipse---OpenIoT-v0.6.1

#Using Arduino Mote with OpenIoT - Manual

[](Documentation/images/manual-installation-guide/Arduino.png)

##1. Creating Virtual Sensor XML File

  • You have to write an XML file describing your sensor

  • It has to be put in this directory:
    /openiot/modules/x-gsn/virtual-sensors

  • An example of an XML file describing a light sensor:

<?xml version="1.0" encoding="UTF-8"?>
<virtual-sensor name="light_sensor" priority="10" >
    <processing-class>
        <class-name>org.openiot.gsn.vsensor.LSMExporter</class-name>
        <init-params>
            <param name="allow-nulls">false</param>
            <param name="publish-to-lsm">true</param>
        </init-params>
        <output-structure>
            <field name="light" type="double" />
        </output-structure>
    </processing-class>
    <description>Arduino station</description>
    <life-cycle pool-size="10"/>
    <addressing>
    </addressing>
    <streams>
        <stream name=“lightInput" sampling-rate="1" storage-size="1">
            <source alias="lightSource">
                <address wrapper= "arduino">
                  <predicate key=“serialport”>/dev/tty.usbmodem1411</predicate>
                  <predicate key="baudrate">9600</predicate>
                </address>
                <query>select * from wrapper</query>
            </source>
            <query>select * from lightSource</query>
        </stream>
    </streams>
</virtual-sensor>
``

* **The Name**: each virtual sensor has a unique name

* **The Priority**: controls the processing priority of a virtual sensor (1 is the lowest priority while 20 is the highest, 10 is the default)

* **The Processing Class**: is a piece of code which acts in the final stage of data processing as sits between the wrapper (discussed later in this document) and the data publishing engine 
  * In order to push data to LSM, the LSMExporter processing class has to be used
  * It is possible to use other processing classes for other purposes. These processing classes can be found in :  
 /openiot/modules/x-gsn/src/main/java/org/openiot/gsn/vsensor
  * Examples of virtual sensors using other processing classes can be found in :  
/openiot/modules/x-gsn/virtual-sensors/samples
  * You can write your own processing class using the help of this link:   
<https://github.com/OpenIotOrg/openiot/wiki/X-GSN-Develop#writing-new-processing-classes>

     * **init-params**: include some of the initialization parameters of the processing class (inputs of the processing    class depending on which class is being used)

     * **The Output Structure**: includes the name of the output and its type

* **The Description**: includes the description of the sensor as a string

* **The Life Cycle**: enables the control and management of resources provided to a virtual sensor such as the maximum number of threads/queues available for processing. 
  * In the example above, the Pool Size specifies a maximum number of 10 threads, which means that if the pool size is reached, data will be dropped (if no pool size is specified, it will be controlled by GSN depending on the current load)

* **Addressing**: can be left empty because it will be specified in the metadata file afterwards.

* **The Stream Name**: it is the name of the stream ( a stream may contain more than one source)
* **The Sampling Rate**: it will tell how long the stream should sleep

* **The Storage Size**: it will tell how much data should be stored locally

* **The Source Alias**: is the name of the source within the stream

* **The Wrapper**: Each sensor should have a supported wrapper to be attached to the GSN server, in order to communicate with the sensor hardware.
  * In the above example, the arduino wrapper is used since the data in collected from an arduino sensor through the serial port
  * There are many wrappers available in the platform in:   
/openiot/modules/x-gsn/src/main/java/org/openiot/gsn/wrappers 
  * You can write your own wrapper following this link:  
  <https://github.com/OpenIotOrg/openiot/wiki/X-GSN-Develop#writing-new-wrappers>
  * If you wrote a new wrapper, place it in /openiot/modules/x-gsn/src/main/java/org/openiot/gsn/wrappers/. 
  * If you wrote a new wrapper, please don’t forget to add it in wrappers.properties file found in /openiot/modules/x-gsn/conf/wrappers.properties

<p align="center">
[<align="center"><img src="Documentation/images/manual-installation-guide/New_Wrapper.png" width="500">](Documentation/images/manual-installation-guide/New_Wrapper.png)

  In the example above, ArduinoWrapper is the name of the created wrapper and arduino is the name to be used in the XML file to refer to this wrapper

  * Each wrapper has certain predicates to be known after reading the wrapper code. In case of the arduino wrapper, the serial port and the baudrate have to be defined in order for the wrapper to work properly.
  * Don’t forget to rebuild x-gsn after making all the changes within the x-gsn folder.

* The first query is to specify what to choose from the wrapper in case the wrapper has more than one output

* The second query is to select what to choose from the outputs of the sensor in case the sensor has more than one output (for example measures temp and humidity)

* More virtual sensor  XML files can be found here:  
/openiot/modules/x-gsn/virtual-sensors/LSM

* More information about GSN, wrappers and processing classes can be found here:  
<https://github.com/LSIR/gsn/wiki/Documentation>

**Notice**: all the above fields should be present in the XML file in order to work properly. Only values can be changed. Any missing field will cause errors in the platform.


##2.  Creating Virtual Sensors Metadata File:

* This file describes the data in the virtual sensor XML file

* It has to be located in the same location of the virtual sensor XML file in:  
/openiot/modules/x-gsn/virtual-sensors

* It must have the same name as the the virtual sensor XML file but with the extension (.metadata). For example, a virtual sensor named sensor1.xml will have an associated metadata file named sensor1.metadata.

* All the sensors have to be registered to LSM
* To create the metadata file, name it with the right name, place it in the right folder and register it to LSM, all you have to do is to 
  * Run JBOSS
  * Navigate to <http://localhost:8080/ui.schemaeditor> if the JBOSS is deployed to localhost. Please replace localhost with the public IP or host name depending on your installation.

* The landing page is a navigator page for
  * Sensor Type Editor
  * Sensor Instance Editor

### Sensor Type Editor:

* The sensor type editor is used to create new sensor classes which will be automatically stored as an extension to the OpenIoT ontology in LSM server.

* Here is a screenshot of the sensor type editor with a sample sensor description

<p align="center">
[<align="center"><img src="Documentation/images/manual-installation-guide/Sensor_Type_Editor.png" width="500">](Documentation/images/manual-installation-guide/Sensor_Type_Editor.png)

* The Fields:

  * **Sensor Type Name**: the name of the new sensor class to be created 

  * **Add Observed Property**: the property is the entity to be measured 
like the light. If you want to measure only one entity so press on it once to add one property. If you want to measure more than one entity, then press on it more than once to add more than one property

  * **Property Name**: this is a URL containing a description of the entity to be measured (Not necessarily a real one for this stage)  
<http://dictionary.reference.com/browse/light>

  * **Accuracy**: The accuracy is a string value. There are some well-known accuracy definitions for some sensors or you can write any string describing the accuracy. The application is responsible to convert the accuracy value to corresponding domain specific knowledge

  * **Frequency**: The frequency is a string value. This is the frequency by which the data is being pushed into the platform. The application is responsible to convert the frequency value to corresponding domain specific knowledge

* Press Generate Description then Register Sensor Type. If everything is written correctly, you will have a message stating that the sensor is registered correctly.


###Sensor Instance Editor:
* The sensor instance editor is used to define new instances of a specific sensor type (either defined by the user or by other users). 

* The screenshot below presents a sample of sensor instance editor

<p align="center">
[<align="center"><img src="Documentation/images/manual-installation-guide/Sensor_Instance_Editor.png" width="500">](Documentation/images/manual-installation-guide/Sensor_Instance_Editor.png)

* Properties:

  * **Sensor Types Registered**: This drop down will display the list of sensor types already registered with the OpenIoT system.

  * **Sensor Name**: Name of the sensor instance (e.g. LightSensor).   
    **Note**: Use _ for text separation

  * **Author/Owner**: The owner of the sensor.  
**Note**: The owner has to be a single string without any spaces or special character. This is currently a limitation which will be fixed in the next release

  * **Description**: Description of the sensor. This can be a freeform text.

  * **Source URL**: This is the URL of the data source. E.g. if it is GSN, it will be <http://localhost:22001>

  * **Source Type**: The type of the source which produces data. For e.g. when using GSN to push data into OpenIoT, the source type will be GSN

  * **Latitude and Longitude**: used to specify the position of the sensor on the map.

  * **Feature of Interest**: A relation between an observation and the entity whose quality was observed. For example, in an observation of the weight of a person, the feature of interest is the person and the quality is weight. (<http://www.w3.org/2005/Incubator/ssn/ssnx/ssn#featureOfInterest>)

  * **Observed Properties**: These fields will be auto generated and is dependent on the sensor type which was defined earlier.

    * **Unit of Measurement**: Defines the measurement unit for the property. E.g.Candela for light

    * **XGSN Field Name**: This is a very important field as it maps the sensor observation to the XGSN fields defined in the XGSN *.xml file and the wrapper. Use the same field name when defining the XGSN XML file. A sample of the XML file is shown below:

```<output-structure> <field name="light" type="double" /> </output-structure>```


####Usage: Create and Register a new Sensor Instance:

1. 1. Select the sensor type for which an instance needs to be created
2. Click the View Sensor Description Button
3. Verify if the sensor instance you wish to create matches the sensor type definition
4. If so click the Create Sensor Instance Button
5. Fill all the necessary field
6. Ensure the page does not display any errors e.g. invalid data format, empty field etc
7. Click the Register Sensor Instance
8. If the registration is successful, you will see a success message.
9. A new "Download XGSN Metadata" Button will appear
10. Click on this to download the sensorname.metatdata file.
11. Save this file under the XGSN virtual director folder (/openiot/modules/x-gsn/virtual-sensors)

####On clicking the register button, the following operation occur:

1. The sensor instance input is verified for consistency 
2. A check if performed to see if a sensor with same name exists
3. The sensor instance is registered with LSM 
4. A sensor ID from LSM is then stored locally in the metadata file along with the other user defined sensor instance descriptions

A sample .metadata file is shown below:

sensorName=LightSensor source="http://localhost:22001" sourceType=GSN sensorType="http://openiot.eu/ontology/ns/LightSensor" information=Arduino light sensor author=Insight feature="light" fields="light" field.light.propertyName="http://dictionary.reference.com/browse/light" field.light.unit="candela" latitude="53.278" longitude="-9.061" sensorID="http://lsm.deri.ie/resource/1422976363860239000"

Clone this wiki locally