Brief Overview

This section explains implementation details of the simple survey system which illustrates Connector Component architecture. Detailed explanation of Connector Component architecture is available here.

What does the survey system do?

This example implements a simple survey conducted on some students. There are two questions whose answers are binary.

The implementation is done using servlets. To remember state, we have used cookies. The database used is MySql (However any database can be used by specifying different JDBC driver).

Architecture 1:

In this we have three components client, server and database. The client side is implemented as a HTML page. The server is a Servlet listening to requests from the client. The user just fills in the survey and the results are displayed to him from the server which accesses the database.

The source code is maintained in the directory Arch1. One file contains the JAVA source code for servlets and another is HTML file for client.

Architecture 2:

The first architecture has no security and a user may take any number of surveys. So to provide security, we use an authentication server which will be communicated by the main server (servlet). The user supplies the authentication information to main server which checks authenticity of user (using connector for authentication server) . If user is authenticated, it checks if user has already taken the survey (connector to database). If yes, he is given the results. Otherwise he is given survey form which he fills and submits to main server. It then commits the survey to database and gives survey results.

To remember state information (user session), we use cookies. A simple hash function is kept within mainserver so as to protect from illegal access.

Here there are four components. The code is maintained in directory Arch2. There are four files corresponding to each of the component.

Architecture 3:

In this architecture, if the database is down, then the cached survey results are provided to the user. So another (sub) component "cache manager" comes into picture. The cache manager is used by the main server.

 The implementation of cache is done through files. Whenever a new user takes survey, the cache is updated (and if server is up). 

The source code is maintained in directory Arch3.  Here there are five files for five components.

How to execute:

The system is written in JAVA and hence it is platform independent. As we have implemented the system using servlets, a web server should be running. See that the class files for each of the JAVA source code file is present in the classpath to the webserver.

Modify the servlet location in HTML files based on the server IP address.