1 package org.sapia.console.examples;2 3 import org.sapia.console.Command;4 import org.sapia.console.CommandFactory;5 import org.sapia.console.CommandNotFoundException;6 7 8 /**9 * @author Yanick Duchesne10 * 2-May-200311 */12 public class HelloWorldFactory implements CommandFactory {13 /**14 * Constructor for HelloWorldFactory.15 */16 public HelloWorldFactory() {17 super();18 }19 20 /**21 * @see org.sapia.console.CommandFactory#getCommandFor(String)22 */23 public Command getCommandFor(String name) throws CommandNotFoundException {24 if (name.equalsIgnoreCase("hello")) {25 return new HelloWorldCommand();26 } else if (name.equalsIgnoreCase("quit") || name.equalsIgnoreCase("exit")) {27 return new QuitCommand();28 } else {29 throw new CommandNotFoundException(name);30 }31 }32 }33