Server Initialization Component Design Alex Kossey 1. Overview The Server Initialization component receives a file uploaded from the ballot creation application, unzips it, puts it in a directory structure on the server, and sets up a database so that the election can run. 2. Interface The interface to the server initialization consists of two pieces: an FTP server running on the server, and a PHP script called receive.php. The ballot creation application uploads the ballot XML file to the FTP server and then contacts receive.php to inform the server that a new ballot file has been uploaded. 3. Functionality The functionality of the Server Initialization is split up into three separate PHP files: receive.php, unzip.php, and dbinitialize.php. receive.php: The ballot creation application contacts this file through HTTP when it has uploaded a ballot file to the server. The main function of this script then calls unzip.php to unpack the ballot file, then calls dbinitialize.php. unzip.php: This script (a third-party script; we won't be writing this ourselves) takes a zip file and unpacks it. Since directory structures can be built into zip files, it'll just unpack this directory structure to a standardized location on the server. dbinitialize.php: This script will contain most of the initialization work for setting up an election. Called only after the ballot file has been unpacked, it will use the XMLFileInterface component to figure out how many questions there are in the election and what their types are, then it will set up the three tables in the database using the Database Interface component: the table of students who have already voted, the table of question types (based on the question types in the XML file), and the table to store voter responses. This won't consist of much actual code; largely it will be calling functions in the XML File interface and Database interface; it'll all take place in the main function for the script.