Skip to content
Julien Eberle edited this page Jan 15, 2015 · 5 revisions

Installing GSN from Source

If you wish to run the most recent version of GSN, then you will need to run the source code version which is available from the GitHub repository.

To run from a command line

  • Download the Jakarta apache ant version 1.7.x or higher.
  • Download and install Apache Maven
  • Add the full pathname to the ANT HOME/bin folder to your PATH
  • Ensure you have the latest version of JDK installed.
  • Download and install Git
  • If you are using a command line git client, use the following command to clone the repository locally git clone git@github.com:LSIR/gsn.git

The following ant tasks are available in the build.xml file:

  • gsn Starts the GSN server.
  • restart Stops any running GSN server and starts it again.
  • stop Stops the currently runing GSN server.
  • jar Creates a jar le from the source.
  • clean Removes the current built files and forces a rebuild.
  • cleandb Removes the redundant tables which are create for holding GSN’s internal states.
  • eval-queries Evaluate the GSN throughput by generating random /multidata queries. To run any of the aforementioned ant tasks simply write:
ant task name.

This will generate a very verbose output. Don't worry if the text goes too fast: all the information is stored in a log file logs/gsn.log that you can view with your favorite text editor. You can configure the log level by editing the file conf/log4j.properties. There are several log levels, from DEBUG (maximum logging) to WARN (minimum logging, maximum performance). If you want to reduce the log verbosity open conf/log4j.properties and find the line that starts with

log4j.rootLogger=...

And change the value to one of the DEBUG, INFO or WARN levels.

Installing to Run and debug GSN in Eclipse

The GSN code can also be installed to run and debug in the Eclipse environment.

  • Download and install Eclipse SDK.
  • Start Eclipse.
  • Download the code from the git repository: git clone git@github.com:LSIR/gsn.git
  • In the New Projects Wizard select "Java Project" and click "Next".
  • In the New Java Projects Wizard.
  • Enter the project name, select "Create new project in workspace".
  • Select "Create separate folders . . . " and click on "Configure default".
  • If the project doesn’t contains a "src" directory (depends on the Eclipse version you are using), assure to create one by clicking on the "Create new source folder".
  • In Build Path preferences select "Folders", enter "build/classes" as the output folder name and click "OK".
  • Click "Finish".
  • Click "Ok" to confirm overwrite of non standard resources.
  • Wait for the files to be downloaded from the repository.
  • To add library files to the build path.
    • Project -> Properties.
    • In the Properties dialog select "Java Build Path".
    • In the Java Build Path dialog, select the "Libraries" tab.
    • On the Libraries tab, click on "Add jars . . . ".
    • Add only the .jar files in the lib directory and its sub-folders ; do not add any LICENSE text files
  • check whether there are any build errors, which prevent the java compiler from building GSN
    • note: some errors are safe to ignore, but need compiler configuration changes (namely "Access restriction" errors)
      • in the main menu select "Window" > "Preferences". a configuration popup should appear
      • in the menu of the popup select "Java -> Compiler -> Errors/Warnings". you should see a list of possible warning/error levels for the java compiler
      • in the list go to "Deprecated and restricted API -> Forbidden reference (access rules)" and change it to "Warning"

Starting from version 1.1.7 GSN is using apache maven for managing the dependencies and libraries. If you update from a previous version, you may need to install additional plugins and change the settings of the project:

  • You can install M2Eclipse
  • Right-click on your GSN project -> configure -> Convert to Maven project...
  • Right-click on your GSN project -> Build Path -> Configure build path...
  • On the libraries tab, remove all references to the libraries that are marked in red.
  • Press alt+F5 and update the maven libraries (it may take a while the first time)
  • If it still complains about missing libraries, check if they are in the lib folder and if needed add them to the build path

GSN is now ready to Run.

Configuring eclipse to run/debug GSN through Eclipse

Step 1: Setting the Ant Home:

  • Download the Ant binaries (apache-ant-1.7.x-bin.zip) from http://ant.apache.org/
  • Extract the folder apache-ant-1.7.x to a suitable location on your hard drive
  • Open Eclipse and do the following steps to set the Ant Home
  • Go to Window Menu and select Preferences, on the left side, click on ANT and then select Runtime.
  • In the Classpath tab (opened on the center of the window) select Ant Home Entries, click on the Ant Home button and browse toward the directory that contains the files from the jakarta-ant archive (\apache-ant-1.7.x\bin).
  • Click on OK in the Browse window and again to exit the Preferences dialog. Step 2: Setting an Ant Build System for your GSN project.
  • Select the GSN project and on the Project menu click on properties tab.
  • On the Properties sheet for the project, select Builders on the left side and click on "New" and select "Ant Builder".
  • A "Builder Properties for . . . " window pops up which has several tabs.
  • Main Tab.
    • For build file, click on Browse Workspace and select the build.xml file.
    • For base directory, click on the Browse Workspace and click on the project name which contains the gsn source code.
    • Leave the "Set an Input Handler" selected.
  • Targets Tab.
    • For After a Clean, click on Set Targets and select both Build and Bind.
    • Click on Ok.
    • Back in the Builders page.
    • Select the new Ant Builder.
    • De-select the existing Java Builder and click OK in the confirmation panel which will appear.
    • Move the new Ant Builder to the top of the list.
    • Click on OK.

Trying it out

  • Build the project.
  • Set the gsn-controller-port parameter:
    • Open build.xml, locate the gsn-controller-port value and copy it to the clipboard.
    • Open the Run dialog (Run -> Open Run Dialog . . . ).
    • In the target Run Configuration (eg. Main)
      • Go to the "Arguments" tab
      • Paste or type the gsn-controller-port value from build.xml
      • Click "Close"
    • Click on the Run button on the toolbar
    • The GNS application should display "GSN Starting . . . " in the console
    • Open a web browser and browse to http://localhost:22001 and verify that the GSN server is working.
    • Stop the running GSN using the ant Stop task
    • Insert a breakpoint in the first line of the Main class
    • Start the application from the "Debug" button on the Eclipse toolbar
    • GSN should start in the Eclipse Debug perspective and pause at the breakpoint

Now you can debug your virtual sensors in eclipse, try it by setting a break point on a line in the main file.

Clone this wiki locally