首页 > > 详细

CO3090/CO7090 Coursework 2

 CO3090/CO7090 Distributed Systems and Applications

Coursework 2
Remote File System Search Engine
Important Dates: 
Handed out: 28-Feb-2020
Deadline: 18-March-2020 at 17:00 GMT
 This coursework counts as 14% of your final module mark.
 This coursework is an individual piece of work. Please read guidelines on plagiarism on the
University webpage: https://www2.le.ac.uk/offices/sas2/assessments/plagiarism/penalties
 This coursework requires knowledge about RPC/RMI and JMS.
Tasks:
Your task is to develop a Distributed File Search Engine (DFS) that allows users to query files and
directory structures on a distributed file system. Your tasks are (1) to implement the RMI server that
accepts and executes queries from clients, and (2) write and deploy a message-driven middleware to
the application server.
The following Java files are provided:
Server Client
A sample directory structure is provided as shown in Figure (1). 
(Note: This directory structure is for illustration purposes only, though you may use it for testing.) 
Figure (1) a sample directory structure
Answer the following questions:
Question 1 [25 Marks]
Designing the interfaces:
(1.1) Design the architecture for DFS. Explain your design with an UML class diagram. Your
design should allow clients to send arbitrary queries to the server without having to change
the remote interfaces. (Hints: Your UML diagram should include any remote interface and
the serializable object. Please read the comments in the source code)
(Hints: Please read the source code before answering)
Question 2 [65 Marks]
Implementing the following classes (or methods):
(2.1) Server's remote method(s).
(2.2) QueryDirDepth.java - A query of this type should return the maximum subdirectory
depth of a given folder in the directory tree. For example, given the directory structure in
Figure (1), suppose q1=new QueryDirDepth(“/A”), when q1 is executed on the
server, FileSystemServer should return 4 because the maximum subdirectory depth
from path /A is 4. ; when q1=new QueryDirDepth(“/A/C”), the query should
return 3. The query should return 0 if the given directory does not exist on the server,
(2.3) QueryFileSearch.java - A query of this type should search for file and return the
full paths (absolute path to your root directory) of the file if it is found. If more than one file
with the given name was found in different locations then it should return all paths in a list
(i.e.Vector). For example, given the directory structure in Figure (1), q2=new
QueryFileSearch(“File1”),the server should return “/A/B/File1.txt” and
“/A/C/D/File1.txt”
(2.4) QueryDirectoryStructure.java - A query of this type should return all sub￾folders (including nesting folders) as a string formatted according to the specified format: 
For example:
Given q3=new QueryDirectoryStructure (“/A”)
FileSystemServer should return “A{B,C{D,E{F}}}”
Given q4=new QueryDirectoryStructure (“/A/B”)
FileSystemServer should return “B”.
Given q5=new QueryDirectoryStructure (“/A/C”)
FileSystemServer should return “C{D,E{F}}”
(Hints: You can create a File object and recursively traverse all the sub directories and files.
Please refer to Appendix 1.2 for more information)
(2.5) Implement the client. 
Note: three instances of query should be created respectively for each class you
implemented in (2.2), (2.3) and (2.4). Queries should be submitted to the
FileSystemServer and subsequently executed. Hints: (1) the order in which the
folders/files are listed is not important, if they are located in the same folder. You may use
built-in data types (e.g. Vector, HashMap etc) to store the results. You should consider
using multi-threading to maximise the degree of parallelism to improve the performance of
searching. (The maximum number of threads running concurrently should be limited to
MAX_THREAD_NUM=10). 
(2.6) Compilation and deployment.
Build two JAR files (server.jar, client.jar) containing all classes necessary to run the server
and the client. Provide the commands (in shell scripts or batch files) for starting your server
and the client.
Question 3 [10 marks]
Create a new EJB project, and deploy a Session Bean or a Message-Driven Bean to get the current
system time on the server. (similar to 2.1). 
Either 
• Create and deploy a session bean or a web service on Glassfish, or 
• Create and deploy a Message-Driven Bean, create two queues in the Glassfish admin
console (JNDI names /jms/queryQueue and /jms/resultQueue). This MDB must implement
the MessageListener, The results should be stored in jms/resultQueue.
Appendix 
(1.1) Classes 
Server:
FileSystemServer.java - main program of RMI Remote File System Server 
FSQueryInterface.java - remote interface
Query.java - Query interface
Client:
FSQueryInterface.java - remote interface (Same as above)
Query.java - query interface (Same as above)
QueryDirDepth.java
Given a path, the query should return its maximum subdirectory depth. (See examples in 2.2)
QueryFileSearch.java
Search for file and return the full paths (absolute path to your root directory) of the file. If more
than one file with the given name was found, the result should included all paths in a list. (See
examples in 2.3)
QueryDirStructure.java
Given a directory path, the query should return the structure of this directory in a string formatted
according to the specified format. (See examples in 2.4)
(1.2) Recursive Directory Traversal
You might find the link below useful:
http://stackoverflow.com/questions/2056221/recursively-list-files-in-java
javadoc for java.io.File
http://docs.oracle.com/javase/7/docs/api/java/io/File.html
Submission
Please create a directory structure as the figure below.
 Directory Q1 contains Answers.pdf (Answer to Q1.1)
 Directory Q2 contains all Java files of your solution (Answers to Q2 ) 
 Subdirectory public_html contains two JARs archives
 Subdirectory RMIclient contains source codes for the client
 Subdirectory RMIserver contains source codes for the server 
 Directory Q3 contains all files required for Q3 in a zip file 
