Server.Server Class
The actual code for operating on elections: maintains the collection of elections and has methods which Worker threads and the election server manager can call. This class is effectively immutable: all operations are passed through a mapping of election names to Election objects, and the mapping does not change once the server is up and running. Concurrency control is on individual elections, since we don't need concurrency control on the server itself. <br/><br/> Operations called by the election server manager have a display argument, which is how they display results (i.e. no return values); they may also throw a DisplayException to display an error. Operations called by worker threads throw exceptions to indicate errors, and return results normally.

Access: Public
Base Classes: Object
  Members Description  
    port    
    localAddr    
    elections    
    DEFAULT_PORT    
    Server Constructor.

 
    Port Port accessor

 
    LocalAddr Local address accessor

 
    setup Reads the contents of an XML file and parses the elections and the candidates.

 
    openElection Opens the election by calling on the method on election object

 
    closeElection Closes the election by calling close() method in election. Passes Display Manager so that election can pass the information to be displayed on the screen.

 
    viewElection Calls view method on election to display the election results.

 
    displayElections Prepares Display Manager to display the results of the elections

 
    getElections Gets the list of elections

 
    getCandidates Gets the candidate list for the specified election

 
    vote Records the vote for the specified candidate in the election