Recent Question/Assignment
Text: Distributed Systems – Author: George Coulouris, Jean Dollimore, Tim Kindberg
Assignment 2
Due: Mar 20, 2013
Description
This assignment will involve the design and implementation of a multi tiered client-server architecture (to be implemented in Java). Your task is to design and implement a server and the clients that will provide reliable transmission in the given problem domain. The client-server system will implement an application that will provide document-vending support. This distributed application will provide the client with a set of documents (and their associated costs) they may purchase. Clients will select their documents and must pay before receiving them.
You will design and implement a single server that will function as the document vending application for multiple client connections (which you will also design and implement). The document vending application must be written in Java and does not include commercial
database-engines (other than your own implementation of a data store). This server will provide a list of documents and their associated costs. A client may review the server’s products and make download requests.
This assignment will involve the design and implementation of a cache service for your document vending application. You do not need multiple machines to implement or test this project. However, the assumption is that each element can exist on a separate physical machine and must use remote communication to accomplish a given task. The intent of the cache is to reduce read latency. This assignment will introduce the concept of a cache service and give you experience in the design and implementation of a multi-tiered system.
In this project, you must design and implement a single cache service that supports multiple clients (IE. any client created within your system will have access to the cache service). You must design and implement the cache functionality such that it supports the lookup, addition, and removal of elements in the cache. Thus, the cache must have a fixed size and must be consistent. This cache service becomes part of the Document Vending Server. Additionally, the Document Vending Server will interface with a data layer that stores the entire inventory of documents.
Each Java client must interface with your Java Document Vending Server. The client-server system will allow a user to send a request for a text file to the server. The assignment will require you to develop a client Java application (VClient), a server Java application (VServer) and the data server (DServer). The system will run on a single physical machine by invoking multiple instances of the Java Virtual Machine.
Details
Client-Server System
The design and implementation of the client-server file vending application will consist of multiple layers and their associated application protocols using a reliable transport protocol:
1. Presentation Layer
• The Client.
2. Processing Layer
• The Document Vending Application Server.
• Cache Service.
3. Data Layer
• Document Store.
The Client
A client program must be designed and implemented. This Java program will communicate with the end user and your Document Vending Server. For this assignment a graphical user interface for the client is neither required nor prohibited. In general, it is better to produce a correctly designed and properly implemented basic program than to produce a poor quality program with many bells and whistles.
The client will initially communicate with the Document Vending Server to start an application session. Your Java client program will provide the options to send a request for service from the server for processing. After session initialization, the user must supply one of the following options:
• Get document names and costs (IE. return all file names present on the vending server along with their associated costs).
• Retrieve document name (read the entire contents of the given file from the
Vending Server) and thus receive a notice of payment.
• At least one client must have the proper authority to add and remove documents.
The client must support an interactive mode, which includes the specification of the file and all processing options. Output must be displayed on the client’s screen. Each client will communicate with the server. The communication is presented in more detail in the next section.
The Server
You will develop a Java server that functions as a Document Vending Service. The server will receive the input from the Java client. Your server must enforce the cost structure per document and handle exceptions.
Each client will send its request to the Document Vending Server. The server will then review the request and complete its duty by fulfilling the specified action. Each server request forms the basis of the client-to-server protocol portion of the communication.
The request contains one of the following options:
• Get document names and costs (IE. return all file names present on the vending server along with their associated costs).
• Retrieve document name (read the entire contents of the given file from the
Vending Server) and thus receive a notice of payment.
This document vending machine has distinct types of documents with the following cost associated with these documents: A 75 units, B 110 units, C 130 units, D 200 units, E 200 units, and F 500 units. Initially, the inventory will have n of each object (specified as a startup parameter where n is an integer between 0-20). For the sake of simplicity, a document is equivalent to a file that has size of 1K times the given cost. Therefore, documents of type A are 75K, documents of type B are 110K, and so on.
The document name space is global and you may use standard files within the data server to represent the document data. After the server has received a request for a document, it will send a notice of payment prior to sending the document, provided the server may fulfill the request. If the document is in the cache (function explained in the next section), the server may reduce the cost of any document by 50%. Thus, the server-to-client protocol will consist of responses to the client’s requests.
Cache Service
Your Document Vending Server must include a cache. A cache service will hold data elements of interest to the clients. Your design and implementation of a cache service must address the following issues:
• Cache size
a. Cannot be infinite.
b. Must make sense for the system.
c. Must be re-configurable based on an initialization parameter.
• Must support element query
a. Search for data in the cache. b. Return data if present.
• Must support element creation
a. Adding of data to the cache.
b. Place in unused space if available.
• Must support element removal
a. Remove data from cache.
b. Define a formula to remove elements.
• Support cache consistency a. Reads.
b. Writes.
Data Store
A separate data layer must be developed to support a persistent store for the documents
associated with a global inventory. This data layer must implement its own mechanism and must not interface with any preexisting database package. However, you may use standard files
within this data layer. This data layer must support the data requirements of the Document Vending Server (described functions above) and only interface with the Document Vending Server.
Deliverables
Client-Server Programs
Your ZIP file must include the following:
1. A detailed discussion of the methodology you used to implement your client-server system and a concise and detailed design for the client-server system (methodology and design in one file).
2. The Java source files for the system.
3. The class files.
4. A description of how to install and use your system (keep it simple).
5. A test plan, and test data.
The files must be Virus free and must run in the Sun JRE.
======================================================================