







Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
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
1 / 13
This page cannot be seen from the preview
Don't miss anything!
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.
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.
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.
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
Login getBallot Interface RMI Registry RMI Registry Stub Vote getResults logout Server RMI Registry Login GetBallot Vote GetResults Logout
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