| Method from org.apache.openejb.core.ivm.EjbObjectProxyHandler Detail: |
public Object _invoke(Object p,
Class interfce,
Method m,
Object[] a) throws Throwable {
java.lang.Object retValue = null;
java.lang.Throwable exc = null;
try {
if (logger.isDebugEnabled()) {
logger.debug("invoking method " + m.getName() + " on " + deploymentID + " with identity " + primaryKey);
}
Integer operation = (Integer) dispatchTable.get(m.getName());
if(operation != null){
if(operation.intValue() == 3){
if(m.getParameterTypes()[0] != EJBObject.class && m.getParameterTypes()[0] != EJBLocalObject.class ){
operation = null;
}
} else {
operation = (m.getParameterTypes().length == 0)?operation:null;
}
}
if (operation == null || !interfaceType.isComponent() ) {
retValue = businessMethod(interfce, m, a, p);
} else {
switch (operation.intValue()) {
case 1:
retValue = getHandle(m, a, p);
break;
case 2:
retValue = getPrimaryKey(m, a, p);
break;
case 3:
retValue = isIdentical(m, a, p);
break;
case 4:
retValue = remove(interfce, m, a, p);
break;
case 5:
retValue = getEJBHome(m, a, p);
break;
case 6:
retValue = getEJBLocalHome(m, a, p);
break;
default:
throw new RuntimeException("Inconsistent internal state");
}
}
return retValue;
/*
* The ire is thrown by the container system and propagated by
* the server to the stub.
*/
} catch (org.apache.openejb.InvalidateReferenceException ire) {
invalidateAllHandlers(getRegistryId());
exc = (ire.getRootCause() != null) ? ire.getRootCause() : ire;
throw exc;
/*
* Application exceptions must be reported dirctly to the client. They
* do not impact the viability of the proxy.
*/
} catch (org.apache.openejb.ApplicationException ae) {
exc = (ae.getRootCause() != null) ? ae.getRootCause() : ae;
if (exc instanceof EJBAccessException) {
if (interfaceType.isBusiness()) {
throw exc;
} else {
if (interfaceType.isLocal()) {
throw new AccessLocalException(exc.getMessage()).initCause(exc.getCause());
} else {
throw new AccessException(exc.getMessage());
}
}
}
throw exc;
/*
* A system exception would be highly unusual and would indicate a sever
* problem with the container system.
*/
} catch (org.apache.openejb.SystemException se) {
invalidateReference();
exc = (se.getRootCause() != null) ? se.getRootCause() : se;
logger.debug("The container received an unexpected exception: ", exc);
throw new RemoteException("Container has suffered a SystemException", exc);
} catch (org.apache.openejb.OpenEJBException oe) {
exc = (oe.getRootCause() != null) ? oe.getRootCause() : oe;
logger.debug("The container received an unexpected exception: ", exc);
throw new RemoteException("Unknown Container Exception", oe.getRootCause());
} finally {
if (logger.isDebugEnabled()) {
if (exc == null) {
logger.debug("finished invoking method " + m.getName() + ". Return value:" + retValue);
} else {
logger.debug("finished invoking method " + m.getName() + " with exception " + exc);
}
}
}
}
|
protected Object _writeReplace(Object proxy) throws ObjectStreamException {
/*
* If the proxy is being copied between bean instances in a RPC
* call we use the IntraVmArtifact
*/
if (IntraVmCopyMonitor.isIntraVmCopyOperation()) {
return new IntraVmArtifact(proxy);
/*
* If the proxy is referenced by a stateful bean that is being
* passivated by the container we allow this object to be serialized.
*/
} else if (IntraVmCopyMonitor.isStatefulPassivationOperation()) {
return proxy;
/*
* If the proxy is being copied between class loaders
* we allow this object to be serialized.
*/
} else if (IntraVmCopyMonitor.isCrossClassLoaderOperation()) {
return proxy;
/*
* If the proxy is serialized outside the core container system,
* we allow the application server to handle it.
*/
} else {
ApplicationServer applicationServer = ServerFederation.getApplicationServer();
if (interfaceType.isBusiness()){
return applicationServer.getBusinessObject(this.getProxyInfo());
} else {
return applicationServer.getEJBObject(this.getProxyInfo());
}
}
}
|
protected Object businessMethod(Class interfce,
Method method,
Object[] args,
Object proxy) throws Throwable {
// checkAuthorization(method);
return container.invoke(deploymentID, interfce, method, args, primaryKey);
}
|
public static Object createProxy(DeploymentInfo deploymentInfo,
Object primaryKey,
InterfaceType interfaceType) {
return createProxy(deploymentInfo, primaryKey, interfaceType, null);
}
|
public static Object createProxy(DeploymentInfo deploymentInfo,
Object primaryKey,
InterfaceType interfaceType,
List interfaces) {
if (!interfaceType.isHome()){
interfaceType = interfaceType.getCounterpart();
}
EjbHomeProxyHandler homeHandler = EjbHomeProxyHandler.createHomeHandler(deploymentInfo, interfaceType, interfaces);
return homeHandler.createProxy(primaryKey);
}
|
protected Object getEJBHome(Method method,
Object[] args,
Object proxy) throws Throwable {
checkAuthorization(method);
return getDeploymentInfo().getEJBHome();
}
|
protected Object getEJBLocalHome(Method method,
Object[] args,
Object proxy) throws Throwable {
checkAuthorization(method);
return getDeploymentInfo().getEJBLocalHome();
}
|
protected Object getHandle(Method method,
Object[] args,
Object proxy) throws Throwable {
checkAuthorization(method);
return new IntraVmHandle(proxy);
}
|
abstract protected Object getPrimaryKey(Method method,
Object[] args,
Object proxy) throws Throwable
|
public ProxyInfo getProxyInfo() {
return new org.apache.openejb.ProxyInfo(getDeploymentInfo(), primaryKey, getInterfaces(), interfaceType);
}
|
abstract public Object getRegistryId()
|
abstract protected Object isIdentical(Method method,
Object[] args,
Object proxy) throws Throwable
|
abstract protected Object remove(Class interfce,
Method method,
Object[] args,
Object proxy) throws Throwable
|