You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by da...@apache.org on 2007/04/24 18:45:06 UTC
svn commit: r532003 - in
/incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/ivm:
BaseEjbProxyHandler.java EjbHomeProxyHandler.java EjbObjectProxyHandler.java
Author: dain
Date: Tue Apr 24 09:45:03 2007
New Revision: 532003
URL: http://svn.apache.org/viewvc?view=rev&rev=532003
Log:
Added exception conversion for business interfaces
Modified:
incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/BaseEjbProxyHandler.java
incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/EjbHomeProxyHandler.java
incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/EjbObjectProxyHandler.java
Modified: incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/BaseEjbProxyHandler.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/BaseEjbProxyHandler.java?view=diff&rev=532003&r1=532002&r2=532003
==============================================================================
--- incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/BaseEjbProxyHandler.java (original)
+++ incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/BaseEjbProxyHandler.java Tue Apr 24 09:45:03 2007
@@ -38,7 +38,9 @@
import javax.ejb.NoSuchObjectLocalException;
import javax.ejb.TransactionRequiredLocalException;
import javax.ejb.TransactionRolledbackLocalException;
-import javax.ejb.Remote;
+import javax.ejb.EJBTransactionRequiredException;
+import javax.ejb.EJBTransactionRolledbackException;
+import javax.ejb.NoSuchEJBException;
import javax.transaction.TransactionRequiredException;
import javax.transaction.TransactionRolledbackException;
@@ -81,7 +83,6 @@
*/
protected boolean doIntraVmCopy;
protected boolean doCrossClassLoaderCopy;
- private boolean isLocal;
protected final InterfaceType interfaceType;
protected final List<Class> interfaces;
private static final boolean REMOTE_COPY_ENABLED = parseRemoteCopySetting();
@@ -100,7 +101,7 @@
this.interfaces = Collections.unmodifiableList(interfaces);
- setLocal(interfaceType.isLocal());
+ this.doIntraVmCopy = !interfaceType.isLocal();
if (!interfaceType.isLocal()){
doIntraVmCopy = REMOTE_COPY_ENABLED;
@@ -256,25 +257,33 @@
return _invoke(proxy, method, args);
} catch (TransactionRequiredException e) {
- if (this.isLocal()) {
+ if (interfaceType.isBusiness()) {
+ throw new EJBTransactionRequiredException(e.getMessage()).initCause(getCause(e));
+ } else if (interfaceType.isLocal()) {
throw new TransactionRequiredLocalException(e.getMessage()).initCause(getCause(e));
} else {
throw e;
}
} catch (TransactionRolledbackException e) {
- if (this.isLocal()) {
+ if (interfaceType.isBusiness()) {
+ throw new EJBTransactionRolledbackException(e.getMessage()).initCause(getCause(e));
+ } else if (interfaceType.isLocal()) {
throw new TransactionRolledbackLocalException(e.getMessage()).initCause(getCause(e));
} else {
throw e;
}
} catch (NoSuchObjectException e) {
- if (this.isLocal()) {
+ if (interfaceType.isBusiness()) {
+ throw new NoSuchEJBException(e.getMessage()).initCause(getCause(e));
+ } else if (interfaceType.isLocal()) {
throw new NoSuchObjectLocalException(e.getMessage()).initCause(getCause(e));
} else {
throw e;
}
} catch (RemoteException e) {
- if (this.isLocal()) {
+ if (interfaceType.isBusiness()) {
+ throw new EJBException(e.getMessage()).initCause(getCause(e));
+ } else if (interfaceType.isLocal()) {
throw new EJBException(e.getMessage()).initCause(getCause(e));
} else {
throw e;
@@ -414,15 +423,6 @@
}
public abstract org.apache.openejb.ProxyInfo getProxyInfo();
-
- public boolean isLocal() {
- return isLocal;
- }
-
- public void setLocal(boolean isLocal) {
- this.isLocal = isLocal;
- this.doIntraVmCopy = !isLocal;
- }
public CoreDeploymentInfo getDeploymentInfo() {
CoreDeploymentInfo info = deploymentInfo.get();
Modified: incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/EjbHomeProxyHandler.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/EjbHomeProxyHandler.java?view=diff&rev=532003&r1=532002&r2=532003
==============================================================================
--- incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/EjbHomeProxyHandler.java (original)
+++ incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/EjbHomeProxyHandler.java Tue Apr 24 09:45:03 2007
@@ -198,7 +198,7 @@
* the server to the stub.
*/
} catch (RemoteException re) {
- if (isLocal()) {
+ if (interfaceType.isLocal()) {
throw new EJBException(re.getMessage(), (Exception) re.detail);
} else {
throw re;
@@ -206,7 +206,7 @@
} catch (org.apache.openejb.InvalidateReferenceException ire) {
Throwable cause = ire.getRootCause();
- if (cause instanceof RemoteException && isLocal()) {
+ if (cause instanceof RemoteException && interfaceType.isLocal()) {
RemoteException re = (RemoteException) cause;
Throwable detail = (re.detail != null) ? re.detail : re;
cause = new EJBException(re.getMessage(), (Exception) detail);
@@ -222,7 +222,7 @@
if (interfaceType.isBusiness()) {
throw exc;
} else {
- if (this.isLocal()) {
+ if (interfaceType.isLocal()) {
throw new AccessLocalException(exc.getMessage());
} else {
throw new AccessException(exc.getMessage());
@@ -236,13 +236,13 @@
* problem with the container system.
*/
} catch (org.apache.openejb.SystemException se) {
- if (isLocal()) {
+ if (interfaceType.isLocal()) {
throw new EJBException("Container has suffered a SystemException", (Exception) se.getRootCause());
} else {
throw new RemoteException("Container has suffered a SystemException", se.getRootCause());
}
} catch (org.apache.openejb.OpenEJBException oe) {
- if (isLocal()) {
+ if (interfaceType.isLocal()) {
throw new EJBException("Unknown Container Exception", (Exception) oe.getRootCause());
} else {
throw new RemoteException("Unknown Container Exception", oe.getRootCause());
Modified: incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/EjbObjectProxyHandler.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/EjbObjectProxyHandler.java?view=diff&rev=532003&r1=532002&r2=532003
==============================================================================
--- incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/EjbObjectProxyHandler.java (original)
+++ incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/EjbObjectProxyHandler.java Tue Apr 24 09:45:03 2007
@@ -108,7 +108,7 @@
if (interfaceType.isBusiness()) {
throw exc;
} else {
- if (this.isLocal()) {
+ if (interfaceType.isLocal()) {
throw new AccessLocalException(exc.getMessage()).initCause(exc.getCause());
} else {
throw new AccessException(exc.getMessage());