Chengyi Shih
Jing-Chuan Dong
A vote server on the back end provides two java rmi interfaces for the two front-ends to this voting system. The applet end issues rmi calls to register voters and lets registered voters cast their votes through the server. The vote manager end runs as a java application that let's the manager create/delete/view votes to be issued by the voter server. The vote description, voter registration and ballot are stored on a jdbc compliant database server. Each vote object, which knows how to display itself and connect itself to the database are serialized on each vote server and able to be restored on each vote server initialization.
The three main packages of the voting system is server, client and applet. The server utilizes java rmi, serialization and jdbc to simplify its jobs, e.g. handle multiple connections, persistent server configuration, data storage and database concurrency controls. The client package uses Java 1.1 awt and JFC Swing 1.0.1 classes for its presentation. The fundamental task for the Client packetage is to give the user the flexibility to crate votes. The Client package have other functionality which will be explained later. The applet package uses java 1.0 awt classes for its presentation. This package is the front end for all the voters. All of the three packages will be explained thoroughly at corresponding sections. Communication between the packages are served by the Vote.
System Requirements
Design
name | the name of the server, the name of the VoteManager remote object Note: the VotingBooth is named [serverName]_Booth |
parent | the parent server that this server queries for new votes |
limit | the limit to total number of connections to the server (not implemented) |
updateWait | the amount of milliseconds between each query to the parent vote server |
parenLogin | the login to the parent server |
parentPasswd | the passwd to the parent server |
saveas | the name of the file that this server should serialize to when shut down |
updatorFile | the password file for the list of servers that are allowed to query this server for new votes |
voterFile | the password file for the list of registered voters that are allowed to vote on this server |
managerFile | the password file for the list of managers that are allowed to administer this server |
dbname | the jdbc url that this server uses to store it's tables |
jdbcLogin | the login to the jdbc server |
jdbcPasswd | the password to the jdbc server |
userTable | the name of the table that stores the registration information of each user registered on this server |
voteTable | the name of the table that stores the information of each vote originated at this server |
Sample configuration file:
#name
name TeleServer
#jdbc url
dbname jdbc:sybase:Tds:tune.cs.columbia.edu:17020/fang_db
#serialized filename
saveas teleserver.save
#updators password file
updatorFile updators
#voters password file
voterFile voters
#managers password file
managerFile managers
#jdbc login
jdbcLogin jiawei
#jdbc password
jdbcPasswd jiafan
#table within database of user registrations
userTable users
#table within database of votes information
voteTable votes
Two objects will be registered with the system's rmiregistry for every VoteServer. The VoteManager object handles the calls which manages the server. The VotingBooth object handles the calls made by applets over the web. Each have completely different purposes.
VoteManager:
This class implements the Manager rmi interface. It provides services to managers and updators, services such as get vote list, get/add/delete vote, add/remove managers and updators. The root password supplied to the VoteServer applies here. The url of this object should be publicized so the managers/updators can connect to it.
VotingBooth:
This class implements the Booth rmi interface. It provides services to applets, services such as get vote list, get vote, register/unregister voter, cast or update on the votes hosted by any VotingBooth. The url of this object should be publicized so the managers/updators can connect to it.
VoteUpdator:
The class implements the federated system among VoteServers, each VoteServer can connect to a parent VoteServer for new Vote updates, that it will host the vote for it's parents. But since each vote knows its own database related functionalities, this is achieved effortlessly.
The main purpose of Client package is for creating, updating, and maintaining
of the voting service, and only the person who have the login and password can
use these services. The main task is to give the user the flexibility to
create and remove votes. Other than the voting service, the client package
gives the user the authority to add new managers to grant and remove other
users the access to add new votes. The person who has the access to this
service can also set up the login and password between servers. The user of
this package can have the authority to shut down the server.
The main goal of this package is to allow the manager to add customized vote
survey, and submit the vote to the server and database. This vote will
become available to the public once the vote is submitted, and the applet
package provides an GUI interface to display the vote survey.
Create Vote
After the application is started and before the user can start to create
a vote, there are several fields that must be specify. First, the
Vote Name field. This field must be unique and no two votes can have
the same name. Vote Type field is currently used as comment, and have
no real importance. DB URL specifies where the vote should be stored
in the database. DB Login and DB Password are used to verify
and setup connection to the database. If there is an error, a warning
frame would pop up and provide proper warnings.
The questions that can be placed on the voting survey can be categorized
into Multiple Choice questions and text-based questions where each question
is followed by an text field. The multiple choice questions have the following
fields: A question field, a comment field in case a warning/note is
necessary, a field to add multiple choices, and finally the manager can
ask the voter to select one or multiple choices. The text question is
similar to the multiple question in the way that it also provides a question
and a comment field. In addition to these two fields, there are to fields
to specify the text area size (in height and width) for the voter input.
The manager can add the question to the list by click Add to List.
A vote can consists of both type of questions. Everytime the a vote
question is added to the list, the new question will be added to a list and
displayed in the center of the frame so that the user can have the option to
remove the question from the list. The user can select multiple questions
and remove them at once. Once the survey is finished, the user should press
the Submit button to submit the vote to the database. Once the survey
is submitted, it becomes available to the public for voting.
View Result
After the voters have submit the survey. The manager can use the Vote Result
Viewer to see the voting statistic by click on the View Result button.
A new window will pop up asking for the following information: login,
password, and rmi connection. Login and password is used to connect to the
remote server to use the rmi objects and the rmi connection is used to
specify the location of the rmi object. To properly establish the connection,
the three fields must be entered properly. Once the Connect button
is pressed, a number of votes should show up on the vote list window if votes
are available. Once a vote is selected from the vote list, the vote
information for Vote Name, Vote Type, Dead-Line, and JDBC Connection will be
displayed right next to the vote list. Recall that these fields are the
fields that are specified when the before the vote creation. In addition to
these information, another window will pop-up to display the statistic of the
selected vote. Since it is impossible to display the result of text-based
questions, the statistic only shows the result for multiple choice questions.
The result is displayed as numbers, and the number indicates how many voters
select this particular choice.
GeneralVote: extends the Vote abstract class. A Vote object knows what questions it contains, how to store itself into its designated database table when a user commits a vote, and how to display itself and display its current state
in the voting process through calls to "drawBallot" and "drawStat". "drawBallot" is used by the applets when voters want to vote. "drawStat" is used by managers when analysis is needed. The functionality provided by "drawStat" is by no means complete, just some basic summarization of choices made by voters. All votes implements serialization and is saved to file when the server is shutdown. The jdbc connection which is a field of any Vote object tells where the table that stores the user voting information is. All commits, cancel, statictical analysis comes down to this table for the Vote object.
To install the voting system, at least one read/write account to a database at a jdbc compliant database server is required. Two tables are needed are on the database initially, one called "votes", the other called "users". "votes" stores all the votes hosted by this server. "users" stores all the information of the registered voters.
Java edu.columbia.cs6998.voter.server.VoteServer -config [config file] -root [root password] -load [serialized VoteServer]
config file: is a VoteServer configuation file that is not under the name of vote.conf. This parameter is not required.
root password: is the root password for this server, used by VoteManager. This parameter is required.
serialized VoteServer: this is the file name of a serialized VoteServer. By default, VoteServer saves itself to the manager's name, the name can be changed in the configuration file.
Use the above command to start the server. And the html file which runs on the same host will be linked to the VotingBooth with the following tags:
Client package
To run this package, JDK1.1 complier is required. The command line should provide three extra arguments:
The
Login and Password provides the basic security for using the client package.
This package consists of the following functionalities:
Create Vote
This function allows the user to add new votes to the voting booth.
Create vote has the functionality of adding questions that are
"multiple choice" or "text" based questions. The user have the
flexibility to mix these question together. Once finish creating
the vote, the submit button should be pressed to add the vote to the
voting booth.
Remove Vote
Allows the manager to remove votes and maintain the database. The
survey name are listed so that the manager can easily choose the
survey to be removed. Multiple surveys can be removed at the
same time by highlighting multiple survey names. The Select
All and Invert Select buttons are also provided for
convenience reasons. Once the vote is removed by click on
Remove Vote the survey will be removed from the database
View Result
View the voting result and statistic
Add Updater
Adds an updater to the Updater list. The updater login and
password is used to set up connection between servers.
Remove Updater
Removes an Updater from the Updater list
Add Manager
Adds a Manager to the Manager list. The authorized manager can have
the option to add new managers to the manager list. The new manager
will be asked to provide new login ID and password. The new manager
will also granted the access to use the Client package
Remove Manager
Removes a Manager from the Manager list by providing a login and
a password
Shut Down
Shuts down the server
Applet package
The applet package consists the following parts:
1. VoteApplet: implementation of main interface, consists of three parts:
1) let user register to the voting system, 2) login into system 3) de_register
from system.
2. VoteClient: handles login process and after-login process.
3. VoteList: gives a list of available voting topics, a thread is used to
constantly update the list of topics by reading messages from server, the
use of Thread causes the list to be refreshed every five minutes.
4. VoteFrame: a frame that contains all infomation needed for each topic,
it is invoked by double clicking on the list item from VoteList.
Vote package:
This package serves as the way of communication between the three packages. It is also a data storage class that stores the formats of votes held by servers.
Installation
Next, set the class path to where Java, the voting system, swing, and Sybase jConnect are installed.
Write a configuration file to set the state/functionality of the VoteServer. The default configuration file is named vote.conf in the current directory where the VoteServer will be started.
Other than the configuration file, the user has three options to set when starting the server: for example
<APPLET
CODEBASE="bytecode/"
CODE="edu/columbia/cs6998/voter/applet/VoteApplet.class" WIDTH=500 HEIGHT=350 >
<PARAM NAME=rmiURL VALUE="//telepath.furn.rhno.columbia.edu/TeleServer_Booth">
</APPLET>
Reference
Source Code