|
|||||||||||||||||||
| 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.7% | 66.7% | 22.2% |
|
||||||||||||||
| 1 |
/**
|
|
| 2 |
* JFoxSOAF, Service-Oriented Application Framework
|
|
| 3 |
*
|
|
| 4 |
* Copyright (C) www.huihoo.org
|
|
| 5 |
*
|
|
| 6 |
* Distributable under GNU LGPL
|
|
| 7 |
*
|
|
| 8 |
* For more information, please visit: http://www.huihoo.org/jfox/jfoxsoaf
|
|
| 9 |
*/
|
|
| 10 |
|
|
| 11 |
package org.huihoo.jfox.soaf.services.ejb;
|
|
| 12 |
|
|
| 13 |
import java.lang.reflect.InvocationTargetException;
|
|
| 14 |
import java.lang.reflect.Method;
|
|
| 15 |
|
|
| 16 |
import javax.ejb.EJBException;
|
|
| 17 |
import javax.ejb.EJBHome;
|
|
| 18 |
import javax.ejb.EJBLocalHome;
|
|
| 19 |
|
|
| 20 |
import org.huihoo.jfox.soaf.exception.ServiceLocatorException;
|
|
| 21 |
|
|
| 22 |
/**
|
|
| 23 |
* <p>
|
|
| 24 |
* EJBProxyService Implementation.
|
|
| 25 |
* </p>
|
|
| 26 |
*
|
|
| 27 |
* @author <a href="mailto:founder_chen@yahoo.com.cn">Peter Cheng </a>
|
|
| 28 |
* @version $Revision: 1.2 $ $Date: 2004/11/22 15:19:08 $
|
|
| 29 |
* @version Revision: 1.0
|
|
| 30 |
*/
|
|
| 31 |
|
|
| 32 |
public class EJBProxyServiceImpl implements EJBProxyService { |
|
| 33 |
|
|
| 34 |
private ServiceLocator serviceLocator;
|
|
| 35 |
|
|
| 36 | 3 |
public EJBProxyServiceImpl(ServiceLocator serviceLocator) {
|
| 37 | 3 |
this.serviceLocator = serviceLocator;
|
| 38 |
} |
|
| 39 |
|
|
| 40 |
/**
|
|
| 41 |
* @see org.huihoo.jfox.soaf.services.ejb.EJBProxyService#getRemoteObject(java.lang.String)
|
|
| 42 |
*/
|
|
| 43 | 2 |
public Object getRemoteObject(String jndiName) throws EJBException { |
| 44 | 2 |
try {
|
| 45 | 2 |
EJBHome ejbHome = serviceLocator.getRemoteHome(jndiName, |
| 46 |
EJBHome.class);
|
|
| 47 |
//get the method of create
|
|
| 48 | 0 |
Method method = ejbHome.getClass().getDeclaredMethod("create",
|
| 49 |
new Class[0]);
|
|
| 50 | 0 |
Object obj = method.invoke(ejbHome, new Object[0]);
|
| 51 | 0 |
return obj;
|
| 52 |
} catch (ServiceLocatorException e) {
|
|
| 53 | 2 |
throw new EJBException(e); |
| 54 |
} catch (SecurityException e) {
|
|
| 55 | 0 |
throw new EJBException(e); |
| 56 |
} catch (IllegalArgumentException e) {
|
|
| 57 | 0 |
throw new EJBException(e); |
| 58 |
} catch (NoSuchMethodException e) {
|
|
| 59 | 0 |
throw new EJBException(e); |
| 60 |
} catch (IllegalAccessException e) {
|
|
| 61 | 0 |
throw new EJBException(e); |
| 62 |
} catch (InvocationTargetException e) {
|
|
| 63 | 0 |
throw new EJBException(e); |
| 64 |
} |
|
| 65 |
} |
|
| 66 |
|
|
| 67 |
/**
|
|
| 68 |
* @see org.huihoo.jfox.soaf.services.ejb.EJBProxyService#getLocalObject(java.lang.String)
|
|
| 69 |
*/
|
|
| 70 | 0 |
public Object getLocalObject(String jndiName) throws EJBException { |
| 71 | 0 |
Object obj; |
| 72 | 0 |
try {
|
| 73 | 0 |
EJBLocalHome ejbLocalHome = serviceLocator.getLocalHome(jndiName); |
| 74 | 0 |
Method method = ejbLocalHome.getClass().getDeclaredMethod("create",
|
| 75 |
new Class[0]);
|
|
| 76 | 0 |
obj = method.invoke(ejbLocalHome, new Object[0]);
|
| 77 | 0 |
return obj;
|
| 78 |
} catch (ServiceLocatorException e) {
|
|
| 79 | 0 |
throw new EJBException(e); |
| 80 |
} catch (SecurityException e) {
|
|
| 81 | 0 |
throw new EJBException(e); |
| 82 |
} catch (IllegalArgumentException e) {
|
|
| 83 | 0 |
throw new EJBException(e); |
| 84 |
} catch (NoSuchMethodException e) {
|
|
| 85 | 0 |
throw new EJBException(e); |
| 86 |
} catch (IllegalAccessException e) {
|
|
| 87 | 0 |
throw new EJBException(e); |
| 88 |
} catch (InvocationTargetException e) {
|
|
| 89 | 0 |
throw new EJBException(e); |
| 90 |
} |
|
| 91 |
} |
|
| 92 |
|
|
| 93 |
} |
|
||||||||||