Skip to content

Openiot Commons Library

mdii edited this page Sep 16, 2014 · 7 revisions

In OpenIoT we maintain a project called Commons where we maintain the "common" Objects, Schemata and utilities used for most of the modules across the OpenIoT platform. This project is included in the binary file distribution as a library but has to be added as a seperate project for development. This project is available under the /utils/utils.commons/ folder.

Developer

As this project is a maven dependency it has to be installed to the local maven repository. If you have not yet done so, you must install Maven.

Download

To download commons’s source code use your favorite git client and retrieve the code from one of the following URLs:

Integrating to Eclipse and installing to local Maven Repository

To integrate the commons in Eclipse one should follow the steps below:

  1. Import Existing maven project File>Import>Maven>Existing Maven Projects

  2. Click the “Browse” button and navigate to the commons’s source code directory that has been previously downloaded.

  3. Choose the utils.commons and click the Finish button.

  4. Right click on the utils.commons project and choose Run As>Maven Install

  5. Now you are ready to use this library from the Other OpenIoT modules.

Properties

The projects that run within JBoss container use a common central properties file (openiot.properties). The modules that are currently configured to use this file are the:

The property file can be found under utils/utils.commons/src/main/resources/properties/. This file SHOULD be placed under the following path: \JBoss_HOME\standalone\configuration of your JBoss 7.XX container. This file contains the following information that should be set up according to your environment:


# IDE Core Navigation Properties

# Request Definition
ide.core.navigation.requestDefinition.title=Request Definition
ide.core.navigation.requestDefinition.url=http://localhost:8080/ui.requestDefinition/pages/applicationDesign.xhtml
ide.core.navigation.requestDefinition.monitoring=true

#Request Presentation
ide.core.navigation.requestPresentation.title=Request Presentation
ide.core.navigation.requestPresentation.url=http://localhost:8080/ui.requestPresentation/pages/requestPresentation.xhtml
ide.core.navigation.requestPresentation.monitoring=true

#Sensor Schema Editor
ide.core.navigation.sensorSchemaEditor.title=Sensor Schema Editor
ide.core.navigation.sensorSchemaEditor.url=http://localhost:8080/sensorschema/index.xhtml
ide.core.navigation.sensorSchemaEditor.monitoring=true


#Scheduler Properties

scheduler.core.lsm.openiotMetaGraph=http://lsm.deri.ie/OpenIoT/guest/sensormeta#
scheduler.core.lsm.openiotDataGraph=http://lsm.deri.ie/OpenIoT/guest/sensordata#
scheduler.core.lsm.openiotFunctionalGraph=http://lsm.deri.ie/OpenIoT/guest/functional#
scheduler.core.lsm.access.username=openiot_guest
scheduler.core.lsm.access.password=openiot
scheduler.core.lsm.sparql.endpoint=http://lsm.deri.ie/sparql
scheduler.core.lsm.remote.server=http://lsm.deri.ie/lsm-light.server/

#Service Delivery & Utility Manager (SD&UM) Properties

sdum.core.lsm.openiotFunctionalGraph=http://lsm.deri.ie/OpenIoT/guest/functional#
sdum.core.lsm.sparql.endpoint=http://lsm.deri.ie/sparql
sdum.core.lsm.remote.server=http://lsm.deri.ie/lsm-light.server/

#LSM-LIGHT Properties

lsm-light.server.connection.driver_class=virtuoso.jdbc4.Driver
lsm-light.server.connection.url=jdbc:virtuoso://lsm.deri.ie:1111/log_enable=2
lsm-light.server.connection.username=<database username>
lsm-light.server.connection.password=<database password>
lsm-light.server.minConnection=10
lsm-light.server.maxConnection=15
lsm-light.server.acquireRetryAttempts=5
#for local virtuoso instance
lsm-light.server.localMetaGraph = http://test/sensormeta#
lsm-light.server.localDataGraph = http://test/sensordta#

#QoS Manager

