From Documentation

Jump to: navigation, search




  • Author
    Robert Lee, Engineer, Potix Corporation
  • Date
    August 29, 2008
  • Version
    Applicable to ZK 3.0.0 and later
Applicable to zk-GMaps-2.0_9 and later


Contents

Introduction

From the previous Small Talk on Construct a Telecom Network Graph, we have seen how to quickly prototype a Telecom Network Graph on Google Maps with ZK components applying Model and Renderer approach. In this working application we have applied object modeling and database access with DAO and by including Server Push feature in order to implement a web application monitor.

Live Demo


Editor-Monitor relationship

The Editor window is running IE7 at the bottom and the Monitor window is running FireFox 2 at the top. Only an Editor has rights to manipulate the structure of the Network, store updated information to DB. Each Monitor has read only access to data cached by editor thread in Application memory.

Editor monitor.png


Monitor with Comet Server Push

In short, the Comet server push technology implemented by ZK virtually allows client processes to be executed on Server side initiation. In this example application the editor thread runs every second loading objects from database into memory in application scope. Monitor threads access the loaded objects and reconstruct the network mapping based on the information obtained.

Following code loops the monitor thread:

while (!_ceased) {
	Executions.activate(_desktop);
	try {
		updateFromApplication();
	} finally {
		Executions.deactivate(_desktop);
	}
	Threads.sleep(DELAY_TIME); 
}


Please do not modify UI components outside the two lines in your program: Executions.activate(desktop) and Executions.deactivate(desktop). By doing so you will get java.lang.IllegalStateException, this means you are trying to modify a component when it's not initialized or when its desktop is not owned by the current thread.


DB Cached in Shared Memory in Application Scope

Monitor obtains information from shared memory in application scope. This memory is cached by editor from DB. The shared memory is updated only by the editor thread when network model has changed. Installing the application

1. Download and deploy GmapsMonitor_01.war to your tomcat directory.

2. Copy hsqldb.jar to your Tomcat's library.

3. Start a db connection and create db tables with this script

4. Run the application

5. You can open either the Monitor.zul or Editor.zul to manipulate your own network object. Note that you can observe change in Status of the nodes and links when they are updated in database.


Summary

Building a monitor with comet server push is a straightforward concept. What we have demonstrated here is a Telecom Network Monitoring System on Google Maps with the aid of ZK components. We have achieved the following:

  • Inject Object layer so UI components are separated with data object during logical data manipulation.
  • Demonstrated the Comet Server Push technology to display real time network status on monitor.


Download


Reference




Copyright © Potix Corporation. This article is licensed under GNU Free Documentation License.