1 5 package org.infohazard.maverick.flow; 6 7 import javax.servlet.ServletException ; 8 9 import org.jdom.Element; 10 11 19 public class ThrowawayControllerAdapter implements ControllerSingleton 20 { 21 22 protected Class controllerClass; 23 24 28 public ThrowawayControllerAdapter(Class controllerClass) 29 { 30 this.controllerClass = controllerClass; 31 } 32 33 39 public void init(Element controllerNode) throws ConfigException 40 { 41 } 42 43 48 public String go(ControllerContext cctx) throws ServletException 49 { 50 try 51 { 52 Controller instance = (Controller)this.controllerClass.newInstance(); 53 54 return instance.go(cctx); 55 } 56 catch (InstantiationException ex) 57 { 58 throw new ServletException (ex); 59 } 60 catch (IllegalAccessException ex) 61 { 62 throw new ServletException (ex); 63 } 64 } 65 } 66 67 | Popular Tags |