Clover coverage report - CRISPY - 1.1.1
Coverage timestamp: Mi Nov 15 2006 13:09:46 CET
file stats: LOC: 87   Methods: 10
NCLOC: 54   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
JBossRemotingInvocationHandler.java 50% 92,3% 100% 92%
coverage coverage
 1    package net.sf.crispy.impl.jboss;
 2   
 3    import java.util.Hashtable;
 4    import java.util.Map;
 5    import java.util.Vector;
 6   
 7    import javax.management.MBeanServer;
 8   
 9    import net.sf.crispy.InvocationException;
 10    import net.sf.crispy.util.Converter;
 11    import net.sf.crispy.util.Invoker;
 12   
 13    import org.apache.commons.logging.Log;
 14    import org.apache.commons.logging.LogFactory;
 15    import org.jboss.remoting.InvocationRequest;
 16    import org.jboss.remoting.ServerInvocationHandler;
 17    import org.jboss.remoting.ServerInvoker;
 18    import org.jboss.remoting.callback.InvokerCallbackHandler;
 19   
 20    /**
 21    * Handle client request.
 22    *
 23    * @author Linke
 24    *
 25    */
 26    public class JBossRemotingInvocationHandler implements ServerInvocationHandler {
 27   
 28    protected static final Log log = LogFactory.getLog (JBossRemotingInvocationHandler.class);
 29    private Map services = new Hashtable();
 30   
 31  3 public JBossRemotingInvocationHandler() {
 32    // addService(Echo.class.getName(), new EchoImpl());
 33    // addService(Calculator.class.getName(), new CalculatorImpl());
 34   
 35    }
 36   
 37  3 public void addService (String pvServiceInterface, Object pvServiceImpl) {
 38  3 services.put(pvServiceInterface, pvServiceImpl);
 39    }
 40  54 public Object getService (String pvServiceInterface) {
 41  54 return services.get(pvServiceInterface);
 42    }
 43  1 public Object removeService(String pvServiceInterface) {
 44  1 return services.remove(pvServiceInterface);
 45    }
 46  2 public int serviceSize() {
 47  2 return services.size();
 48    }
 49   
 50  54 public Object invoke(InvocationRequest pvInvocation) throws Throwable {
 51  54 try {
 52  54 String lvClass = (String) pvInvocation.getRequestPayload().keySet().iterator().next();
 53  54 String lvMethod = (String) pvInvocation.getRequestPayload().get(lvClass);
 54    if (log.isDebugEnabled()) { log.debug("Invoke service: " + lvClass + " with method: " + lvMethod); }
 55  54 Object lvObject = getService(lvClass);
 56  0 if (lvObject == null) { throw new InvocationException("For the class: " + lvClass + " can't find a register service!"); }
 57  54 Object lvResult = Invoker.invoke(lvObject, lvMethod, (Vector) pvInvocation.getParameter(), false, new Converter());
 58    if (log.isDebugEnabled()) { log.debug("Result invoke service " + lvClass + ": " + lvResult); }
 59   
 60    // System.out.println("--- " + lvClass + "--" + lvMethod + "--" + lvResult + "--" + pvInvocation.getParameter());
 61   
 62  52 return lvResult;
 63    } catch (Exception e) {
 64  2 return e;
 65    }
 66    }
 67   
 68   
 69   
 70  2 public void setMBeanServer(MBeanServer pvArg0) {
 71    // make nothing
 72    }
 73   
 74  2 public void setInvoker(ServerInvoker pvArg0) {
 75    // make nothing
 76    }
 77   
 78   
 79  1 public void addListener(InvokerCallbackHandler pvArg0) {
 80    // make nothing
 81    }
 82   
 83  1 public void removeListener(InvokerCallbackHandler pvArg0) {
 84    // make nothing
 85    }
 86   
 87    }