Clover coverage report - CRISPY - 1.1.1
Coverage timestamp: Mi Nov 15 2006 13:09:46 CET
file stats: LOC: 72   Methods: 5
NCLOC: 38   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
StaticLocalObjectProxy.java 83,3% 88,2% 100% 89,3%
coverage coverage
 1    /*
 2    * Created on 06.05.2005 from Linke
 3    *
 4    */
 5    package net.sf.crispy.impl;
 6   
 7    import java.util.Properties;
 8   
 9    import net.sf.crispy.InvocationException;
 10    import net.sf.crispy.impl.local.MiniLocalObjectServer;
 11    import net.sf.crispy.proxy.StaticProxy;
 12   
 13    /**
 14    * Local call from Java object.
 15    *
 16    * @author Linke
 17    *
 18    */
 19    public class StaticLocalObjectProxy extends StaticProxy {
 20   
 21  38 public StaticLocalObjectProxy () {}
 22  32 public StaticLocalObjectProxy (Properties pvProperties) { super (pvProperties); }
 23   
 24    /**
 25    * Get default url and port. If no url and port is in properties.
 26    *
 27    * @return Default url and port.
 28    */
 29  28 public String getDefaultUrlAndPort() {
 30  28 return null;
 31    }
 32   
 33    /**
 34    * @see net.sf.crispy.proxy.Proxy#newInstance(java.lang.Class)
 35    */
 36  73 public Object newInstance (Class pvClass) {
 37  73 setProxyClass (pvClass);
 38  73 setProxyObject(getProxyByInterface(pvClass));
 39  69 return getProxyObject();
 40    }
 41   
 42    /**
 43    * Abbildung einer Schnittstelle auf eine Implementierung.
 44    * Spielt nur eine Rolle beim lokalen Zugriff.
 45    */
 46  73 private Object getProxyByInterface(Class pvInterface) throws InvocationException {
 47  73 if (pvInterface == null) {
 48  0 throw new IllegalArgumentException("Das Interface fuer die Erzeugung des Proxy-Objektes darf nicht null sein.");
 49    }
 50   
 51    // wenn Server den Service kennt, wird er vom Server genommen
 52  73 try {
 53  73 Object o = MiniLocalObjectServer.getServiceByInterface(pvInterface);
 54  8 if (o != null) { return o; }
 55    } catch (InvocationException e) {
 56    if (log.isDebugEnabled()) { log.debug(e); }
 57    }
 58   
 59    // wenn kein Server vorhanden ist
 60  65 String lvClassName = getProperties().getProperty(pvInterface.getName());
 61  65 if (lvClassName == null) {
 62  4 throw new InvocationException("It is not possible to create a proxy object for the interface -" + pvInterface.getName());
 63    }
 64  61 try {
 65  61 return Class.forName(lvClassName).newInstance();
 66    } catch (Exception e) {
 67  0 throw new InvocationException("For the Interface: " + pvInterface + " can no class: "
 68    + lvClassName + " create!", e);
 69    }
 70    }
 71   
 72    }