Skip to content

Developer Setup Instructions Eclipse OpenIoT v0.6.1

premjayaraman edited this page Dec 8, 2014 · 12 revisions

Table of Contents

INTERGRATION ENVIORMENT SETUP

Source code location

Documentation

Development Platform

Eclipse Integrated Development Environment (IDE) – Latest Version

Java SDK 1.7+ - Latest Version

JBOSS AS 7.1.1 (Please use only this version)

Maven 3.1 (Or Latest)

Environmental Path

  • The following variables needs to be set for successful running of maven, JBOSS and java
    • JAVA_HOME
    • MAVEN_HOME
  • The following path needs to be set
    • Java bin directory
    • Maven bin directory
The following is a useful link on how to setup maven.

http://www.mkyong.com/maven/how-to-install-maven-in-windows/

ECLIPSE Install Guide FOR openiot code

This document aims to provide a step-by-step instruction to deploy the OpenIoT components form scratch.

OpenIoT Modules in GitHub

  • UI Folder
    • ui.requestCommons
    • ui.requestDefinition
    • ui.requestPresentation
    • ide/ide.core
    • ui.schemaeditor
    • modules
      • Scheduler
        • scheduler.core
        • scheduler.client
      • SDUM
        • sdum.core
        • sdum.client
      • LSM-Lite
        • lsm-server
        • lsm-client
      • x-gsn
      • security
        • security-management
        • security-client
        • security-server
      • CUPUS
    • Under utils
      • utils.commons

Pre-requisites

  1. Install maven
Download maven from http://maven.apache.org/
  1. Set the path to the maven bin directory
  2. Ensure you can run the mvn –version command from terminal or command prompt
  1. Install Eclipse Juno (or latest version). The following eclipse plugins needs to be installed to get a working environment without any errors. If you use a different version of eclipse, please update the following tools with corresponding version.
  1. Maven 2 Eclipse plugin – This is required to run maven commands from Eclipse and also import POM files into Eclipse as a eclipse-maven project.
http://download.eclipse.org/technology/m2e/releases
  1. Install JBOSS Maven Support and JBOSS Web and Java EE Development tools – http://download.jboss.org/jbosstools/updates/stable/juno
For JBOSS Web and Java EE Development Tools, only install
  • Context and Dependency Injection Tools
  • Forge Tools
  • JBOSS JAX-RS Rools
  • JBOSS Tools Java Standard Tools
  • JBoss Tools JSF
  • JBoss Tools RichFaces
  • JBoss Tools Visual Page Editor
  • JBoss WebService Tools
  • JBossAS Tools
    1. JIBX Eclipse plugin 1.1.6a from
http://jibx.sourceforge.net/eclipse/
  1. Web Tools Platform 3.4.2
http://download.eclipse.org/webtools/repository/juno/

All these plugins can be installed from eclipse “install new software” option from under Help menu.

Note: If you use a more recent version of eclipse, please replace the URl with corresponding version specific plugins.

Note: When using Eclipse Kepler, as much as possible, install the above plugins from the Eclipse Marketplace by searching for plugins by name.

  1. Download JBoss 7.1.
    1. Unzip JBOSS to a directory in your hard drive.
  2. In Eclipse, under Windows->Show View->Other, search for servers.
    1. In the server window, right click and select new.
    2. If you have all the above plugin and tools installed, you will see an option for JBOSS 7.1 under the server options
    3. Select the location of JBOSS (the location on your drive previously unzipped).
    4. Start the JBOSS server from eclipse (a small play icon in the server window) to test and ensure JBOSS is starting and running successfully.

Download OpenIoT source code

