Ask DBMS Expert


Home >> DBMS

Part -1: Assignment-Specification

Java Interface, Java Object Serialization, Java multi-threading model and client/server model are very useful and important Java components to build distributed applications. In this assignment, you are to research the Java APIs on Java Interface, Object Serialization, multi-threading model and client/server model and write a technical report. The report is to be structured as an academic report and must be appropriately referenced using the Author-Date style. The length of the report should be about 2,500 words. You are not required to provide an executive summary for the report, but your report must be organised into the format of an introduction section, a body (multiple sections) and a conclusion section. An Exemplar for Writing a Simple Academic Technical Report is available on the course web site. You should read this exemplar before writing your report.

Note: thorough review and understanding of these Java APIs or models are also important for the assignment-2, where you need to use these APIs and models to implement a distributed application.

To prepare your report, you will need to research widely on these Java APIs and models. Your report must cover the issues that are detailed as follows.

Introduction

Give your introduction to these Java APIs and models. Present the organisation of your report.

Review of Java Interface

Use an example to describe
1. What is Java Interface?
2. What is the use of a Java interface?
3. What is the implementation of a Java interface?

Review of Java Object Serialization

Use an example to describe
1. What is Java Object Serialization?
2. What is the use of object serialization?
3. How to make a Java object serializable?

Review of Java multi-threading model

Use an example to describe
1. What is multi-threading?
2. The difference between a process and a thread
3. The two ways to create a Java thread
4. How to start running a Java thread

Review of client/server model

1. What is client/server model?
2. Why must the server be multi-threaded?

Conclusion

Conclude why these APIs and models are the components to build distributed applications.

Part -2: Assignment-2 Specification

Java RMI (Remote Method Invocation, reference Chapter 5 of the textbook and Week-3 lecture) makes the local invocation and remote invocation use the same syntax to implement generic remote servers like the Compute Engine example in Week-3 lecture slides. However, Java RMI needs 2 HTTP servers to transfer Java classes between a RMI client and a RMI server at runtime. In addition, Java RMI applications need a RMI Registry for registering or looking up the remote objects.

In this assignment (assignment-2), you are to implement a remote invocation framework that is similar to Java RMI but lightweight (note: for this assignment, you don't use any Java RMI APIs). To implement the framework, you will need to use Java Interface, Java Objection Serialization, Java Thread and client/server model. Recall you have written a technical report about these Java components and models for assignment-1; now you will need to use these Java components to build this framework. Thus if necessary, you may need to review your assignment-1.

This assignment specification is as follows.

Part 1: Java TCP Networking, Multi-threading and Object Serialization Programming

The framework consists of a compute-server, a compute-client and a codebase repository, which are depicted in the following diagram. The framework is a generic computing architecture because the compute-client and compute-server just need to know the Task and CSMessage in advance before the framework can start to run. The specification of the components is as follows.

51_fig.jpg

1. The interaction contract

The interaction contract between the client and server is defined by the Task interface:

//The Task interface (interaction contract) between clients and the server public interface Task {
public void executeTask(); public Object getResult();
}

Every compute-task must implement the Task interface. Executing the executeTask() method will perform the task and set the result. Calling the getResult() method will return the result.

2. The compute-client and compute-server

The compute-server is used as a generic compute-engine. While running, the server is continuously waiting for the compute-tasks. A compute-task is created by a compute-client and sent as a serialized object to the compute-server. Once the compute-server receives a task, it will cast(be deserialized) it into the Task interface type and call its executeTask() method. After executing the task, the compute-server will send the same object back to the compute- client.

The compute-client is continuously accepting a user's requests. Every request specifies a compute-problem and its corresponding parameters. For a request, the compute-client creates a compute-task and sends it as a serialized object to the compute-server. Once receiving the compute-task object back from the server, the compute-client will call the getResult() method of the object to display the result.

The following screenshots show the interaction between a compute-client and the compute- server.

1330_fig1.jpg

1085_fig2.jpg

3. The codebase repository

Such a framework makes the compute-server generic. That is, the compute-server just needs to know the Task interface, then it can be compiled and run. If a compute-client implements a new compute-task after the server is run up, the compute-client just needs in some way (in real world application it could be a FTP server, but in this assignment, you just need to copy the files into a directory) to upload the Java class of the compute-task into a pre-determined network location (e.g. the codebase directory), which the compute-server can access from its Java classpath. Then the compute-server can perform such a new compute-task. Therefore, the server never needs to be shut down, recompiled, and restarted.

The following screenshot shows that there are 2 compute-tasks that have been uploaded into the codebase repository.

2139_fig3.jpg

4. The error message

However, when there is an exception occurred (e.g. a compute-client wants the compute-server to perform a compute-task, but forgets uploading the Java class of the compute-task) onto the codebase of compute-server, the compute-server will create a CSMessage object and sends it back to the compute-client. Note: the CSMessage follows the interaction contract by implementing the Task interface. By calling the getResult() method, the compute-client will know the problem and fix it later on.

import java.io.*;
public class CSMessage implements Task, Serializable {
//The variable that holds the error information private String finalResult;
public CSMessage() {
}
//Return the final computing result public Object getResult() {
return finalResult;
}
//Set the error message
public void setMessage(String msg) { finalResult=msg;
}
public void executeTask() {
}
}

The following screenshots show the situation of calling the compute-server before and after the compute-task ComputeGCD is uploaded.
• Before the compute-task ComputeGCD is uploaded:

1079_fig4.jpg

1646_fig5.jpg

• After the compute-task ComputeGCD is uploaded:

