public Object invoke(Object deployID, Method callMethod, Object[] args, Object primKey, Object securityIdentity) throws OpenEJBException {
return invoke(deployID, callMethod.getDeclaringClass(), callMethod, args, primKey);
}
public Object invoke(Object deployID, Class callInterface, Method callMethod, Object [] args, Object primKey) throws OpenEJBException {
CoreDeploymentInfo deployInfo = (CoreDeploymentInfo) this.getDeploymentInfo(deployID);
if (deployInfo == null) throw new OpenEJBException("Deployment does not exist in this container. Deployment(id='"+deployID+"'), Container(id='"+containerID+"')");
ThreadContext callContext = new ThreadContext(deployInfo, primKey);
ThreadContext oldCallContext = ThreadContext.enter(callContext);
try {
boolean authorized = getSecurityService().isCallerAuthorized(callMethod, deployInfo.getInterfaceType(callInterface));
if (!authorized)
throw new org.apache.openejb.ApplicationException(new EJBAccessException("Unauthorized Access by Principal Denied"));
Class declaringClass = callMethod.getDeclaringClass();
if (EJBHome.class.isAssignableFrom(declaringClass) || EJBLocalHome.class.isAssignableFrom(declaringClass)) {
if (callMethod.getName().startsWith("create")) {
return createEJBObject(deployInfo, callMethod);
} else
return null;// EJBHome.remove( ) and other EJBHome methods are not process by the container
} else if (EJBObject.class == declaringClass || EJBLocalObject.class == declaringClass) {
return null;// EJBObject.remove( ) and other EJBObject methods are not process by the container
}
Instance instance = instanceManager.getInstance(callContext);
callContext.setCurrentOperation(Operation.BUSINESS);
callContext.setCurrentAllowedStates(SingletonContext.getStates());
Method runMethod = deployInfo.getMatchingBeanMethod(callMethod);
callContext.set(Method.class, runMethod);
callContext.setInvokedInterface(callInterface);
Object retValue = _invoke(callInterface, callMethod, runMethod, args, instance, callContext);