GreenFire.dev.java.net is an opensource project which goal is to manage heating systems in convenient and efficient way. It is acually a bunch of ejb-jars (created with Netbeans 5.5, 5.5.1, and 6.0) which are
deployed as an EAR to Glassfish v2. GreenFire abstracts early from the proprietary vendor extensions - the whole management is heating system independent. GreenFire consists of the following building blocks:
Diagram created with Netbeans UML plugin.
GreenFire wakes up every 5 minutes (the archiver, actually the heartbeat - implemented by a timer bean) completes the following tasks:
- It gathers the data (heating + configuration, weather forecast) and passes it to the „brain“
- The brain is asked what to do (heating on/off, etc.)
- The decision is passed to the integration layer and executed
- All the data is stored in the Derby DB and can be used in reports.
The „brain“ dowloads a script from an URL (Glassfish as well). It has access to all the data (JPA entities) and can decide what to do.
The data in the JavaDB is used for reports and monitoring independently (it stores every 5 minutes all the data since about 2 years – and performs still very well -> no problems).
The Reporting-UI is accessing JavaDB to read the decisions and interesting data like external temperature, weather etc. – not directly the heating system (decoupling – the serial port seems not to be thread safe).
However the current data is broadcasted every five minutes using JMS internally (inside the application server) the shoal.dev.java.net / fishfarm.dev.java.net framework as well and can be accessed with every device (currently multi-media system, PCs, working on Java ME) over W-LAN. Even the following widget is updated by the JMS/Shoal heartbeat:
The rules for the heating should be changed without redeploying and especially recompiling the application.
For the implementation the Fluid Kernel, Persistent Anemic Objects, Lookup Utility etc.. pattern were used (see: http://p4j5.dev.java.net).