Hi this is an assignment in which you are supposed to implement RMI using java TCP API socket. Very important thing is You are to implement a remote invocation framework that is similar to Java RMI...

1 answer below »
Hi this is an assignment in which you are supposed to implement RMI using java TCP API socket. Very important thing is You are to implement a remote invocation framework that is similar to Java RMI but lightweight and no registry is required. I have uploaded three files - 1. The pdf file which clearly states the specifications. 2- A JRM zip folder which contains files and please use the required files from that. Also another zip file which contains TCP client server connection codes as well. But the objects in those zip files are different so only use the required client and server files and create the objects or classes according to the specifications. Please see the class diagram provided in the specifications which is the pdf file. All three files have been attached. Please use jdk version 8 and netbeans 8.2 to develop the classes and creating the assignment.


COIT13229, 2018 Term One - Page 1 of 9 Applied Distributed Systems COIT 13229 Assessment item 2—Java TCP Client Server Application Due date: Week 10 T1-18 – 11.45PM AEST, Friday 18th May 2018 ASSESSMENT Weighting: 30% Length: N/A 2 Objectives This assessment item is designed to test your understanding in Java TCP networking, multi- threading concept, Object Serialization and client/server application development. Assessment task Write a java application using lightweight Java RMI Framework and demonstrate its application. Your task for this assignment is to design and implement RMI using Java TCP API Socket. Using TCP protocol and client/server model, you can implement a remote method invocation framework. In this assignment, you are to implement such a remote method 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 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 and no registry is required (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. COIT13229, 2018 Term One - Page 2 of 9 Part 1: Java TCP Networking, Multi-threading and Object Serialization Programming The framework consists of the classes given in the below. Constants SERVERNAME=”localhost” and SERVERPORT=9999; 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(ComputeCircle,ComputeSquare,ComputeRectangle) must implement this Task interface. Executing the overridden method executeTask() will perform the specific task and set the result. Calling the getResult() method will return the result. COIT13229, 2018 Term One - Page 3 of 9 2. The ComputeClient and ComputeServer The ComputeServer is used as a generic compute-engine. While running, the server is continuously waiting to receive and compute-tasks. A compute-task is created by a ComputeClient and sent as a serialized object to the ComputeServer. Once the ComputeServer receives a task, it will cast (deserialize) it into the Task interface type and call its executeTask() method. After executing the task, the ComputeServer will send the same object back to the ComputeClient. 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 ComputeClient and the ComputeServer. Starting Server: Starting Client: COIT13229, 2018 Term One - Page 4 of 9 Normal Interaction COIT13229, 2018 Term One - Page 5 of 9 3. Handling ClassNotFoundException on ComputeServer and ComputeClient If all the java files are in the same folder and deployed you do not need this approach because Compute Server has access to all the .class files. In reality ComputeClient and ComputeServer may be deployed from different locations locally or remotely and in that case, the ComputeServer should have access to all the class definitions (.class files), this framework makes the ComputeServer generic. That is, the ComputeServer just needs to know the Task interface, then it can be compiled and run. If a ComputeClient implements a new compute-task while the server is running, the ComputeClient needs to upload the Java class of the compute-task into a pre-determined network location, and link it during ComputeServer compilation, for simplicity we copy them to a folder where ComputeServer resides. If the class file is removed before the compute-server starts, it will throw ClassNotFoundException which should be handled well without causing a system crash. The following screenshot shows the folder contents when ComputeCircle.class is removed before ComputeServer is started. However, when there is an exception occurred (e.g. a ComputeClient wants the ComputeServer to perform a compute-task, but forgets uploading the Java class of the compute-task.), the ComputeServer will create an ErrorMessage object and sends it back to the ComputeClient. Note: the ErrorMessage follows the interaction contract by implementing the Task interface. By calling the getResult() method. import java.io.*; public class ErrorMessage implements Task,Serializable { //The variable that holds the error information private String finalResult; public ErrorMessage(){ } COIT13229, 2018 Term One - Page 6 of 9 //Return the final computing result public Object getResult() { return finalResult; } //Set the error message public void setErrorMessage(String msg){ finalResult=msg; } public void executeTask(){ } } Before the compute-task ComputeCircle is uploaded: COIT13229, 2018 Term One - Page 7 of 9 After the compute-task ComputeCircle is uploaded: COIT13229, 2018 Term One - Page 8 of 9 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. This information is 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. 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 below. Submission You need to provide the following files in your submission. 1. All java files mentioned in class diagram, the ComputeServer should have inner class to support thread processing. The in-line comments on the data structures and control statements used in the programs are required. These source code files must be able to be compiled by the standard JDK (Java Development Kit). (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) and be placed in the same location as that of the server. (http://www.oracle.com/technetwork/java/index.html). COIT13229, 2018 Term One - Page 9 of 9 3. A Microsoft Word document to address the issues as specified in the Part 2 above. Part 3: Compare and contrast Assignment1 (UDP) with Assignment2 (TCP) In this section you need to discuss the differences between the technologies used in assignment1 and assignment2. Which technology is best suitable for what applications? And also the overheads involved for both the technologies. Limit your discussion to within 300 words. Any hardcopy or email submission will not be accepted. After the marked assignments are returned, any late submissions will not be accepted. The Marking Criteria
Answered Same DayMay 03, 2020COIT13229Central Queensland University

Answer To: Hi this is an assignment in which you are supposed to implement RMI using java TCP API socket. Very...

Snehil answered on May 10 2020
133 Votes
How to run videos/How to run in console (command prompt).mp4
How to run videos/How to run in netbeans.mp4
RMI threaded/build.xml

Builds, tests, and runs the project RMI threaded.


RMI threaded/build/classes/.netbeans_automatic_build
RMI threaded/build/classes/.netbeans_update_resources
RMI threaded/build/classes/ComputeCircle.class
public synchronized class ComputeCircle implements Task, java.io.Serializable {
private double radius;
private double area;
private double perimeter;
private String result;
public void ComputeCircle();
public void ComputeCircle(double);
public double getRadius();
public void setRadius(double);
public void executeTask();
public Object getResult();
}
RMI threaded/build/classes/ComputeClient.class
public synchronized class ComputeClient {
private static final String SERVERNAME = localhost;
private static final int SERVERPORT = 8888;
public void ComputeClient();
public static void main(String[]);
}
RMI threaded/build/classes/ComputeRectangle.class
public synchronized class ComputeRectangle implements Task, java.io.Serializable {
private double length;
private double width;
private double area;
private double perimeter;
private String result;
public void ComputeRectangle();
public void ComputeRectangle(double, double);
public double getLength();
public void setLength(double);
public double getWidth();
pu
blic void setWidth(double);
public void executeTask();
public Object getResult();
}
RMI threaded/build/classes/ComputeServer.class
public synchronized class ComputeServer implements Runnable {
private static final int SERVERPORT = 8888;
private static java.net.ServerSocket serverSocket;
public void ComputeServer();
public static void main(String[]) throws java.io.IOException;
public void run();
static void ();
}
RMI threaded/build/classes/ComputeServer.rs
RMI threaded/build/classes/ComputeSquare.class
public synchronized class ComputeSquare implements Task, java.io.Serializable {
private double side;
private double area;
private double perimeter;
private String result;
public void ComputeSquare();
public void ComputeSquare(double);
public double getSide();
public void setSide(double);
public void executeTask();
public Object getResult();
}
RMI threaded/build/classes/ErrorMessage.class
public synchronized class ErrorMessage implements Task, java.io.Serializable {
private String finalResult;
public void ErrorMessage();
public void setErrorMessage(String);
public void executeTask();
public Object getResult();
}
RMI threaded/build/classes/MyRunnable.class
synchronized class MyRunnable implements Runnable {
java.net.Socket aSocket;
public void MyRunnable(java.net.Socket);
public void run();
}
RMI threaded/build/classes/Task.class
public abstract interface Task {
public abstract void executeTask();
public abstract Object getResult();
}
RMI threaded/manifest.mf
Manifest-Version: 1.0
X-COMMENT: Main-Class will be added automatically by build
RMI threaded/nbproject/build-impl.xml















































































































































































































Must set src.dir
Must set test.src.dir
Must set build.dir
Must set dist.dir
Must set build.classes.dir
Must set dist.javadoc.dir
Must set build.test.classes.dir
Must set build.test.results.dir
Must set build.classes.excludes
Must set dist.jar




































































































Must set javac.includes
































































































































No tests executed.























































































































































































































































Must set JVM to use for profiling in profiler.info.jvm
Must set profiler agent JVM arguments in profiler.info.jvmargs.agent



















...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here