1121_fig6.jpg

476_fig7.jpg

2445_fig7.jpg

To complement this assignment, you need to implement such a framework and integrate the Calculate Pi, Calculate Primes and Calculate the Greatest Common Divisor tasks into this framework. The algorithms of these tasks are given on the course web site. Your compute- server must be multi-threaded and follow the ‘thread-per-connection' architecture (reference Week-4 contents). The communication between the compute-server and the compute-client must use TCP protocol through the Java TCP API Socket and ServerSocket as described in Week-2 contents of this course and also online at, http://docs.oracle.com/javase/7/docs/api/java/net/Socket.html, and

http://docs.oracle.com/javase/7/docs/api/java/net/ServerSocket.html). Please note: use of any other protocols will incur no marks to be awarded for this part.

To implement the framework, you need to implement the following Java classes:

1. A Java application to implement the compute-client;

2. A Java application to implement the compute-server; and

3. A Java class to implement the request processing thread.

4. A number of Java classes to implement Calculate Pi, Calculate Primes and Calculate the Greatest Common Divisor tasks.

Note: to simulate compute-client and compute-server interaction, you don't have to run them on two physical machines. Instead, they can be run on two JVMs (Java Virtual Machines) on a single physical machine. As a result, the name of the server machine can be ‘localhost'.

Part 2: Program use and test instruction

After the implementation of the framework, prepare an end user' instruction about how to use your software.

Submission

You need to provide the following files in your submission.

1. Files of Java source code of the compute-client, the compute-server and the processing thread and the compute-tasks. The in-line comments on the data structure and program structure in the programs are required. These source code files must be able to be compiled by the standard JDK (Java Development Kit) from Oracle (http://www.oracle.com/technetwork/java/index.html).

2. The compiled Java class files of the source code. These Java classes must be runnable on the standard Java Runtime Environment (JRE) from Oracle (http://www.oracle.com/technetwork/java/index.html).

3. A Microsoft Word document to address the issues as specified in Part 2 above.

All the required files must be compressed into a zip file for submission. You must submit your assignment via the course web site. Any hardcopy or email submission will not be accepted. After the marked assignments are returned, any late submissions will not be accepted.

Part 1: Java TCP Networking, Multi-threading and Object Serialization Programming

1. Whether the program can be compiled by JDK and executed by JRE

2. Whether the given Task interface is properly used as the unique communication contract between the client and server

3. Whether the 3 compute-tasks have been implemented as Java serializable objects

4. Whether the 3 compute-tasks can be successfully transferred between the client and server

5. Whether the 3 compute-tasks can be successfully executed by the server and can return correct results to the client

6. Whether the ‘not uploading task' exception can be handled by using the CSMessage

7. Whether the client program functions correctly

8. Whether TCP protocol is correctly used for the client and server communication

9. Whether the sever is multi-threaded by using the ‘thread-per-connection' model

Part 2: Program use and test instruction
1. Whether the program installation is clearly described

2. Whether the codebase is clearly described

3. Whether the test instruction covers all 3 compute- tasks

4. Whether the test instruction covers ‘not uploading task' exception handling.

5. Whether the necessary screenshots have been provided and helpful for the test instruction.

DBMS, Programming

  • Category:- DBMS
  • Reference No.:- M91910301
  • Price:- $75

Priced at Now at $75, Verified Solution

Have any Question?


Related Questions in DBMS

Data mining assignment -in this assignment you are asked to

Data Mining Assignment - In this assignment you are asked to explore the use of neural networks for classification and numeric prediction. You are also asked to carry out a data mining investigation on a real-world data ...

Sql query assignment -for this assignment you are to write

SQL Query Assignment - For this assignment you are to write your answers in a word document. This assignment is in three parts: Part A (reporting queries), Part B (query performance), Part C (query design). For this assi ...

The groceries datasetimagine 10000 receipts sitting on your

The groceries Dataset Imagine 10000 receipts sitting on your table. Each receipt represents a transaction with items that were purchased. The receipt is a representation of stuff that went into a customer's basket. That ...

You are in a real estate business renting apartments to

You are in a real estate business renting apartments to customers. Your job is to define an appropriate schema using SQL DDL in MySQL. The relations are Property(Id, Address, NumberOfUnits), Unit(ApartmentNumber, Propert ...

Objectivethe objective of this lab is to be familiar with a

OBJECTIVE: The objective of this lab is to be familiar with a process in big data modeling. You're required to produce three big data models using the MS PowerPoint software. This tool is available on UMUC Virtual Deskto ...

The relation memberstudentid organizationid roleid stores

The relation Member(StudentId, OrganizationId, RoleId) stores the membership information of student joining organization. For example, ('S1', 'O2', 'R3') indicates that student with Id 'S1' joined the organization with i ...

Relational database exerciseyou have been assigned to a new

Relational Database Exercise: You have been assigned to a new development team. A client is requesting a relational database system to manage their present store with the anticipation of adding more stores in the future. ...

Relational database design a given the following business

Relational Database Design A) Given the following business rules, identify entity types, attributes (at least two attributes for each entity, including the primary key) and relationships, and then draw an Entity-Relation ...

We can represent a data set as a collection of object nodes

We can represent a data set as a collection of object nodes and a collection of attribute nodes, where there is a link between each object and each attribute, and where the weight of that link is the value of the object ...

Data model development and implementationpurpose of the

Data model development and implementation Purpose of the assessment (with ULO Mapping) The purpose of this assignment is to develop data models and map Database System into a standard development environment to gain unde ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As