Clover coverage report - JFox Service-Oriented Application Framework - 1.0-RC3
Coverage timestamp: 星期三 二月 15 2006 18:10:22 CST
file stats: LOC: 120   Methods: 4
NCLOC: 64   Classes: 1
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover
 
 Source file Conditionals Statements Methods TOTAL
EJBProxyServiceImpl.java - 16% 50% 20.7%
coverage coverage
 1   
 /**
 2   
  * @(#)EJBProxyServiceImpl.java
 3   
  * 
 4   
  * JFoxSOAF, Service-Oriented Application Framework
 5   
  * 
 6   
  * Copyright(c) JFoxSOAF Team
 7   
  * 
 8   
  * Licensed under the GNU LGPL, Version 2.1 (the "License"); 
 9   
  * you may not use this file except in compliance with the License. 
 10   
  * You may obtain a copy of the License at  
 11   
  * 
 12   
  * http://www.gnu.org/copyleft/lesser.html
 13   
  * 
 14   
  * Unless required by applicable law or agreed to in writing, software
 15   
  * distributed under the License is distributed on an "AS IS" BASIS, 
 16   
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
 17   
  * See the License for the specific language governing permissions and 
 18   
  * limitations under the License. 
 19   
  * 
 20   
  * For more information, please visit:
 21   
  * http://www.jfox.cn/confluence/display/JFoxSOAF/Home
 22   
  * http://www.huihoo.org/jfox/jfoxsoaf
 23   
  */
 24   
 
 25   
 package org.huihoo.jfox.soaf.services.ejb;
 26   
 
 27   
 import java.lang.reflect.InvocationTargetException;
 28   
 import java.lang.reflect.Method;
 29   
 import java.rmi.RemoteException;
 30   
 
 31   
 import javax.ejb.EJBException;
 32   
 import javax.ejb.EJBHome;
 33   
 import javax.ejb.EJBLocalHome;
 34   
 import javax.ejb.EJBObject;
 35   
 import javax.ejb.FinderException;
 36   
 
 37   
 import org.huihoo.jfox.soaf.exception.ServiceLocatorException;
 38   
 
 39   
 import com.opensymphony.util.EJBUtils;
 40   
 
 41   
 /**
 42   
  * <p>
 43   
  * EJBProxyService Implementation.
 44   
  * </p>
 45   
  * 
 46   
  * @author <a href="mailto:founder_chen@yahoo.com.cn">Peter Cheng </a>
 47   
  * @version $Revision: 1.8 $ $Date: 2005/05/22 06:49:31 $
 48   
  * @version Revision: 1.0
 49   
  */
 50   
 
 51   
 public class EJBProxyServiceImpl implements EJBProxyService {
 52   
 
 53   
     private ServiceLocator serviceLocator;
 54   
 
 55  3
     public EJBProxyServiceImpl(ServiceLocator serviceLocator) {
 56  3
         this.serviceLocator = serviceLocator;
 57   
     }
 58   
 
 59   
     /**
 60   
      * @see org.huihoo.jfox.soaf.services.ejb.EJBProxyService#getRemoteObject(java.lang.String)
 61   
      */
 62  2
     public Object getRemoteObject(String jndiName) throws EJBException {
 63  2
         try {
 64  2
             EJBHome ejbHome = serviceLocator.getRemoteHome(jndiName,
 65   
                     EJBHome.class);
 66   
             //get the method of create
 67  0
             Method method = ejbHome.getClass().getDeclaredMethod("create",
 68   
                     new Class[0]);
 69  0
             Object obj = method.invoke(ejbHome, new Object[0]);
 70  0
             return obj;
 71   
         } catch (ServiceLocatorException e) {
 72  2
             throw new EJBException(e);
 73   
         } catch (SecurityException e) {
 74  0
             throw new EJBException(e);
 75   
         } catch (IllegalArgumentException e) {
 76  0
             throw new EJBException(e);
 77   
         } catch (NoSuchMethodException e) {
 78  0
             throw new EJBException(e);
 79   
         } catch (IllegalAccessException e) {
 80  0
             throw new EJBException(e);
 81   
         } catch (InvocationTargetException e) {
 82  0
             throw new EJBException(e);
 83   
         }
 84   
     }
 85   
 
 86   
     /**
 87   
      * @see org.huihoo.jfox.soaf.services.ejb.EJBProxyService#getLocalObject(java.lang.String)
 88   
      */
 89  0
     public Object getLocalObject(String jndiName) throws EJBException {
 90  0
         Object obj;
 91  0
         try {
 92  0
             EJBLocalHome ejbLocalHome = serviceLocator.getLocalHome(jndiName);
 93  0
             Method method = ejbLocalHome.getClass().getDeclaredMethod("create",
 94   
                     new Class[0]);
 95  0
             obj = method.invoke(ejbLocalHome, new Object[0]);
 96  0
             return obj;
 97   
         } catch (ServiceLocatorException e) {
 98  0
             throw new EJBException(e);
 99   
         } catch (SecurityException e) {
 100  0
             throw new EJBException(e);
 101   
         } catch (IllegalArgumentException e) {
 102  0
             throw new EJBException(e);
 103   
         } catch (NoSuchMethodException e) {
 104  0
             throw new EJBException(e);
 105   
         } catch (IllegalAccessException e) {
 106  0
             throw new EJBException(e);
 107   
         } catch (InvocationTargetException e) {
 108  0
             throw new EJBException(e);
 109   
         }
 110   
     }
 111   
 
 112   
     /**
 113   
      * @see org.huihoo.jfox.soaf.services.ejb.EJBProxyService#findEntity(
 114   
      *      javax.ejb.EJBHome, java.lang.String)
 115   
      */
 116  0
     public EJBObject findEntity(EJBHome home, String id)
 117   
             throws RemoteException, FinderException {
 118  0
         return EJBUtils.findEntity(home, id);
 119   
     }
 120   
 }