Monitor A Telecom Network Graph On Google Maps

Robert Lee, Engineer, Potix Corporation
August 29, 2008

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.

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

 

Version

Applicable to ZK 3.0.0 and later

Applicable to zk-GMaps-2.0_9 and later

 

Reference

Comments
 
Marcos de Sousa
2008-09-04

@Connecting............

I was checking GmapsEditorThread and GmapsMonitorThread because I implemented something like user in and out popup an window at right bottom of screen like msn, skype, gmail chat.

It looks the same as you did.

I am considering where Java 5: java.util.concurrent.Executors could help me when using Server Push.

What happen with previous thread if an user press F5 (refresh)?

@Disconnecting.........

Marcos de Sousa
2008-09-04

For those who don't mind Java 5 and Life cycle thread take a look at java.util.concurrent Framework, there is 2 option:
> final ExecutorService pool = Executors.newSingleThreadExecutor();
> ScheduledExecutorService

Actual I am usig ExecutorService with newSingleThreadExecutor();

And for those who still in stone age there is compatibility concurrent framework for java 1.2, 1.3 1.4

Marcos de Sousa
2008-09-04

Now using ScheduledExecutorService since is most appropriated for this case.

Robert Lee
2008-09-10

Hi Marcos,

Thanks for pointing this out, it is indeed a better approach applying the thread pool pattern. I should take a good look at this topic.

Robert
2009-12-31

Hello,

Is there a tutorial for configuring this app. or just a lead to configure it.

I want to connect it to the db and change the key for google map.

Thanx for any help,

Ian
2010-01-04

This is just a smalltalk, so I don't think the author have prepared a tutorial for it. I think you can show up what you want to do in detail and ask more specific question in Forum.

 
 
Leave a Reply
 
Name (required)
Mail (will not be published) (required)
Website
(Case Insensitive)
Bold textItalic textUnderLine textSource CodeHorizontal rulerExternal Link
Post
Preview