Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Electronic Voting Project in Java RMI: Design, Implementation, and Diagrams - Prof. Paul S, Study Guides, Projects, Research of Computer Science

A project implementing a simple electronic voting application using java rmi as an interface. The project includes a description of the code running, use case, interaction, and activity diagrams, class and deployment diagrams, and results. The document also covers conclusions, bibliography, and assumptions.

Typology: Study Guides, Projects, Research

Pre 2010

Uploaded on 08/16/2009

koofers-user-5c9
koofers-user-5c9 🇺🇸

10 documents

1 / 13

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
PROJECT 1
ELECTRONIC VOTING
CSC 8530
Prof: Dr. Schragger
Implemented by
Deepthi Reddy
Date: March 7, 2004
pf3
pf4
pf5
pf8
pf9
pfa
pfd

Partial preview of the text

Download Electronic Voting Project in Java RMI: Design, Implementation, and Diagrams - Prof. Paul S and more Study Guides, Projects, Research Computer Science in PDF only on Docsity!

PROJECT 1

ELECTRONIC VOTING

CSC 8530

Prof: Dr. Schragger

Implemented by

Deepthi Reddy

Date: March 7, 2004

CONTENTS

1. Project Description

2. Description of the running of code

3. Diagrams

 Use Case Diagrams

 Communications diagrams

 Sequence diagrams

 Class diagrams

 Deployment diagrams

4. Results of the runs

5. Conclusions

6. Bibliography/Citations

7. Appendixes

 Source Code

1. Project Description:

This Method takes Name as a parameter and checks if that name is registered and would return String type SessionID public Ballot getBallot(String SessionID) throws java.rmi.RemoteException This method takes SessionId (returned by Login method) as a parameter and returns Ballot object containing Election details. Public boolean vote(Ballot ballot,String sessionID) throws java.rmi.RemoteException In this method the user makes his selection to which party he wants to vote. It returns true if the vote submitted is stored successfully. public Ballot getResults(String SessionID) throws java.rmi.RemoteException Returns the current Election status. The administrator has the privileges to view the status. public int logout(String sessionID)throws java.rmi.RemoteException This method closes the session for that user.

Interface implementation

The interface implementation is named as evotingimp. This class extends java.rmi.server.UnicastRemoteObject and implements Voter. Methods implemented: All the methods present in the interface Voter and some additional functions were developed to display ballot lists. The login method takes username and returns the session Id for that user.The getBallot method takes session id returned by login as an argument and returns the Officelist and Referendum list for that user. The Officelist is a list of OfficeBallots, which contain the name of the office we are voting for, the parties to select from, and the selected party and Vector Vote count. The Referendum list is a list of ReferendumBallots, which contains the referendum name and integer which holds the selection and count of votes. The Vote method takes the ballot object and user session id as arguments and stores the submitted vote successfully. This method increments the vote count depending on whether it is for

Office or Referendum. Once the Vote method successfully done logout method closes the session.

Client Program

The name of the client program is evotingclient. This class creates a remote object(Voter) and Look up for naming binded to contact server. This client program prompts for Login Name. Voter ev = (Voter) Naming.lookup("rmi://localhost/VotingService"); The input provided by the user is checked in the login.txt if the user exists. If the user doesn’t exist then the input is stored in login.txt and the input is passed as an argument to Login method. After getting session id from Login method, the remote method getBallot is called to display the ballot for that user. The logout method is used for user to logout.

Server Program:

The name of the Server program is evotingserver. This server program creates an object of interface implementation and binds the name. Voter ev = new evotingimp(); Naming.rebind("rmi://localhost/VotingService", ev); The main method calls the constructor for server.

Interaction Diagrams: User interact with server though client. First the client requests for login. Server replies back whether it is valid or not. If the login is invalid user tries to login again. If the login is valid, then the client requests for Ballot. Server returns the Office list and Referendum list for that user. User selects from the options provided and votes for his selection and sends this information to server. User logout and server closes the connection. Client Server Login Invalid Login Valid Login, SessionID getBallot Office list/Referendum list Vote Logout Session close

Activity Diagrams: Voter Login Login() Voter Selectionlist getBallot() Review Election getResults() Selects and Votes Vote() Logout 1.a 1.b^ 1.a 1.a 1.b

1  Voter login 1.a if the user is not voted, return the Selection list 1.a1  Voter selects his choice and submits his vote 1.a2  Voter logout 1.b  if the user is already voted 1.b  Reviews the Election 1.b1  user logout

Deployement Diagrams: Order of Deployment

  1. Compile all the source files. User Server Client

RMI

Login getBallot Interface RMI Registry RMI Registry Stub Vote getResults logout Server RMI Registry Login GetBallot Vote GetResults Logout

  1. Use rmic to generate the stubs and skeletons rmic evotingserver
  2. Start the rmiregistry to allow the remote clients to get a reference to a remote object start rmiregistry.
  3. Start the Server. Javac evoitngserver.java Java evoitngserver
  4. For running the evotingclient, in another machine install the stub created above, the class files for the interface and the object classes and run the client. The above order of deployment is very important. If this order is not maintained while deployment the remote invocation will not be successful. Assumptions:  User already registered and user knows his user name  RMI policy file must be present in the package.

Conclusion:

Lessons Learnt: Before this project I had no prior knowledge about RMI. I learned the concepts of RMI in java. While doing the coding for this project, I learned how to implement Java RMI. Soon I ended up with a distributed application that collects data from client and also sends the client the required information. Difficulties: I also learned about the security policy issues in java when I had the initial trouble of setting up the server and RMI registry. Extension: This project can be extended in many ways. Here are some of my ideas which can be implemented for the future versions: a) The login security can be extended with a password b) A good GUI can be implemented