private static boolean isDynamicBean(final Bean<?> bean) { return CdiEjbBean.class.isInstance(bean) && CdiEjbBean.class.cast(bean).beanContext.isDynamicallyImplemented(); } }
public Class<Object> getManagedClass() { if (isDynamicallyImplemented()) { return (Class<Object>) getProxyClass(); } return this.beanClass; }
public Class<Object> getManagedClass() { if (isDynamicallyImplemented()) { return (Class<Object>) getProxyClass(); } return this.beanClass; }
@Override protected boolean needsProxy() { return !bean.beanContext.isDynamicallyImplemented() && super.needsProxy(); }
private static void eagerInitOfLocalBeanProxies(final Collection<BeanContext> beans, final ClassLoader classLoader) { for (final BeanContext deployment : beans) { if (deployment.isLocalbean() && !deployment.isDynamicallyImplemented()) { // init proxy eagerly otherwise deserialization of serialized object can't work final List<Class> interfaces = new ArrayList<>(2); interfaces.add(Serializable.class); interfaces.add(IntraVmProxy.class); final BeanType type = deployment.getComponentType(); if (BeanType.STATEFUL.equals(type) || BeanType.MANAGED.equals(type)) { interfaces.add(BeanContext.Removable.class); } try { LocalBeanProxyFactory.createProxy(deployment.getBeanClass(), classLoader, interfaces.toArray(new Class<?>[interfaces.size()])); } catch (final Exception e) { // no-op: as before } } } }
public void configureDeployments(final List<BeanContext> ejbDeployments) { beans = new WeakHashMap<Class<?>, BeanContext>(); for (final BeanContext deployment : ejbDeployments) { if (deployment.getComponentType().isSession()) { if (deployment.isLocalbean() && !deployment.isDynamicallyImplemented()) { beans.put(deployment.get(BeanContext.ProxyClass.class).getProxy(), deployment); } beans.put(deployment.getBeanClass(), deployment); } } }
public void configureDeployments(final List<BeanContext> ejbDeployments) { beans = new WeakHashMap<>(); for (final BeanContext deployment : ejbDeployments) { if (deployment.getComponentType().isCdiCompatible()) { if (deployment.isLocalbean() && !deployment.isDynamicallyImplemented()) { beans.put(deployment.get(BeanContext.ProxyClass.class).getProxy(), deployment); } beans.put(deployment.getBeanClass(), deployment); } } }
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); } }
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); } }
if (beanContext.isLocalbean() && !beanContext.getComponentType().isMessageDriven() && !beanContext.isDynamicallyImplemented()) { final List<Class> interfaces = new ArrayList<Class>(3); interfaces.add(Serializable.class);
if (beanContext.isLocalbean() && !beanContext.getComponentType().isMessageDriven() && !beanContext.isDynamicallyImplemented()) { final List<Class> interfaces = new ArrayList<Class>(3); interfaces.add(Serializable.class);
final ThreadContext oldContext = ThreadContext.enter(callContext); final boolean dynamicallyImplemented = isDynamicallyImplemented();
final ThreadContext oldContext = ThreadContext.enter(callContext); final boolean dynamicallyImplemented = isDynamicallyImplemented();