Skip to content

Openiot Commons Library

Nikos Kefalakis edited this page Oct 29, 2013 · 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 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 your environment:

#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


#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

scheduler.core.lsm.openiotMetaGraph

TODO:Add Description

scheduler.core.lsm.openiotDataGraph

TODO:Add Description

scheduler.core.lsm.openiotFunctionalGraph

TODO:Add Description

scheduler.core.lsm.access.username

TODO:Add Description

scheduler.core.lsm.access.password

TODO:Add Description

sdum.core.lsm.openiotFunctionalGraph

TODO:Add Description

sdum.core.lsm.sparql.endpoint

TODO:Add Description

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.

Clone this wiki locally