import NetConnectStub; //import Mailbox; /** * A stub class for the MailBox class. This class will apparently implement * all of the methods of MailBox. * * @author Josh Vickery * @author Ben Kaiser * @author Dan Hawando * @version 1.0 of October 1999 */ public class MailBoxStub // implements MailBox { // A variable to determine if the user is logged in boolean status; /** * Call NetConnectStub, with the parameter "up" to simulate a connection. * Then, If the the username and password are valid, that is that they * are both "bob" then set status to true. * * @exception LoginException * when the user/pass combo is invalid */ public void login(String username, String passwd) throws LoginException, ConnectionException { NetConnectStub connection = new NetConnectStub(); connection.connectStub("up"); if ((username == "bob") && (passwd == "bob")) { status = true; } // if correct user/pass combo else throw new LoginException("Invalid user name or password"); } // login(String, String) /** * This stub returns an array of the folder names in the accoount. In * this case this will only be Inbox and Deleted */ public String[] listFolders() { return new String[0]; } // listFolders() /** * This stub returns nothing * * @exception FolderException * when a protected folder name (inbox and trash may never be * deleted) is given */ public void deleteFolder(String folderName) throws FolderException { if ((folderName == "inbox") || (folderName == "trash")) throw new FolderException("can not delete inbox or trash"); } // deleteFolder(String) /** * This will update the fictitious folder list fictitously * * @exception FolderException * when a protected or previoulsy used folder name is used */ public void createFolder(String folderName) throws FolderException { // Stub, does nothing } // createFolder(String) /** * This will return the contents of a folder * * @exception FolderException * when a non existant folder is given */ public String[] getFolderContents(String folderName) throws FolderException { return new String[0]; } // getFolderContents(String) /** * This stub pretends to rename a folder * * @exception FolderException * when an invalid folder is given */ public void renameFolder(String folderName, String newFolderName) throws FolderException { // STUB } // renameFolder(String folderName, String newFolderName) /** * Pretends to set the active folder throws FolderException * * @exception FolderException * when a non-existant folder is selected */ public void setFolder(String folderName) throws FolderException { //STUB } // setFolder(String folderName) /** * Pretends to delete a message * *@exception MessageException * when an invalid message name is given */ public void deleteMessage(String MessageName) throws MessageException { // STUB } // deleteMessage(String MessageName) /** * Gets the contents of a fictitious message, returns a string * * @exception MessageException * when an invalid message name is given */ public String getMessage(String MessageName) throws MessageException { return "Hi there!"; // STUB } //getMessage(String MessageName) /** * pretends to file a message in an existing folder * * @exception MessageException * when an invalid message name is given * @exception FolderException * when an invalid Folder name is fiven */ public void fileMessage(String MessageName, String FileName) throws MessageException, FolderException { // STUB } // fileMessage(String MessageName, String FileName) /** * Pretends to close the imap socket. */ public void bye() { // STUB } // bye() } //class MailBoxStub