Clover coverage report - CRISPY - 1.1.1
Coverage timestamp: Mi Nov 15 2006 13:09:46 CET
file stats: LOC: 64   Methods: 4
NCLOC: 37   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
XmlRpcExecutor.java 100% 100% 100% 100%
coverage
 1    /*
 2    * Created on 19.04.2005
 3    *
 4    */
 5    package net.sf.crispy.impl;
 6   
 7    import java.lang.reflect.Method;
 8    import java.util.Vector;
 9   
 10    import net.sf.crispy.ExceptionWrapper;
 11    import net.sf.crispy.Executor;
 12    import net.sf.crispy.InvocationException;
 13    import net.sf.crispy.InvocationStrategy;
 14    import net.sf.crispy.strategy.NameSpacePlusMethodInvocationStrategy;
 15    import net.sf.crispy.util.Invoker;
 16    import net.sf.crispy.util.Util;
 17   
 18    import org.apache.xmlrpc.XmlRpcClient;
 19    import org.apache.xmlrpc.XmlRpcException;
 20   
 21    /**
 22    * Remote-Call for XML-RPC.
 23    *
 24    * @author Linke
 25    *
 26    */
 27    public class XmlRpcExecutor extends Executor {
 28   
 29    public final static String DEFAULT_URL_AND_PORT = "http://localhost:9090";
 30   
 31    private XmlRpcClient client = null;
 32   
 33   
 34  128 public String getDefaultUrlAndPort() { return DEFAULT_URL_AND_PORT; }
 35   
 36  82 public InvocationStrategy getDefaultInvocationStrategy() { return new NameSpacePlusMethodInvocationStrategy(); }
 37   
 38  77 public boolean withConverter() { return true; }
 39   
 40    /**
 41    * @see net.sf.crispy.Executor#execute(java.lang.Class, java.lang.Object, java.lang.reflect.Method, java.lang.Object[])
 42    */
 43  77 public Object execute(Class pvProxyClass, Object pvProxy, Method pvMethod, Object[] pvArgs) throws Exception {
 44    // Create xmlRpcClient
 45  77 if (client == null) {
 46  47 client = new XmlRpcClient(getUrlAndPort());
 47    if (log.isDebugEnabled()) { log.debug("Create XmlRpcClient: " + client + " - URL: " + getUrlAndPort()); }
 48    }
 49   
 50  77 String lvStrService = getInvocationStrategy().toString();
 51    if (log.isDebugEnabled()) { log.debug("Service: " + lvStrService + ": " + pvArgs); }
 52  77 Vector param = Invoker.array2Vector(pvArgs);
 53  77 Object ret = null;
 54  77 try {
 55  77 ret = client.execute(lvStrService, param);
 56  75 ret = ExceptionWrapper.isResultExceptionThanThrowIt(ret);
 57    } catch (XmlRpcException e) {
 58  1 Throwable t = Util.findDeepestThrowable(e);
 59  1 throw new InvocationException("Error by execute service: " + lvStrService + " -- args: " + param + " -- " + t.getMessage(), t);
 60    }
 61   
 62  72 return ret;
 63    }
 64    }