//File: retrieve.java //CS 471 - Operating Systems Project //Dennis Pereira, Ely Soto, John Cavalieri //The retrieve command is an added feature to our OS simulator, which is complimentary to transmit //retrieve is similar to 'receive' however, it is applied to inter-process communication rather than //user-to-user communication //the retrieve command displays all of the messages that have been transmitted to a process public class retrieve extends VMachine { public retrieve() { } public void run() { try { //if there are no arguments, prompt the user for them if(args.length == 0) { //prompt user sysapi.Write(OUT,"Enter Process ID: "); String ThreadID = sysapi.Read(IN); //display the messages sysapi.Write(OUT,sysapi.getProcessMsg(ThreadID) + "\n"); } //if there is one argument, display the messages for the process //that is passed in as an arg else if(args.length == 1) { sysapi.Write(OUT,sysapi.getProcessMsg(args[0])+ "\n"); } //if there is more than one argument, then display an error else if(args.length > 1) { sysapi.Write(OUT,"Too many arguments.\n"); } } catch(Exception ex) { System.out.println(ex); } sysapi.Exit(vmh,owner); } }