The scenario

POV-Ray is a graphical application to transform images using a technique, known as ray tracing, so to produce a high degree of visual realism but it is computationally expensive.

The main goal of this coursework is to transform the code in code.tgz (a variant of the model answer of CW1) so that the image elaboration is done remotely according to the requirements specified in each question. More precisely, the goal is to develop services for elaborating and merging the images and test them with simple clients.

Warning To answer the questions below, you can introduce any classes you need (this depends on your design). However, in all your answers, you have to respect the following naming conventions

  • names of objects/class/variables in this worksheet or in the code provided must not be changed
  • the file name of any class you introduce must end with Class before the .java suffix (eg.,
  • the file name of any interface you introduce must end with Interface before the .java suffix (eg.,
  • the name of a class implementing some interfaces, say BarInterface and FooInterface, must be BarFooClass

Question 1

After inspecting this code, design a possible solution for the distributed scenario above such that

  • there is a remote service called ElaborationService for elaborating the image; ElaborationService is an object of the class ElaborationClass supposed to slice an image and produce elaborated tasks
  • there is a remote service called MergingService for merging tasks; MergingService is an object of the class MergingClass supposed to merge the tasks elaborated by ElaborationService
  • a typical client is given in input the path to a .pov file, the number of threads n_of_threads, and width and height of the image; the client invokes the ElaborationService providing
    • an array of bytes corresponding to a .pov file,
    • n_of_threads, width, and height

Write all the interfaces necessary to implement objects servers and clients assuming that elaborated images are stored on the machine of MergingService.

Hint. The code for transforming files to arrays of bytes and viceversa (necessary only in Question 2 and Question 3) is given in the class Such class is not part of the assessment, namely you do not have to decide whether the objects of is local or remote: you just have to duplicate and use in each client and server of your solution.

Hint. As usual, there are many possible solutions and you may need to add extra classes to those mentioned above or in the model answer. Also, interface depends on your design. Indeed, to work out the solution of the questions of this coursework, it is strongly recommended to sketch a design of the application using the notation adopted in this module (see notes) and casting into a Java implementation.

Such design is not part of the assessment and should not be submitted.

Question 2

Under the hypothesis of Question 1, write

  • the class ElaborationClass
  • the class MergingClass
  • all the main classes for your application.

It is not required to return the final file obtained generated MergingService to the client.

To test your solution, deploy it on a single physical machine and use this java.policy:

grant { permission "*:1024-65535", "connect,accept"; permission "*:80", "connect"; };

The following idiosyncrasies of Java must be taken into account to test you code:

  • use lowercase strings made only of letters for package names
  • valid codebase attributes must have a trailing '/' symbol

Hint. To answer this question you can use and modify the classes in code.tgz. Depending on your design, the actual changes are minimal and should not affect the business logic of the code using POV-Ray.

Warning When organising the files in the folder question2/ you must have a subdirectory for one client (only) and one for each server of your solution; such subdirectories contain on turn two further directories named public_html and home. The subdirectory public_html plays the role of public_html on the slides explaining the deployment of RMI applications, while the subdirectory home is meant to represent the home directory of the programmer of each part of the application. An example of a typical structure is See image.

Question 3

For each server myServer of your solution, create a directory structure as the one below See image.

and organise your files so that

  • the subdirectory home contains the Java package myServer any file you developed necessary for for compiling myServer
  • the subdirectory public_html contains all the .class files necessary for the remote invocation
Academic Honesty!
It is not our intention to break the school's academic policy. Projects posted are only used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly fill out the form. Please provide a valid email address and we'll get back to you in less than 24 hours. We will be sending an invoice through PayPal upon confirmation. We are a non profit organization however we need an amount to keep this organization running, and to be able to complete our research and development.