Question: The File Retrieval Engine must adhere to the architecture shown in Figure 1 and must contain three components: AppInterface, ProcessingEngine and IndexStore. The AppInterface component

The File Retrieval Engine must adhere to the architecture shown in Figure 1 and must
contain three components: AppInterface, ProcessingEngine and IndexStore.
The AppInterface component is responsible with implementing a command line interface
that the user can use to interact with the File Retrieval Engine, with interpreting indexing
and search commands submitted by the user, with forwarding the commands to the
ProcessingEngine and with printing the results of the commands on screen.
The ProcessingEngine component is responsible with running the indexing and search
commands received from the AppInterface component. In terms of indexing, the
ProcessingEngine must use multiple worker threads, that are configured at execution
time, to build an index from the files found at a specified directory. Each worker thread is
responsible with building a local index and with forwarding the local index to the
Figure 1: File Retrieval Engine Architecture.
IndexStore in order to ultimately build a global index. In terms of search, the
ProcessingEngine must break down a search query into one or more single term queries,
must retrieve for each single term query the list of files in which the term can be found and
the number of occurrences, and must combine the list of files from each single term query
result, sort the files by occurrence and return the top 10 files.
The IndexStore component is responsible with storing the global index and providing the
means to query the global index. More specifically, it should expose an interface to update
the global index with a local index and an interface to return the list of files and the number
of occurrences in which a term can be found.
package csc435.app;
import java.lang.System;
import java.util.Scanner;
public class AppInterface {
private ProcessingEngine engine;
public AppInterface(ProcessingEngine engine){
this.engine = engine;
// TO-DO implement constructor
}
public void readCommands(){
// TO-DO implement the read commands method
Scanner sc = new Scanner(System.in);
String command;
while (true){
System.out.print(">");
// read from command line
command = sc.next();
// if the command is quit, terminate the program
if (command.compareTo("quit")==0){
engine.stopWorkers();
break;
}
// if the command begins with index, index the files from the specified directory
if (command.length()>=5 && command.substring(0,5).compareTo("index")==0){
// TO-DO implement index operation
continue;
}
// if the command begins with search, search for files that matches the query
if (command.length()>=6 && command.substring(0,6).compareTo("search")==0){
// TO-DO implement index operation
continue;
}
System.out.println("unrecognized command!");
}
}
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!