Please compress the directory using zip. The archive should be named DSA_(your_id)_cw2.zip
(e.g. DSA_yh37_cw2.zip). Your submission should also include a completed coursework
coversheet (print and signed pdf or image). You need to submit the zip file via Blackboard and you
are allowed to re-submit as many times as you like before the deadline.
Marking Scheme
(G) <30%
 The submitted code does not compile.
 The shell scripts or batch files provided for the RMI server/client could not execute.
 The message-driven bean does not compile.
(F) 30-40%
 The submitted code compiles but there are major issues with the RMI server deployment.
 The RMI server fails to register itself with the rmiregistry.
 The RMI clients are partially implemented but establish communication with the server.
 There are still issues with the JNDI configuration.
 Fail to deploy the Message-Driven Bean to the application server.
(E) 40-50%
 The shell scripts (or Windows batch files) for the RMI server successfully execute.
 RMI Server successfully binds with the rmiregistry. 
 Three RMI clients are partially working but the remote interface does not allow the server to
accept new queries without changing the remote interface.
 The RMI server can send the messages to the destination JMS queue, but the Message￾driven bean still has some problem processing the data in the queue. 
(D) 50-60%
 The shell scripts (or Windows batch files) for RMI server/client successfully execute.
 RMI Server successfully binds with the rmiregistry, and the RMI server allows the clients to
introduce new queries without changing the remote interface dynamically.
 Three queries can be executed on the server, 
 There are still major issues with some of the queries, in some cases, the server crashes or
fails to return the correct results.
 Queries can be sent to the destination JMS queue with the given JNDI name. 
 Message-driven bean can process the queries from the queue but the results are not saved to
(/jms/resultQueue).
(C) 60-70%
 Meets all the criteria specified in (C).
 Mostly correct query results, though there are minor issues.
 Message-driven bean can process the queries from the queue, and the results are saved to
/jms/resultQueue.
(B) 70-80%
 Meets all the criteria specified in (C).
 All test cases passed (RMI queries/Message-driven bean)
(A) 80+%
 Meets all the criteria specified in (B) 
 Apart from the RMI server/client and the MDB, design and implement a Stateless session
bean and expose the remote interface as a SOAP web service, write a non-java client (e.g. in
.NET, Python) to retrieve the results stored in /jms/resultQueue.
联系我们 - QQ: 99515681 微信:codinghelp2
© 2014 www.7daixie.com
程序代写网!