Calculate the Greatest Common Divisor tasks

Assignment Help JAVA Programming
Reference no: EM132357848

Coding Assignment - A Simplified Remote Invocation Framework

Java RMI (Remote Method Invocation, reference Chapter 5 of the textbook and Week-3 lecture) enables the local invocation and remote invocation use the same syntax to implement a generic remote server 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 to register or look up the remote objects. In this assignment, 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).

Java object serialization, multi-threading model and client/server model are the fundamental Java components to build distributed applications. In this assignment, you are to use these components or models to develop a particular application - a simplified remote invocation framework. The Java object serialization, multithreading and client/server components have been introduced through weekly lectures, tutorials and lab projects of this unit; you should ensure that you have good understanding of these learning materials before you start this assignment. In this assignment, you will need to integrate what you have learnt to develop the framework. 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 class 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 interface or class in advance to interact with each other via the framework. The specification of the components is as follows.

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. When running, the server is continuously waiting for 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) the task 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.

3. The class 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 upload, 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 Contract 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 for any new tasks. The following screenshot shows that there are 2 compute-tasks that have been uploaded into the Contract repository.

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 class repository of the 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.

To complete 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 unit 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 unit.

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

1. A Java application to implement the compute-client; graphic user interface is required;

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.

The instruction should cover all aspects of the framework as detailed in the marking criteria.

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) or NetBeans IDE from Oracle.

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.

Note: an easy way to provide the source code and executables is to submit them in a NetBeans project.

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 unit web site.

Attachment:- Coding Assignment File.rar

Verified Expert

In this assignment,we have done the network programming in java.Here,I have create the client /server architecture.Here we have used the socket classes and made the client server communication.We have perform the different operation in this program.

Reference no: EM132357848

Questions Cloud

Digital forensic methods to solve crimes : Law enforcement professionals and investigators use digital forensic methods to solve crimes every day.
Hadoop-MapReduce data processing versus traditional OLAP : Discuss the rationale behind choosing between using Hadoop/MapReduce data processing versus traditional OLAP .
What is the companies effective positioning strategy : Select a Multi-National company and conduct a marketing overview of the company. Conduct research on the organization and apply the components of the syllabus.
Qualitative v quantitative risk assessment. : Compare and evaluate in 500 words or more qualitative v quantitative risk assessment.
Calculate the Greatest Common Divisor tasks : Coding Assignment - A Simplified Remote Invocation Framework. Calculate Primes and Calculate the Greatest Common Divisor tasks
Why did choose a gamification approach : What are James Halliday's goals? Why did he choose a gamification approach? Provide a ranking of his goals in terms of importance. The gamification.
Top ten recommendations for securing virtual servers : Need to prepare 8 slides PPT based on below topic. Top Ten Recommendations for Securing Virtual Servers
What concept is used in supply chain process : A supply chain comprises all steps required to provide a service or product to the customer. CT Enterprises is a utility trailer manufacturing company.
How do you measure quality in a product : How do you measure quality in a product? Can you use the same measurement for every product and service? Provide an example.

Reviews

len2357848

8/14/2019 3:20:40 AM

Its coding assignment. I gave you a same assignment like this is another so I want this assignment totally different and I don't have too much time for this assignment can you make this urgently. 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’.

len2357848

8/14/2019 3:20:34 AM

You need to provide the following files in your submission. 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) or NetBeans IDE from Oracle.

len2357848

8/14/2019 3:20:27 AM

The compiled Java class files of the source code. These Java classes must be runnable on the standard Java Runtime Environment (JRE) from Oracle. Note: an easy way to provide the source code and executables is to submit them in a NetBeans project. 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 unit web site. Any hardcopy or email submission will not be accepted. After the marked assignments are returned, any late submissions will not be accepted.

len2357848

8/14/2019 3:20:20 AM

The Marking Criteria - Part 1: Java TCP Networking, Multi-threading and Object Serialization Programming 21 marks - Whether the project can be compiled by JDK or NetBeans IDE and executed by JRE. Whether the given Task interface is properly used as the unique communication contract between the client and server. Whether the 3 compute-tasks have been implemented as Java serializable objects. Whether the 3 compute-tasks can be successfully transferred between the client and server. Whether the 3 compute-tasks can be successfully executed by the server and can return correct results to the client. Whether the ‘not uploading task’ exception can be handled by using the CSMessage. Whether the client program functions correctly. Whether TCP protocol is correctly used for the client and server communication. Whether the sever is multi-threaded by using the ‘thread-per-connection’ model.

len2357848

8/14/2019 3:20:14 AM

Part 2: Program use and test instruction 9 marks - Whether the program installation is clearly described. Whether the code repository in the server is clearly described. Whether the test instruction covers all 3 compute-tasks. Whether the test instruction covers ‘not uploading task’ exception handling. Whether the necessary screenshots have been provided and helpful for the test instruction.

Write a Review

JAVA Programming Questions & Answers

  Design and implement a basic graphical user interface

Design and implement a basic graphical user interface (GUI) program for recording information about a family tree -

  List three sets of test data for a program

List three sets of test data for a program that determines the quotient A/B, where A must be an integer between 21 and 10, and B must be non-zero.

  Exceptions-memory management and concurrency

This question asks you to compare properties of exceptions in C++ and Java.

  Write player classes that have certain behaviour

Write player classes that have certain behaviour. These classes will lead you along to implementing the players you will need for the project.

  Create a class named purchase

Create a class named Purchase. Each purchase contains an invoice number, amount of sale, and amount of sales tax. Include set methods for the invoice number and sale amount.

  Write a program that displays a countdown first

Write a program that displays a countdown first, and then displays the position and velocity of an object for every second it drops, as long as it is above 500 feet

  Prepare address book java application

Prepare an application that reads the contents of your address book file and prepare a user guide that includes a description of the functionality of your overall address book system.

  Determine total annual compensation of a salesperson

Write a Java application using NetBeans Integrated Development Environment (IDE) that calculates the total annual compensation of a salesperson. Consider the following factors: A salesperson will earn a fixed salary of $45,000

  Write java program to accept two words as input

Write a Java program that accepts two words as input and determines if one of them is resulting from changing the order of the others' letters.

  Productexception class whose constructor

Create a ProductException class whose constructor receives a String that consists of a product number and price. Save the file as ProductException.java. Create a Product class with two fields, productNum and price. The Product constructor requires va..

  Evaluate a variety of data structures and algorithmic

Compare and contrast different algorithms in problem solving - Design and implement appropriate data structures for application development

  What alternative approaches were considered

What alternative approaches were considered and why were they rejected and What did you learn from doing this project and what would you do differently

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd