public static <Bean extends EntityBean> Bean getEntityBean(final EJBObject proxy) { if (proxy == null) { return null; } final EjbObjectProxyHandler handler = (EjbObjectProxyHandler) ProxyManager.getInvocationHandler(proxy); if (handler.container == null) { return null; } if (!(handler.container instanceof CmpContainer)) { throw new IllegalArgumentException("Proxy is not connected to a CMP container but is conect to " + handler.container.getClass().getName()); } final CmpContainer container = (CmpContainer) handler.container; final Bean entity = (Bean) container.getEjbInstance(handler.getBeanContext(), handler.primaryKey); return entity; }
public static <Bean extends EntityBean> Bean getEntityBean(final EJBLocalObject proxy) { if (proxy == null) { return null; } final EjbObjectProxyHandler handler = (EjbObjectProxyHandler) ProxyManager.getInvocationHandler(proxy); if (handler.container == null) { return null; } if (!(handler.container instanceof CmpContainer)) { throw new IllegalArgumentException("Proxy is not connected to a CMP container but is conect to " + handler.container.getClass().getName()); } final CmpContainer container = (CmpContainer) handler.container; final Bean entity = (Bean) container.getEjbInstance(handler.getBeanContext(), handler.primaryKey); return entity; }
public static <Bean extends EntityBean> Bean getEntityBean(final EJBLocalObject proxy) { if (proxy == null) { return null; } final EjbObjectProxyHandler handler = (EjbObjectProxyHandler) ProxyManager.getInvocationHandler(proxy); if (handler.container == null) { return null; } if (!(handler.container instanceof CmpContainer)) { throw new IllegalArgumentException("Proxy is not connected to a CMP container but is conect to " + handler.container.getClass().getName()); } final CmpContainer container = (CmpContainer) handler.container; final Bean entity = (Bean) container.getEjbInstance(handler.getBeanContext(), handler.primaryKey); return entity; }
public static <Bean extends EntityBean> Bean getEntityBean(final EJBObject proxy) { if (proxy == null) { return null; } final EjbObjectProxyHandler handler = (EjbObjectProxyHandler) ProxyManager.getInvocationHandler(proxy); if (handler.container == null) { return null; } if (!(handler.container instanceof CmpContainer)) { throw new IllegalArgumentException("Proxy is not connected to a CMP container but is conect to " + handler.container.getClass().getName()); } final CmpContainer container = (CmpContainer) handler.container; final Bean entity = (Bean) container.getEjbInstance(handler.getBeanContext(), handler.primaryKey); return entity; }
protected Object getEJBHome(final Method method, final Object[] args, final Object proxy) throws Throwable { checkAuthorization(method); return getBeanContext().getEJBHome(); }
protected Object getEJBLocalHome(final Method method, final Object[] args, final Object proxy) throws Throwable { checkAuthorization(method); return getBeanContext().getEJBLocalHome(); }
protected Object getEJBHome(final Method method, final Object[] args, final Object proxy) throws Throwable { checkAuthorization(method); return getBeanContext().getEJBHome(); }
protected Object getEJBLocalHome(final Method method, final Object[] args, final Object proxy) throws Throwable { checkAuthorization(method); return getBeanContext().getEJBLocalHome(); }
@Override public ProxyInfo getProxyInfo() { return new ProxyInfo(getBeanContext(), primaryKey, getInterfaces(), interfaceType, getMainInterface()); }
@Override public ProxyInfo getProxyInfo() { return new ProxyInfo(getBeanContext(), primaryKey, getInterfaces(), interfaceType, getMainInterface()); }
public Object createProxy(final Object primaryKey, final Class mainInterface) { try { final InterfaceType objectInterfaceType = this.interfaceType.getCounterpart(); final BeanType type = getBeanContext().getComponentType(); final EjbObjectProxyHandler handler = newEjbObjectHandler(getBeanContext(), primaryKey, objectInterfaceType, getInterfaces(), mainInterface); // TODO Is it correct for ManagedBean injection via managed bean class? if ((InterfaceType.LOCALBEAN.equals(objectInterfaceType) || getBeanContext().getComponentType().equals(BeanType.MANAGED)) && !getBeanContext().isDynamicallyImplemented()) { return LocalBeanProxyFactory.constructProxy(handler.getBeanContext().get(BeanContext.ProxyClass.class).getProxy(), handler); } else { final List<Class> proxyInterfaces = new ArrayList<Class>(handler.getInterfaces().size() + 2); proxyInterfaces.addAll(handler.getInterfaces()); proxyInterfaces.add(Serializable.class); proxyInterfaces.add(IntraVmProxy.class); if (BeanType.STATEFUL.equals(type) || BeanType.MANAGED.equals(type)) { proxyInterfaces.add(BeanContext.Removable.class); } return ProxyManager.newProxyInstance(proxyInterfaces.toArray(new Class[proxyInterfaces.size()]), handler); } } catch (final IllegalAccessException iae) { throw new OpenEJBRuntimeException("Could not create IVM proxy for " + getInterfaces().get(0), iae); } }
protected Object businessMethod(final Class<?> interfce, final Method method, final Object[] args, final Object proxy) throws Throwable { final BeanContext beanContext = getBeanContext(); if (beanContext.isAsynchronous(method)) { return beanContext.getModuleContext() .getAppContext() .getAsynchronousPool() .invoke(new CUCallable<Object>(new Callable<Object>() { @Override public Object call() throws Exception { try { return synchronizedBusinessMethod(interfce, method, args); } catch (final ApplicationException ae) { logger.error("EjbObjectProxyHandler: Asynchronous call to '" + interfce.getSimpleName() + "' on '" + method.getName() + "' failed", ae); throw ae; } } }), method.getReturnType() == Void.TYPE); } else { return synchronizedBusinessMethod(interfce, method, args); } }
public Object createProxy(final Object primaryKey, final Class mainInterface) { try { final InterfaceType objectInterfaceType = this.interfaceType.getCounterpart(); final BeanType type = getBeanContext().getComponentType(); final EjbObjectProxyHandler handler = newEjbObjectHandler(getBeanContext(), primaryKey, objectInterfaceType, getInterfaces(), mainInterface); // TODO Is it correct for ManagedBean injection via managed bean class? if ((InterfaceType.LOCALBEAN.equals(objectInterfaceType) || getBeanContext().getComponentType().equals(BeanType.MANAGED)) && !getBeanContext().isDynamicallyImplemented()) { return LocalBeanProxyFactory.constructProxy(handler.getBeanContext().get(BeanContext.ProxyClass.class).getProxy(), handler); } else { final List<Class> proxyInterfaces = new ArrayList<Class>(handler.getInterfaces().size() + 2); proxyInterfaces.addAll(handler.getInterfaces()); proxyInterfaces.add(Serializable.class); proxyInterfaces.add(IntraVmProxy.class); if (BeanType.STATEFUL.equals(type) || BeanType.MANAGED.equals(type)) { proxyInterfaces.add(BeanContext.Removable.class); } return ProxyManager.newProxyInstance(proxyInterfaces.toArray(new Class[proxyInterfaces.size()]), handler); } } catch (final IllegalAccessException iae) { throw new OpenEJBRuntimeException("Could not create IVM proxy for " + getInterfaces().get(0), iae); } }
protected Object businessMethod(final Class<?> interfce, final Method method, final Object[] args, final Object proxy) throws Throwable { final BeanContext beanContext = getBeanContext();