Skip to content

SolarNode Development Guide

Matt Magoffin edited this page Aug 29, 2016 · 12 revisions

SolarNode Development Guide

This guide explains how to setup a development environment for contributing or modifying the SolarNode application code.

The SolarNode project consists of a set of OSGi bundle projects that, when combined and run in an OSGi container, form a complete SolarNode application. Each OSGi bundle comes configured as an Eclipse IDE plug-in project (Eclipse refers to OSGi bundles as "plug-ins" and its OSGi development tools are collectively known as PDE). Although Eclipse is not actually required, the remainder of this guide will describe setting up Eclipse for viewing and running the code for development purposes.

Eclipse Setup

If you haven't already set up your SolarNetwork development environment, go through the Eclipse Setup Guide first, and then return here.

Clone Git repositories

The SolarNode project is contained in the solarnetwork-node repository. You can clone a Git repository by going to Window > Open Perspective > Git Repository Exploring (you may need to choose "Other..." under Open Perspective if Git does not appear there).

  1. [email protected]:SolarNetwork/solarnetwork-node.git

Note this is in addition to the common repositories mentioned in the Eclipse Setup Guide, which also describes in more detail how to clone repositories in Eclipse.

Bundle project naming conventions

The SolarNode code is divided into many small projects which follow a Java package-like naming convention using periods between domain names, like net.solarnetwork.node.power. All SolarNode-specific projects start with new.solarnetwork.node followed by a feature name and then optionally followed by other implementation specific names. Examples of features are:

  • consumption - net.solarnetwork.node.consumption*
  • power - net.solarnetwork.node.power*
  • price - net.solarnetwork.node.price*
  • weather - net.solarnetwork.node.weather*

To illustrate the idea of SolarNode features, see the following illustration:

SolarNode features have been grouped by colored rectangles, and the mock implementation project for each feature highlighted within each feature. If you are not interested in a particular feature, you can disable all projects whose name starts with that feature by closing them in Eclipse (right-click and choose Close Project.

Configuring bundle properties

Some bundles expose properties that can be configured to suit different operating environments. These bundles will always provide default values for the configurable properties, so you only need to create custom properties files if the default values do not match your local environment.

The bundle properties are configured via Java Properties files located in the /solarnetwork-osgi-target/configurations/services directory. If a bundle project exposes configurable properties, it will have an example properties file in the example/configuration directory within that project. These files will have particular names which must not be changed because the bundle will look for its properties file based on the pre-defined name. To customize the properties for a bundle, copy the desired example/configuration/*.properties file into /solarnetwork-osgi-target/configurations/services, rename it to have a .cfg extensions, and then modify the copied file as necessary. The example files will contain all available configurable properties, along with documentation on each property.

For example, the net.solarnetwork.node.dao.jdbc project exposes some configurable properties as detailed in /net.solarnetwork.node.dao.jdbc/example/configuration/net.solarnetwork.node.dao.jdbc.properties. This bundle configures the JDBC connection used by the SolarNode for persisting data. If you want to customize the JDBC connection in any way, copy this file to /solarnetwork-osgi-target/configurations/services/net.solarnetwork.node.dao.jdbc.cfg and modify it as desired.

Running or debugging the SolarNode application

See the Debugging SolarNetwork with Eclipse page for information on running SolarNetwork applications within Eclipse. You don't need to run the SolarNet application if you run the .mock versions of bundles like net.solarnetwork.node.upload.mock.

Clone this wiki locally