Clover coverage report - CRISPY - 1.1.1
Coverage timestamp: Mi Nov 15 2006 13:09:46 CET
file stats: LOC: 54   Methods: 3
NCLOC: 31   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
StaticHessianProxy.java - 100% 100% 100%
coverage
 1    package net.sf.crispy.impl;
 2   
 3    import java.util.Properties;
 4   
 5    import net.sf.crispy.InvocationException;
 6    import net.sf.crispy.InvocationStrategy;
 7    import net.sf.crispy.proxy.StaticProxy;
 8    import net.sf.crispy.strategy.NameInvocationStrategy;
 9   
 10    import com.caucho.hessian.client.HessianProxyFactory;
 11   
 12    /**
 13    * Remote-Call with Hessian Remote Invocation (Caucho).
 14    *
 15    * @author Linke
 16    *
 17    */
 18    public class StaticHessianProxy extends StaticProxy {
 19   
 20    public final static String DEFAULT_URL_AND_PORT = "http://localhost:8091/crispy/hessian";
 21   
 22    /**
 23    * Get default url and port. If no url and port is in properties.
 24    *
 25    * @return Default url and port.
 26    */
 27  73 public String getDefaultUrlAndPort() {
 28  73 return DEFAULT_URL_AND_PORT;
 29    }
 30   
 31  36 public InvocationStrategy getDefaultInvocationStrategy(Properties pvProperties) {
 32  36 String lvInterfaceName = (String) pvProperties.get(PROPERTY_CURRENT_INTERFACE_CLASS);
 33  36 return new NameInvocationStrategy(lvInterfaceName);
 34    }
 35   
 36    /**
 37    * @see net.sf.crispy.proxy.Proxy#newInstance(java.lang.Class)
 38    */
 39  37 public Object newInstance(Class pvProxyClass) {
 40  37 String lvUrlAndPort = getUrlAndPort() + "/" + getInvocationStrategy();
 41    if (log.isDebugEnabled()) { log.debug("Hessian Url and Port: " + lvUrlAndPort); }
 42  37 HessianProxyFactory factory = new HessianProxyFactory();
 43  37 factory.setOverloadEnabled(true);
 44  37 try {
 45  37 Object lvProxyObject = factory.create(pvProxyClass, lvUrlAndPort);
 46  36 setProxyObject(lvProxyObject);
 47  36 setProxyClass(lvProxyObject.getClass());
 48    } catch (Exception e) {
 49  1 throw new InvocationException("Error in newInstance in StaticHessianProxy: " + e, e);
 50    }
 51    if (log.isDebugEnabled()) { log.debug("Hessian Object created: " + getProxyObject()); }
 52  36 return getProxyObject();
 53    }
 54    }