Log Demo

The Log Demo shows how to use the functionality of the Log Bundle for storing messages. The demo is represented as a bundle called Log Demo Bundle.

Demo Components

The JAR file of the Log Demo is logdemo.jar and is situated in the demo/bundles directory. The other components of the demo are placed in demo/framework/log folder. There are two script files - an mk for rebuilding the demo and an install.txt for installation through the Kit Manager Bundle. The readme.txt file gives a short description of the demo. The source file is placed in a demo.log package.

Starting the Demo

To start the demo you need to install the Log Demo Bundle. You may use a command line like this:

>$fw.i -s ../../../demo/bundles/logdemo.jar

The Log Demo depends only on the Log Bundle, which is installed by default on the framework, so you don't need to preliminary install any bundles.

Inside the Demo

The Log Demo Bundle gets two services from the Log Bundle - Log Service and Log Reader Service. A Log Listener is added to the Log Reader Service which allows the bundle to be notified each time a log entry is entered into the Log Bundle. The testing of the functionality of the Log Service is done in a method called test. This method tries to open a port and each time the operation is successful or unsuccessful, an appropriate message is written to the Log Bundle.

The Log Listener added to the Log Reader Service is the LogDemo class itself. Its logged method filters the messages received in the log, to get only those, which are written by the Log Demo Bundle. Then the log message is got and printed to the framework console.


Framework Demos