qos.name=QualityOfService
qos.brokerIP=localhost
qos.brokerPort=10000
qos.gsnAddress=localhost:22001
qos.wrapperPort=30000
qos.numberOfSensors = 3
qos.highBatteryLevel = 70
qos.lowBatteryLevel = 30
qos.sensorParameters = Temperature,Humidity,Pressure,NO2,SO2,CO,BatteryS,BatteryMP,Area,Timestamp,SensorID,Latitude,Longitude
qos.sensorTypes = double,double,double,double,double,double,double,double,string,bigint,string,double,double
qos.lsmProperty =  http://lsm.deri.ie/OpenIoT/Temperature,http://lsm.deri.ie/OpenIoT/Humidity,http://lsm.deri.ie/OpenIoT/Pressure,http://lsm.deri.ie/OpenIoT/NO2,http://lsm.deri.ie/OpenIoT/SO2,http://lsm.deri.ie/OpenIoT/CO,http://lsm.deri.ie/OpenIoT/BatterySensor,http://lsm.deri.ie/OpenIoT/BatteryMobilePhone,http://lsm.deri.ie/OpenIoT/Area,http://lsm.deri.ie/OpenIoT/Timestamp,http://lsm.deri.ie/OpenIoT/SensorID,http://lsm.deri.ie/OpenIoT/Latitude,http://lsm.deri.ie/OpenIoT/Longitude
qos.lsmUnit = C,Percent,hPa,ug/m3,ug/m3,mg/m3,Percent,Percent,Unit,Unit,Unit,Unit,Unit
qos.testing = true
qos.logWriting = true

scheduler.core.lsm.openiotMetaGraph

We use this property, at the Scheduler module, to point to the Graph name that OpenIoT is using to store the sensors metadata.

scheduler.core.lsm.openiotDataGraph

We use this property, at the Scheduler module, to point to the Graph name that OpenIoT is using to store the sensors data.

scheduler.core.lsm.openiotFunctionalGraph

We use this property, at the Scheduler module, to point to the Graph name that OpenIoT is using to store the functional data (i.e. service description).

scheduler.core.lsm.access.username

The Username to access LSM-Light server.

scheduler.core.lsm.access.password

The Password to access LSM-Light server.

sdum.core.lsm.openiotFunctionalGraph

We use this property, at the Service Delivery & Utility Manager module, to point to the Graph name that OpenIoT is using to store the functional data (i.e. service description).

sdum.core.lsm.sparql.endpoint

We use this property, at the Service Delivery & Utility Manager module, to point to the LSM-Light server's SPARQL endpoint.

Developer

The following example shows how to use the global properties file to your code:

import org.openiot.commons.util.PropertyManagement;

public class TestProperties {

	private PropertyManagement propertyManagement = null;

	public TestProperties() {
		propertyManagement = new PropertyManagement();
	}

	public void readFromProperties() {

		// ============For Scheduler=========================

		// reading proeprty LSM_META_GRAPH
		System.out.println("lsmMetaGraph: " + propertyManagement.getSchedulerLsmMetaGraph());

		// reading proeprty LSM_DATA_GRAPH
		System.out.println("lsmDataGraph: " + propertyManagement.getSchedulerLsmDataGraph());

		// reading proeprty LSM_FUNCTIONAL_GRAPH
		System.out.println("lsmFunctionalGraph: " + propertyManagement.getSchedulerLsmFunctionalGraph());

		// reading proeprty LSM_USER_NAME
		System.out.println("lsmUserName: " + propertyManagement.getSchedulerLsmUserName());

		// reading proeprty LSM_PASSWORD
		System.out.println("lsmPassword: " + propertyManagement.getSchedulerLsmPassword());

		// ============For SD&UM=============================
		// reading proeprty LSM_FUNCTIONAL_GRAPH
		System.out.println("lsmFunctionalGraph: " + propertyManagement.getSdumLsmFunctionalGraph());

		// reading proeprty LSM_SPARQL_END_POINT
		System.out.println("lsmSparqlEndPoint: " + propertyManagement.getSdumLsmSparqlEndPoint());
	}
}

Moreover you have to add the new properties to the properties file mentioned above and edit the PropertyManagement class by adding the new properties constant names and getters and setters for the new properties.

Security Configuration

The security-config.ini file can be found under utils/utils.commons/src/main/resources/. This file SHOULD be placed under the following path: \JBoss_HOME\standalone\configuration of your JBoss 7.XX container. This file contains the security configuration that should be set up according to your environment. Detailed instruction for security configuration is provided in Security Client.

Clone this wiki locally