Clover coverage report - CRISPY - 1.1.1
Coverage timestamp: Mi Nov 15 2006 13:09:46 CET
file stats: LOC: 68   Methods: 3
NCLOC: 45   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
BurlapServlet.java 75% 84,2% 100% 84,6%
coverage coverage
 1    package net.sf.crispy.impl.caucho;
 2   
 3    import java.io.IOException;
 4    import java.util.Enumeration;
 5   
 6    import javax.servlet.ServletConfig;
 7    import javax.servlet.ServletException;
 8    import javax.servlet.http.HttpServletRequest;
 9    import javax.servlet.http.HttpServletResponse;
 10   
 11    import net.sf.crispy.InvocationException;
 12    import net.sf.crispy.util.Util;
 13   
 14    import com.caucho.burlap.io.BurlapInput;
 15    import com.caucho.burlap.io.BurlapOutput;
 16    import com.caucho.burlap.server.BurlapSkeleton;
 17   
 18    /**
 19    * This class execute the services and answer to request from the burlap client.
 20    *
 21    * @author Linke
 22    *
 23    */
 24    public class BurlapServlet extends CauchoServlet {
 25   
 26    private static final long serialVersionUID = 47128998724L;
 27   
 28  2 public BurlapServlet() {
 29    // super.addCache(Echo.class.getName(), new BurlapSkeleton(new EchoImpl()));
 30    // super.addCache(Calculator.class.getName(), new BurlapSkeleton(new CalculatorImpl()));
 31    }
 32   
 33  2 public void init(ServletConfig pvConfig) throws ServletException {
 34  2 super.init(pvConfig);
 35  2 Enumeration lvEnumeration = pvConfig.getInitParameterNames();
 36  2 while (lvEnumeration.hasMoreElements()) {
 37  6 String lvKey = (String) lvEnumeration.nextElement();
 38  6 String lvValue = getInitParameter(lvKey);
 39  6 try {
 40  6 Object lvServiceObject = Util.createObject(lvValue);
 41  5 addCache(lvKey, new BurlapSkeleton(lvServiceObject));
 42    // addCache(lvKey, new BurlapInvoker(lvServiceObject, lvServiceObject.getClass()));
 43    } catch (Exception e) {
 44  1 throw new ServletException("Exception in init-method: " + e, e);
 45    }
 46    }
 47    }
 48   
 49  52 protected void doPost(HttpServletRequest pvRequest, HttpServletResponse pvResponse) throws ServletException, IOException {
 50  52 String lvKey = getCacheKey(pvRequest);
 51  52 BurlapSkeleton skeleton = (BurlapSkeleton) getFromCache(lvKey);
 52    // BurlapInvoker skeleton = (BurlapInvoker) getFromCache(lvKey);
 53    if (log.isDebugEnabled()) { log.debug("CachKey: " + lvKey + " / Skeleton: " + skeleton); }
 54  0 if (skeleton == null) { throw new InvocationException("For the key: " + lvKey + " can't find a register service in the BurlapServlet!"); }
 55   
 56  52 BurlapInput in = new BurlapInput(pvRequest.getInputStream());
 57  52 BurlapOutput out = new BurlapOutput(pvResponse.getOutputStream());
 58   
 59  52 try {
 60  52 skeleton.invoke(in, out);
 61    } catch (Throwable e) {
 62  0 e.printStackTrace();
 63  0 throw new ServletException(e);
 64    }
 65    }
 66   
 67   
 68    }