Clover coverage report - CRISPY - 1.1.1
Coverage timestamp: Mi Nov 15 2006 13:09:46 CET
file stats: LOC: 106   Methods: 11
NCLOC: 69   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
RmiInvocationHandlerImpl.java 100% 100% 100% 100%
coverage
 1    package net.sf.crispy.impl.rmi;
 2   
 3    import java.lang.reflect.Method;
 4    import java.rmi.RemoteException;
 5    import java.rmi.server.UnicastRemoteObject;
 6    import java.util.Vector;
 7   
 8    import net.sf.crispy.ExceptionWrapper;
 9    import net.sf.crispy.InterceptorHandler;
 10    import net.sf.crispy.server.InterceptorHandlerCreator;
 11    import net.sf.crispy.server.ServiceEndpoint;
 12    import net.sf.crispy.server.ServiceEndpointImpl;
 13    import net.sf.crispy.server.SingleServiceContainer;
 14    import net.sf.crispy.server.SingleServiceContainerImpl;
 15    import net.sf.crispy.util.Converter;
 16    import net.sf.crispy.util.Invoker;
 17   
 18    import org.apache.commons.logging.Log;
 19    import org.apache.commons.logging.LogFactory;
 20   
 21    /**
 22    * This is the central Invocation Handler for all client calls.
 23    * You must register the service. The invoke methode make the call per reflection API.
 24    * @author Linke
 25    *
 26    */
 27    public class RmiInvocationHandlerImpl extends UnicastRemoteObject implements RmiInvocationHandler, ServiceEndpoint, SingleServiceContainer {
 28   
 29    protected static final Log log = LogFactory.getLog (RmiInvocationHandlerImpl.class);
 30   
 31    private static final long serialVersionUID = 998729587238L;
 32   
 33    private ServiceEndpoint serviceEndpoint = new ServiceEndpointImpl();
 34    private SingleServiceContainer singleServiceImplContainer = new SingleServiceContainerImpl();
 35   
 36  42 public RmiInvocationHandlerImpl() throws RemoteException {
 37  42 super();
 38    }
 39   
 40   
 41    /**
 42    * @see net.sf.crispy.impl.rmi.RmiInvocationHandler#invoke(java.lang.String, java.lang.String, java.util.Vector)
 43    */
 44  63 public Object invoke(String pvClassName, String pvMethodName, Vector pvParams) throws RemoteException, Exception {
 45  63 Object lvProxyObject = getService(pvClassName);
 46  63 if (lvProxyObject == null) {
 47  1 throw new RemoteException("On the server is the class: " + pvClassName + " is not registered!");
 48    }
 49   
 50  62 Object lvReturn = null;
 51  62 Converter lvConverter = new Converter();
 52  62 lvConverter.setWithSimpleKeyMapper(true);
 53  62 try {
 54  62 Method lvMethod = Invoker.findMethod(lvProxyObject.getClass(), pvMethodName, pvParams);
 55  61 Object[] lvArgs = Invoker.vector2Array(pvParams, lvMethod, lvConverter);
 56  61 lvReturn = doInvoke(lvProxyObject, lvMethod, lvArgs, createNewInterceptorHandlerInstance());
 57    } catch (Exception e) {
 58  1 lvReturn = ExceptionWrapper.isThrowableThanHandleThrowable(e);
 59    }
 60  62 lvReturn = lvConverter.makeSimple(lvReturn);
 61  62 return lvReturn;
 62    }
 63   
 64  174 public void addService(String pvServiceInterfaceName, Object pvServiceImpl) {
 65  174 singleServiceImplContainer.addService(pvServiceInterfaceName, pvServiceImpl);
 66    }
 67   
 68  1 public void addService(String pvServiceInterfaceName, String pvServiceImplName) {
 69  1 singleServiceImplContainer.addService(pvServiceInterfaceName, pvServiceImplName);
 70    }
 71   
 72  1 public void removeService(String pvServiceInterfaceName) {
 73  1 singleServiceImplContainer.removeService(pvServiceInterfaceName);
 74    }
 75   
 76  64 public Object getService(String pvServiceInterfaceName) {
 77  64 return singleServiceImplContainer.getService(pvServiceInterfaceName);
 78    }
 79   
 80  5 public int getServiceSize() {
 81  5 return singleServiceImplContainer.getServiceSize();
 82    }
 83   
 84   
 85   
 86   
 87  61 public Object doInvoke(Object pvServiceImpl, Method pvMethod, Object[] pvArgs, InterceptorHandler pvInterceptorHandler) {
 88  61 return serviceEndpoint.doInvoke(pvServiceImpl, pvMethod, pvArgs, pvInterceptorHandler);
 89    }
 90   
 91   
 92  5 public void setInterceptorHandlerCreator(InterceptorHandlerCreator pvCreator) {
 93  5 serviceEndpoint.setInterceptorHandlerCreator(pvCreator);
 94    }
 95   
 96   
 97  8 public InterceptorHandlerCreator getInterceptorHandlerCreator() {
 98  8 return serviceEndpoint.getInterceptorHandlerCreator();
 99    }
 100   
 101   
 102  61 public InterceptorHandler createNewInterceptorHandlerInstance() {
 103  61 return serviceEndpoint.createNewInterceptorHandlerInstance();
 104    }
 105   
 106    }