Download the OpenIoT sources from github using your favorite git client (https://github.com/OpenIotOrg/openiot) or if using bash using the command

git clone https://github.com/OpenIotOrg/openiot.git

Configuring JBoss

Here we assume that JBoss AS7 is used in standalone mode. By $jboss-home we refer to JBoss AS7 directory.

Enabling SSL in JBoss

Assume that you store the required SSL files in a path YOUR_SSL_DIR_PATH (e.g., $jboss-home/standalone/configuration/ssl).

  1. If the directory structure does not exist, run mkdir -p YOUR_SSL_DIR_PATH
  2. Run cd YOUR_SSL_DIR_PATH
  3. Run keytool -genkey -alias jbosskey -keypass <password> -keyalg RSA -keystore server.keystore Use "localhost" as Common Name [as answer to "What is your first and last 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 [as answer to "What is your first and last name?"]. Also add the following command to the keytool -genkey -ext san=ip:10.0.0.1
  4. Run keytool -export -alias jbosskey -keypass <password> -file server.crt -keystore server.keystore
  5. Run keytool -import -alias jbosscert -keypass <password> -file server.crt -keystore server.keystore Ignore the warning!
  6. In $jboss-home/standalone/configuration/standalone.xml add the following connector in <subsystem xmlns="urn:jboss:domain:web:1.1" ..
<connector name="https" protocol="HTTP/1.1" scheme="https" socket-binding="https" secure="true">
    &lt;ssl name="https" key-alias="jbosskey" password=&lt;password&gt; certificate-key-file="YOUR_SSL_DIR_PATH/server.keystore" /&gt;

</connector>

  1. Restart JBoss and go to https://localhost:8443 to see if SSL is enabled and works correctly.
  2. Next, you'll have to import this certificate into the java trust-store with the commandkeytool -import -keystore $JAVA_HOME/jre/lib/security/cacerts -file server.cert -alias incommon. In Linux you will have to do this as root.
JBOSS SSL Troubleshooting

If you encounter the error, unable to load the key (as documented by a bug report here https://issues.apache.org/bugzilla/show_bug.cgi?id=38217) follow the below steps

In step 3, 4, and 5 ensure the <password> parameter for keypass and the security store password (requested during command execution in the terminal) are identical.

To remove the previously registered key use the command

keytool -delete -noprompt -alias jbosskey -keystore server.keystore

SSL Troubleshooting

If you encounter the following error, follow the steps suggested here.

SunCertPathBuilderException: Unable To Find Valid Certification Path To Requested Target

Also you might find the solution for your ssl-related issues here.

Installing Local Virtuoso Instance

Please follow the link below for detailed instructions for installing Virtuoso.

Note: for Linux installations, Virtuoso requires a 64 bit machine.

https://github.com/OpenIotOrg/openiot/wiki/InstallingVirtuosoOpensource7Ubuntu

Eclipse Workspace and Project setup

  1. Start eclipse and create a new workspace.
  2. Import the following projects into eclipse using the file->import->maven project option.
    1. scheduler.core
    2. sdum.core
    3. security.server
    4. security.management
    5. security.client
    6. ui.requestCommons
    7. ui.requestDefinition
    8. ui.requestPresentation
    9. ui.schemaeditor
    10. utils.commons
    11. lsm.server
    12. lsm.client
    13. x-gsn
Note: If maven complains about a JIXB plugin go ahead and import the project. This error is temporary and we will fix it later.
  1. Each project should import successfully, download all the POM dependencies.
  2. The above projects are dependent on the utils.commons, ui.requestCommons, lsm-client and security-client.
    1. Other project might pop up a missing dependency error. Don’t worry yet.
    2. Right click on the utils.commons project and choose run as-> maven build … (choose the one with three dots)
    3. In the new window, for goals enter the word “install”
    4. This will compile the project, generate the jar and install it in the maven repository.
    5. Repeat the same steps for the ui.requestCommons, security-client and lsm-client projects.
  3. Right Click on the other projects and run maven->update project
  4. Now all errors should be resolved and only x-gsn will indicate an error. Ignore this as the error is due to incompatibility to eclipse maven plugin with some x-gsn configurations.
  5. Copy the openiot.properties and the security.ini file from the utils.common/src/main/resources/properties to the jboss folder standalone/configuration
Sample openiot.properties and security.ini files that work with a local installation of OpenIoT including LSM and Virtuoso is provided for reference.

openiot.properties https://github.com/OpenIotOrg/openiot/blob/develop/utils/utils.commons/src/main/resources/properties/openiot.properties

security-config.ini https://github.com/OpenIotOrg/openiot/blob/develop/utils/utils.commons/src/main/resources/security-config.ini

More documentation on how to assign roles to users is available at https://github.com/OpenIotOrg/openiot/wiki/Security-Use-Console

  1. Assign the newly created user the above roles allowing this user to access all the services
  2. Logout

Sensor Schema Editor

The schema editor interface can be access from http://localhost:8080/ui.schemaeditor

  1. Login with CAS
Follow the instructions in the wiki below to generate sensor descriptions

https://github.com/OpenIotOrg/openiot/wiki/Virtual-Sensor-RDF-Schema-Editor-Use

xGSN

The first component setup was xGSN. This was to ensure that there was sensor data available to be used later on by the request application

Wiki reference

LSM configuration properties

Update the X-GSN application.conf file under modules/x-gsn/src/main/resources as below

Note: The graph information in the application.conf must be identical to the graph information in the openiot.properties file.

https://github.com/OpenIotOrg/openiot/blob/develop/modules/x-gsn/src/main/resources/application.conf

Creating virtual sensor metadata file

To generate the metadata file, use the sensor schema editor which can be accessed from localhost:8080/ui.schemaeditor if the JBOSS is deployed to localhost. Please replace localhost with the public IP or host name if JBOSS depending on your installation.

Follow the instructions in the wiki below to generate sensor descriptions

https://github.com/OpenIotOrg/openiot/wiki/Virtual-Sensor-RDF-Schema-Editor-Use

The schema editor will register the sensor with LSM and provide the user with a metadata file which has to be place in the following directory along with the virtual sensor XML file /modules/x-gsn/virtual-sensors/

Creating virtual sensor XML file

There are many sample XML files in the xGSN folder under the LSM directory. Below is a sample XML file that connects to a CSV wrapper to read data from a CSV file.

https://github.com/OpenIotOrg/openiot/blob/develop/modules/x-gsn/virtual-sensors/LSM/opensense_1.xml

Running xGSN from Command Prompt

To run xGSN from command prompt (windows), and shell (linux) the following command is executed

gsn-start.bat

gsn-start.sh

Scheduler Core/Client

The scheduler core is the core service that will be deployed on JBOSS. The scheduler service can be tested by opening the following URL

http://localhost:8080/scheduler.core/rest/services

The scheduler client is a java application with Swing UI to test the services of the scheduler.core service.

The wiki / cookbook does not seem to provide any documentation on this client application. Here is a quick summary of the function. Some of the functions are still unclear.

Welcome - Will ping the server to test it is running

Discover – The discover service will discover the list of sensors within the given latitude and longitude

Register user – will register a new user with LSM (the new user will be stored into the graph as indicated by the configuration property file previously copied to the JBOSS store).

Login – the second register user section will test if a user is valid by authenticating the user against LSM.

Oamo and Osmo – These functions are used to get rdf information of users and services from the LSM store.

sDUM

The SDUM core is the core service that will be deployed on JBOSS. The SDUM service can be tested by opening the following URL

http://localhost:8080/sdum.core/rest/services

The sdum client is a java application with Swing UI to test the services of the sdum.core service.

Similar to the scheduler client application, the wiki / cookbook does not seem to provide any documentation on this client application. This makes it difficult for user to start using.

From experimentation, the following is the function of the client UI

Welcome – will test if the sdum.core service has been successfully deployed

Poll – the poll for service will take a service id and get the rdf data related to the service id

note: currently, there is no way to find the service id when using the user interfaces. The scheduler API if used directly without the request definition ui can provide the user with service id’s

Request Definition

The request definition interface can be access from http://localhost:8080/ui.requestDefinition

  1. Login with CAS
  2. Compose a new service
  3. Validate the design
  4. Save the design
Please refer to the OpenIoT Wiki for more detailed procedures. Please explore both user and develop sections.

Request Presentation

The request definition interface can be access from http://localhost:8080/ui.requestPresentation

  1. Login with CAS
  2. Load your application
  3. Click on current application-force dashboard refresh
  4. Data should become available in the selected output format
Please refer to the OpenIoT Wiki for more detailed procedures. Please explore both user and develop sections.

Clone this wiki locally