Clover coverage report - CRISPY - 1.1.1
Coverage timestamp: Mi Nov 15 2006 13:09:46 CET
file stats: LOC: 75   Methods: 5
NCLOC: 46   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
XmlRpcConvertHandler.java - 100% 100% 100%
coverage
 1    /*
 2    * Created on 20.04.2005
 3    *
 4    */
 5    package net.sf.crispy.impl.xmlrpc;
 6   
 7    import java.lang.reflect.Method;
 8    import java.util.Vector;
 9   
 10    import net.sf.crispy.ExceptionWrapper;
 11    import net.sf.crispy.InterceptorHandler;
 12    import net.sf.crispy.server.ServiceEndpoint;
 13    import net.sf.crispy.server.ServiceEndpointImpl;
 14    import net.sf.crispy.util.Converter;
 15    import net.sf.crispy.util.Invoker;
 16   
 17    import org.apache.commons.logging.Log;
 18    import org.apache.commons.logging.LogFactory;
 19    import org.apache.xmlrpc.XmlRpcHandler;
 20   
 21   
 22    /**
 23    * Make of the server the invocation from services.
 24    *
 25    * @author Linke
 26    *
 27    */
 28    public class XmlRpcConvertHandler implements XmlRpcHandler {
 29   
 30    protected static final Log log = LogFactory.getLog (XmlRpcConvertHandler.class);
 31   
 32    private Object object = null;
 33    private String nullValue = null;
 34    private ServiceEndpoint serviceEndpoint = null;
 35   
 36   
 37  39 public final void setNullValue (String pvNullValue) {
 38  39 nullValue = pvNullValue;
 39    }
 40  81 public final String getNullValue() {
 41  81 return nullValue;
 42    }
 43   
 44   
 45  35 public XmlRpcConvertHandler(Object pvObject, String pvNullValue) {
 46  35 object = pvObject;
 47  35 setNullValue(pvNullValue);
 48  35 serviceEndpoint = new ServiceEndpointImpl();
 49    }
 50   
 51  4 public XmlRpcConvertHandler(Object pvObject, String pvNullValue, ServiceEndpoint pvServiceEndpoint) {
 52  4 object = pvObject;
 53  4 setNullValue(pvNullValue);
 54  4 serviceEndpoint = pvServiceEndpoint;
 55    }
 56   
 57   
 58    /**
 59    * @see org.apache.xmlrpc.XmlRpcHandler#execute(java.lang.String, java.util.Vector)
 60    */
 61  81 public Object execute(String pvMethod, Vector pvParams) throws Exception {
 62  81 String lvMethodName = pvMethod.substring(pvMethod.lastIndexOf('.') + 1);
 63  81 Converter lvConverter = new Converter(getNullValue());
 64  81 lvConverter.setWithSimpleKeyMapper(true);
 65  81 Method lvMethod = Invoker.findMethod(object.getClass(), lvMethodName, pvParams);
 66  80 Object[] lvArgs = Invoker.vector2Array(pvParams, lvMethod, lvConverter);
 67   
 68  80 InterceptorHandler lvHandler = serviceEndpoint.createNewInterceptorHandlerInstance();
 69  80 Object ret = serviceEndpoint.doInvoke(object, lvMethod, lvArgs, lvHandler);
 70  80 ret = ExceptionWrapper.isThrowableThanHandleThrowable(ret);
 71  80 ret = lvConverter.makeSimple(ret);
 72  80 return ret;
 73    }
 74   
 75    }