-
Notifications
You must be signed in to change notification settings - Fork 2
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.
If you haven't already set up your SolarNetwork development environment, go through the Eclipse Setup Guide first, and then return here.
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).
- [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.
The SolarNode code is divided into many small plug-in projects which follow a Java package-like
naming convention using periods between domain names, like net.solarnetwork.node.datum
.
All SolarNode-specific projects start with net.solarnetwork.node
followed by a feature
name and then optionally followed by other implementation specific names. Examples of
features are:
-
control
- plug-ins for controlling devices -
datum
- plug-ins for collecting data from devices -
hw
- plug-ins for hardware-specific support -
io
- plug-ins for communication protocol implementations -
setup
- plug-ins for managing SolarNode itself
If you are not interested in a particular feature, you can streamline your Eclipse workspace by closing the projects you don't need (right-click and choose Close Project).
Import the /solarnetwork-build/solarnetwork-osgi-target/defs/launch-confs/SolarNetwork-node.launch launch configuration via File > Import > Run/Debug > Launch Configurations. After you import this, go to Run > Debug configurations… and you should see a SolarNetwork-node configuration.
Most SolarNetwork bundles have an associated unit test fragment bundle whose name ends with
.test
. For example the net.solarnetwork.common.web
bundle has an associated
net.solarnetwork.common.web.test
unit test bundle. These unit test bundles can really slow down
the launching of the SolarNetwork platform in Eclipse, so it is a good idea to disable them so
they are not included at runtime.
You can disable test bundles on the Bundles tab of the launch configuration. Type test
in the
filter field to easily show only the test bundles, and then you can disable each of them, like this:
For unit tests, a different log configuration from the platform runtime is used. In the
net.solarnetwork.node.test project, copy the environment/example/*.properties
files into
environment/local
. You can then edit the ones in local
as needed, as they are ignored by Git.
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 include the
net.solarnetwork.node.setup.developer
and net.solarnetwork.node.upload.mock
bundles in your
launch configuration and omit the other net.solarnetwork.node.setup.upload.*
bundles. Once you
launch the platform, SolarNode will be available at http://localhost:8080:
When using the net.solarnetwork.node.setup.developer
bundle, the login credentials are
Username | Password |
---|---|
-11 |
solar |
After logging in, you should see all available configurable bundles show up on the Settings tab: